Arduino Forum

Using Arduino => Project Guidance => Topic started by: HappyTron on Jan 19, 2013, 10:42 am

Title: Simple Image Processing
Post by: HappyTron on Jan 19, 2013, 10:42 am
Hello,

Basically I want to implement simple image processing using Arduino (whichever works).
The board with a camera will be mounted on a small 4-wheeled car.
Basically I will be holding a bright Red LED and the objective of the car is to follow me using that LED.

Being new to Arduino platform I wanted a bit of advice on which camera and board to use if I want the image processing done by the controller?
How will go about doing that? Like are there any build in libraries I can use?
I will also need a bit of help interfacing the camera with the controller.

And is there a way to do the image processing from the camera mounted on the car on my computer and send the commands back to the controller wirelessly?

It will be awesome if someone can help me out getting things together.

Title: Re: Simple Image Processing
Post by: Grumpy_Mike on Jan 19, 2013, 11:56 am
So have you searched this forum for similar posts?
What happens is I say no, you can't do it.
Then other people jump in and say maybe but it is complex.
Then you go away to look at another platform.
Title: Re: Simple Image Processing
Post by: JimboZA on Jan 19, 2013, 01:18 pm
To have a robot follow light, you don't need a camera and image processing- you can get by with two LDRs (Light Dependent Resistors).

Unless there are some other constraints to this project that mean you have to use a camera and image processing, Google "photovore" (light eater...) and you'll get some good info.
Title: Re: Simple Image Processing
Post by: holmes4 on Jan 19, 2013, 01:30 pm
You also don't need to have one processor do every thing. Use a WiFi cam mounted on the 'bot. Link the cam to the PC and have the PC do the image processing and send instructions to the 'bot. Lookup robotics - horse and rider.

Mark
Title: Re: Simple Image Processing
Post by: PeterH on Jan 19, 2013, 02:01 pm
... but it's complex.
Title: Re: Simple Image Processing
Post by: HappyTron on Jan 19, 2013, 08:41 pm

You also don't need to have one processor do every thing. Use a WiFi cam mounted on the 'bot. Link the cam to the PC and have the PC do the image processing and send instructions to the 'bot. Lookup robotics - horse and rider.

Mark


That sounds like a better idea.

Can you explain me a bit more about this?

So what I make out of what you said is:
1. Wifi Camera sends image to PC.
2. I process the image in say MATLAB.
3. I send the instructions to the controller wirelessly from my results generated in MATLAB.

Now I am not very well versed with MATLAB. It would be really great if you could guide me on this.
How would I automate results from my MATLAB scripts to be sent over to the controller?
Give me some sources to study. Also, I am planning to get the XBEE module with the shield for my UNO board. How exactly would XBEE talk to my PC. (Is it possible to do that on an AD-Hoc network? or I would need a Wireless Router?)

It would be really helpful if you could give me more pointers on this.
Title: Re: Simple Image Processing
Post by: zoomkat on Jan 19, 2013, 09:01 pm
1. Wifi Camera sends image to PC. >  Not associated with arduino

2. I process the image in say MATLAB. > Matlab forum

3. I send the instructions to the controller wirelessly from my results generated in MATLAB. > possible arduino interface

How would I automate results from my MATLAB scripts to be sent over to the controller? > serial is the usual format

Give me some sources to study. > google is your friend

How exactly would XBEE talk to my PC. > probably thru another XBEE attached to your pc.

Is it possible to do that on an AD-Hoc network? or I would need a Wireless Router? > I think you are trying to mix apples and oranges.


