KilianB / JImageHash

Perceptual image hashing library used to match similar images
MIT License
397 stars 80 forks source link

RotAverageHash returns the different results for the same object #49

Closed marekkapowicki closed 3 years ago

marekkapowicki commented 3 years ago

I m using the static instance private static final HashingAlgorithm ROT_AVERAGE_HASH = new RotAverageHash(32);of a hash

//given

I m using the same bufferImage (the same object reference) to calculate the hash a few times.

//expect

the same result for every calculation

//current result

the 1st calculation returns a different result than the others

I in each invocation we are using the same object: BufferedImage@2f6bcf87, but the 1st generated value: 00000000000101110001010000000000 is different (2nd, and 3rd one are the same: 00000000000101110001010101100000) look at the details:

--first:

input: BufferedImage@2f6bcf87: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 612 height = 792 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0

rot_hash: Hash: 00000000000101110001010000000000 [algoId: 2087538531]

--second:

input: BufferedImage@2f6bcf87: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 612 height = 792 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0

rot_hash: Hash: 00000000000101110001010101100000 [algoId: 2087538531]

--third

input: BufferedImage@2f6bcf87: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 612 height = 792 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0

rot_hash: Hash: 00000000000101110001010101100000 [algoId: 2087538531]

KilianB commented 3 years ago

fixed in next version