Click here to Skip to main content
15,665,229 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I subtracted two fingerprint image and got the resultant image. Now I have to find the non zero location from the resultant image.

How can i get? Please help me for this.

This is my subtraction code.
public static Bitmap subtractImage(Bitmap minuend, Bitmap deduction, int relativeX, int relativeY)
    Bitmap b = minuend;
    Bitmap b1 = deduction;

    Bitmap random = new Bitmap(256, 256, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

    Graphics g = Graphics.FromImage(random);
    g.DrawImage(b, new Point(0, 0));

    Bitmap rec = new Bitmap(256, 256, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
    Graphics g1 = Graphics.FromImage(rec);
    g1.DrawImage(b1, new Point(0, 0));

    Bitmap result = new Bitmap(256, 256, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

    //  Bitmap r = new Bitmap(256, 256, , System.Drawing.Imaging.PixelFormat.Format24bppRgb, IntPtr.Size);
    //Bitmap rand=new Bitmap(pictureBox1.Image,256,256,System.Drawing.Imaging.PixelFormat.Format24bppRgb,IntPtr.Zero);
    //Bitmap rec = new Bitmap(pictureBox2.Image,System.Drawing.Imaging.PixelFormat.Format16bppGrayScale,IntPtr.Zero);
    //Bitmap result = new Bitmap(256, 256);

    Difference filter = new Difference(random);
    result = filter.Apply(rec);
    return result;

[Edit member="Tadit"]
Added pre tags.
gggustafson 2-Apr-14 11:33am    
Why are you using colored bitmaps? Convert to black/white. Why are your creating aliases (b and b1) for the originals? Use the originals. Where is your "difference" method?
Member 10663066 7-Apr-14 0:37am    
The above coding is for subtracting two images,that i did.Now i want the code to find non zero location in an image. Here am using fingerprint images. Please help me i need this coding for project.
gggustafson 7-Apr-14 8:45am    
What is "Difference"? What do you mean by "find non zero location in an image"?
Member 10663066 9-Apr-14 0:07am    
My topic is "novel techniques in steganography using fingerprint images".
Description of my project is-

The system is working in two steps in general, the first is
hide the message, at the beginning, the sender will write or
upload his/her secret message to be hidden. Then the system
will get two fingerprint images: one is the receiver's
fingerprint image, and the second one is a random fingerprint
image. After that the system will convert it to bitmap type to
conduct the mathematical process on it. The system will
compare between the two images and subtract one from the
other to generate a new fingerprint image which is called
different fingerprint image, The system will extract from the
different fingerprint image the positions that are not equal to
zero, that means the differences positions. After that the
message will be prepared to the inserting process by
converting it from string type to bit type. The message will be inserted into the least significant bit of these extracted
positions of the random fingerprint image. The second step is
unhide the message, the receiver will get the fingerprint image
that hides the message from the sender via email, an instant
messaging file transfer, media storage devices, or by any way
they prefer. Then he/she will upload the fingerprint image that
hides the message, and his/her ID into the system, the system
will get his/her fingerprint image from the user fingerprint
image database and compares it with the fingerprint image that
hides the message to get the difference positions that hide the
message, then gets the message bits from the difference
positions least significant bits. Finally, it converts the bits into
string and displays it to the receiver.
i did the subtraction portion,now want to know the non zero location ofthe image to store the message.
gggustafson 9-Apr-14 0:39am    
Thank you for the well-stated project description. But does not the difference contain what you want? Say the result of the difference for one byte, is 10011001. Are not the non-zero location the one's? So I ask again, what do you mean by the non-zero location in the image if it is not the difference?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900