Let's Make Robots! | RobotShop

Good info or project about blob detection, line following or similar using camera and microcontroller

Hello all,

I decided to post here as a member since I have now spent many many hours without success to find what I'm about to ask.

I have an STM32F103 arm based board with 2.8" tft and a camera OV7670+fifo buffer memory bought cheaply from Ebay. Many hours I've struggled but I got it this far that I get qvga or qqvga (160x120 pixel) full color images from the OV7670 into my STM32 and show the image on the LCD. If somebody is interested, I'm willing to share the whole code.

Now...what my real goal is: not to get the stm32-ov7670 to work (i thought it was easy) but to do something with it. I'm open for anything, line following or maybe blob detection (follow a colored ball). The only thing I have now is 2-3 frames per second of 160x120 pixels in RGB565 format. I can depict the color values on the TFT, find specific pixel values etc etc but still....have no clue how to do something with it.

I've spent many hours with google and doing specific searches by using site:letsmakerobots.com. Either I see cool projects with absolutely no sourcecode or I find these cool openCV computer based projects which I find cool but I want to do something embedded.

Anyone, got a good suggestion? A lead to go on, like a good project you worked on? Maybe some good tutorial?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

...which was meant for another one's post. Cannot find the delete button... so I just edit it to this

Sadly there is no Delete for forum posts. What you type is here for prosperity. :P The best you can do is edit the comment to contain a '.' or maybe even just a ' '(space).

If you are developing in C/C++ then you can always bring the OpenCV platform into your embedded system, source code is available from Willow Garage... no promises on how efficiently it will run though =)

If you want to develop your own vision processing functions, Wikipedia has plenty of info under Feature Detection, although it can be more formal and math-heavy than it needs to be.

The first computer vision filter I remember learning about was the standard Sobel filter, I suggest you give implementing that a try. Get ready for a lot of matrix based functions, they're everywhere in image processing.

Good luck!

Hi Telefox, another good idea which I was unaware of: I can bring in the OpenCV to my embedded system? Now that is something I will dig into tonight! I indeed develop in C.

The heavy math I've run into... thats not for me. I found tons of impressive 4-page papers of universities and I found 2 complete books in pdf about Robot Vision. As soon as the first Matrix calculations hit my head I felt at school again. That stuff I preserve for work in my free time I like to get my hands dirty and be as practical as possible.

I even found a book containing every imaginable vision/image processing algorithm there is, in C language. But here I stumbled over the problem not knowhing what to do with this algorythm. I will dig into the info you gave me and that of Birdmum. Hopefully I find some code in whatever language which I will dig into deep and translate to my system

I am pretty sure the Sparkfun UGV contest utilizes traffic cones. Being able to home in on them for accurate cornering would be useful. You already mentioned line following. I have seen University robots that catch baseballs. I doubt 2-3 fps would be sufficient for that purpose though.

Tnx Birdmum, I got something to go on now! I am aware that my framerate is poor, I can crank it up when I do not display the frames on my TFT, that is probably what I do when I have an application fully working no debug required anymore.

I just want to learn the lowlevel stuff, I have 120x160 pixels and they represent info, now what to do with it. For a more powerful version I will revert to this openCV, I have a raspberry pi as well with an addon pcb STM32 (its called embedded pi)

There used to be an open source AVR Cam project, which used a camera that would send frame grabs to an on-board Mega 8 for processing and the microcontroller would talk with other hosts over serial (either computer or microcontroller). The output would be coordinates of the bounding boxes for the color the camera module is looking for. That was done on the camera module.

On your own microcontroller, having the bounding box, lets you determine the size of the blob and the center point coordinates of that box. Then, you can determine how far off-center the box is in the frame and move the robot or the camera (mouted on a head) to center the blob in the frame. If you know the height of the camera, the angle it is facing down to have the blob centered on the frame, you can calculate the distance to the object (represented by the blob) if the object is sitting on the floor, of course.

I have such an AVRcam module, but I haven't been able with my limited programming knowledge to make good use of it. I also have an Arduino library, but it is limited and works awfully slow (slower than the camera can actually work). 

Oh, it seems that the project's page is still active, so you can take a look at the provided embeded code:


another discution on LMR thread: https://www.robotshop.com/letsmakerobots/node/23611

and the AVRcam Arduino library: http://www.societyofrobots.com/robotforum/index.php?topic=2679.0

oh, and I also found a resurrection of the AVRcam here: http://www.bot-thoughts.com/2012/06/avrcam-resurrection.html

huh, there also seems to be an ArduCam project: http://www.arducam.com/

Man, lots of options here... let us know what you do!

Hi Ro-Bot-X

This is a big coincidence! Yesterday evening I was tracking down the lead I got from Birdmum and Telefox.

Telefox told me about openCV on embedded systems. When looking for that it quickly became clear that this would be a new struggle or challange (it depends how to look at it) because I found no one who had some compact embedded code availble (but I keep looking). While I searched the internet I found a post about Jrobot and checked it out. First impression is this is exactly what I need. So I already downloaded his AVR code and will take a look at it the coming days (its a big project).

I surely let you know what I do, I plan to write something about it on LMR as well. It frustrated me that there is no project or post that guides you through like a tutorial. I know its a lot of work thats probably why and the ones understanding how this all works might not be able at all to 100% put it on paper.

I will start with Jrobot and will go through the rest of your links as well. Man am I glad I put this post out, finally I'm making progress again