Image comparison, from image capture device

  • Thread starter Thread starter Paul Aspinall
  • Start date Start date
P

Paul Aspinall

Hi
I am trying to find some code, or reference docs, to assist in helping
capture images from an image capture device (ie. webcam etc etc).

I want to be able to compare successive images coming from the device, and
be able to detect if the image has changed from the previous one. I have
found some Java code which does something similar to what I want to do, but
I am unsure which classes in the .Net framework are equivalents or of use in
this.

If anyone can help, it would be most appreciated.

Thanks


Paul
 
Paul,

There's nothing directly built in to .Net for capturing images, but you can
use the DirectX API to do so. There's no need to sweat, though -- try the
DirectX.Capture library for capturing images. I found it pretty easy to use:
http://www.thecodeproject.com/cs/media/directxcapture.asp

Now, as far as comparing successive images... that's practically a whole
science! Quick and dirty, you could do per-pixel or region comparisons of
successive images with threshold values. I would probably write those
functions in unmanaged C++ and compile a DLL that you could then reference
from .Net, since it's processor-intensive and will run faster than managed
code.

Keep in mind that many webcam drivers auto-adjust the image for lighting
conditions, so the image brightness or saturation may change automatically
and trick your program into thinking something has moved when it hasn't.
Some cameras (I have a Logitech cam) let you turn all that auto-adjustment
stuff off if you don't want it.

-Adrian
 
Hi Paul,

I believe there is a way to do this in managed code using Windows Messaging
without having to resort to Directx or COM.
http://www.webtropy.com/articles/art7.asp?Webcam

Difference image and motion detection algorithms, using pattern recognition
as is found in security and QA apps, are usually in the realm of DSP. I
would say the easiest way would be to do a Fast Fourier Transform on the
images and then calulate some vector difference. You can use the Exocortex
engine:
http://www.exocortex.org/dsp/

ok,
aq
 
Back
Top