GithubHelp home page GithubHelp logo

gaborvecsei / color-tracker Goto Github PK

View Code? Open in Web Editor NEW
165.0 6.0 35.0 66.76 MB

Color tracking with OpenCV

License: MIT License

Python 100.00%
opencv color-tracker python computer-vision numpy opencv-python color-detection image-processing tracker object-detection

color-tracker's Introduction

Codacy Badge PyPI version License: MIT Python 3 DOI

Color Tracker - Multi Object Tracker

Easy to use multi object tracking package based on colors 🎨

yellow-cruiser ball-tracking

Install

pip install color-tracker
pip install git+https://github.com/gaborvecsei/Color-Tracker.git

Object Tracker

  • Check out the examples folder, or go straight to the sample tracking app which is an extended version of the script below. This script tracks the red-ish objects, if you'd like to track another color, then start with the hsv_color_detector.py script

    $ python examples/tracking.py --help
    
    
    usage: tracking.py [-h] [-low LOW LOW LOW] [-high HIGH HIGH HIGH]
                   [-c CONTOUR_AREA] [-v]
    
    optional arguments:
      -h, --help            show this help message and exit
      -low LOW LOW LOW, --low LOW LOW LOW
                            Lower value for the HSV range. Default = 155, 103, 82
      -high HIGH HIGH HIGH, --high HIGH HIGH HIGH
                            Higher value for the HSV range. Default = 178, 255,
                            255
      -c CONTOUR_AREA, --contour-area CONTOUR_AREA
                            Minimum object contour area. This controls how small
                            objects should be detected. Default = 2500
      -v, --verbose
  • Simple script:

    import cv2
    import color_tracker
    
    
    def tracker_callback(t: color_tracker.ColorTracker):
        cv2.imshow("debug", t.debug_frame)
        cv2.waitKey(1)
    
    
    tracker = color_tracker.ColorTracker(max_nb_of_objects=1, max_nb_of_points=20, debug=True)
    tracker.set_tracking_callback(tracker_callback)
    
    with color_tracker.WebCamera() as cam:
        # Define your custom Lower and Upper HSV values
        tracker.track(cam, [155, 103, 82], [178, 255, 255], max_skipped_frames=24)

Color Range Detection

This is a tool which you can use to easily determine the necessary HSV color values and kernel sizes for you app

You can find the HSV Color Detector code here

python examples/hsv_color_detector.py

Donate ☕

If you feel like it is a useful package and it saved you time and effor, then you can donate a coffe for me, so I can keep on staying awake for days 😃

Buy Me a Coffee at ko-fi.com

About

Gábor Vecsei

@misc{vecsei2018colortracker,
      doi = {10.5281/ZENODO.4097717},
      howpublished={\url{https://github.com/gaborvecsei/Color-Tracker}},
      author = {Gabor Vecsei},
      title = {Color Tracker - Multi Object Tracker},
      year = {2018},
      copyright = {MIT License}
}

color-tracker's People

Contributors

gaborvecsei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

color-tracker's Issues

use

how can i change color

Video files are accelerated

I replaced the webcam with a video file. But why is the video accelerated when the video file is read? The 30-plus second video was sped up to about three seconds.
Can you help me solve this problem as soon as possible? Thank you very much.

Import error

Hi, this looks interesting. I installed using pip running Python 3.6.1 but see this error.

>>> import color_tracker
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "color_tracker.py", line 6, in <module>
    cam = color_tracker.WebCamera(video_src=0)
AttributeError: module 'color_tracker' has no attribute 'WebCamera'

Tracking a video

Hello, how can we replace the webcam by a video?
Thank you for this tool!

pip install color-tracker not working

Hi,

I wanted to try out your tools and i did pip install color-tracker

and i am getting this error : ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'c:\users\dany_\appdata\local\programs\python\python39\Lib\site-packages\cv2\cv2.cp39-win_amd64.pyd'

any idea ?

Thanks a lot :)

color_tracker error

Hello,

I´ve been trying to use this module, already installed it plus OpenCV but when I try to import the color_tracker:

import cv2
import color_tracker
color_tracker.__version__ '0.1.0'

There´s this error message:

Traceback (most recent call last):
File "D:/Proyectos_Python/Modulo_Color.py", line 2, in
import color_tracker
ImportError: No module named 'color_tracker'

I tried with import tracker but realized that is the color_tracker itself that´s needed. I would appreciate your help a lot.

PD: I leave a screenshot below:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.