문제

             Localization of an object specified in the image.

I am working on the project of computer vision to find the distance of an object using stereo images.I followed the following steps using OpenCV to achieve my objective 1. Calibration of camera 2. Surf matching to find fundamental matrix 3. Rotation and Translation vector using svd as method is described in Zisserman and Hartley book. 4. StereoRectify to get the projection matrix P1, P2 and Rotation matrices R1, R2. The Rotation matrices can also be find using Homography R=CameraMatrix.inv() H Camera Matrix.

Problems: i triangulated point using least square triangulation method to find the real distance to the object. it returns value in the form of [ 0.79856 , .354541 .258] . How will i map it to real world coordinates to find the distance to an object.

http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/

Alternative approach: Find the disparity between the object in two images and find the depth using the given formula Depth= ( focal length * baseline ) / disparity

for disparity we have to perform the rectification first and the points must be undistorted. My rectification images are black.

Please help me out.It is important

Here is the detail explanation of how i implemented the code.

  • Calibration of Camera using Circles grid to get the camera matrix and Distortion coefficient. The code is given on the Github (Andriod).

    2.Take two pictures of a car. First from Left and other from Right. Take the sub-image and calculate the -fundmental matrix- essential matrix- Rotation matrix- Translation Matrix....

    3.I have tried to projection in two ways.

  • Take the first image projection as identity matrix and make a second project 3x4d through rotation and translation matrix and perform Triangulation.

  • Get the Projection matrix P1 and P2 from Stereo Rectify to perform Triangulation.

My object is 65 meters away from the camera and i dont know how to calculate this true this based on the result of triangulation in the form of [ 0.79856 , .354541 .258]

Question: Do i have to do some extra calibration to get the result. My code is not based to know the detail of geometric size of the object.

도움이 되었습니까?

해결책

So you already computed the triangulation? Well, then you have points in camera coordinates, i.e. in the coordinate frame centered on one of the cameras (the left or right one depending on how your code is written and the order in which you feed your images to it).

What more do you want? The vector length (square root of the sum of the square coordinates) of those points is their estimated distance from the same camera. If you want their position in some other "world" coordinate system, you need to give the coordinate transform between that system and the camera - presumably through a calibration procedure.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top