Skip to content
This repository was archived by the owner on Jun 21, 2025. It is now read-only.

FadriPestalozzi/CamBallToe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CamBallToe

The Brazilian version of the popular game TicTacToe - using a Camera, a footBall and the Toe of your choice.

Description

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.

define playing wall

User clicks onto 3 points to define playing wall.

Get depth of 4 corner points = distance to origin of camera coordinate system.

Alt text

ball detection

After defining the playing wall, the ball position is detected in a continuous video stream from the ZED 2 camera.

ball detected

ToDo

  • 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

Build and install

Prerequisites

  • 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 prerequisites

  • 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

Clone the repository

git clone https://github.com/FadriPestalozzi/CamBallToe
cd zed-open-capture

Add udev rule

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

Build

cmake .. && make -j$(nproc) && ./zed_open_capture_detectball

Coordinates system

The coordinate system is only used for sensor data. The given IMU and Magnetometer data are expressed in the RAW coordinate system as shown below

About

Apply Low level Linux camera driver for the ZED USB3 stereo cameras.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 87.1%
  • CMake 12.8%
  • Shell 0.1%