How to get 3D point Cloud ?
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Image Analyst
il 14 Mar 2019
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.
Risposte (1)
Vedere anche
Categorie
Scopri di più su Point Cloud Processing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!