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
Walter Roberson 2019년 2월 15일
run stereoCameraCalibrator . save from the menu . Assign stereoParameters to stereoParams . Save that into stereocalibration.mat
KALYAN ACHARJYA
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개)

카테고리

질문:

2019년 2월 15일

댓글:

2019년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by