FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Discussion
   General Processing Discussion
(Moderators: fry, REAS)
   How to compare frames?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: How to compare frames?  (Read 283 times)
Alen Zurfluh
Guest
Email
How to compare frames?
« on: Apr 13th, 2004, 3:18pm »

hello,
 
I want to open a video file (avi-XVid).
From this video file I have to compare the frames. If there is a "hugh" difference between the frames then I should log this difference as "numeric" value to a text-file.
 
I think about calculating a difference image.
 
And the end, I wish to have a textfile. Containing a timestamp (framestamp) and a value indicating the "difference. With between the current frame and the previsous frame. It think its enough when I compare every second on frame with the previous frame.
The thing I have to do, I somehow like 'motion detection'
 
Any help, advice or suggestions?
Thank you,
 
Alen
 
Glen Murphy

WWW Email
Re: How to compare frames?
« Reply #1 on: Apr 15th, 2004, 7:25am »

Simple motion detection:
 
Get the brightness value of each pixel, and compare to the previous frame. Do this for all pixels, and tally the result (don't forget to abs() each value as you add it). If it's above a certain number, then there's likely motion.
 
Now, to make this more efficient, you don't need to do every pixel, just do it in a grid. Be aware that most cameras produce a fair amount of noise, so perhaps subtract 15 from the difference value before you add it (and if it's less than zero, ignore it).
 
You could make it faster by just focusing on the red channel instead of getting the brightness.
 
Pages: 1 

« Previous topic | Next topic »