1
Camera Calibration / Using Metashape to remove distortion from CCTV cameras
« on: January 24, 2024, 08:51:01 PM »
Hello,
I have a regular demand in my work of aligning CCTV captured images in 3D space point clouds (inverse camera). For that type of algorithm to work, it is necessary to remove the CCTV camera distortions prior to 3D alignment (and CCTV cameras introduce a lot of distortion). See the "Original.jpg" image attached for an exemple.
First, I´ve tried to follow this tutorial: https://agisoft.freshdesk.com/support/solutions/articles/31000160059-lens-calibration-using-chessboard-pattern-in-metashape. Based on that, I followed this workflow:
So, that didn’t work. What I got was the same distorted original image with heavy cylindrical distortion added. See the attached "bad.jpg" image.
Then, I tried a variation of that workflow where I added the distorted images to the same chunk as the chessboard images, thus skipping the steps 4 to 6 above. Well, that just worked! See the "good.jpg" image attached.
So, what I’d like to know is why it didn’t work using the aforementioned workflow, with the export/import of the calibration parameters from one chunk to another. Is there something I’m forgetting to do?
Thanks in advance.
I have a regular demand in my work of aligning CCTV captured images in 3D space point clouds (inverse camera). For that type of algorithm to work, it is necessary to remove the CCTV camera distortions prior to 3D alignment (and CCTV cameras introduce a lot of distortion). See the "Original.jpg" image attached for an exemple.
First, I´ve tried to follow this tutorial: https://agisoft.freshdesk.com/support/solutions/articles/31000160059-lens-calibration-using-chessboard-pattern-in-metashape. Based on that, I followed this workflow:
- Captured the Metashape generated chessboard pattern using the same CCTV camera which captured the images I want to remove the distortions.
- Loaded those images in a Metashape chunk.
- Run the tools->lens->calibrate lens… algorithm.
- Saved the calculated calibration parameters using the save button at the Camera Calibration dialog box (save the parameters as an XML files).
- Created a new chunk and loaded the images to be undistorted.
- With that chunk selected, opened the Camera Calibration dialog box, and loaded the XML file I generate in step 4. So, the Type option changed to precalibrated and the parameters were loaded inside the text boxes.
- Exported the images using the option File -> Export -> Convert Images… with the Transform to initial calibration option checked.
So, that didn’t work. What I got was the same distorted original image with heavy cylindrical distortion added. See the attached "bad.jpg" image.
Then, I tried a variation of that workflow where I added the distorted images to the same chunk as the chessboard images, thus skipping the steps 4 to 6 above. Well, that just worked! See the "good.jpg" image attached.
So, what I’d like to know is why it didn’t work using the aforementioned workflow, with the export/import of the calibration parameters from one chunk to another. Is there something I’m forgetting to do?
Thanks in advance.