开发者

OpenCV + photogrammetry

i have a stereopair, photo 1: http://savepic.org/1671682.j开发者_开发百科pg photo 2: http://savepic.org/1667586.jpg

there is coordinate system in each image. How can I find coordinates of point A in this system using OpenCV library. It would be nice to see sample code. I've looked for it at opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction.html but haven't found (or haven't understood :) )


Your 'stereo' images are fine. What you have already done is solve the correspondence problem: in both images you have indicated points 'A'. This means that you know which pixel corresponds to eachother labeling point 'A'.

What you want to do, is triangulate where your camera is. You can only do this by first calibrating your camera. This is inside of OpenCV already. http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

This gives you the exact vector/ray of light for each vector, and the optical center of your cameras through which the ray passes. Moreover, you need stereo calibration. This establishes the orientation and position of each camera with respect through each other.

From that point on, your triangulation is simple, knowing the pixel location in both images of point 'A'. You have

  • Location and orientation of camera 1 and camera 2
  • Otical Ray Vector (pixel location) from the cameras to label 'A'.

So you have 2 locations in space, and 2 rays from these location. The intersection of these rays is your 3D answer.

Note that in practice there rays will never exactly intersect (2 lines in 3D rarely do), so you need to approximate. Use opencv function triangulatePoints(), using the input of the stereo calibration and the pixel index relating to label A.


Firstly of all this is not truly a stereo pair. A nice stereo pair needs to have 60%-80% overlap usually small rotation differences between images. Even if this pair had the necessary BASE to be a good stereo pair due to the extremely kappa rotation the resulting epipolar image would be useless.

Secondly among others you should take a look at the camera calibration and collinearity equations both supported by OpenCV

http://en.wikipedia.org/wiki/Camera_resectioning

http://en.wikipedia.org/wiki/Collinearity_equation


You need to understand the maths.

If the page isn't enough then you should look at the opencv book - it devotes a couple of chapters to this. Then there are a lot of textbooks that cover it in more detail

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