From b2e56dfbd3701b0b2a642ee6c85354c5bac5ba35 Mon Sep 17 00:00:00 2001 From: Miller Cy Chan Date: Sun, 22 Sep 2024 21:23:06 +0800 Subject: [PATCH] Add files via upload --- nQuantGpp/Otsu.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nQuantGpp/Otsu.cpp b/nQuantGpp/Otsu.cpp index 4a6cf1c..71d15f8 100644 --- a/nQuantGpp/Otsu.cpp +++ b/nQuantGpp/Otsu.cpp @@ -380,13 +380,12 @@ namespace OtsuThreshold auto pixelsGray = pixels4b.clone(); if (!isGrayscale) ConvertToGrayScale(pixels4b, pixelsGray); - vector pixels(pixels4b.begin(), pixels4b.end()); + vector pixels(pixelsGray.begin(), pixelsGray.end()); - auto oldPixels = pixels4b.clone(); auto otsuThreshold = getOtsuThreshold(pixels); auto lowerThreshold = 0.03, higherThreshold = 0.1; pixels4b = cannyFilter(pixelsGray, lowerThreshold, higherThreshold); - threshold(oldPixels, pixels4b, otsuThreshold); + threshold(pixelsGray, pixels4b, otsuThreshold); Mat palette(2, 1, srcImg.type(), scalar); if (srcImg.channels() == 4)