Title: Re: Simple Image Processing
Post by: szangvil on Jan 19, 2013, 09:58 pm
I am no expert at this, but the company I work for was using image processing hardware in their machines over 20 years ago(!). Isn't the Arduino (or a few of them connected together) "strong" enough to do what was done by hardware 20 years ago?
Title: Re: Simple Image Processing
Post by: AWOL on Jan 19, 2013, 10:11 pm
I too did image processing over twenty years ago.
We used 32 bit processors, often lots of them in parallel, with (for then) bucket loads of wide, fast RAM.
It wasn't a beginner's project.
Have a look at the video experimenter's board.
There's example code.
Title: Re: Simple Image Processing
Post by: creativen on Jan 19, 2013, 10:29 pm
Using Kinect Camera to do color tracking and determine its coordinate using depth sensor, it is interesting since you also could use Processing to receive any data from Kinect and send data to your Arduino. Check this out: http://zugiduino.wordpress.com/2012/12/30/kinect-color-tracking/
Title: Re: Simple Image Processing
Post by: AWOL on Jan 19, 2013, 10:34 pm
Forget colour.
Use optical filters.
Title: Re: Simple Image Processing
Post by: Grumpy_Mike on Jan 20, 2013, 12:08 am

I am no expert at this, but the company I work for was using image processing hardware in their machines over 20 years ago(!). Isn't the Arduino (or a few of them connected together) "strong" enough to do what was done by hardware 20 years ago?

I did image processing 30 years ago on a TRS80 computer.
While the processing power was roughly the same as an arduino the memory capacity was not. That is what stops you using the Arduino to do any meaningful image processing. Also I build my own real time frame grabber. I programmed it in Fourth.
Title: Re: Simple Image Processing
Post by: Magician on Jan 20, 2013, 01:59 am
Arduino could process 1-bit video, extracting 240 points on regular NTSC frame. Applying simple math it would be possible to distinguish straight lines, cycles etc.
http://coolarduino.wordpress.com/2012/07/28/visual-navigator-making-it-mobile/ (http://coolarduino.wordpress.com/2012/07/28/visual-navigator-making-it-mobile/)
and
http://coolarduino.wordpress.com/2011/12/29/optical-magnet-arduino-project-next-in-a-series-laser-tracking-3d/ (http://coolarduino.wordpress.com/2011/12/29/optical-magnet-arduino-project-next-in-a-series-laser-tracking-3d/)
Title: Re: Simple Image Processing
Post by: JimboZA on Jan 20, 2013, 05:25 am
Pauses thread here for a moment and rewinds.....

Is this really an image processing issue or just light following?

Title: Re: Simple Image Processing
Post by: HappyTron on Jan 20, 2013, 07:13 am

Pauses thread here for a moment and rewinds.....

Is this really an image processing issue or just light following?




It will be image processing cause the light which the bot has to follow, I will be holding it in my hand waving around in a 3-D space. If it was just following something on the floor I would've used LDR's.

Using Kinect is an awesome idea...but Sir I have no Idea how to send Kinect's data wirelessly back to my computer.
Could you help me a bit in that?

If that can be worked out it will be amazing!
Title: Re: Simple Image Processing
Post by: JimboZA on Jan 20, 2013, 07:16 am
Quote
It will be image processing


Cool... it was just a thought, always good to keep things simple if possible!
Title: Re: Simple Image Processing
Post by: Grumpy_Mike on Jan 20, 2013, 07:23 am
Quote
Using Kinect is an awesome idea...but Sir I have no Idea how to send Kinect's data wirelessly back to my computer.
Could you help me a bit in that?

If that can be worked out it will be amazing!


Truly it would. But you can't do it with an Arduino, maybe the Due but so far I have not seen anything to talk to the USB port and input video. That sort of setup would require a laptop on your robot.
Title: Re: Simple Image Processing
Post by: HappyTron on Jan 20, 2013, 07:36 am

Quote
Using Kinect is an awesome idea...but Sir I have no Idea how to send Kinect's data wirelessly back to my computer.
Could you help me a bit in that?

If that can be worked out it will be amazing!


Truly it would. But you can't do it with an Arduino, maybe the Due but so far I have not seen anything to talk to the USB port and input video. That sort of setup would require a laptop on your robot.


Well the Arduino won't have to do any processing other than recieving data wirelessly and telling the motors what to do. Rest everything will be done by the laptop.

As creativen said that I could use Kinect to capture the image data and process it using Processing on the computer and send the data to Arduino for driving the motors. So if I could figure out a way to send images captured by Kinect wirelessly to my PC, it would make things really simple. Well for starters I could actually just wire my laptop to it. As this project is no school work, I am just doing it to increase my own knowledge about image processing and embedded systems.

