Skip to content

Video Orientation #6

@john7002

Description

@john7002

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions