Instead of using static background model to find difference in current frame, I am using frame difference technique where current frame is compared or subtracted from previous frame. The difference depends upon speed of moving objects. Making a fair analysis is very difficult. Find the code bellow to find difference in frames.
The simplest technique is to take a background image without any moving object. Subtract current frame from static background image to find changes in current frame. But it can’t deal with objects being added or removed from static scene, illumination changes and changes in camera position etc. To overcome above mentioned issues frame difference approach is commonly used. I discussed frame differencing approach above. Average background is an alternative technique is used to incorporate background changes. I discussed averaging method in another article. Average background can be computed using accumlateWeighted function to determine average background.