Ask Your Question
1

How to follow a line while moving in (x,y) plane?

asked 2016-01-18 02:04:58 -0600

Apastrix gravatar image

updated 2016-01-18 02:06:01 -0600

In short what i want is to follow a line like the guy in this video:
https://www.youtube.com/watch?v=iHias...

He talked a little bit about his algorithm in the description and in the comment section, but he wasn't that clear, since This type of following the line has great applications, i thought you guys might help me shed some light on it.

In the video description he said: "The line intersects the roi and the vector is calculated"
Question1: What vector he is talking about? a vector of what exactly?

In the comment section he said:

"I get the array of values from my ROI, one per degree. I then set a threshold level and turn these values into binary values. In my direction of travel I set a region (30 degrees) either side of that point and disregard anything outside of it. I find the centre value of the binary array representing line. This gives me an angle to drive to. I then turn this into a x and y velocity using sin cos functions. I feed the x any velocity into the stepper drives and the camera closes the loop."

Question2: What values he is extracting from the ROI? and what does "one per degree" mean in this context
Question3: Why would he need a threshold? isn't the image already binary?
Question4: What direction of travel?, and what point?
Question5: What does the center value of binary array mean?!
Question6: How is he getting his angle of travel?

As you guys see, i didn't understand a thing from his explanation? any help please.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-18 05:33:09 -0600

updated 2016-01-18 05:35:05 -0600

Question 1 - The vector holds sequential X,Y coordinates for the camera.

Question 2 - He is extracting X,Y coordinates for each camera moving step. Don't know exactly what "one per degree" means, but it has to be some kind of resolution measure.

Question 3 - A binary image holds either 0 or 255 pixels. The webcam may be seeing a white sheet with a drawn black line, but there still are shades of grey.

Question 4 - There is a way to transform X,Y coordinates from the contour to camera coordinates and finally instructions to the motors. Applying the right math and with proper calibration, you can transform X,Y coordinates from the contour to camera coordinates.

Question 5 - Mean of all the X,Y coordinates on the coordinate array.. also known as centroid.

Question 6 - I am not sure about this.. but I think he is comparing current position with the centroid of the whole array.. and he can calculate the direction of travel somehow.

edit flag offensive delete link more

Comments

"Question 1 - The vector holds sequential X,Y coordinates for the camera." If he wants to get the coordinates of the camera, he can simply read the central pixel of the image, since the camera is facing it.

"Question 4 - There is a way to transform X,Y coordinates from the contour to camera coordinates and finally instructions to the motors."

From my binary image, i can get the angle of orientation of the line segment, but that isn't enough to drive the motors, i need to decide which way i want to follow the line, CW or CCW, how can i do that? and how did he do that?!
.. Any details are much appreciated.

Apastrix gravatar imageApastrix ( 2016-01-18 07:15:21 -0600 )edit

Question 1: I meant the XY coordinates for the camara's future position, not current position.

Question 4: I think that he calculates the centroid point of the current line being followed, and the correct travel direction is always towards that point.

Pedro Batista gravatar imagePedro Batista ( 2016-01-18 08:44:07 -0600 )edit

So the edge of the ROI is where the center of the camera needs to go? Indeed he needs to always centralize the camera on the line being followed. What about the phrase: " In my direction of travel I set a region (30 degrees) either side of that point and disregard anything outside of it." ? I'm trying to figure out from where to where is this region of 30 degrees, any ideas?

Apastrix gravatar imageApastrix ( 2016-01-18 12:04:12 -0600 )edit

I can't fully understand that statement either. But I am assuming that he discards most of the image and analyses just a small portion of it (ROI) around the center. Normally ROIs are defined as offset coordinates to a certain point, not by a measure of degrees..

Pedro Batista gravatar imagePedro Batista ( 2016-01-18 12:25:56 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-01-18 02:04:58 -0600

Seen: 450 times

Last updated: Jan 18 '16