Contour Based Tracking
Contour Based Tracking
By
Background –
Video tracking is the process of locating a moving object (or multiple
objects) over time using a camera. It has a variety of uses, some of
which are: human-computer interaction, security and surveillance,
video communication and compression, augmented reality, traffic
control, medical imaging and video editing.
To perform video tracking, an algorithm analyzes sequential video
frames and outputs the movement of targets between the frames.
There are a variety of algorithms, each having strengths and
weaknesses. Considering the intended use is important when choosing
which algorithm to use. There are two major components of a visual
tracking system: target representation and localization, as well as
filtering and data association.
Objectives –
The objective of video tracking is to associate target objects in
consecutive video frames. The association can be especially difficult
when the objects are moving fast relative to the frame rate. Another
situation that increases the complexity of the problem is when the
tracked object.
TABLE OF CONTENTS
1.INTRODUCTION
2.LITERATURE SURVEY
3.BACKGROUND OF THE PROJECT WORK
4.PROPOSED WORK
5.EVALUATION AND RESULT ANALYSIS
6.TABULAR COMPARISON WITH EXISTING WORK
7.OVERALL DISCUSSION
8.CONCLUSION
9.REFERENCES
10.APPENDIX
INTRODUCTION
Motivation-
There were several motivating interests that led to the decision of making
this project
1.China monitors its citizens through Internet, camera as well as through other
digital technologies. Mass surveillance in China is closely related to its Social
Credit System, and has significantly expanded under the China Internet Security
Law and with the help of local companies
2. Wii Remote was a major paradigm shift in user/game interaction. Over on the
PlayStation side, we had PlayStation Move, essentially a wand with both (1) an
internal motion sensors, (2) and an external motion tracking component via a
webcam hooked up to the PlayStation 3 itself. Of course, then there is the XBox
Kinect (one of the largest modern day computer vision success stories,
especially within the gaming area) that required no extra remote or wand —
using a stereo camera and a regression forest for pose classification, the Kinect
allowed you to become the controller.
So it was the curiosity to know how image tracking works and how it was
possible for the remote controller to know where the object was in the screen.
Given the real time data on the webcam, the project will make use of OPEN CV
to make sure that the pointer is able to recognize objects and contours present in
the webcam display and display it on the screen as distinct objects
The project will make use of Object tracking, painting with the object along the
screen and able to recognize distinct shapes and contours. As well as a video
demo to show the future capabilities of this technology.
CONTRIBUTION
Xu and Ahuja proposed a contour based object tracking algorithm to track object contours in
video sequences. In their algorithm, they segmented the active contour using the graph-cut
image segmentation method. The resulting contour of the previous frame is taken as
initialization in each frame. New object contour is found out with the help of intensity
information of current frame and difference of current frame and the previous frame.
Dokladal et al. the proposed approach is active contour based object tracking. For the
driver’s-face tracking problem they used the combination of feature-weighted gradient and
contours of the object. In the segmentation step they computed the gradient of an image.
They
proposed a gradient-based attraction field for object tracking
In this section, work done in the area of edge detection is reviewed and focus has been
made on detecting the edges of the digital images. Edge detection is a problem of
fundamental importance in image analysis. In typical images, edges characterize
object boundaries and are therefore useful for segmentation, registration, and
identification of objects in a scene. Edge detection of an image reduces significantly
the amount of data and filters out information that may be regarded as less relevant,
preserving the important structural properties of an image.
Literature survey Table
Can
2. Edge Detection Techniques Video files Uses algorithm to distinguish
find different objects between
in the frame different
shapes &
sizes
Background of the Project
SOFTWARE REQUIREMENTS
This application is written in Python 3.6 and it uses the very famous and
widely used OpenCV library. OpenCV is a computer vision and machine
learning software library that includes many common image analysis
algorithms that will help us build custom, intelligent computer vision
applications.
We will also need numpy for some arithmetic operations and will also need
to import deque from collections, a data structure about which we shall
discuss later on.
METHODOLOGY
To run this program, there are some essential steps that are required.
We will be mentioning each step which are required followed by
their brief explanation.
PROPOSED WORK
Initialization
Firstly, we import the necessary libraries.
import numpy as np
import cv2
from collections import deque
Define kernel
kernel = np.ones((5, 5), np.uint8)
bindex = 0
rindex = 0
yindex = 0
gindex = 0
colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (0, 255, 255)]
colorIndex = 0
# Add the same paint interface to the camera feed captured through the webcam (for ease of usage)
frame = cv2.rectangle(frame, (40,1), (140,65), (122,122,122), -1)
frame = cv2.rectangle(frame, (160,1), (255,65), colors[0], -1)
frame = cv2.rectangle(frame, (275,1), (370,65), colors[1], -1)
frame = cv2.rectangle(frame, (390,1), (485,65), colors[2], -1)
frame = cv2.rectangle(frame, (505,1), (600,65), colors[3], -1)
cv2.putText(frame, "CLEAR ALL", (49, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(frame, "BLUE", (185, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(frame, "GREEN", (298, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(frame, "RED", (420, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(frame, "YELLOW", (520, 33), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (150,150,150), 2, cv2.LINE_AA)
Find The Contour-Of-Interest
# Determine which pixels fall within the blue boundaries and then blur the
binary image blueMask = cv2.inRange(hsv, blueLower, blueUpper)
blueMask = cv2.erode(blueMask, kernel, iterations=2)
blueMask = cv2.morphologyEx(blueMask, cv2.MORPH_OPEN,
kernel) blueMask = cv2.dilate(blueMask, kernel,
iterations=1)
Object Tracking as seen by the User The algorithm used can clearly track
the object on the basis of its color (Blue)
Path Mapping using Paint Application The algorithm further tracks the
movement of the object and defines its path on a Paint Application
Contour of Interest tracking (Defining edges) Here is another photo of how
well the algorithm can differentiate between color even in Dimly lit
environment
How the software sees object through the mask v/s How the user sees the
object The following algorithm applies a mask to determine contrasting
objects
The use of the prepared algorithm isn’t just limited to these applications, The
applications of this technology are limitless.
CONCLUSION
We see that OpenCV can be used to easily make tools which are interesting
to use and may come in handy in certain cases and certain people.
Our Project focuses mainly on the video tracking and contour based object
detection techniques which can be used to implement applications in field
related to
To name a few.
Numpy NumPy is a library for the Python programming language, adding support for
large, multi-dimensional arrays and matrices, along with a large collection of high-level
mathematical functions to operate on these arrays.
Dlib Dlib is a general purpose cross-platform software library written in the programming
language C++. Its design is heavily influenced by ideas from design by contract and
component-based software engineering. Thus it is, first and foremost, a set of independent
software components.