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

PV camera frame's origin #155

Open
emaschino opened this issue Dec 14, 2022 · 1 comment
Open

PV camera frame's origin #155

emaschino opened this issue Dec 14, 2022 · 1 comment

Comments

@emaschino
Copy link

Hello,

As we all know, OpenCV image origin [0,0] is the top, left corner of the image, +Y pointing down [1].

When retrieving HoloLens 2 PV camera frames using Media Foundation, the CameraIntrinsics.PrincipalPoint API documentation clearly states that "The origin [0,0] is the bottom, left corner of the image (+Y pointing up)" [2]. So the Y axis is reversed w.r.t. the OpenCV coordinate frame.

In the StreamRecorder sample [3], PrincipalPoint.y data is however passed as-is, whereas I was expecting CameraIntrinsics.ImageHeight() - PrincipalPoint.y. This has no effect in the context of the StreamRecorder sample, as the data are simply logged to a file. But a similar discrepancy can also be observed in the older HoloLensForCV repository sample when initializing cy component in the camera matrix later used for image undistortion [4].

What am I missing here? I've experimentally determined the HoloLens[2]ForCV samples being correct, i.e. taking PrincipalPoint.y as-is for OpenCV camera matrix cy component gives the correct visual result (with a sample app of my own), but I would also be very surprised that the CameraIntrinsics.PrincipalPoint API documentation could be so wrong, with a remark section even emphasizing the frame origin peculiarity from other image frameworks.

Thanks for any input/suggestion/clarification.

[1] https://docs.opencv.org/4.0.1/d9/d0c/group__calib3d.html
[2] https://learn.microsoft.com/en-us/uwp/api/windows.media.devices.core.cameraintrinsics.principalpoint?view=winrt-17763#windows-media-devices-core-cameraintrinsics-principalpoint
[3]

file << m_latestFrame.VideoMediaFrame().CameraIntrinsics().PrincipalPoint().x << "," << m_latestFrame.VideoMediaFrame().CameraIntrinsics().PrincipalPoint().y << ","

[4] https://github.com/microsoft/HoloLensForCV/blob/master/Samples/ComputeOnDevice/AppMain.cpp#L138

@emaschino
Copy link
Author

The documentation counterpart [1].

[1] MicrosoftDocs/winrt-api#2312

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

1 participant