Hi,
I'm using VLIB library functions working with DM6437 EVM.
I'm using background substraction algorithm which mainly uses the following functions:
VLIB_subtractBackgroundS16
VLIB_updateEWRMeanS16
VLIB_updateEWRVarianceS16
The main point in background substraction is to originally obtain a Mean and a Variance of a background image, then obtain a new image and substract
this new image from the background image, and then update the Mean and Variance of the background image used in this substract operation.
The algorithm works fine but I have a huge problem: It is highly sensitive to changes in illumination.
I have my application indoors, so let's say I take a background reference as a the interior of my office, when I walk around I can see myself detected as a foreground
object which is ok, but when I turn the general lights off or on, which just lightly decrease the general illumination ( not darkness just a slight change in illumination)
then the whole background is detected as foreground, as if the new illumination tells VLIB that is working with a completely new image and must be detected as foreground.
Supposely, the main and variance are used to avoid this cases and be able to have an adaptive background substraction, so that changes in background illumination are transparent to algorithm.
These previous functions use some constants as parameters:
- THRESHOLD_FACTOR_S16/2
- CAMERA_NOISE_S16/32
- IIR_ALPHA_S16
Which I have no idea how to interpret them as the explanaition in VLIB user manual is somewhat vague. Besides, don't know what are the values to be taken as reference ( a maximum or a minimum in each parameter) so I can play with them. These parameters are supposely used to adjust the new mean and variance into the background.
my code states:
// call the function
VLIB_subtractBackgroundS16(FGmask32packedPtr, // new foreground mask to be computed
&VLIB_lum_imageA[0], // the newest luma frame
&runningMean[0], // running mean
&runningVar[0], // running variance
thresholdGlobal, // global threshold
thresholdFactor, // multiplicative factor for the image threshold
BITMAP_SIZE);
// Update Background Mean
VLIB_updateEWRMeanS16( &runningMean[0], // running mean
&VLIB_lum_imageA[0], // newest luma frame
FGmask32packedPtr, // current foreground mask
bgAdaptRate, // old-new mixing ratio
BITMAP_SIZE); // no. of pixels to be processed
// Update Background Variance
VLIB_updateEWRVarianceS16( &runningVar[0], // running variance
&runningMean[0], // running mean
&VLIB_lum_imageA[0], // newest luma frame
FGmask32packedPtr , // current foreground mask
bgAdaptRate, // old-new mixing ratio
BITMAP_SIZE);
And I previously initialize the mean and variance once (the background image) with:
// initialize the running mean "image"
VLIB_initMeanWithLumaS16(runningMean, Previous, BITMAP_SIZE);
// initialize the running variance "image"
VLIB_initVarWithConstS16(runningVar, thresholdGlobal, BITMAP_SIZE);
Am I doing something wrong?? why is my background being so susceptible to small illumination changes ? Any orientation in how I can work around this problem regarding VLIB ???
I tested the Moving object segmentation Example that comes with the VLIB library package. I could see it works fine, and the example is taken using an outdoor camera pointing to a road with cars going along... I assume in the example illumination changes are considered such as gradual darkening.
Thank you very much for you help!! as this illumination problem is throwing down all my project with VLIB