@Test public void testReferenceHash() { ImageHashAlgorithm algorithm = new DCTImageHashAlgorithm(); OpenBitSet actual = algorithm.getHash(Data.reference_imgdata); OpenBitSet exp = new OpenBitSet(new long[]{Data.reference_hash}, 1); System.out.println(Long.toBinaryString(Data.reference_hash)); System.out.println(Long.toBinaryString(actual.getBits()[0])); assertEquals(exp, actual); }
@Override public OpenBitSet getHash(BufferedImage image) { final BufferedImage smallSize; if (image.getWidth() == INTERNAL_SIZE && image.getHeight() == INTERNAL_SIZE && image.getType() == INTERNAL_IMAGE_TYPE) { smallSize = image; } else { smallSize = createResizedCopy(image); } DenseMatrix64F imageMatrix = getImageMatrix(smallSize); return doHash(imageMatrix); }
DCTImageHashAlgorithm implements ImageHashAlgorithm { @Override public OpenBitSet getHash(BufferedImage image) { final BufferedImage smallSize; if (image.getWidth() == INTERNAL_SIZE && image.getHeight() == INTERNAL_SIZE && image.getType() == INTERNAL_IMAGE_TYPE) { smallSize = image; } else { smallSize = createResizedCopy(image); } DenseMatrix64F imageMatrix = getImageMatrix(smallSize); return doHash(imageMatrix); } }
DCTImageHashAlgorithm implements ImageHashAlgorithm { @Override public OpenBitSet getHash(BufferedImage image) { final BufferedImage smallSize; if (image.getWidth() == INTERNAL_SIZE && image.getHeight() == INTERNAL_SIZE && image.getType() == INTERNAL_IMAGE_TYPE) { smallSize = image; } else { smallSize = createResizedCopy(image); } DenseMatrix64F imageMatrix = getImageMatrix(smallSize); return doHash(imageMatrix); }  }
DCTImageHashAlgorithm implements ImageHashAlgorithm { @Override public OpenBitSet getHash(BufferedImage image) { final BufferedImage smallSize; if (image.getWidth() == INTERNAL_SIZE && image.getHeight() == INTERNAL_SIZE && image.getType() == INTERNAL_IMAGE_TYPE) { smallSize = image; } else { smallSize = createResizedCopy(image); } DenseMatrix64F imageMatrix = getImageMatrix(smallSize); return doHash(imageMatrix); }  @Override BufferedImage createResizedCopy(BufferedImage originalImage); @Override OpenBitSet getHash(BufferedImage image); @Override OpenBitSet getHash(double[][] imageMatrix); }
DCTImageHashAlgorithm implements ImageHashAlgorithm { @Override public OpenBitSet getHash(BufferedImage image) { final BufferedImage smallSize; if (image.getWidth() == INTERNAL_SIZE && image.getHeight() == INTERNAL_SIZE && image.getType() == INTERNAL_IMAGE_TYPE) { smallSize = image; } else { smallSize = createResizedCopy(image); } DenseMatrix64F imageMatrix = getImageMatrix(smallSize); return doHash(imageMatrix); }  @Override BufferedImage createResizedCopy(BufferedImage originalImage); @Override OpenBitSet getHash(BufferedImage image); @Override OpenBitSet getHash(double[][] imageMatrix); static final int INTERNAL_SIZE; static final int INTERNAL_IMAGE_TYPE; }