What camera is best for object detection with Open CV? (Air Hockey Puck)
We are building an air hockey table with an integrated AI that can play against humans. Up to now we only had a Playstation3 Camera with 320x240px resolution and 187 fps available for the detection of the puck (Using OpenCV). Now we have the money to buy a new camera, but we are not sure what the best brand / model would be. Does anyone have experience here and can recommend a camera?
More information: The size of the table is 1920mm x 900mm. We are Using EmguCV on a RaspberryPi.
I think that this is a more general question and probaly you'll find many more answers in SO for example rather than here.
If you have the money, you need to say how much money you have. There are camera ranging from 2€ up to 5k and more, if you don't specify a budget it's difficult to help you. More pixels you process more power you'll need, but some cameras have a built-in processor to do some stuff directly on the camera itself. Personally I used in the past the Allied Vision Camera. I had bad experience with their software, but the cameras afterall are good in many environment and there are a good documentation and support. In my opinion you should look for a global shutter sensor, with a VGA resolution (at least). More the FPS, more the heat, more memory problem, so choose carefully
What is the maximum speed of the Air Hockey Puck?
Here it's state that it can go 130km/h (80 miles per hours) that with some math it can be found that is 36m/s. So a high speed camera is needed
Did you achieve something with the current setup? Where is the bottleneck of the system?
I think the current camera should be a good starting point. Record some videos, try to detect the puck and estimate the trajectory and see where is the problem and look for the best solution to solve it. Maybe you'll need a stronger computer; in this case it makes no sense to spend your budget on shiny cameras.
An advice: try to use a simple detection algorithm to make processing fast. Simplify the setup: use a black puck on a shining white table with plenty of light (for less image noise and no motion blur).
Hi, sorry, I replied a 2 days ago but it seems my reply was deleted for some reason. Thank you so much for your replys though!
So on more try:
We have a budget of up to 400$. We did have some success with the current setup already, but it really seems like the main issue is, that the bad PS3 camera resolution leads to the puck "Fluttering" around 4px during detection in each frame. This way the calculation of the trajectory is often off by quite a bit.
We usually do not achieve 130km/h with the puck. During ordinary play it is definitely less.
The problem with higher resolution cameras is the data quantity: a 640x480 color image is 1MB in size. At this resolution 60-70 FPS can saturate a Gigabit Ethernet or USB3 port - especially for a small computer.
BTW, an idea: check out the OpenMV modules (like the H7 board and the global shutter camera). It's a microcontroller specialized in image processing, so it might be quite fast for a simple algorithm. I never used them, so I can't say if they'll work, but they are worth a look. As it's a microcontroller, it can also control directly whatever you are using to control the AI player.
Thank you!
I'll definitely take a look at it. Unfortunately, it seems like with the higher resolution models only 60 FPS are possible. But it's worth giving it a shot, if just for comparison. I mean, they are quite cheap :)
As I suggested to you in a comment, using a proper camera you can get higher FPS just setting a ROI. Since the camera and the table are rigidly fixed (eventually there can be some shift/drift of some mm, nothing important), you can detect the puck at first sight (let's say you acquire an entire frame at full resolution and then tracking it and set different ROI to have the puck at the center of the image in each frame. Setting ROI should be poossible by some API call. The camera I worked with had this possibility, so it should be possible also with other (I think!). In this way you reduce the resolution (fasten the process) and get more FPS. The only overhead is the continuously ROI changing, but I think it should be possible without a big cost...
have you considered black&white camera? With the same resolution you can get three times fps