# Measuring Planar Objects with a Calibrated Camera

I would like to measure some coins placed on top of a calibration plate, as per this matlab example http://mathworks.com/help/vision/exam... .

Does OpenCV have an equivalent to the pointsToWorld function that lets you pass in pixel X,Y's and get world X,Y's on a plane?

edit retag close merge delete

thanks but I don't see anything in those links directly relating to the question. Am I missing something?

Sort by » oldest newest most voted

There's no analog for pointsToWorld as I know. You can find x and y (z is equal zero in such case) like this:

1. apply cv::undistortPoints to your pixel coordintes (let's u and v) and get ideal coordinates (un and vn)
2. solve system of linear equations:

w * [un vn 1] = Rt * [x y 0 1]

that gets you

r11 * x + r12 * y - w * un = -t1;
r21 * x + r22 * y - w * vn = -t2;
r31 * x + r32 * y - w = -t3;


Here x and y are coordinates in chessboard plane, w is distant to point from camera, rij are components of rotation matrix and ti are components of translation vector.

more

Thanks, i'm still struggling to get the correct equation. My python to go from object points to image points looks like this:

 object_points = np.array([[0, 0, .4], [.3, .2, .4]])

image_points, jacobian = cv2.projectPoints(object_points, rvec, tvec, camera_matrix, dist_coefs)cv2.line(img, tuple(image_points.astype(int).ravel()), tuple(image_points.astype(int).ravel()),(0, 255, 0), 1)image_points = np.array([[100, 100], [200, 200]])

object_points_on_plane = ???? 

but i'm unsure how to go back to object points on a plane from image points.

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2016-07-08 18:54:35 -0500

Seen: 599 times

Last updated: Jul 22 '16