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.
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.