object tracking in real time via opencv and python

2019-09-05 06:38发布

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.

1条回答
Fickle 薄情
2楼-- · 2019-09-05 07:11

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.

查看更多
登录 后发表回答