From: Jeroen V. <pe...@am...> - 2005-06-16 16:31:22
|
Kenneth Lavrsen wrote: > I have noted similar problem when experimenting with tracking. > > Slow movements from a distance works but anything close and the camera > chases what was there before. > > The problem with video based Motion detection is that the algoritm > looks at pixels that change. And when a person moves he changes > pixles. But the background which was covered is also a change when > they reappear and this is also detected. > > I have been thinking of ways to fix this. > > - Use old reference frame. Either this requires a long buffer or the > reference frame has to jump. I imagine this meaning a major negative > impact on normal motion detection. > - Only use last frame as reference frame. Jeroen developed the current > mode because it gave safer Motion detection. So doing this solves > parts of the problem but creates other maybe more severe problems. To > try this find this code in motion.c > > for (i=cnt->imgs.size-1; i>=0; i--) { > cnt->imgs.ref[i]=(cnt->imgs.ref[i]+newimg[i])/2; > } > > and replace it with > memcpy(cnt->imgs.ref, newimg, cnt->imgs.size); > > But be warned that slow moving objects will go undetected this way. > > - Have a tracking algoritm (old frame renewed every minute and > therefore between one minute and two minutes old) and a Motion > detection algoritm (like now). This increases CPU load. But maybe by > using the fast algoritm for tracking it could be feasible. > > Other ideas welcome. It won't help for the first frames, but you could try to create a motion vector. Remember in the first frame with the detected center and update it with each new frame. This way you get to know the average direction the object is moving and you can anticipate on it by giving the tracking code a bias in that direction. This could be done by keeping just a few integers in memory instead of a whole extra frame. (Not that keeping an extra older reference frame is a bad idea but I don't think it is needed for tracking and the location box) Jeroen |