Skip to content

Arguments of the program

Benjamin Laugraud edited this page Sep 28, 2017 · 4 revisions

In this repository, LaBGen-OF is provided with a ready-to-use program, able to estimate the stationary background of any video sequence. Since the possibilities of this program are numerous, a long list of options is available. This page aims at explaining the different options and the allowed combinations.

Once the program has been compiled, the following command gives the complete list of available options:

$ ./LaBGen-OF-cli --help

The syntax used to provide the path of the input video sequence is the same one used by the OpenCV library. Thus, for instance, one can generate a stationary background image for the IBMtest2 sequence of the SBI dataset with (A, S, N, P,T) = (DeepFlow, 119, 8, 3, 0.04) as follows:

$ ./LaBGen-OF-cli -i path_to_IBMtest2/IBMtest2_%6d.png -o my_output_path -a deep_flow -s 119 -n 8 -p 3 -t 4

The following strings are accepted with the -a option: deep_flow, sparse_to_dense (Lucas-Kanade), dis_flow, farneback, simple_flow, dual_tvl1. One can directly use the default set of parameters with the -d option:

$ ./LaBGen-OF-cli -i path_to_IBMtest2/IBMtest2_%6d.png -o my_output_path -d

One can observe the processing performed by LaBGen-OF in a graphical window by adding the -v option:

$ ./LaBGen-OF-cli -i path_to_IBMtest2/IBMtest2_%6d.png -o my_output_path -d -v

With this last option, the processing will be significantly slower as an estimation of the stationary background is generated after each frame in the corresponding window. Here is an example of the execution of the program with the -v option:

Screenshot

By default, all the items to observe are gathered in a unique window. If, for any reason, a graphical window per item is required, one can add the -l option along with -v:

Screenshot Split

It is possible to customize the width and height of an image to visualize. For instance, using the options -w (to set the width) and -h (to set the height), one is able to resize each image to display in 400x400:

$ ./LaBGen-OF-cli -i path_to_IBMtest2/IBMtest2_%6d.png -o my_output_path -d -v -w 400 -h 400

Screenshot 400x400

By adding the -k option, the aspect ratio is kept:

Screenshot 400x400 with aspect ratio kept

Last but not least, one is able to record the processing in a video file using the MJPEG codec embedded in an AVI container. The -r record option takes two arguments. The first one is the path of the recorded video file, the second one (which is optional) is the recording frame rate (set by default to 15 fps). Thus, using the following command, the processing is recorded at 15 fps:

$ ./LaBGen-OF-cli -i path_to_IBMtest2/IBMtest2_%6d.png -o my_output_path -d -r path_to_recorded_video.avi

while it is recorded at 26 fps using the following one:

$ ./LaBGen-OF-cli -i path_to_IBMtest2/IBMtest2_%6d.png -o my_output_path -u -a frame_difference -r path_to_recorded_video.avi 26

Note that the options -w (set width), -h (set height), -k (keep aspect ratio), and -r (record) cannot be used with split windows (-l). It is not mandatory to enable visualization to record a video file. Furthermore, the -r (record) option can be combined with -w (width), -h (height), and -k (keep aspect ratio).

Finally, one can use the -u option to define (in ms) the time to wait between the processing of two frames when the visualization is enabled (this options has no impact on recording). This time is given to the waitKey() function of OpenCV. Consequently, the option -u 0 means that you have to press any key to process the next frame. By default, the time is defined to 1 ms.

Clone this wiki locally