Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

NI stereo depth image and disparity

Hello,

I am trying to set up a stereovision with labview, I am novice at stereo and I would appreciate some help.
I am using cheap 2 usb cameras 640x480px f=3.85mm d=80mm

 

So far I have calibrated 2 cameras
Then I have calibrated stereo system:
calibration quality and rectification quality is >0.9 so I think all is good so far...

distance z is from 300-500mm so I calculate that number of disparities is 16
window size is set to 7

 

 

and from images:

2013-08-23_14-28-36l.jpg2013-08-23_14-28-36r.jpg

this is what i get

disparity.png


Problems start when I try to calculate depth... Result is exactly the same likedisparity image
My goal Is to create 3d model from depth image and overlay texture on it.
Can I do that by using rectifiled stereo images?

I have attached images that I ve used for callibration, calibrated images and sample images for disparity.


Please help.
And if I made a mistake, please correct me 🙂

0 Kudos
Message 1 of 10
(6,193 Views)

Hello,

 

can you please provide the original calibration grid images (non-thresholded). Also, i looked at the "calibrated images" folder and the images look like this (nevermind the border):

 

left

 

left.png

 

right

 

right.png

 

What exactly is this?

 

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 2 of 10
(6,169 Views)

Thanks for looking into that.

 

As far as I understand this calibrated images contain informations about camera and prespective, labview stores that in png files, and it is used later to calibrate stereo.  I have no idea from where this pixel data in calibrated images comes from.

 

New set of images attached.

 

Best regards

pawhan11 

0 Kudos
Message 3 of 10
(6,164 Views)

Hello,

 

i am sorry i did not ask for this before, but please tell me the vertical and horizontal distance between the points on the calibration grid (real-world units, best in mm).

 

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 4 of 10
(6,151 Views)

15mm for vertical and horizontal 

 

Best regards,

pawhan11

0 Kudos
Message 5 of 10
(6,148 Views)

Hello,

 

i have tried to calibrate the grid images, you have given and the quality is indeed greater than 0.95. So, the calibration should be ok by looking at the quality, reprojection error, etc..

 

How did you calculate the number of disparities to 16? That is a small number for such a close object scene.

 

Quickly calculating:

 

image width: 640 pix

fx: 950 pix

Z: 500 mm

 

stereo resolution =  760 pix

stereo focal length = 1130 pix

disparity = 1130 pix*80mm/500mm ~ 180 pix

 

Anyway, i still cannot get a proper depth image (by the way, the disparity image is inversly proportional to the depth as the equation tells you - Z = f*b/d) with your images. Also, the widows size basically determines the precision (detail) and noise. Small window stands for better detail, but higher noise. Big window is less detail, less noise.

 

I've lost so many hours tring to evaluate the NI stereo library, but still cannot say anything about it. I will try once again (hopefully, this weekend) to setup my own scene again and calibrate the system in order to obtain the depth image. In the mean time i suggest you try to follow the instructions that are posted here . Maybe this procedure can help you calibrate your system in order to obtain somewhat normal depth image.

 

Sorry i could not be more helpful at this time. If i find out anything else, i will post here. Please do the same, since i am very eager to see some results.

 

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 6 of 10
(6,133 Views)

Thanks for looking into that.

I thing I ve managed to make it working, at least I get some acceptable depth values thanks to that article:

http://zone.ni.com/reference/en-XX/help/370281U-01/imaqvision/stereo_vision_faq/

Klemen, on Your blog Yoh have overlaid texture on depth map.

Could You give me some pointers how to do that?

0 Kudos
Message 7 of 10
(6,099 Views)

Hello,

 

i have overlaid the texture on a point cloud, yes. I have an ocx control to do this in LV, but unfortunately, I cannot share the code with you.

You can alternatively use 3d picture in LV. Please see the attached example (saved for LV2012). I took the 3d stereo example from labview (the cubes with letters).


Beware that it is poorly coded and very messy. But should give you a basic idea. You should be able to overlay the texture over the points in the pointcloud.

Please tell me if it works for you.

 

Anyway, if you have a texture image that is aligned with the depth data, you can perform any object detection on the 2D image and then extract the 3D information form the detected coordinate position.

 

Sorry for the messy post, but i have to be somewhere real quick. Smiley Happy I will get back to you if you have any additional questions.

 

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 10
(6,082 Views)

If you are still interested (or anyone else) in a 3d viewer, i have created a dll that can be used in Labview based on PCL visualization library. It takes the spatial coordinates X,Y,Z and RGB data to represent a point cloud in 3d space.
The dll can be found here:

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

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 9 of 10
(5,991 Views)

Pawhan - can you share your code? I hope to give the stereo vision example a try in the next few days and am looking for a good working example.

Chris Walker
Certified Labview Developer
0 Kudos
Message 10 of 10
(5,885 Views)