I have a C# desktop application.

I am using a wrapper to OpenCV which is EMGU.

I am just performing a basic motion detection operation.

I am using component labelling and 2 frames differencing to determine motion changes. I am also using an averaging background approach to update the background which i use to 'subtract' from the current and previous frames.

All this works well.

Now consider this image:

Green Bush

Because this bush is close to the camera, movement will be detected by my current methods when the wind blows.

Also, consider this image:


Here we see a cobweb to the right of the image. Again when the wind blows I get motion detection.

My possible solutions:

Look for shapes. In the case of elongated shapes like the cobweb where the height is greater than the width (to a certain scale) then ignore that movement. But, I found I am missing motion when someone walks on the pavement at the back of the image from across the road.

Erosion. Again I am missing genuine motion like people and bikes.

Compare Histograms I have found it is not reliable. A histogram will only measure the number of different colours (in its own bin). It is possible for the colours to change due to the saturation and lighting or/and the same numbers of colours are found because another object has passed by.

So, I thought about using atrophy. I did post an earlier question to this here:

Entropy of an image

but as the person who so kindly explained entropy suggested that I should post as a specific/separate question here...

I want to explore whether the frequency or/and entropy would help me here? Should I look at spatial or frequency distribution? Would frequency be best to look into if I want to avoid colour changes?

Would either approach be faster than the other as I want it real-time as possible.

Any eduction for me here would be great.

  • 1
    $\begingroup$ Wouldn't it work better to use entropy across time instead of entropy across space? $\endgroup$
    – Aaron
    Mar 26, 2014 at 1:28
  • $\begingroup$ hi @Aaron. Yes I believe this approach would be best. If only I knew how to apply an entropy filter to an image! Matlab has this functionality but openCV and Emgu do not. $\endgroup$ Mar 26, 2014 at 5:14

1 Answer 1


Entropy would be a good metric in order to separate trees. However I would suggest you to calculate the entropy of gray values within a rectangular window. Consider this image: Aerial Image

After entropy filter, I could obtain this one:

Entropy filtered image

Note that the trees (and also other informative areas) look white and it's possible to segment them out with a simple threshold. Try and see whether it also works for your case.

Due to the possible pre-computations, this could be optimized to run in real-time.

  • $\begingroup$ Hi, that looks really promising. How did you apply the atrophy filter? Would you a link to some C# code? Even C++ I could attempt to translate $\endgroup$ Mar 25, 2014 at 12:50
  • 1
    $\begingroup$ Well, MATLAB has that in its image processing toolbox. Here is how to apply : mathworks.com/help/images/ref/entropyfilt.html However this is a mex implementation and closed source. Yet, there is a dirty open code on: stackoverflow.com/questions/20371053/findding-entropy-in-opencv $\endgroup$ Mar 25, 2014 at 15:33
  • $\begingroup$ hi, thanks for that stackflow link. I shall take a look at that one. I believe OpenCV 3.0 will have this functionality but still waiting for the release - thanks again $\endgroup$ Mar 25, 2014 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.