We're working on a project where we have to detect the moments where motions happen in a medical scene. I have a data set of 20 videos that are closely resemble (Same camera & configuration used, same shooting/environment conditions etc...). Here is what I did for each video:

  • Compute the optical flow (Farneback) between 2 consecutive images (t-1, t)
  • For each couple of images (t-1, t), compute the Norm1 of the displacement vector of all the pixels and then get the mean of these values. Then, I represent each couple of images by the mean of the Norm1 of optical flow results.
  • By doing so, I could draw a signal that represents the variation of these values as you can see below (Example video #1) enter image description here

  • We zoom on the first 100 seconds of this signal to see the following: enter image description here

To be able to detect the motions in video #1, we can just use as threshold the value 0.2 so we can differentiate between motion and not. But to be able to handle similar cases, we have to set a threshold at application/project level not on a video level: the threshold should be applicable over all the videos and for any new video of the same type. Let's take a look over the same kinda signal for video #2:

enter image description here

Obviously, the threshold in this case is 0.25 which is different from 0.2, the one we used for video #1 . To have a robust solution, we shall have one threshold per application so my question is about how can we use these thresholds (choosed manually) to have a global threshold for this application?

P.S: We already tried to use the mean of all these thresholds but it didn't work.. It failed to detect some important motions. We're asking such a question here because we just want to know if there is a fundamental principle to follow in such cases.


you should filter the data before you use the threshold. Run a low pass filter on the 1D signal (convolution with a Gaussian) and than normalize the data to the range between 0-1 after that i think you will be able to find a global threshold.

  • $\begingroup$ I already did it. In the images above, you can see clearly the green signal. which is the result of median filter. By comparing the results of this filter for both videos, we could see that we have the same problem.. The threshold can't be the same for both videos. $\endgroup$ – Maystro Aug 26 '16 at 9:30
  • $\begingroup$ Normalize the data to the range 0-1 $\endgroup$ – Amitay Nachmani Aug 26 '16 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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