Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

My attempt at the world of computer vision. More specifically, openCV with the Rasperry Pi 2 Model B and camera module.

Notifications You must be signed in to change notification settings

lee-pham/openCV-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openCV-tracking

My attempt at the world of computer vision. More specifically, openCV with the Rasperry Pi 2 Model B and camera module. Written in Python.

In the /clickdrag/ folder, I have uploaded two files that involve openCV's HighGUI modules. It involves creating a rectangular overlay by clicking and dragging the mouse around the Region of Interest (ROI).

For the static edition, an initial copy of the image is made, so when a new mouse callback occurs, the image will be reset to the original, and a new rectangle will be drawn. Having the copy, and recalling the copy prevents rectangles being overwritten on an image with rectanles already on it.

For videos, a different approach had to be taken as a new image is being constantly written at all times. The copy method was foregoed and drawing the rectangles had to be moved to the main video loop. Essentially, a rectangle is constantly being drawn at all times, as opposed to a rectangle being drawn once, with the same image being constantly displayed.

I've spent a great deal of time figuring out how to best draw rectangles (without a following cascade) for static and video--I hope this helps!

There is also a bug regarding a MacBook's compatibility with openCV 3.1. Mouse callback events are glitched when using the trackpad. Please use an external mouse.

This is an extremely basic foray into object tracking with openCV. By converting an image to the Hue Saturation Value color space, it is easier to track a uniformly colored object, as opposed to the typical BGR color space. (In openCV's case, the image arrays are interpreted as [Blue, Green, Red], NOT [Red, Green, Blue])

A range of acceptable HSV ranges are added in and your (uniformly) colored object of choice should be the only thing to appear.

Use the HSVPreview.py program to obtain your minimum and maximum values.

Much thanks to @abidrahmank and his Open-CV-Python Tutorials in which I was able to learn most of this. Also, thanks to @ladvien and his How to Track your Robot with OpenCV guide.

About

My attempt at the world of computer vision. More specifically, openCV with the Rasperry Pi 2 Model B and camera module.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages