I do marker tracking for ARKit using OpenCV (using ARUCO), and I see good results with the portrait orientation of the camera, but a slight displacement in the landscape.
ARUCO markers at known positions:

Detection in portrait mode:

In landscape orientation, the detection shows an offset:

Details what I am doing:
- For each
ARFrame do the following: - Get CVPixelBuffer
height, width, baseaddress and convert to cv::Mat - Perform marker validation and position evaluation (
cv::aruco::detectMarkers , cv::aruco::estimatePoseSingleMarkers ) using the built-in ARFrame value.- The inner should be transposed for the main ARKit column in the OpenCV main row matrix store.
- OpenCV
rvec and tvec converted to a 4x4 transform using cv::Rodrigues , and then converted from OpenCV to the OpenGL coordinate space on diag(1,-1,-1,1) * transform - The result is converted back from the row to the main column and is the conversion of the marker into camera space.
- Multiplying a transform with an ARCameras transform gives the marker plane in world coordinates, which I represent as a green rectangle.
My questions:
- Did I miss something?
- Should
frame.displayTransform play any part of the transform? - Why does turning the device cause an internal change? The width and height of the pixel buffer do not change.
- Any other ideas?
Update 07.25.2017:
- I get it! This is a mistake from Apple! They messed up the insides between the UIInterfaceOrientation.landscapeLeft and landscapeRight. If you cache these values โโand change them, then everything works fine.
- iOS 11 Beta 4 Changes Nothing
- I keep this question open until resolved by Apple (bug ID 33519315 on the radar).
Update 09.14.2017:
- Apple closed the error by saying that everything is correct. I'm not sure if they are correct, but potentially this is really a problem between OpenCV and ARKit.
ios opencv augmented-reality arkit
Christopher oezbek
source share