This is a brief introduction to cv-cat new filters:
This filter is used to calculate pixel-wise (and channel-wise) average from the sequential series of input images.
As it relies on the sequential accumulated input images, this filter is run in serial mode in cv-cat. This as implications when used with 'forked' image processing.
However parallel processing is utilised on image rows dimension.
Please download the following file which contains a total of 8 images: images.bin: 8 images showing movement. Viewing the images:
Calculating averages using all accumulated input images, the output is also 8 images.
The 6th output image is the average of all 6 accumulated images, the 7th is the average of the 7 accumulated input images.
Exponential Moving Average (EMA):
Calculating the average using a sliding window of images. Here a sliding window of 3 images is used.
The output is 8 images, the 6th image is the accumulation of image 1 to 6. Please research the simple EMA formula.
Forked Arithmetic Filters: Multiply, Divide, Add and Subtract
This group of filters work similar to the mask filer: Masking images with cv-cat, they both use a sub-filters to generate a mask or operand image.
A mask has values of 0 or '> 0' mask file to apply to the image, a corresponding pixel in the mask with a value of 0 is masked. The arithmetic filters work on operand images where is pixel value is important.
This filter will do pixel-wise multiplication the operand image and the input image. It wraps cv::multiply function.
Please download this simple mask file: scaled-3f.bin
Applying a single scaled image to the input images:
You should see images similar to below. scaled-3f.bin has values in the range of 0 to 1.0, the command above will darken the images.
From the example above: cv-cat's multiply is run in parallel, multiple input images are applied the scaled-3f.bin file in parallel.
This is because the all sub-filter(s) can run in parallel mode, in this case there is only one sub-filter 'load'.
The example below also shows multiply running in parallel mode as as load and threshold are parallel-able filters.
This filter simply subtract the operand image from each input image. This is a wrapper to cv::subtract.
The operand image is derived from the sub-filters. In this example we shall use the accumulated filter mentioned earlier. This is a simple method for detecting moving objects in the image.
Each input image is subtracted the EMA average, where the EMA window is 3.
You should see similar images shown below:
In the example above: the multiply filter is run in serial mode. This is because one of the sub-filter or sub-filters ('accumulated' in this case) can only be run in serial mode.
If you have a webcam handy or it is built into the laptop, try this command:
This is a wrapper to cv::add.
This filter is the opposite of subtract. In this case if you add the EMA average (the "background") to the input images. Any moving object becomes transparent.
This is the result:
Of course you can always try this pipeline with a physical camera:
This filter wraps cv::divide, divides the input images by the operand.
Arithmetic filters: the output image type is the same as the input image type.