Linear encoder with webcam to measure length

asked 2015-05-26 11:07:45 -0600

There are tools like digital caliper, linear encoders that measures lengths. the are basically digital rulers and they use magnetic strips. they simply count magnetic stripes and calculated the distance.

I want to make it optical by using webcam instead of using magnetic stripes.

Imagine a ruler with webcam pointed on it. dont think about numbers or anything. just imagine ruler with vertical lines. webcam placed on to this ruler very closely and image is very clear. maybe not just webcam but usb microscope, meaning it will obtain very clear and magnified video of ruler.

as webcam moves, vertical lines will travel across video.

what I want to do is count these lines at the center of the video so I can calculate how far we go. or maybe a better algorithm to calculate the horizontal distance of webcam moved.

I googled every word I can think of to find a stating point I had no luck.

any suggestions please ?

best...

edit retag flag offensive close merge delete

Comments

If you want to detect the different lines, you could use the Hough transform (tutorial).

Eduardo gravatar imageEduardo ( 2015-05-26 13:19:04 -0600 )edit

there is also this answer regarding how to extract horizontal and vertical lines using morphological operations, which also ported into an official tutorial.

theodore gravatar imagetheodore ( 2015-05-26 15:04:26 -0600 )edit

you have to take care of camera distorsion/calibration and maybe have to use a telecentric lens if accuracy requirement is high

pklab gravatar imagepklab ( 2015-05-28 09:25:48 -0600 )edit