3D point cloud

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);

ERROR:

Error using matlab.graphics.axis.Axes/horzcat

Cannot convert double value 5 to a handle.

MATLAB R2015a

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

You need to learn to use the debugger. Or you need to learn to provide sufficient information, with the complete error message that arose, so what line failed. However, I will hazard a guess that what you did was make a syntax error.

You form the variable ax as:

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:

SEE COMPLETE ANSWER CLICK THE LINK

--

--

--

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

3 Obstacles Hampering Organizational Agility

Convert 2D and 3D Assets for Free (Tutorial)

AWS DocumentDB — How it works, its set up and performing operations on it

Learning Crystal programming: tips & tricks

A Naked HashMap

150x Speedup in Real-Time Dashboards with Postgres 9.5

Retrofit Easy First Steps for Android

echo3D introduces support for Niantic Lightship to help Metaverse developers build highly-dynamic…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

More from Medium

How to Detect Edges of an Image using Canny Edge Detection technique

Start to work quickly with GPUs in Python for Data Science projects.

Microsoft Sentinel Machine Learning (ML) based Threat Detection Rules

Google Colab vs Google Colab Pro on Multidimensional TFT Architectures