How to track black marker line

edited April 2015 in How To...

Hello everyone,

I am trying to build something similar to this guy

He is using a laser to track/avoid black lines and objects captured by the camera. I am mainly interesting in the tracking part, not really in the laser yet..

I have been playing around with simple tracking colors examples in Processing but I don't understand how I could simulate that tracking effect. For example:

1) A circle is drawn on the page

2) The camera picks it up (because of it's color)

3) x,y coordinate in the software "follow" the shape (as shown in the video)

Is that possible?

Answers

  • edited April 2015

    Imagine a car that has special wheels. The wheels on the left side of the car only turn when they are driving on grass. The wheels on the right side only turn when they are driving on pavement. Now the car only makes progress if it's driving along the boarder between grass and pavement...

  • If you look at the video carefully you can see that the laser is not tracking the black line, rather its is tracking the 'edge' of the black line. In other words it is looking for a sharp change in brightness.

    If for each pixel you assign a value of 1 for bright pixels and 0 for dark pixels, now any pixel has eight neighbours and if you count their values you will get a value between 0 and 8. A value of 3-5 say would indicate that you are on a border. Once you have such a pixel then you have a starting point for tracking. and then you can test the neighbouring pixel in the direction of travel and the pixels either side to find the best next point to move to.

Sign In or Register to comment.