📜 ⬆️ ⬇️

Tire on Raspberry, version 2.0


An article about further improving the previous version of the shooting gallery geektimes.ru/post/255350
Using a shooting gallery at home was quickly boring, therefore, to the joy of colleagues, it was installed at work. However, after a short operation, a number of shortcomings were identified:

All this has been fixed in the new version.

First of all, the gun was replaced by a weighty and solid - airsoft:


The barrel was removed and the laser was installed.


Instead of arduino, a simple control scheme was assembled. Since the contacts in the gun only for the closure, I had to excel:

')
Initially, the pistol engine was not turned off - it worked with imitation recoil and a loud bang of a shot. But, despite the rapid enthusiasm of the shooters, this option had to be abandoned, as it distracted her work colleagues.

Targets were added markers for calibration:
Image is clickable


The algorithm for searching for markers made simple, but reliable enough. First, it searches for all the corners in the image. Then there is a search for corners, with four neighbors next to each other and checking that the lines connecting them form an angle of at least 45 degrees. From the target angles found, a transformation matrix from the perspective space to the abstract target space is constructed once.


30 frames per second from the USB camera did not suit, so the camera was replaced by hardware. At the same time, the Malinka was replaced with the Raspberry Pi 2. After that, it was possible to achieve an update rate of about 80 frames per second, which completely solved the problem of skipping shots. Also improved the laser spot search algorithm. Now the image is pre-blurred for averaging and is used to compensate for the difference in brightness within the frame. This allowed the shooting range to work in any light.


The program was also rewritten from Python to C ++. For its assembly on the malinka requires assembled OpenCV. The sources here are github.com/DIMOSUS/Laser-shoting-2.0
Now shooting again pleases colleagues. My personal record is 92 out of 100 from 10 meters.

Source: https://habr.com/ru/post/371891/


All Articles