kamino410 / procam-calibration

A calibration software for projector-camera system using chessboard and structured light patterns.
MIT License
122 stars 37 forks source link

How to use the matrices in calibration_result.xml ? #8

Open samueltorche opened 3 years ago

samueltorche commented 3 years ago

Hello,

First thank you for your project!

I was wondering if you could provide an example on how to use the matrices in the calibration_result.xml file.

I understand that you can read the matrices using the following code:

cv_file = cv2.FileStorage("calibration_result.xml", cv2.FILE_STORAGE_READ)
rotation_matrix = cv_file.getNode("rotation").mat()
translation_matrix = cv_file.getNode("translation").mat()

How can I then use these matrices to translate a point from camera coordinates to projector coordinates ?

cam_coord = (500, 400)
proj_coord = ???
Dmytro-Shvetsov commented 3 years ago

Hey, any luck finding out the answer to your question?

tylpk1216 commented 1 year ago

You only get the projector parameters from calibration result. You must use other way to get proj_cord. If you use gray code pattern, you can get matching relationship between camera and projector easily.

The rotation matrix or translation vector is used to calculate triangulation between camera and projector.

If you don't care about real 3D point, you could treat camera center as original point, and use R, t to get coordinate of projector related to camera. However, you must handle scale factor.