How to get 3D point Cloud ?
20 ビュー (過去 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!