Method: I am detection motion by using successive frame subtraction in a video file or webcam and i am using contours to represent the motion.
Note: For every object there are multiple contours because i did't given any specific size to contours the reason is my objects in video file are in different scales.
Method: I have used lucas kanade algorithm to detect the optical flow of an objects in successive frames