Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan authored Sep 23, 2024
1 parent 284d075 commit 0bb2422
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nQuantGpp/Otsu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace OtsuThreshold
}

auto minThresh = (uchar)(thresh * (m_transparentPixelIndex >= 0 ? .9f : weight));
const auto shadow = m_transparentPixelIndex >= 0 ? 3.5 : 3;
for (uint y = 0; y < pixels.rows; ++y)
{
for (uint x = 0; x < pixels.cols; ++x)
Expand All @@ -108,7 +109,7 @@ namespace OtsuThreshold

if (c[3] < alphaThreshold && c[2] + c[1] + c[0] > maxThresh * 3)
d = Vec4b(UCHAR_MAX, UCHAR_MAX, UCHAR_MAX, c[3]);
else if (c[2] + c[1] + c[0] < minThresh * 3)
else if (c[2] + c[1] + c[0] < minThresh * shadow)
d = Vec4b(0, 0, 0, c[3]);
}
}
Expand Down

0 comments on commit 0bb2422

Please sign in to comment.