4 ms·
Ask HN: OpenCV – How would you track the spinning of a 'wheel'?
So I want to track how many times a wheel spins. I have a few ideas, but I'm curious about alternative solutions.
My solutions all require placing a marker on the wheel and tracking its path. I'm okay with using a marker.
Since I want this solution to work with a night vision camera, I can't be dependent on color. So I'm leaning towards looking for a unique shape that wouldn't be found in the environment. e.g., a Star
I know this solution seems rather simplistic and limited, but I'm not trying to build a very flexible or intelligent solution.
What I've built already works for a very sterile environment, translation - a white background with a green circle moving in a circular motion.
This is just a fun weekend project.
- RandomOpinion 8y agoPerhaps use the pattern used by rotary encoders? https://en.wikipedia.org/wiki/Rotary_encoder#Ways_of_encoding_shaft_position https://en.wikipedia.org/wiki/Rotary_encoder#Ways_of_encodin... See https://www.youtube.com/watch?v=oc5hIxdCMZ0 https://www.youtube.com/watch?v=oc5hIxdCMZ0 for a visual example.
- mrburton 8y agoI'll certainly read up on this. I noticed the struggles in using gray scale (night vision images) can be tricky. I have a few ideas but I'll certainly look into this. thanks!
- nikonyrh 8y agoIs the wheel constantly rotating, or might it be stationary at times? I had already typed an answer but I was about measuring the RPM, not its orientation.
- mrburton 8y agoThe wheel won't always be spinning. In order to handle that, I'll look to see if the center of the marker has moved by a factor of say 3-4 pixels from it's last known position. I have a list for every point encountered along the way, so this won't be an issue. What I think I might try today is identify the wheel by looking for the largest circle. The wheel is light enough to always present a circle with the night vision camera. Once I identify the wheel, I'll then do one of two things. Using CRSF or KCF tracking on the black marker. The fact that the wheel for the most part is light (white in the image) and the marker is black, it should be easy to identify. I do have a few black "circular' like objects on the wheel, but I feel like I can cancel those out. Maybe :)
- nikonyrh 8y agoActually once you know the circle's position (this needs to be accurate) and approximate size you can convert it into log-polar coordinates and then apply phase correlation [1] to a known "template" to determine the rotation angle very accurately. I'm not sure what would be the best pattern for this, but I might actually try implementing a prototype. [1] https://en.wikipedia.org/wiki/Phase_correlation https://en.wikipedia.org/wiki/Phase_correlation