I have the positions of a computer mouse, sampled at a high frequency, with a good amount of noise. When the user stops moving the mouse, instead of going to zero the velocity reported by the mouse is non-zero and the cursor drifts.

I want to estimate the drift velocity. The attached image is a plot of the x and y velocity components. The user has is not moving the curs between datapoints ~600 and ~660. Plot of velocity.

Are there standard techniques for identifying a constant subinterval of a signal?

Here are some things I have tried:

  1. Using a high pass filter to estimate the standard deviation of the noise. Then I used that as a comparison of nearest neighbor velocity differences. This does not catch slowly increasing intervals. (Black intervals in second figure)
  2. Looked at instantaneous min/max over the current interval and filtered out those intervals where (max-min) is too high. (Red intervals in second figure).

enter image description here As you can see from the second image, I can select out some reasonable intervals of interest, but I still end up with spurious ones. I could come up with more filters, but I'm now just introducing more ad hoc parameters. What is a more principled way to do this?

  • $\begingroup$ What type of mouse sensor has that sort of drift? $\endgroup$ Nov 26 '19 at 8:11
  • $\begingroup$ It's not a mouse in actuality, that was a simple analogy. $\endgroup$
    – b0xcar
    Nov 26 '19 at 19:09

Perhaps transferable to your problem, one method from Olyha B., Rutledge J., "TrackPoint System Version 4.0 Engineering Specification", IBM, 1999:


Due to the significant temperature sensitivity of the force sensors, it is necessary to recalibrate the zero force origin of each axis on a periodic basis. In order to properly recalibrate, it is necessary to determine when a ‘hands off’ condition exists (i.e. when no force is being applied). This is done by monitoring the X and Y axis force samples, and when there is minimal change in the readings (no more than ±1 count) for a specified length of time (3 seconds by default) it is assumed that the hands off condition exists. At this time the X, Y, and Z axis origins are reset to the smoothed current value of the X, Y, and Z axis force samples respectively. It should be noted that noise introduced by any source other than applied sensor forces will severely impact the effectiveness of this technique.

In my experience as a long-time ThinkPad user, this technique cannot always differentiate between the user trying to move the mouse cursor at constant speed and real sensor drift. Then again this is not usually dangerous and it is easy to manually trigger recalibration by hands off. Perhaps there should be a more advanced analysis algorithm running that can identify velocity variation in a manual attempt to move the mouse cursor at constant speed.

  • $\begingroup$ Thank you Olli. That is helpful. This appears to offer a solution to my problem assuming 1) not too much noise 2) a long period of rest (> 1s). Unfortunately, in my setting requirement 2 is unrealistic. $\endgroup$
    – b0xcar
    Nov 26 '19 at 19:54

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.