Title: Re: Simple Image Processing
Post by: HappyTron on Jan 20, 2013, 07:47 am
Okay, nevermind. In India the Kinect for PC is costing around $400. That is way over my budget at the moment. So we are back to webcam.

So I will have to use a wireless webcam and process it on the computer.

I will study and learn processing. But can anyone guide me on how to exactly send data to my controller from the results generated by Processing?
Or once I study it from a normal tutorial/wiki I will know that and nothing special would be required.

Title: Re: Simple Image Processing
Post by: arduinohabib on Jan 20, 2013, 07:56 am
I'm no expert, but I would imagine that you write code for processing to send info to the serial port. You connect an XBEE to an FDTI breakout board, which is connected to the computer.
Title: Re: Simple Image Processing
Post by: zoomkat on Jan 20, 2013, 08:05 am
Just a thought, maybe you should start with a small B/W bitmap image file and see if you can process what it contains line by line.
Title: Re: Simple Image Processing
Post by: HappyTron on Jan 20, 2013, 08:32 am

Just a thought, maybe you should start with a small B/W bitmap image file and see if you can process what it contains line by line.


Yes before buying all the hardware, I am going to start experimenting with processing and various images.


Thanks for the help. I guess I've figured out what exactly has to be done. I will ask again if I get stuck somewhere specific.
Title: Re: Simple Image Processing
Post by: creativen on Jan 20, 2013, 11:08 am

Okay, nevermind. In India the Kinect for PC is costing around $400.


Wow, that is expensive.
I bought it in Indonesia, only cost around US$250..

Hmm it might be a little bit impossible to get the image data from kinect wirelessly since, it require very high data speed, remember if you wanna operate Kinect for Windows in PC, you need to install a lot of things, Simple OpenNI, OpenNI, KinectSDK, etc. It is my opinion, correct me if I am mistaken.
Title: Re: Simple Image Processing
Post by: michinyon on Jan 20, 2013, 01:17 pm
It is easy to follow light,  if you turn all the rest of the lights in the room off.

How reliable does this thing have to be ?  Work outdoors,  or indoors only ?  Can you guarantee that there
will be no other "red" things in the room for it to home in on ?

Arduino is not really capable of real "machine vision" capability.

One idea, might to be make your led blink at some specific and unusual frequency ( not necessarily visible),   
and set up an antenna on the robot which is going to notice that specific frequency and home in on it.
Title: Re: Simple Image Processing
Post by: 0AlphaOmega on Jan 20, 2013, 01:47 pm
*Points at grumpy* Ha Haaaa!
Beat ya!  :P Before the TSR80, with a home made camera, a home designed/built Z80 'pc' and a neural net; I was able to identify if the "camera" was looking left, right or centre of a scene.
The camera used a loop of super 8 film (hand cranked, never motorized it) as a pixel mask to give a 16 and then a 64 pixel (8x8) device (just filmed a white card on a black background to create a moving window) and a single photo transistor :)

No forums (or web) back then  :P The point being, don't let them tell you it's impossible, keep plodding and use your imagination. There are many ways to the solution, but the fastest way there is to understand the problem. ;)

I was talking to a guy a couple of years ago who was into neural nets, and he said he uses high end video cards, and hacks the multiple cores/processors as a very fast engine to "parallel process" his nets.

Now matter how fast the processor, we will always overload it with crud and make out it's slow! Like cupboard space, you always have 10% more rubbish than space! :)

Title: Re: Simple Image Processing
Post by: arduinohabib on Jan 20, 2013, 01:49 pm
I know now!!!! Used an IR led flashing at 38 khz and put an IR receiver on the Arduino robot!
Title: Re: Simple Image Processing
Post by: PeterH on Jan 20, 2013, 03:31 pm

It will be image processing cause the light which the bot has to follow, I will be holding it in my hand waving around in a 3-D space.


So you have a light, which the 'bot has to follow. Could you explain how you came to the conclusion that this is not a light-following problem?