The Brazilian version of the popular game TicTacToe - using a Camera, a footBall and the Toe of your choice.
Let's play tic tac toe by shooting a football onto 9 wall segments while detecting our hits with a camera.
This project code is based on zed-open-capture.
User clicks onto 3 points to define playing wall.
Get depth of 4 corner points = distance to origin of camera coordinate system.
After defining the playing wall, the ball position is detected in a continuous video stream from the ZED 2 camera.
- detect ball
- draw target playing wall
- detect wall distance
- define wall coordinate system with x-y-origin at wall center and z axis pointing away from the wall towards the camera (inverted from z_camera)
- get transformation matrix from camera to wall coordinate system
- transform ball coordinates from camera to wall coordinate system
- divide wall into 9 marking areas
- detect if ball in a marking area
- if ball in marking area and distance of ball center close to wall distance = hit
- USB3 Stereolabs Stereo camera: ZED 2i, ZED 2, ZED, ZED Mini
- Linux OS
- GCC (v7.5+)
- CMake (v3.1+)
- OpenCV (v3.4.0+) -Optional for the examples-
-
Install GCC compiler and build tools
sudo apt install build-essential -
Install CMake build system
sudo apt install cmake -
Install HIDAPI and LIBUSB libraries:
sudo apt install libusb-1.0-0-dev libhidapi-libusb0 libhidapi-dev -
Install OpenCV to build the examples (optional)
sudo apt install libopencv-dev libopencv-viz-dev
git clone https://github.com/FadriPestalozzi/CamBallToe
cd zed-open-captureStereo cameras such as ZED 2 and ZED Mini have built-in sensors (e.g. IMU) that are identified as USB HID devices.
To be able to access the USB HID device, you must add a udev rule contained in the udev folder:
cd udev
bash install_udev_rule.sh
cd ..cmake .. && make -j$(nproc) && ./zed_open_capture_detectballThe coordinate system is only used for sensor data. The given IMU and Magnetometer data are expressed in the RAW coordinate system as shown below


