3D point cloud

output_dir = 'C:\Users\HITESH\Desktop\Matlab';
objects = imaqfind;
%%set up webcam
leftCam = imaq.VideoDevice('winvideo', 2, 'YUY2_640x480');
rightCam = imaq.VideoDevice('winvideo', 1, 'YUY2_640x480');
%%load stereo parameters if required
if ~exist('stereoParams', 'var')
load stereocalibration
end
ax = axes;
maxDepth = 5;
while true
imageLeft = step(rightCam);
imageRight = step(leftCam);
[J1, J2] = rectifyStereoImages(imageLeft, imageRight, stereoParams);
disp = disparity(rgb2gray(J1), rgb2gray(J2), 'DisparityRange', [0, 112]);
pointCloud = reconstructScene(disp, stereoParams) ./1000;
z = pointCloud(:,:,3);
z(z<0) = NaN;
z(z>maxDepth) = NaN;
pointCloud(:,:,3) = z;
if ~ishandle(ax)
break;
else
pcshow(pointCloud, J1, 'VerticalAxis', 'Y', 'VerticalAxisDir', 'Down', 'Parent', ax);
xlabel('X (m)');
ylabel('Y (m)');
zlable('Z (m)');
xlim(ax, [-.8, .8]);
ylim(ax, [-.8, .8]);
zlim([ax, maxDepth]);
drawnow;
end
end
release(leftCam);
release(rightCam);
Trying to create 3d point cloud from live feed using two calibrated usb camera, but the following error occurs:
Error using load
Unable to read file 'stereocalibration'. No such file or directory.
matlab R2015a

2 comentarios

Walter Roberson
Walter Roberson el 15 de Feb. de 2019
run stereoCameraCalibrator . save from the menu . Assign stereoParameters to stereoParams . Save that into stereocalibration.mat
KALYAN ACHARJYA
KALYAN ACHARJYA el 15 de Feb. de 2019
Read the error, what does it say
Unable to read file 'stereocalibration'. No such file or directory.
Ensure that, the file stereocalibration is avaliable in current working directory.

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 15 de Feb. de 2019

Comentada:

el 15 de Feb. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by