1. Principle After understanding the Meanshift algorithm, we extend the Meanshift algorithm to continuous image sequences (generally referring to video image sequences), which forms a Camshift algorithm. The full name of the Camshift algorithm is "Continuously APAPTIVE Mean-Shift", which is the basic idea of the video image as a Meanshift operation, and the result of the previous frame (ie, the center and size of Search Window) as the next frame of Meanshift algorithm The initial value of Search Window, you can implement tracking of the target. The specific step of the entire algorithm is 5 steps: Step 1: Set the entire image as search area. STEP 2: The size and location of the initial Search Window. Step 3: Calculate the color probability distribution in Search Window, the size of this area is slightly larger than Search Window. Step 4: Run Meanshift. Get new positions and sizes of Search Window. STEP 5: In the next frame of video images, the position and size of the Search Window are initially obtained by the value obtained by STEP 3. Jump to STEP 3 to continue running.
2. OpenCV achieved, there are functions for CamShift algorithm, the prototype of this function is: cvCamShift (IplImage * imgprob, CvRect windowIn, CvTermCriteria criteria, CvConnectedComp * out, CvBox2D * box = 0); wherein: imgprob: color probability distribution image. Windowin: The initial value of Search Window. Criteria: It is used to determine whether the search stops. OUT: Save the calculation result, including the location and area of the new Search WINDOW. Box: Contains the minimum rectangle that is tracked. Description: 1. In the directory of OpenCV 4.0 Beta, there is an example of Camshift. Unfortunately, the tracking of this example goal is semi-automatic, that is, people need to select a target. I am trying to try fully automatic target tracking, I hope that I can communicate with you in this regard. ----------------------------- Committed to multimedia technology, becoming ideological software engineers ---------- -------------- This article is my original creation, to reprint, please contact me or indicate. Welcome everyone to make valuable comments on the content of the article, and I hope that everyone will point out the mistakes in the text, so I can correct it in time. My contact: QQ: 7578420Email: shichongdong80@gmail.com Note: Because I have already went to work, there is no time to hang in QQ, so I will be happy to communicate with the following research areas: image processing / video processing / OpenCV / Computer image ----------------------------------------------- -----------------------------------------