0

I have a fixed pinhole camera. I aim it a flat panel and take an image. I tilt the flat panel up and take an image. Is there some way to convert the pixels to real-world coordinates, getting rid of the keystoning? What matrix is that.

I tried going from real-world coordinates to pixels using https://www.mathworks.com/help/vision/ref/cameramatrix.html but it throws back not a trapezoid shape but a parallelogram. Does my loaded calibration image need to be directly above the chessboard or what?

Even so, I need to convert from pixels to real-world, so is there a way to invert that 4x3 camera matrix if this is a valid method?

Thanks.

Moano
  • 41
  • 1
  • 3
  • Looks like this could help you. https://stackoverflow.com/questions/14514357/converting-a-2d-image-point-to-a-3d-world-point?rq=1 – Moano Jul 25 '17 at 18:13

1 Answers1

0

You are asking for extra things: removing the keystone does not require knowing the 3D world location of the panel. You only need the 3x3 homography matrix mapping the "keystoned" version of the panel to the "flat" one.

You can compute the homography given a minimum of 4 pixel correspondences between the two images. In OpenCV you use "findHomographyMat" for this purpose.

Francesco Callari
  • 11,300
  • 2
  • 25
  • 40
  • Thank you but if my panel flexes, that wouldn't exactly work. I would need a rigid object to get a correct homography matrix. I think converting to world coordinates by some scale factor would be best. Just figuring out how right now if it's possible at all – Moano Jul 26 '17 at 15:13