Determine extrinsic camera with opencv to opengl with world space object

前端 未结 3 1662
执笔经年
执笔经年 2020-12-24 09:47

I\'m using opencv and openframeworks (ie. opengl) to calculate a camera (world transform and projection matrixes) from an image (and later, several images for triangulation)

相关标签:
3条回答
  • 2020-12-24 10:43

    The first thing to check is to verify that markers are reprojected correctly on the image given estimated intrinsic and extrinsic camera matrices. Then you can find camera position in the global frame and to see if it agrees with markers positions. (Use coordinate system as in OpenCV.) One this is done, there are not much things that can go wrong. Since you want points to lie on the xz plane, you need just a single transformation of coordinates. As I see, you do it with gWorldToCalibration matrix. Then apply the transformation both to markers and to camera position and verify that markers are in the right place. Then the camera position will be also correct (unless something went wrong with the handedness of coordinate system, but can be easily corrected).

    0 讨论(0)
  • 2020-12-24 10:44

    For now at least I'm treating my Edit 2 (ImageSize must be something bigger than 1,1) as the fix as it produced results much, much more like what I was expecting.

    I might have things upside down at the moment, but this is producing pretty good results.

    0 讨论(0)
  • 2020-12-24 10:46

    I think you should not take the inverse of gWorldToCalibration

    ofMatrix4x4 gCalibrationToWorld = gWorldToCalibration.getInverse();
    

    Here I posted code, which is doing more or less what you want OpenCV- to OpenGL COS. It's in C, but should be similar in C++.

    0 讨论(0)
提交回复
热议问题