Reputation: 7413
I want to detect motion in a quick way before tracking, will absDiff() (or cmpS() ) between 2 frames be sufficient to achieve this or should I consider something more? Pls keep in mind I'm completely new to vision processing and opencv :)
Thanks
Upvotes: 1
Views: 8186
Reputation: 7413
There's no quick and easy way. The method I'm trying is to build a background image over time, subtract the foreground which would be anything not part of the background and put a roi over the foreground object.
Upvotes: 0
Reputation: 66
There is a pretty good explanation in chapter 9 of the book 'Learning OpenCV: Computer Vision with the OpenCV Library'. Depending on your scene (indoors/outdoors, lighting conditions etc) the learning stage of your algorithm consists of accumulating the difference between frames in a buffer, then filtering the result using morphology operations to cancel noise. Or, when basic cvAbsDiff detects spurious motion, you implement a little bit more complicated 'codebook' algorithm instead.
The source code is available on the OReilly's site.
Upvotes: 2
Reputation: 2507
If you want to detect the specific object's motion, you would need 'connected components' calculation. Refer to http://www.bukisa.com/articles/263221_connected-components-using-opencv
Upvotes: 2