Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Stereo calibration in LabView using Matlab toolbox

Hi!

I have a pair of cameras aligned in stereo which I would like to calibrate. For this I have used the Matlab toolbox 'Stereo Calibration' which gives the parameters necessary to rectify imperfections in the camera's alignment.

Question: How to perform stereo calibration in Labview using parameters from Matlab? Other suggestions on how to perform stereo calibration are most welcome.

What I have tried: I have already calibrated the camers for radial distortion using the Matlab toolbox 'Camera Calibration' and implemented parameters using link.

 

Attachments: VI which imports images and rectifies barrel distortion. I have also included the .mat file which containts the stereo calibration parameters.

 

Download All
0 Kudos
Message 1 of 9
(5,360 Views)

I will try to make myself clearer. 

 

In Stereo Vison mode in LabView you can perform calibration of you stereo vision system. The result would be the Intrinsic Parameters for each camera, as well as the Rotational- and Translational Matrices for Camera 2 relative to Camera 1. This is all good, and  this matrices can be read out by using the "Get Binocular Stereo Calibration Info" block.

 

However, is there a way to give these matrices (Rotational and Transational) to LabView in order to rectify the image?

That would be something that has the opposite function of the block "Get Binocular Stereo Calibration Info".

 

Is this pssible to do i LabView, or can it only use calibration info from itself?

 

If anybody wonder have I perfomed the Stereo Calibration In MatLab, which gave good result. Have also tried multiple times in LabView without any success. 

Snip of LabView block

 

0 Kudos
Message 2 of 9
(5,315 Views)

I will try to make myself clearer. 

 

In Stereo Vison mode in LabView you can perform calibration of you stereo vision system. The result would be the Intrinsic Parameters for each camera, as well as the Rotational- and Translational Matrices for Camera 2 relative to Camera 1. This is all good, and  this matrices can be read out by using the "Get Binocular Stereo Calibration Info" block.

 

However, is there a way to give these matrices (Rotational and Transational) to LabView in order to rectify the image?

That would be something that has the opposite function of the block "Get Binocular Stereo Calibration Info".

 

Is this pssible to do i LabView, or can it only use calibration info from itself?

 

If anybody wonder have I perfomed the Stereo Calibration In MatLab, which gave good result. Have also tried multiple times in LabView without any success. 

Snip of LabView block

 

0 Kudos
Message 3 of 9
(5,315 Views)

Not a 100% sure this will help but you could take a look at the provided calibration stereo example.

http://zone.ni.com/reference/en-XX/help/370281W-01/imaqvision/stereo_vision_example/

 

Did you already take a look at this?

Best Regards
Jonas Mäki
Systems Developer
Novator Solutions
0 Kudos
Message 4 of 9
(5,306 Views)

Yes, I have checked that one out. But it did not give me anything really. I could not make it work, even though I tried it multiple times. Some times it started to fill out the percentage grid which continiously indicate how well the calibration is, but was never pleased, and just asked for more and more pictures. But most times it did not give any response in the percentage grid at all. 

 

However, there is not any way to import Rotational and Translational Matrices ether, after what I have seen.

 

For single camera calibration I found a CamCalib VI that someone had shared that corrected each camera individually after intrinsic parameters. Have anyone seen anyhing like that, just for Stereo Calibration?

 

Jared.

0 Kudos
Message 5 of 9
(5,300 Views)
Hi Jasper449 I think you meet the same problem with me. If you are using NI example Calibrate Stereo Vision system, there is a bug in it. I do not find where it is ,but there is a way to avoid it and get calibrated. While you calibrate your system, open calibration manager.vi, turn to "Add Grid Images" case, after you capture first, check Image copy.vi error output, if there is an error, you will never get system calibrated, no matter how much images you capture, do start calibration once again! if it is ok, you can get right calibration. If you have any progress, let me know it.
CLD
CAU
0 Kudos
Message 6 of 9
(4,953 Views)

lizhuo_lin ha scritto:
Hi Jasper449 I think you meet the same problem with me. If you are using NI example Calibrate Stereo Vision system, there is a bug in it. I do not find where it is ,but there is a way to avoid it and get calibrated.

I'm currently working with LabVIEW and stereo vision and my conclusion is that the functions needs a lot of improvement. Calibrating a stereo system is almost impossible due to several problems:

1- the Calibration Target to Point - Circular Dots vi does not behave correctly when the imaged calibration target has a strong perspective

2- the Learn Camera Model vi refuses to calibrate if the calibration grid is not sufficiently tilted which collides with point 1 particularly with stereo vision systems layed out for small field of view and working distance, i.e. with high vergence angle (which is my case)

3- the bug you mention is in the Calibration Manager vi which is actually a functional global. There is a race condition on the init case

4- the Calibrate Stereo Vision Example is also poor coded, difficult to read and with several other glitches

 

For all of these reasons I'm looking for a way to calibrate the system with OpenCV (which I can manage) and feed the data to the LabVIEW stereo functions. Any help would be very appreciated!

0 Kudos
Message 7 of 9
(4,814 Views)
Hello,

the OpenCV stereo calibration and measurement is a part of my toolkit for Labview. If you are interested, check out the following link:

https://decibel.ni.com/content/blogs/kl3m3n/2015/08/28/stereo-vision-opencv-and-labview-comparison

OpenCV stereo "library" is much more versatile than Labview's.

Best regards,
K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 8 of 9
(4,802 Views)

Hi Klemen,

 

i'll give a look at it.

Anyway let me thank you for all the information that you shared on your blog: they are extremely helpful and I keep reading it since I started working on stereo vision.

THANK YOU!

0 Kudos
Message 9 of 9
(4,795 Views)