Ask Your Question
0

What camera is best for object detection with Open CV? (Air Hockey Puck)

asked 2020-04-24 09:23:10 -0500

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.

edit retag flag offensive close merge delete

Comments

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

HYPEREGO gravatar imageHYPEREGO ( 2020-04-24 09:48:20 -0500 )edit

What is the maximum speed of the Air Hockey Puck?

andrei186 gravatar imageandrei186 ( 2020-04-24 10:28:51 -0500 )edit

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

HYPEREGO gravatar imageHYPEREGO ( 2020-04-24 10:48:11 -0500 )edit

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).

kbarni gravatar imagekbarni ( 2020-04-24 16:51:46 -0500 )edit

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.

Slartybartfast gravatar imageSlartybartfast ( 2020-04-27 09:36:15 -0500 )edit
1

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.

kbarni gravatar imagekbarni ( 2020-04-27 17:48:52 -0500 )edit

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 :)

Slartybartfast gravatar imageSlartybartfast ( 2020-04-29 03:23:28 -0500 )edit

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...

HYPEREGO gravatar imageHYPEREGO ( 2020-04-29 11:43:52 -0500 )edit

have you considered black&white camera? With the same resolution you can get three times fps

andrei186 gravatar imageandrei186 ( 2020-04-29 15:43:04 -0500 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2020-04-24 11:16:35 -0500

andrei186 gravatar image

To intercept the pack like here www.youtube.com/watch?v=CjzSeOg8oTs no AI is needed. Do you mean you wants to detect the opponent mallet position and speed and calculate the trajectory of the fended pack to the goal?

Your current 187fps means that in worst case scenario between two frames the pack will travel 19cm out of 96 cm of the half-table. What makes you think you need more fps?

edit flag offensive delete link more

Comments

I think it depend mainly on how the AI/Algo is build: if it can do some prediction on the future position (it can be useful set a dynamic ROI and work with part of the image only) of the puck and depending in how fast it can process a decision and react. As I said more frames it means also more memory and stuff to manage, so I agree with you that maybe get more frames it is not convenient afterall, but I think that the OP was asking about which model is better rather than the one that they are using in terms of resolution and eventually framerate. 187 IMHO is a very high framerate, but in the worst case 19cm can be critical (can be a goal or not) but those situation I think are very rare. 187 FPS means also 5ms to elaborate a frame, is ...(more)

HYPEREGO gravatar imageHYPEREGO ( 2020-04-24 14:16:28 -0500 )edit
1

in worst case 19 cm can't be critical as the pack travel starts from the central line, i.e. at least 96 cm from the goal ( the pack can't be hit on the opponent side), More than 2 frames might be required if the pack bounces off the rail changing direction. U R right, high res multiplied by high fps might be unnecessary burden on CPU/GPU and USB, especially when a AI algorithm needs to be executed for every frame and time to be left for the mechanics to react. To tell the best model, minimal cam spec needs to be estimated and pack speed is factor No1. BTW, the link U provided mentions 80mph for ice hockey pack. I guess the air pack is much slower. I reckon examining frame by frame their 187 fps video the OP can evaluate pack speed. And why OP is ...(more)

andrei186 gravatar imageandrei186 ( 2020-04-24 15:25:38 -0500 )edit

I checked again, it is stated that We can say that if hit correctly, the **air** hockey puck travels at a blink of an eye. By blink of an eye, we mean that the top recorded speeds have reached up to 80 miles per hour. But this is a worst case scenario for sure. Yeah, you're right, the field is 96cm at least as you states: I haven't considered that, I'm always looking at time and speed because of my use case scenario :D. By the way my suggestion can me maybe correct, he can go upper with the resolution (if is needed for more accuracy) and select the proper ROI based on the position mantaining the same frame rate. But still, without a budget is difficult give a suggestion.

HYPEREGO gravatar imageHYPEREGO ( 2020-04-24 15:52:10 -0500 )edit

it's a fresh idea to measure speed in blnks of eye! And no point discussing budget before the minimal technical requirements are specified. Perhaps even existing PS3 is too much for their RaspberryPi and they better spend their budget on another computer. Also after the 2nd thought I stopped understanding why AI. AI is't needed for trajectory calculation. It might be needed to predict position of the opponent's mallet. But for this the second camera is needed to monitor the opponent, not just his mallet

andrei186 gravatar imageandrei186 ( 2020-04-25 04:25:35 -0500 )edit

Hi! Thank you so much for your answers! Sorry for my late reply. See my comment on the first answer, that might answer some of your questions.

We can run the calculations on other hardware than the RPi to ensure we have enough computing power. The bottleneck really seems to be the camera (see my other reply again). Yes, we do not necessarily have to use AI/Machine Learning for our project. But we are continuing the work of a group before us and they made use of these technologies. Therefore we are for now continuing to use their program.

Slartybartfast gravatar imageSlartybartfast ( 2020-04-27 09:41:13 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-04-24 09:23:10 -0500

Seen: 98 times

Last updated: Apr 24