Calculation of distance (z-axis) to object using CVST
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I am facing an issue while using Computer Vision System Toolbox, while calculating the 3D distance to an object from a stereo set-up.
I have calibrated my stereo setup (mean reprojection error of <0.2 pixels). The checkerboard used for calibration are all within a range of 1m to 2.5m away from camera (z-axis).
However, I am not able to get a good stereo reconstructed image. It seems very noisy along the z-axis.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150327/image.png)
This is my code:
I1 = imread('A1r.png');
I2 = imread('B1r.png');
[I1_r, I2_r] = rectifyStereoImages(I1, I2, stereoParams);
[J1,J2] = PreProcessing(I1_r,I2_r); figure, imshow(J1); figure, imshow(J2); % PreProcessing() is uploaded
pointCloudDisp = Disparity_Reconstruct( J1, J2, stereoParams ); % Disparity_Reconstruct() is uploaded
DisplayReconstructedScene( pointCloudDisp, J1 );
I have uploaded stereoParameters and the object images on dropbox . Kindly refer these. The object (wheel) is kept around 1.5m away from setup (along z-axis).
The disparity is around 105 (when manually calculated).
Any inputs regarding how I can improve my reconstructed scene would be useful. Kindly let me know if any other information has to be shared
Also, is this the only way by which I can get the object distance? Can I somehow use triangulation here? (If so, how can i find the corresponding matching points in left and right images?)
0 Commenti
Risposte (1)
Dima Lisin
il 20 Mag 2015
Hi Meghana,
The first thing I see is that if your images are RGB, you are doing disparity only on the blue channel. The better thing to do would be to use rgb2gray instead.
The other thing that seems odd, is the BlockSize of 55. That seems too large. I would try smaller values.
If that doesn't help, try applying histogram equalization using histeq to the images, before computing disparity.
Once you get your disparity map to look reasonable, then you should limit the z-values further. I would set minZ to 0, and maxZ to something like 2000. If your units are millimeters then 45000 mm is 45 meters, which is way too much, if your object is 1.5 meters away from the cameras.
3 Commenti
Dima Lisin
il 20 Mag 2015
Hi Meghana,
Try setting the disparity range to [0 128]. Also, try other values for BlockSize. Something between 15 and 25.
I would still advise that you use rgb2gray, though. It helps to have actual pixel values in all parts of the image, so that most pixels get a valid disparity.
Vedere anche
Categorie
Scopri di più su Camera Calibration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!