I am working on machine vision task. I am using openCV in Python. I need to detect motion. Best would be if I can calculate the difference between the new image and background. However, the environment is difficult so I need to update the background in every step.
Because the difference between current picture and last one is small (the motion is not significant), I do some kind of background leak.
background = background * 0.9 + last_image * 0.1
After that - and this is maybe not that important - I calculated root of the square difference and threshold it:
diff = (background**2 - image**2) **(1/2) diff[np.where(diff < threshold)] = 0
The 90% leak works great. The moving objects are nicely visible, leaving acceptable trace and disappearing slowly if the object get stationary.
- what is the name of this approach/filter?
- what is the terminology - is there correct name for the leak factor etc.?
- is there a theory I should study (some not so obvious tricks I should know and use)?
- is there a way how to determine optimal leak (according FPS and movement speed for example)?