From 11e96905854c41236bd447f4c679e4c8cddf068a Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Sun, 6 Jun 2021 15:24:24 +0200 Subject: [PATCH] * Sped up perceptual hashing by switching from Gaussian to Box blur. --- README.md | 2 +- db.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f8e2ee6..6871076 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The perceptual hash for an image is calculated by: * flattening the image (merging layers/frames) * transforming the color space to gray scale - * resizing to 16 by 16 pixel while applying Gaussian blur + * resizing to 16 by 16 pixel using box blur * normalizing contrast and brightness * conversion to monochromatic image * interpreting the pixel values as 256 bit hash value diff --git a/db.c b/db.c index 644a350..4990d8e 100644 --- a/db.c +++ b/db.c @@ -47,7 +47,7 @@ static int phash(db_entry_t *p, double blur) { goto ERR2; wand2 = MagickFlattenImages(wand); MagickSetImageColorspace(wand2, GRAYColorspace); - MagickResizeImage(wand2, 16, 16, GaussianFilter, blur); + MagickResizeImage(wand2, 16, 16, BoxFilter, blur); MagickNormalizeImage(wand2); MagickGetImagePixels(wand2, 0, 0, 16, 16, "I", CharPixel, pix); uint64_t h = 0; -- 2.30.2