I am trying to get a 3D point cloud using the following code:
output_dir = 'C:\Users\Xyz\Desktop\Matlab'; %%set up webcam delete(imaqfind) 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);
ax = axes.
When you do that in MATLAB, for example...
plot(1:5) >> ax = axes ax = Axes with properties: XLim: [0 1] YLim: [0 1] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0.1300 0.1100 0.7750 0.8150] Units: 'normalized' Show all properties
As you can see, the result is a handle to the axes in a figure.
Then later on, you did this:
xlim(ax, [-.8, .8]); ylim(ax, [-.8, .8]); zlim([ax, maxDepth]);
Do you see that in the calls to xlim and ylim, you used one form, yet when you called ylim, for some reason, you did something completely different?
In fact, inside the call to zlim, you tried to catenate the number 5 to a graphics handle?
maxDepth = 5;
Now, go back and READ THE ERROR MESSAGE YOU GOT. maxdepth is the number 5.
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.