开发者

finding image silhouette using openCV

a开发者_StackOverflows i want to track motion of an object, i require silhouette of sequence of images. does anybody know , how to do this? Silhouette mask is a binary image that has non-zero pixels where the motion occurs


You can use the technique of background subtraction. Here are two ways of doing it.

  1. Subtract the previous frame from the current frame. Only pixels in both frames that haven't changed will result in zero. See cvSub, cvAbsDiff.
  2. Maintain a running average of the video frames. See the function cvRunningAvg in the Motion Analysis and Object Tracking section of the OpenCV docs. For each new frame, subtract the running average from the current frame. When you're done, update the running average with the current frame.

After using one of the methods above, you could segment the resulting difference image using cvThreshold or cvAdaptiveThreshold. This will result in a binary image, ideally with zero where the image was static, and 1 or 255 where motion was present.

Though you didn't mention this in your question, you can then proceed to calculate the contour of the binary image. There's cvFindContours for that.


Have a look at this: Tracking colored objects in OpenCV

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