Computer Vision News - July 2019
41 Focus on Computer Vision News This is actually it. In my code, I added a few additional lines of code to measure the number of frames per second and to make the visualization nicer, but this code is enough to track any object! Let's see some examples: Results We now demonstrate the performance of the tracker. To this end we track the phrase FOCUS ON ME on the following video. You can see the results below. Conclusion In this article we have seen how to use tracking algorithms in OpenCV. Specifically, we explained and implemented the KCF tracker which gave us the desired speed and accuracy we wanted. As mentioned above, there are seven more trackers implemented on OpenCV. Each of them has different properties and different robustness. You can use our code as is and just replace the line that define the tracker. This would allow you to check other trackers depending on your application. Enjoy! 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 flag = tracker.init(frame, box) while True : flag, frame = video.read() flag, box = tracker.update(frame) if flag: p1 = ( int (box[ 0 ]), int (box[ 1 ])) p2 = ( int (box[ 0 ] + box[ 2 ]), int (box[ 1 ] + box[ 3 ])) cv2.rectangle(frame, p1, p2, ( 0 , 0 , 255 ), 2 , 1 ) cv2.imshow( "Tracking" , frame) k = cv2.waitKey( 1 ) & 0xff if k == 27 : break Object Tracking in Python Using OpenCV
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=