# Finding a method to classify pixels according to how drastic their intensity change

I am looking for a method to classify pixels into three groups: (1) Pixels which does not change their intensity much in general (the slight changes may be due to noise only), (2) Pixels which change their intensity very slowly, in general monotonically and gradually, and (3) Pixels which change their intensity drastically over a certain threshold.

I tried using the Running Gaussian Average Method, such as checking how many standard deviations the current pixel is away from the running mean. The pixel is classified as group (1) when the result is very small, as group (3) when the result is very large, and (2) otherwise. But it does not seem to work very well, especially for group (2) because by definition, this group contains pixels which change their intensity moderately instead.

I expect I may need to build 2 or more models, because background subtraction methods normally result in classifying the pixels into 2 groups only, but here I need to classify pixels into 3 groups. Any ideas will be welcome. Thanks!

One approach to distinguish between (1) vs (2)-or-(3) is to use a statistical hypothesis test. A statistical hypothesis test can tell you whether the amount of change is too large to be explained by random chance. One reasonable approach might be to use linear regression: try to model intensity as a linear function of time $y = at+b$, and then use a statistical hypothesis test to see whether the coefficient $a$ is positive (i.e., $a>0$ and the null hypothesis $a=0$ can be rejected at a 99% significance level).
Once you've identified all the type-(1) pixels, it's not clear how to distinguish between (2) vs (3), because you haven't given us a precise definition of what counts as drastic vs slow. One reasonable approach would be to again use linear regression, and then use a threshold $\alpha$: if it's not a type-(1) pixel and $0<a\le \alpha$, then classify it as type (2), else if if it's not a type-(1) pixel and $a \ge \alpha$, then classify it as type (3). You'd have to set the threshold $\alpha$ in some way that's appropriate for your application. You could of course consider variations on this, e.g., where the linear regression only considers observations from the last 10 seconds of time (or whatever), or weights more recent observations more highly, etc.