简体   繁体   中英

Opencv C++ finding movement in a thresholded image

I am using openCv with C++ and I am trying to find a moving ball under different lighting conditions. So far I am able to filter an image by thresholding it using HSV color space. The problem with this is that it will pick up other object that have a similar color. It is very tedious to figure out the exact hsv range everytime there is a ball with different color/background.

Is there a way for me to apply any filter on the thresholded binary image to detect only the objects that are moving? This way I will only find the ball and not other objects since they are usually stationary.

Thank you,

Varun

Simplest approach would be frame differencing / background learning in an image sequence.

  • frame differencing: substract two successive frames, the result is the moving part (you will probably only get the edges of moving objects)

  • background learning: eg build an average over 50 frames, this would be your learned background, then substract the current frame, again the difference is the moving part

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM