Multiple tracking in a Video

前端 未结 3 1753
失恋的感觉
失恋的感觉 2020-12-17 02:40

I m working on small image processing assignment where I need to track 4 red color object. I got how to track single one. I want to know what is the best approach to track m

3条回答
  •  醉梦人生
    2020-12-17 03:19

    Here are the steps for multiple colored object tracking:
    For each frame do the following steps:

    1. Convert your input image (BGR) to HSV color space using cv::cvtColor()
    2. Segment red colored objects using cv::inRange()
    3. Extract each blob from the image using cv::findContours()
    4. For each blob calculate its center using cv::boundingRect()
    5. Match the blobs from the previous frame plus some movement to the current blobs comparing the distances between their centers --> Match them if they have the smallest distance

    This is the basis of the algorithm. Then you have to handle situations, when blobs enter the image (this is the case when there is a blob in the current frame, but no close blob from the previous frame) or leave the image (there is a blob in the previous frame, but no close blob in the current frame).

提交回复
热议问题