How to get 3D point Cloud ?
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Image Analyst
le 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.
Réponses (1)
Voir également
Catégories
En savoir plus sur Point Cloud Processing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!