Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Since you don't have a sample image and didn't provide too much detail, I'm going to assume a couple of things, and point you to a way of solving it.

  • The treadmill belt is black.
  • The shoes are not.
  • The camera is always in the same place, directly behind the treadmill, and it's not low enough to see under the feet when they are lifted. But it is low enough that the front-back doesn't change the apparent height as much as the up-down.
  • The center of the belt runs down the center of the image.
  • You don't actually care about the precise moment it's lifted from the belt, just which foot is currently down.

So. You define your region of interest as the area of the image that is the belt. Ignore everything else.

Convert the image to binary. The person's feet are now white, the rest is black.

Split your ROI in two down the middle.

For each half, start at the bottom, and sum the row. If the sum is greater than (experimental value)*white, you've found the bottom of the foot.

Whichever half has the lower row that is above the threshold, is the side with the foot down.


Since that's probably not going to work perfectly, here is the likely cause, and a possible solution.

Probably, the foot that's in back but coming off the belt will still register as down even though it's not touching. You should keep track of how long each foot is down and calculate a stride time. Then, manually, you'll need to look at the video and apply an offset as a percentage of the stride time so that it switches feet sooner. Hopefully that percentage offset is the same for everyone, but no guarantees.

Add a Kalman filter to learn the stride time as they speed up and slow down if necessary, and it could be pretty accurate.