Pages: [1]   Go Down
Author Topic: [Detecting Thrown Ball] Which camera to use and which arduino board to use?  (Read 1652 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Basically, what my system should do is to detect a thrown ball's position and tell if it's in the "safe" zone.

Sets of basic sensors (infrared) will be placed to detect a ball thrown, and as soon as they detect the ball,

it will send signal to the camera, so that the camera can start taking shots, and detect the ball using

background subtraction. After the subtraction, the system will output corresponding x,y coordinates to other system.

The question I have at this point is, what kind of camera would be suitable for this job?

I have done a similar project with embedded camera called CITRIC camera mote, but for this project

I'm wondering which camera is the best choice to use with Arduino board.

I've done some searches and found cameras such as OVA7670 or TTL Serial Camera (http://learn.adafruit.com/ttl-serial-camera/).

I currently have an Arduino UNO, and wonder if these cameras are suitable for both my project and UNO.

Thank you.


Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The usual answer is the Arduino is too slow and too memory limited to be able to do this processing in real time.

I suspect the Arm embedded processors (Teensy 3.0, Due, Mbed, etc.) are more optimized for low power situations.  They are presumably faster than the Arduino (particularly at processing 16/32-bit data), but they may not be fast enough or have enough memory to hold a complete image in memory.  Perhaps something like a Beaglebone (500-700Mhz depending on power issues) or Rasberry Pi (700Mhz) would give you the additional speed and memory to do what you want.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand roughly what the solution is intended to do, but I don't understand what part the Arduino plays in this solution.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand roughly what the solution is intended to do, but I don't understand what part the Arduino plays in this solution.

For my current plan, what the Arduino does is,

-receives an image without the ball in presence, and store it as "background" image
-once the signal from the sensor is received, which indicates an object(ball) has been thrown,
-camera starts capturing new sets of images.
-every time the new image is captured, Arduino subtracts the image array with the "background" image, and
-detects the position of the ball (x,y coordinates), and output the coordinates




The usual answer is the Arduino is too slow and too memory limited to be able to do this processing in real time.

I suspect the Arm embedded processors (Teensy 3.0, Due, Mbed, etc.) are more optimized for low power situations.  They are presumably faster than the Arduino (particularly at processing 16/32-bit data), but they may not be fast enough or have enough memory to hold a complete image in memory.  Perhaps something like a Beaglebone (500-700Mhz depending on power issues) or Rasberry Pi (700Mhz) would give you the additional speed and memory to do what you want.

Thank you for your reply.
I'm sorry, but I'm kind of new to these. So you are saying, the Arduino processor is not fast enough, and those processors (Teensy..etc)
should be added to the Arduino board, to store images and do image processing?
So in that case, is Arduino acting just as a connecting board between the camera and Teensy (or other) processor?
and is the programming on Teensy still done through Arduino board and software?

Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2544
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

cmucam (cmucam.org) can do color tracking/detection and will return the coordinates of the object.

If you have a computer then look into RoboRealm (commercial) or OpenCV (open source).
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For my current plan, what the Arduino does is,

-receives an image without the ball in presence, and store it as "background" image

I think you will find this is more or less a complete non-starter. People have got low resolution black and white images off cameras, and some clever people have got an compressed colour image off a camera, but the Arduino doesn't have sufficient resources to decompress the image let alone do anything with it. You really need a computer to tackle this problem, not a microcontroller. If you add a PC to your solution, it would be possible to put together a solution very easily - in fact there is freeware software available that already does this sort of thing.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 444
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What is your desired outcome? Maybe it doesn't need to be quite so complicated... I don't know much about it but the Wii controller, I understand, can be used with the arduino and can track infrared points. Maybe if you had a background that did not reflect infrared and a ball that does you could use the Wii controller to do all the tracking for you.
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your reply.
I'm sorry, but I'm kind of new to these. So you are saying, the Arduino processor is not fast enough, and those processors (Teensy..etc)
should be added to the Arduino board, to store images and do image processing?
So in that case, is Arduino acting just as a connecting board between the camera and Teensy (or other) processor?
and is the programming on Teensy still done through Arduino board and software?
I'm saying the Arduino is too slow and memory limited to do the job.  It runs at 16Mhz, and only has 2K of read/write memory.  You probably need at least a megabyte of memory, more likely much more to do anything.

In terms of embedded microprocessors, the Teensy, Due, Mbed are the next step from an Arduino, since they are built with a faster processor.  However, as I said, it is likely that those processors while faster than an Arduino, are still not fast enough to do image processing in real time.  For example, the Teensy 3.0 runs at 48Mhz (and probably runs faster than 3x of the Arduino due to instruction set, etc.) and has 16K of read/write memory.  I don't know the other processors off the top of my head, but I would still think they cannot process images in real time.

Going to the next rung, which is microcomputer.  These run at a much faster Mhz, and have much more memory, but generally they are not real time micro-controllers that are dedicated to a particular task.  They usually run Linux or other more complex system.  The Rasberry Pi, runs at 700 Mhz and has 256/512 megabytes of memory.  You can pick up the model B R-pi for $35 and you will get either 256 or 512M of memory (old stock is 256M, they just recently updated the base configuration to 512M).

Besides something like a Raspberry PI, I suspect most of the modern Android phones have enough processing power to do it.  I don't know what the details are for programming Android devices as compared to Arduino.  Of course a normal PC that is of recent vintage is also probably powerful enough (the 486 sitting over in the corner with Windows 98 on it may not be powerful enough).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe I need to clarify little more here,

The theme of the project is "electric umpire", so the user will throw a ball to a surface,

and the system will be able to tell whether the ball is "safe" or "ball".

To do this, we are setting sensor near the surface, so we know when the ball hit the surface, the time that camera should

be detecting the position of the ball.

So as long as the camera captures that moment when the ball hit the surface, the image processing and all the other processes

doesn't really need to be in "real time", because we are not actually tracking the moving ball from the beginning to the end.

So much simplified description of this would be : ball thrown -> hit the surface -> camera activated to see where the ball hit-> sends

x,y position of the ball so that computer can say this is ball or safe.

This is the processor that I used for similar project. : Intel PXA270

http://www.phytec.com/pdf/datasheets/PXA270_DS.pdf

—32 KB instruction cache
—32 KB data cache
—2 KB “mini” data cache

« Last Edit: October 16, 2012, 09:17:18 pm by Anchun » Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe I need to clarify little more here,

The theme of the project is "electric umpire", so the user will throw a ball to a surface,

and the system will be able to tell whether the ball is "safe" or "ball".

To do this, we are setting sensor near the surface, so we know when the ball hit the surface, the time that camera should

be detecting the position of the ball.

So as long as the camera captures that moment when the ball hit the surface, the image processing and all the other processes

doesn't really need to be in "real time", because we are not actually tracking the moving ball from the beginning to the end.

So much simplified description of this would be : ball thrown -> hit the surface -> camera activated to see where the ball hit-> sends

x,y position of the ball so that computer can say this is ball or safe.

This is the processor that I used for similar project. : Intel PXA270

http://www.phytec.com/pdf/datasheets/PXA270_DS.pdf

—32 KB instruction cache
—32 KB data cache
—2 KB “mini” data cache
What we've got here is failure to communicate.

Lets see, at its slowest speed the processor you used has a cycle speed of 6 times the Arduino, and at the fastest speed 38 times.  Because the Arduino is an 8-bit processor, it means it must do multiple instructions where the xscale would be able to do them in one instruction.  So figure maybe the xscale is 12 - 60 times faster than the Arduino.

The xscale's memory is 256 kilobytes, the Uno is 2 kilobytes, the Leonardo is 2.5 kilobytes, and the Mega has 8 kilobytes.  That means the xcale has between 32 and 128 times the memory of the Arduino.

In addition, the xscale has a camera interface, and has multimedia instructions that are useful for dealing with the image.  The Arduino does not have these instructions.  In addition, it looks like the xcale has an image sensor builtin .

If you can deal with an image area of 128x96 that is black and white, the UNO would just barely have enough memory to represent one frame.  The Video Experimenter Shield (http://nootropicdesign.com/ve/projects.html) would allow you to do some processing.  Be sure to watch the Computer Vision video, where it has trouble finding the brightest spot in front of  a blank screen.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe I need to clarify little more here,

The theme of the project is "electric umpire", so the user will throw a ball to a surface,

and the system will be able to tell whether the ball is "safe" or "ball".

To do this, we are setting sensor near the surface, so we know when the ball hit the surface, the time that camera should

be detecting the position of the ball.

So as long as the camera captures that moment when the ball hit the surface, the image processing and all the other processes

doesn't really need to be in "real time", because we are not actually tracking the moving ball from the beginning to the end.

So much simplified description of this would be : ball thrown -> hit the surface -> camera activated to see where the ball hit-> sends

x,y position of the ball so that computer can say this is ball or safe.

This is the processor that I used for similar project. : Intel PXA270

http://www.phytec.com/pdf/datasheets/PXA270_DS.pdf

—32 KB instruction cache
—32 KB data cache
—2 KB “mini” data cache
What we've got here is failure to communicate.

Lets see, at its slowest speed the processor you used has a cycle speed of 6 times the Arduino, and at the fastest speed 38 times.  Because the Arduino is an 8-bit processor, it means it must do multiple instructions where the xscale would be able to do them in one instruction.  So figure maybe the xscale is 12 - 60 times faster than the Arduino.

The xscale's memory is 256 kilobytes, the Uno is 2 kilobytes, the Leonardo is 2.5 kilobytes, and the Mega has 8 kilobytes.  That means the xcale has between 32 and 128 times the memory of the Arduino.

In addition, the xscale has a camera interface, and has multimedia instructions that are useful for dealing with the image.  The Arduino does not have these instructions.  In addition, it looks like the xcale has an image sensor builtin .

If you can deal with an image area of 128x96 that is black and white, the UNO would just barely have enough memory to represent one frame.  The Video Experimenter Shield (http://nootropicdesign.com/ve/projects.html) would allow you to do some processing.  Be sure to watch the Computer Vision video, where it has trouble finding the brightest spot in front of  a blank screen.

Thank you for the patient yet very kind explanations.

I'll do more searches based on your advice.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So much simplified description of this would be : ball thrown -> hit the surface -> camera activated to see where the ball hit-> sends

x,y position of the ball so that computer can say this is ball or safe.

In that case, a sensible approach would be to use the Arduino as an interface between the ball/ground contact sensor and the PC, and connect the camera directly to the PC, and do all your analysis and processing on the PC. If the outcome of that analysis needs to be output via any devices that can't interface directly to a PC (displays, lamps, sounders etc) then you may want to use the Arduino to interface to those too.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: