How to get 3D point Cloud ?
조회 수: 22 (최근 30일)
이전 댓글 표시
Trying to get a pointcloud from live video feed using 2 usb webcams.
CODE:
output_dir = 'C:\Users\HITESH\Desktop\Matlab';
delete(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.m;
end
ax = axes;
maxDepth = 5;
clear maxdepth;
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
showPointCloud(pointCloud, J1, 'VerticalAxis', 'Y', 'VerticalAxisDir', 'Down', 'Parent', ax);
xlabel('X (m)');
ylabel('Y (m)');
zlabel('Z (m)');
xlim(ax, [-.8,.8]);
ylim(ax, [-.8,.8]);
zlim([ax,maxDepth]);
drawnow;
end
end
release(leftCam);
release(rightCam);
Error message:
Error using matlab.graphics.axis.Axes/horzcat
Cannot convert double value 5 to a handle.
How do I resolve this issue.
MATLAB R2015a
댓글 수: 1
Image Analyst
2019년 3월 14일
The error message should give additional info, like the line number and the line of code that threw the error. Please give that also, if you're still having the problem.
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Point Cloud Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!