Ask Your Question

Revision history [back]

Unexpected behavior of the program

I try to execute this fragment of code. On my reason he must do next: Find bg mask, count white pixels on it and if this count return <5 update stat_backgnd image. But if i run this code imshow show me that stat_backgnd update always. Whats wrong?

UMat small_raw_frame, tmp_backgnd, stat_backgnd;

capture.read(small_raw_frame)

stat_backgnd = raw_frame;

for(;;){

capture.read(small_raw_frame)

pMOG2->apply(small_raw_frame, tmp_backgnd);

int cnt =countNonZero(tmp_backgnd);

if ( cnt<= 5) stat_backgnd = raw_frame;

imshow("back", stat_backgnd);

}

Unexpected behavior of the program

I try to execute this fragment of code. On my reason he must do next: Find bg mask, count white pixels on it and if this count return <5 update stat_backgnd image. But if i run this code imshow show me that stat_backgnd update always. Whats wrong?

UMat small_raw_frame, tmp_backgnd, stat_backgnd;

capture.read(small_raw_frame)

stat_backgnd = raw_frame;small_raw_frame;

for(;;){

capture.read(small_raw_frame)

pMOG2->apply(small_raw_frame, tmp_backgnd);

int cnt =countNonZero(tmp_backgnd);

if ( cnt<= 5) stat_backgnd = raw_frame;small_raw_frame;

imshow("back", stat_backgnd);

}