none
Comparing clipboard bitmap with new bitmap? RRS feed

  • Question

  • I have a bitmap taken from my webcam capture in my clipboard... a new capture is taken every several milliseconds. I want to compare these two bitmaps to see if they are the same image or not. I want to try and stay away from the directx api and stick with what I have if possible. Any way for me to compare these two images?
    Tuesday, January 22, 2008 2:37 AM

Answers

  • Hi,

      one way would be to use the LockBits method of the Bitmap class (http://msdn2.microsoft.com/en-us/library/system.drawing.bitmap.lockbits(VS.71).aspx) to get the pixel bitmap information of the images and then compare each pixel until you find a discrepancy or not.

     

      However..... it is very unlikey that two images captured from your webcam, even if they are of the same scene will be very close if you are doing pixel by pixel comparison, so for each pixel when you compare you should take into account some tolerance level to allow for the discrepancies :-)  Have fun.

     

    Mark.

    Tuesday, January 22, 2008 3:10 AM