We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey guys ! I'am trying to modify code for motion detection from Dan's tutorial:
In his original code, he is comparing current frame only with the previous one. What I'am trying to do is comparing current frame with the average frame of two previous frames (actually I'am taking 99% pixel value of pre-previous frame and 1% pixel value of previous frame. It should make detection more accurate). I edited "captureEvent" function so it can load second frame and added new "GetFrame" function which takes two frames as argument and returns an average frame. In theory it should work but it doesn't and I only get gray, empty window. What did I screw up ? I know code is a little bit long but I suspect mistake to be in "GetFrame" or "captureEvent" function.
EDIT: I have problem placing code here using markers in editor so Iam pasting it from pastebin: https://pastebin.com/jkBuex0v