Comparing images with different resolutions

前端 未结 2 1822
無奈伤痛
無奈伤痛 2020-12-06 12:15

Is there possible to compare two images with different resolutions?

I mean here some algorithmic/programming approach. For instance, now I calculate hash co

相关标签:
2条回答
  • 2020-12-06 12:47

    For synthetic images with a few distinct colours I would start with histogram matching.

    Basically add up the number of pixels of each colour in each image and divide by the total number of pixels. Then you have a simple float vector as a fingerprint. You can ignore white if you want images with more or less border to count as a match

    It's not going to detect the same image with the slices re-arranged, or the text moved down a line but i don't think that is the concern in this case

    0 讨论(0)
  • 2020-12-06 13:03

    Two very simple perceptual hashing methods you might give a try before venturing into more complicated territory are based on the Discrete Cosine Transform and the local vs glocal mean of an image:

    1. Convert image to grayscale

      1.1 (EDIT) Make your image zero mean

    2. Crush your image down to thumbnail size, say [32x32]
    3. Run the two dimensional Discrete Cosine Transform
    4. Keep the top left [8 x 8], most significant low frequency components
    5. Binarize the block, based on the sign of the components
    6. Result is a 64 bit hash

    And a variant on this theme would be

    1. Convert image to grayscale
    2. Optionally re-size to a predefined size.
    3. Partition the image in a fixed number of blocks
    4. Determine the global mean
    5. Determine the local mean per block
    6. For the hash, write out a 1 or a 0 per block, pending if the local mean was larger or smaller than the global mean.

    Also, have a look at phash.

    0 讨论(0)
提交回复
热议问题