none
powershell compare two images RRS feed

  • Question

  • I have a need to compare two images. the file names are different.

    I have about 1000 images and about 40% of them are the same image visually.

    I am using PowerShell 4

    Monday, February 17, 2014 11:13 PM

Answers

  • You will need to purchase image recognition software and learn how to use it.  This cannot be done with a script.


    ¯\_(ツ)_/¯

    Tuesday, February 18, 2014 2:32 PM

All replies

  • Monday, February 17, 2014 11:35 PM
  • Compare tags if the images have tags.  It taken from the same camera they should have the same tags assuming no one has edited them.


    ¯\_(ツ)_/¯

    Monday, February 17, 2014 11:39 PM
  • Are we talking about files that are completely identical, just with different names? Or are you talking about visual analysis of two slightly different pictures to determine whether they're basically the "same image"?

    If it's the former, this is very easy.  If it's the latter, it's quite complicated, and you'd be better off searching for image analysis software rather than trying to write your own in a script.

    Tuesday, February 18, 2014 2:40 AM
  • these images are no captured by a camera, they are captured by a VGA capture card. I have found that the file size can be a little different. so the images are only visually the same.

    is it still possible.

    Tuesday, February 18, 2014 2:22 PM
  • You will need to purchase image recognition software and learn how to use it.  This cannot be done with a script.


    ¯\_(ツ)_/¯

    Tuesday, February 18, 2014 2:32 PM
  • these images are no captured by a camera, they are captured by a VGA capture card. I have found that the file size can be a little different. so the images are only visually the same.

    is it still possible.

    Perhaps, if you're able to convert something like this to be used in PowerShell:

    http://www.c-sharpcorner.com/uploadfile/prathore/image-comparison-using-C-Sharp/

    There's not going to be a quick builtin way to do this.


    Don't retire TechNet! - (Don't give up yet - 12,700+ strong and growing)

    Tuesday, February 18, 2014 2:37 PM
  • Unfortuantely a pixel by pixel comparison will not work. (This can be easily done in PowerShell.)

    No two camera images are every identical.  Image recognition software can do a scaled match.  We can look for image recognition and set criteria for it such as a face or the existence of a vehicle that matches by 90%.

    This is a spinoff of CGI.  It is highly specialized and requires specific training to learn how to set up the match criteria.

    Remember that an image skew by one pixel will fail a linear match.   A camera will never produce two identical images.  Identical matches are good for finding copies that have been made but with different names.


    ¯\_(ツ)_/¯

    Tuesday, February 18, 2014 2:51 PM
  • this sounds close a pixel by pixel comparison.

    I do understand what you are saying jrv but I don't know how close the images are to each other. buying software and then individuality comparing thousands of images by hand is not an option so therefore I need to script it.

    if I can find that the images are about 98% the same then I think that would be ok. so how can this be done?

    Tuesday, February 18, 2014 4:38 PM
  • this sounds close a pixel by pixel comparison.

    I do understand what you are saying jrv but I don't know how close the images are to each other. buying software and then individuality comparing thousands of images by hand is not an option so therefore I need to script it.

    if I can find that the images are about 98% the same then I think that would be ok. so how can this be done?

    No images will compare on a pixel-by-pixel comparison.  Almost no two pixels will be the same.  What you want to do cannot be done. It wil only work to detect identical images.

    Think about it.


    ¯\_(ツ)_/¯

    Tuesday, February 18, 2014 4:53 PM
  • Well, it can be done, you'd just be writing your own version of image analysis software (which is not likely to work; it's a very complex topic.) In this case, it's better to purchase one that already works. Ideally, you'd choose one that offers some sort of command-line or automation interface, so you can then write a script that uses the product's analysis capability to find your "duplicates".
    Tuesday, February 18, 2014 4:57 PM
  • > Unfortuantely a pixel by pixel comparison will not work. (This can be easily done in PowerShell.)

    Any clue as to how this might be achieved?

    I have an image processing library that takes input and produces output.

    I want to understand exactly what pixels have been modified by the lib.

    I thought maybe an AND compare for each pixel that will produce a 1 if the values are different, I would then take the value and create a new bitonal difference image...   

    Thursday, October 5, 2017 10:44 AM
  • First you should not post in a 3 year old thread.  Second the thread is answered for the question as it was asked 3 years ago.

    You will need to master the image classes of Net to do a pixel comparison.  Load the images and compare the arrays of pixels.

    As I noted above.  Any single edit to the file may well cause all pixels to not match.  Each tool save an edited image with slightly different layout.  If a pixel is inserted then all pixels after that location will no longer match.

    Image processing software that uses sophisticated image analysis algorithms can highlight differences.  Forensic image analysis software can do pixel level analysis.  None of this is done by comparing pixels. 

    If this is critical I recommend finding forums that specialize in image processing.


    \_(ツ)_/

    Thursday, October 5, 2017 11:14 AM