diff --git a/src/pHash.cpp b/src/pHash.cpp index 6c9f47d..cada310 100755 --- a/src/pHash.cpp +++ b/src/pHash.cpp @@ -218,7 +218,13 @@ int _ph_image_digest(const CImg &img, double sigma, double gamma, Digest &digest, int N) { int result = EXIT_FAILURE; CImg graysc; - if (img.spectrum() >= 3) { + + if(img.spectrum() >3) + { + CImg<> rgb = img.get_shared_channels(0,2); + graysc = rgb.RGBtoYCbCr().channel(0); + } + else if (img.spectrum() == 3) { graysc = img.get_RGBtoYCbCr().channel(0); } else if (img.spectrum() == 1) { graysc = img;