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 个评论
Walter Roberson
2019-2-15
run stereoCameraCalibrator . save from the menu . Assign stereoParameters to stereoParams . Save that into stereocalibration.mat
KALYAN ACHARJYA
2019-2-15
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.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Point Cloud Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!