Device & Environment requirements have been specified in CMakeList.txt
.
Build program
mkdir build && cd build
cmake ..
make
Run program
./main
More specific information about the environment set up can be found here: Configure the VSCode Environment for C++ on MacOS
The project and documentation are still under development. The drafted doc can be viewed from here: wray.blog - A Visual Based Shot Tracking System For Target Shooting
Currently, the detection algorithms are implemented using the openCV library. But we are working on implementing some of the methods from scratch so that the programme can run faster and be better tailored to this specific application scenario.
- Sound detection.
- Image capturing with raspi cam module.
- Shot sample image collection and learning.
- The detection system is sensitive to lighting conditions, so how do we automatically tune the image processing parameters relative to the image contrast and brightnesses?
The current setup is as follows:
- An iPhone camera to take a photo of the target board
- The target board is placed inside a black box to maintain a clean background and consistent lighting conditions
ImageAlignment.hpp
ImageAlignment.cpp
Here two different methods are used: outline shape detection and interest point matching. The former approach is cleaner and faster to execute but fails on different lighting and background conditions; more improvements on this are needed. The latter one is more robust in different environments. So we'll keep both of them for now and decide later which one should be kept.
Input: Image taken from the camera
-
Find polygon contours with 4 corners (quadrilaterals).
-
Extract the edge of the target board by their hierarchies.
-
Selected contour seen from the input image
-
Find homography and warp perspective of the selected quadrilateral to a 1080x1080 px image, which gives an output as follows:
Input:
-
Matching interest points
All Matches Good Matches -
Warped Perspective. After the warping, the output is given as below.
ShootingScore.hpp
ShootingScore.cpp
After the original image has been warped, it is processed. Now we can extract and calculate the shots and scoring information from it. The score is approximated by the differences in the image from the next one:
Before the shot | After the shot |
---|---|
The differences from the above two images are as follows, which indicate the new shot location. There are a few issues with this, as the shots on paperboard are not always easily visible. Depending on the paper density, the shape of the shot can vary.
From the diff image and the original shot image, shot location, contour, and other info can be calculated:
Including the target center, which was calculated by detecting the outermost circle in the image:
According to the shot location and centre location, a score is obtained, and we output the result image as follows.
Final Output: