-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Getting Started
janek42 edited this page Jul 22, 2022
·
7 revisions
This page gets you started with OpenTLD and explains some features.
First install the software using the Installation page and solve any problems using the FAQ.
You can use your own camera for tracking.
- In MATLAB, run
imaqhwinfoto see what adaptors are installed (for example: 'winvideo' or 'macvideo'). - Use
a=imaqhwinfo('intalled_adaptor_name'); a.DeviceInfoto figure out the supported formats. - Open
initcamera.mand change the linesource.vid = videoinput('winvideo', 1,'YUY2_320x240');with your adaptor name and format. - Open
run_TLD.mand setcamerato1like this:opt.source = struct('camera',1, ... - Run
run_TLD.mto start tracking. It will pop up a figure with an image from your camera in which you can draw the bounding box.
You've seen the motor bike example running, but how do you load your own movie?
- Install ffmpeg or another tool that can convert a video into a frame image sequence.
- Make a new folder for your own movie (we take /path/to/input/ as an example path).
- Convert the movie. For ffmpeg, use:
ffmpeg -i movie.avi -sameq /path/to/input/%5d.pngordos('ffmpeg -i movie.avi -sameq /path/to/input/%5d.png')from within Matlab on Windows. Note: consider using .jpg which might save disk space and time (during tracking). - (optional) Define the bounding box of the first frame by creating
/path/to/input/init.txtand filling it with the following numbers:X_topleft,Y_topleft,X_bottomright,Y_bottomright. For example:101,200,320,299You can determine those numbers by opening the first frame in a picture editor and use the mouse XY position. If you skip this step, OpenTLD will ask you to draw the bounding box yourself, but it won't create aninit.txt, so you'll have to draw it each time you use this video. - Tell TLD where your movie is found by opening
run_TLD.mand changinginputto the folder like this:opt.source = struct('camera',0,'input','/path/to/input/', ... - Run
run_TLD.mto start tracking.
It is also possible to load videos without converting them first. See this issue.
Maybe you would like to make a movie of the tracking process to show it to others. You can use screen capture software like Camtasia (Windows), but here's an alternative:
- Open
other/run_TLD_demo.mand set thesavevariable to1like this:opt.plot = struct('pex',1,'nex',1,'save',1, ... - Start the tracking process by running
other/run_TLD_demo.m. (Troubleshooting: if you receive the error??? Undefined function or method 'tldDemo' for input arguments of type 'struct'., make sure that your current MATLAB folder is the OpenTLD root, so jump out of the 'other' folder. Then while running, MATLAB could popup a messageFile .../run_TLD_demo.m is not found in the current folder or in the MATLAB path. ChooseAdd to Pathto solve this.) - Now each frame is saved to the to the
_snapshots/folder. Useffmpeg(or another tool) to reconstruct it to a movie:ffmpeg -i _snapshots/%05d.png -sameq movie.mp4If you wish to do this from Matlab on Windows you can navigate to the _snapshots/ directory, and enter:dos '(ffmpeg -i _snapshots/%05d.png -sameq movie.mp4')You may need to tell Windows where to find ffmpeg which you can do like this:dos('<system_path_to_ffmpeg> -i _snapshots/%05d.png -sameq movie.mp4')
Note that enabling saving will lower your frame rate (fps).