Drawing a line on the ground
Hello everybody,
I would like to draw "perspective" line on the ground (z = 0) in the middle of the image starting at bottom and moving to top of image (in u,v coordinates). This line should point into the image. Which should be the z-coordinate of the camera coordinates.
My camera Matrix is calculated by calibrateCamera with a chessboard pattern. The chessboard is positioned on the ground (z = 0).Within this matrix there is cx = 399.5, cy = 299.5 (my Image is 800x600).
I would enter the coordinates of the line in world coordinates. Therefore I would set the world coordinates to the camera coordinates. I have the rvec and tvec between the chessboard and the camera. The coordinates of the chessboard I call "body-coordinates". To be able to use the projectPoints function, I need the calculate my line coordinates from camera to body-coordinates. I do this by X_body = R.inv * X_cam - R.inv * tvec
Now, I can call the function projectPoints. But I want my line to start at the image coordinate (u=400, v=600) can I reset the cx and cy values in the cameraMatrix to cx = 400 and cy = 600, to achieve this?
If you have like this
projectPoints(x, y)
orprojectPoints(img, x, y)
:projectPoints(600, 400
) orprojectPoints(img, x, y)