Skip to content

Image Preprocessing (Beta)

Kilian Brachtendorf edited this page Jan 16, 2019 · 1 revision

Sometimes you may wish to alter the images before they are hashed by applying filters like gaussian blur, box blur, sharpening ....

HashingAlgorithm pHash = new PerceptiveHash(32);
//Some examples of filters...
pHash.addFilter(Kernel.gaussianFilter(5, 5, 5));
pHash.addFilter(new MedianFilter(4,4));
pHash.addFilter(new SobelFilter(0.7));
//Or add your custom kernel masks ...

Note: Image preprocessing currently is a rough part of the module and may be improved over time. Preprocessing each image in full resolution carries a major performance penalty, therefore it should be evaluated carefully if this step is really worth the effort. Most of the times filter do not improve the performance of hashing algorithms due to the fact that a lot of the effect is lost during reszing at a later stage.

Alternatively take a look at AverageKernelHash to see how to apply kernels to the rescaled image.

Here are some of the available filters:

Filter Original Output
MedianKernel
Gaussian
Sobel
Clone this wiki locally