Ask Your Question

Maxim Krd's profile - activity

2016-07-01 01:37:09 -0600 received badge  Editor (source)
2016-07-01 01:15:20 -0600 asked a question 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 = 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 = small_raw_frame;

imshow("back", stat_backgnd);

}