I wonder if this would be a competitive robot compared with one made with a traditional approach using a microcontroller and infrared sensors. I suppose that raspberry can perform an edge detection to tell the dynamic of the line far away, much more that the infrared sensor, but how fast can the raspberry do this process? should be a relative simple process in terms of computational requirements , an edge detection in a high contrast arena. Probably the bigger issue would be get the relative position of the robot respect to the line, may be a combination of the camera with some infrared sensors would work better, and what about the size? the robot will be significantly bigger when is used a camera and a raspberry for the control.
2 Answers
This may be overkill, but some of the past work I was involved in was trying to detect a vertical line (a pipe) in the camera's field of vision, and navigate relative to it.
The process was as follows:
- Pick a threshold value, and split the image into black and white
- Perform Canny edge detection on the image
- Use a Hough transform to find the strongest lines in the image, and consider those to be the boundaries of the vertical strip you're looking for
- Adjust for the perceived width (indicating distance -- you won't need this) and angle of the vertial strip in the image
We didn't get very good results at full camera resolution; The very pixellated lines in the image above were from downsampling the source video frame (by a factor of 3 in both directions, I think... so 1/9 the number of pixels to worry about). This allowed us to process frames fast enough for it to be useful. Also, the point of the initial threshold step was to speed up the Canny process -- fewer lines to find.
-
$\begingroup$ Thanks, it looks pretty interesting, I like it, did you use a raspberry pi? I would like to get and idea of the distance, to speed up, or speed down when the robot is far or close to the hard points of the arena $\endgroup$ Aug 10, 2014 at 2:20
-
1$\begingroup$ We were using this board, which even though several years old is apparently still faster than the Rpi: adl-usa.com/products/detail/19/adls15pc $\endgroup$– IanAug 11, 2014 at 13:51
-
$\begingroup$ I see, it really looks more powerful, I was thinking about make a edge detection and then a correlation of the image with some model curves like a really close curve or a straight segment of the track to know how the arena is in the next point, It would be this a reasonable approach? How much time could take to the raspberry do such a thing? I mean the correlation of an 320×240 image, I read that the raspberry can make the edge detection in a speed of about 7.7 to 17.5 fps: ryanmessina.wordpress.com/2013/06/10/… $\endgroup$ Aug 12, 2014 at 3:45
-
1$\begingroup$ Unfortunately there isn't a good way to guess the performance without trying. There are surprising differences in performance from subtle changes in the code, and what order various operations happen in. $\endgroup$– IanAug 12, 2014 at 17:36
-
$\begingroup$ Ian is correct. You can't really tell if a RasPi will be good for the job until you do it yourself, or talk with someone who has tried it already. My gut instinct is that it won't be powerful enough. Are you trying to use a RasPi for a reason - already have one? Because there are embedded boards out there that are built for image processing. $\endgroup$ Feb 1, 2016 at 16:37
I did a project based on RPi2 + Pi-Camera + ROS jade + OpenCV to make a line following rover. Two methods are used, one is to find contour of the track, the other is to use Hough-transform for edge detection. Under well-controlled environment (even light sources, less noises, etc.) the performance is good, and I use RANSAC to find preferred edges under noisy environment. Pi-Camera is set to capture 320x240 RGB in 30fps. I overclock my RPi2 to 1.0Ghz, finding contour can process frames in 18-23 fps, and hough-transform is about 17fps (in a bit noisy environment.) For these two methods, Canny filter and Hough transform is the major bottleneck. I built this as a test platform, a cheap rover chassis is used with 2 geared DC motors. My codes in github: https://github.com/alexhuang888/roscar