I am trying to find the coördinates of a point on my image (Xpixel, Ypixel) on a object plane... like the reverse of (cv::Projectpoints)
My camera is already calibrated , so i know the :
intrinsic matrix
distortion matrix
translation vector
rotation matrix
I want to find the corners of my image ( so (0,0) ; (0,height)....) on the object plane. Object plane with Z = 0 is calibrated with a chessboard.
Eventualy i want to use the equation for the line from the camera centre (in world coordinates), through the image plane (through the correct pixel). Since the camera's don't move, i will use the calibration data for all the frames for that camera.
What i have tried :
- M *W with W = [R,t] (M = camera matrix, R= rotation matrix, t = translation vector)
- findHomography , coordinate in image * H = coordinate in world coordinates
- tried by adjusting 3D coordinates to eventually find a match with the right pixel (i was desperate)
I really need to find that line, camera ray if you wil. Startpoint should be the position of the camera in world coördinates and the Endpoint should be on a plane I choose (any plane will do but with a variable Z would be a bonus). Or if possible, just the equation in world coördinates for the line starting from the camera centre through the right pixel in the image ...
Every time i try something and project my 3D coordinate back (with projectpoints); the result isnt the same ...
Some questions just in case i understand something wrong :
- the rvecs from calibratecamera can be 'converted' to the rotationmatrix with cv::Rodrigues
- the tvecs from calibratecamera is the position of the camera in world coördinates from the origin (determined by the chessboard)
- pixelcoordinates are from 0 to width or height, no negative values (when used for projection)