/cursor-detection

nerd sniped by derek and todd

Primary LanguagePython

Basic Cursor Detector (BCD)

bcd

Implements a basic multi-scale cursor detection using openCV.

Features:

  1. Works across multiple scales.
  2. Works (at all!) (see below)
image

To view the processed video, please check this link.

Limitations:

  1. May not function effectively on non-white backgrounds, though conversion to grayscale could mitigate this issue (results may vary).
  2. Performance is fucked

Installation

Install using uv and run using python.

#If you haven't installed UV yet, run the following command:
curl -LsSf https://astral.sh/uv/install.sh | sh

# create a venv with uv

uv venv

# activate venv

source .venv/bin/activate

# install reqs (just opencv)

uv pip install -r requirements.txt

# run the thing

python main.py

# hit space or any key when you are done viewing the image

To run on a video

python video.py

# Or, if you want to parallelize the processing, 

# this has a dependency on FFMPEG - if you don't have it installed on your machine, install it
python paralell_video.py

My m2 does a 7 second 2.5k video @ 30 fps in about 8 minutes using the parallelized script