Object recognizing and tracking play a very crucial role in our daily life. Object tracking enables us to count and label each tracked object. Our goal is to detect, label, and track all individual vehicles in a given video.
Building the project using CMake from the command-line:
Linux:
export OpenCV_DIR="~/OpenCV/build"
mkdir build
cd build
cmake -D OpenCV_DIR=$OpenCV_DIR ..
make
MacOSX (Xcode):
export OpenCV_DIR="~/OpenCV/build"
mkdir build
cd build
cmake -G Xcode -D OpenCV_DIR=$OpenCV_DIR ..
Windows (MS Visual Studio):
set OpenCV_DIR="C:\OpenCV\build"
mkdir build
cd build
cmake -G "Visual Studio 12 2019" -D OpenCV_DIR=%OpenCV_DIR% ..
Overall we want to extract feature points for each object from the background and keep tracking them (we used canny edge detection and optical flow) but we need to figure out a way to merge and separate blobs for identifying if the feature belongs to the same or different objects (by clustering the blobs using the relative translations and directions).
The following picture is a flow chart representation of our logic.
Canny Edge Detection is one way for us to remove the background and extract objects/features from each individual frame.
There are multiple stages in the Canny Edge Detection: noise reduction, finding intensity gradient of the image, non-maximum suppression, and Hysteresis thresholding.
Optical flow or optic flow is the pattern of apparent motion of objects, surfaces, and edges in a visual scene caused by the relative motion between an observer and a scene.
By finding the strong corner points and comparing with the consecutive frame, we could sift out unwanted points and prevent us from missing potential candidates.
[1]"Canny Edge Detector — OpenCV 2.4.13.7 documentation", Docs.opencv.org, 2019. [Online]. Available Here
[2]A. Consulting, "Histogram of Oriented Gradients | Learn OpenCV", Learnopencv.com, 2019. [Online]. Available Here
[3]T. Lindeberg, "Detecting salient blob-like image structures and their scales with a scale-space primal sketch: A method for focus-of-attention", International Journal of Computer Vision, vol. 11, no. 3, pp. 283-318, 1993. Available: 10.1007/bf01469346.
[4]"OpenCV: Optical Flow", Docs.opencv.org, 2019. [Online]. Available Here
[5] Opencv-python-tutroals.readthedocs.io. (2019). Harris Corner Detection — OpenCV-Python Tutorials 1 documentation. Available Here
[6]"Harris corner detector — OpenCV 2.4.13.7 documentation", Docs.opencv.org, 2019. [Online]. Available Here