Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Orientation #6

Open
john7002 opened this issue Apr 17, 2018 · 3 comments
Open

Video Orientation #6

john7002 opened this issue Apr 17, 2018 · 3 comments

Comments

@john7002
Copy link

john7002 commented Apr 17, 2018

Hi,

Nice work ! the code works fairly well on my device with my own graph. Just one question, I do not know if it is really an issue or a request, but currently it seems that the object recognition only works with landscape orientation on my device. I would like it to work in portrait upside down mode (or portrait). I checked the code, check that in TensorflowGraph.mm:

tensorflowGraph?.runModel(on: pixelBuffer, orientation: UIDevice.current.orientation)

orientation parameter is portrait. But then in Tensorflowgraph.mm, there is this part, where I can not find the way the buffer is read for portrait mode:

if (orientation == UIDeviceOrientationLandscapeRight)
            {
                // landscape right - we start at the end of the buffer and read backwards
                srcPixel  = srcStartAddress - (srcRow * bytesPerRow) - (srcCol * srcChannels);
            }
            else
            {
                // landscape left - we start at the beginning of the buffer and read forward
                srcPixel  = srcStartAddress + (srcRow * bytesPerRow) + (srcCol * srcChannels);
            }

How srcPixel should be set in portrait updsideDown orientation?

Thanks

@csharpseattle
Copy link
Owner

Did you every resolve this? I have a branch somewhere where I implemented portrait orientation but never pushed. I'll incorporate it into master.

@john7002
Copy link
Author

Hi. No success, I've been trying to understand the way the buffer are read, but I can't figure out.

Would be great to have a look at your branch with the portrait orientation ! thanks in advance!

@csharpseattle
Copy link
Owner

Hi John,
I finally got around to fixing the issue with portrait orientations. The main issue was my width and height were flipped when feeding the image data into the Tensorflow graph in portrait orientations. Let me know if this fixes your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants