This example shows how to use GOTURN Tracker in OpenCV in Python and C++. Before running the code, make sure you have the following caffe model files available in the same folder as the codes:
goturn.caffemodel
filegoturn.prototxt
file
goturn.caffemodel
and goturn.prototxt
file can be downloaded from my Dropbox Link
goturn.caffemodel
and goturn.prototxt
file can be downloaded from opencv_extra.
To use the goturn.caffemodel
file, first follow the instructions given below to unzip the split files.
-
Click “Start” if you have Windows XP or later versions and choose “Programs,” “Accessories” and “Windows Explorer.” The Windows Explorer window appears.
-
Navigate to the folder containing the zip files by double-clicking drives and folders to open them.
-
Choose “File” from the Windows Explorer window and select “New” and “Folder” to create a new folder. You can optionally rename this folder by right-clicking it and choosing “Rename.”
-
Drag the split zip archives into this new folder. Open the folder to reveal its contents. All the 4 pieces of the complete zip must be in the folder or you cannot extract them.
-
Right-click the first zip file and choose “Open With” and then “Compress (zipped) Folder.” The original file appears in a new window. Click “Extract All Files” in the Folder Tasks pane on the right side of the window. A wizard is displayed. Specify a location for the extracted archive, which by default is the current folder. Then go through the wizard to complete extraction.
-
The file will be extracted to specified location.
-
Copy/cut the unzipped
goturn.caffemodel
file to the directory containing the codes.
-
Use
terminal
to navigate to the folder containing the split zip files. -
Use
cat
command to merge the split files:
cat goturn.caffemodel.zip* > goturn.caffemodel.zip
- Unzip the zip file:
unzip goturn.caffemodel.zip
- Move the unzipped
goturn.caffemodel
to the directory containing the codes.
Run python goturnTracker.py
in command line. This will display the chaplin.mp4
video with a bounding box around Charlie Chaplin.
Run g++ goturnTracker.cpp -o goturnTracker `pkg-config opencv --cflags --libs`
in command line to compile the code.
After compilation, use ./goturnTracker
in command line to run the code.