to understand how the motion detection works I have had a look at the source code, namely zm_zone.cpp. I don't understand the part which handles the detection of blobs so I would appreciate if anybody could give me the big picture what the code does.
I'm talking about the code after
Code: Select all
if ( check_method >= BLOBS )
Code: Select all
BlobStats *bsx, *bsy;
BlobStats *bsm, *bss;
Code: Select all
pdiff = diff_image->Buffer( lo_x, y );
The two for-loops around this statement are iterating over the zone.
Code: Select all
if ( *pdiff == WHITE )
Code: Select all
lx = x>lo_x?*(pdiff-1):0;
ly = y>lo_y?*(pdiff-diff_image->Width()):0;
if ( lx )
{
//printf( "Left neighbour is %d\n", lx );
bsx = &blob_stats[lx];
if ( ly )
{
//printf( "Top neighbour is %d\n", ly );
bsy = &blob_stats[ly];
if ( lx == ly )
{
//printf( "Matching neighbours, setting to %d\n", lx );
// Add to the blob from the x side (either side really)
*pdiff = lx;
bsx->count++;
if ( x > bsx->hi_x ) bsx->hi_x = x;
if ( y > bsx->hi_y ) bsx->hi_y = y;
}
else
{
I can't see what the check "if ( lx == ly )" does. There are the conditions "if (ly)" and "if (lx)" before so if the programm reaches this check it is every time true and the else clause is never executed. Or is it possible that lx is neither 0x00 nor 0xff?
Thanks,
hajo