Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello

in MATLAB , webcam see some things like a Clock
and an A4 paper on the wall that is hanged

A Red Laser hits the paper
now i want matlab to show me
the Coordinate of laser location on the paper
and
the Coordinate of laser location on the paper
I wanted
Height paper
For MATLAB
The vertical axis coordinate considered
And
The paper
For MATLAB
The horizontal axis coordinate considered
X of Laser LOcation in the paper = ?
Y of Laser LOcation in the paper = ?
i want to
Thanks
Thank You
Thank you Very Much
..................................

What I have tried:

only
i learned how to run my laptop webcam in matlab and take some frames
Posted
Updated 17-May-16 5:46am
v4
Comments
Sergey Alexandrovich Kryukov 10-May-16 11:36am    
What "centimeter"? It makes no sense. Do you realize that your paper is not even a rectangle? Everything plays in 3D. It looks like you wildly underestimate the complexity of the situation.
—SA
Member 12514755 12-May-16 12:11pm    
Hello
in MATLAB , webcam see some things like paper , ....
A Red Laser hits the paper
now i wanted matlab to show me
the distance from laser until the upper edge
and
the distance from laser until the left edge
Sergey Alexandrovich Kryukov 12-May-16 12:20pm    
Yes, I understand. I'm just trying to explain that it's way more complicated than you are trying to present. You can do blob recognition to find the sheet and that use its convex hull. But you hardly can directly measure centimeters; and it hardly will be a rectangle...
—SA

1 solution

If you want to measure distances in real world units, such as cm or inches, with any vision system, you need to calibrate the system.

In this case you could enter the actual size of the paper into your your algorithm, then you measure the size of the paper with the vision system. Now you can calculate the scale factors for the height and the width of the paper.

This simple approach will get you started, but it will not be completely accurate. For that you need to consider the effect of lens distortion and the angle between the camera and the object. If the camera is not perpendicular to the object you will introduce skewness and your calculations will be slightly off.

In your case the lens distortion might be ignored, but that you need to decide for yourself.
If you have a skewed image, you can compensate by using more measurement points, for example the coordinates for each corner and change the algorithm you use to calculate the distance.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900