tensorflowiOS
tensorflowiOS copied to clipboard
Video Orientation
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
Did you every resolve this? I have a branch somewhere where I implemented portrait orientation but never pushed. I'll incorporate it into master.
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!
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.