`mog` should be same in the begining of `TEST_CYCLE` body.
I think it should be declared inside of `TEST_CYCLE`. Or it

Also `foreground` should be same for every `TEST_CYCLE` loop. So, please think about `foreground.release()` before `for` loop.