I need to run a command on each file in a directory. Since I want to process hundreds of videos, I will find it easier using a batch script.
The command looks like this:
blobtrack_sample.exe fg=FG_0 bd=BD_CC btgen=RawTracks track=E:\opencv\tracks\video1.txt bta=TrackDist btavi=E:\opencv\btavi\test.avi E:\sample\video1.avi
Where btavi= indicates the output file and the last argument indicates the input file.
The name of the output file for each file must be different.
To iterate through all files in the some folder, do this:
The loop takes each file, puts it into the variable
%%fand calls your blobtrack_sample.exe with%%fbeing one of its arguments. Also, the name of the executable inEXE_FILE.To run this script, copy-paste this code into a file with a “.bat” extension and execute it. Hope it helps!