What is javacv

Java JavaCV experts wanted

Instead of the camera, I would rather install a couple of ultrasonic sensors in the edges of the table and use their measured values ​​to calculate the position of the puck. You can connect these things to an Arduino board, for example.

There are a number of advantages:
- Camera = expensive, it will probably be a few hundred € <-> ultrasonic sensors = cheap, 4-20 € each
- Image processing = complex <-> distance measurements = very, very simple via triangulation
- The camera records with 60-100 fps (= 60-100 Hz) <-> ultrasonic sensors with <= 125 Hz. Perhaps there are also faster sensors for sale.

Such an Arduino board can be programmed with C, a BASIC dialect and Java.

Another advantage of the whole thing would be that you don't have to set up a frame over the table. In the heat of the moment, the part will vibrate a lot, and that can cause problems with the camera.


Edit:
To clarify that again:
The camera records at 60 fps and spits out a 320x200 pixel image in VGA. That's 64 KB per image, and they have to be processed in less than 16 ms for the desired response speed (1/60 fps = 16.67 ms between the image recordings). This is possible in principle, but also time-consuming. A bandwidth of approx. 3.7 MB / s is required for 64 KB / image, so the camera must be connected to the computer with at least USB 2.0 (achieves <= 30 MB / s and 1000 Hz).
Furthermore, the image has to be processed, for which I have set 16 ms. In these 16 ms, the current image must also be compared with the previous one in order to calculate the puck, its direction and its speed.

More precisely, this means:
1. Filter the image to make the puck visible. (B / W picture would be useful.)
2. Detection of the puck with an algorithm.
3. Comparison of the current puck position with that of previous images.
4. Calculate the direction and speed of the puck from this.
5. Extrapolate values ​​several milliseconds into the future (do not overlook the gang play) in order to compensate for the time lost through the calculations.
6. Feed the PLC with the values ​​obtained.

This requires at least one low-end computer that costs a few hundred euros.


Four ultrasonic sensors, on the other hand, provide four distance values. 60 times a second. Even a small microcontroller like the Arduino can do that. You can also use a Raspberry for more convenience. But you still have to see how many sensors you can connect there.

And then:
1.) Query of all sensor data (one byte, word or double word per sensor)
2.) Triangulation to calculate the puck position
3.) Derive direction and speed by comparison with the previous position (s).
4.) Feed the PLC with the data obtained.

A microcontroller, such as the one in the Arduino, can handle it while you sleep. The amounts of data aren't really worth mentioning either. Interpolation is not necessary because the whole process is done in <1 ms.