简体   繁体   中英

object tracking in real time via opencv and python

I'm looking for good algorithm to do object tracking in real time. the best one I found so far was camshift but the problem with that is that I need to object detection will come from out side image.(I give the algorithm an image and he find it in the video...) and camshift required to select the ROI points with the mouse. I tried to change it but it didn't succeed. I'm open to learn new algorithm or to change the camshift.

Thanks.

I don't know camshift very well, but i'm guessing you are using opencv implementation. The below code is a snippet from the opencv example:

        hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
        dst = cv2.calcBackProject([hsv],[0],roi_hist,[0,180],1)

        # apply meanshift to get the new location
        ret, track_window = cv2.CamShift(dst, track_window, term_crit)

For the first image, choosing the dst as large as the frame size should solve your problem. Otherwise you can use a sliding window approach to locate the target in the first frame.

On the other hand, the term real time really depends on your requirements and deployment environment in such aspects:

  • frame rate of input video
  • resolution of the frames
  • color scheme of the frame (rgb, yuv, gray, hsv, ...)
  • maximum/minimum target size
  • maximum target speed (pixels/frame)
  • should it be robust to occlusions?
  • what's the most specific properties of your targets: cars, human/animals, solid objects, changing shape, turning, ...
  • are you using a CPU, DSP or GPU?
  • ...

Since all of the considerations above would be really effective on your choice, i cannot recommend you a specific one. This one may be useful for example.

I would dig into IEEE explore and make a search such as real time object tracking . I did one for you :) Here is your best start point, i guess.

Hope this helps. Gokhan.

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