0

What should I do in the condition? I want to compare the details of the image to know if it was scanned before.

        //Source of Hard Image
        var path = Path.Combine(@"C:\Users\mo\Desktop", "myscan" + imageExtension);

        //Source of Ram Image
        var imageBytes = (byte[])image.FileData.get_BinaryData();
        var ms = new MemoryStream(imageBytes);

        //Make them to Same type
        Image ImgRam = Image.FromStream(ms);
        Image ImgHard = Image.FromFile(path);

        if(ImgRam==ImgHard)
        {
            pictureBox2.Image = new Bitmap(ImgRam);
        }
66Gramms
  • 769
  • 7
  • 23
Ali Hamza
  • 21
  • 4
  • 2
    Explain your problem and your approach. Do you want to compare images for similarity, do you want to compare per pixel or do you want to compare for byte-for-byte equality? – CodeCaster Oct 15 '21 at 09:24
  • I have no Idea what is the beast , I think per Pixel What I want CodeCaster – Ali Hamza Oct 15 '21 at 09:32
  • I don't know whether pixel per pixel comparison is viable, because you haven't explained what you want to do. If you have an image file from your phone cam and you print that, and you put the print in a flatbed scanner and scan it, it won't be the same image as the file from your phone. – CodeCaster Oct 15 '21 at 09:36
  • I Have flatbed scanner What I wat to Know if the document has been Scanned before if not remove the the scanned before and put the new one else notify the user the Image you have already Scanned – Ali Hamza Oct 15 '21 at 09:44
  • Two scans of the same image won't yield the same file. – CodeCaster Oct 15 '21 at 09:45
  • If you want pixel per pixel comparison then this should help you: https://stackoverflow.com/questions/35151067/algorithm-to-compare-two-images-in-c-sharp – 66Gramms Oct 15 '21 at 10:14
  • If you do a pixel by pixel comparison then it will only work if the image saved on disk is saved using lossless compression. – jason.kaisersmith Oct 15 '21 at 10:15
  • That is not true, you just have to add some degree of freedom. – 66Gramms Oct 15 '21 at 10:24

0 Answers0