From 0474b64e6f47b8f1a40a006b191b540760db658f Mon Sep 17 00:00:00 2001 From: rootkiller6788 Date: Thu, 20 Aug 2026 12:14:04 +0800 Subject: [PATCH] Fix findOutline4 emitting interior mask pixels as outline pixels The center-rows pass of MaskAnalyzer::findOutline4 only checked the four-neighborhood of each pixel, without first verifying that the pixel itself is a non-mask pixel. As a result every interior mask pixel having at least one mask neighbor was incorrectly added to outlinePixels4, contradicting the documented behavior that an outline pixel is a non-mask pixel with a mask neighbor in the four-neighborhood. Gate the check on maskRow[x] == nonMaskValue, matching the top/bottom row and left/right column passes of the same function. --- impl/ocean/cv/segmentation/MaskAnalyzer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impl/ocean/cv/segmentation/MaskAnalyzer.cpp b/impl/ocean/cv/segmentation/MaskAnalyzer.cpp index 4a5a130c4..cb0be1d68 100644 --- a/impl/ocean/cv/segmentation/MaskAnalyzer.cpp +++ b/impl/ocean/cv/segmentation/MaskAnalyzer.cpp @@ -445,7 +445,7 @@ void MaskAnalyzer::findOutline4(const uint8_t* mask, const unsigned int width, c for (unsigned int x = std::max(1u, firstColumn); x < std::min(endColumn, width_1); ++x) { - if (maskRow[x - 1u] != nonMaskValue || maskRow[x + 1u] != nonMaskValue || maskRowTop[x] != nonMaskValue || maskRowBottom[x] != nonMaskValue) + if (maskRow[x] == nonMaskValue && (maskRow[x - 1u] != nonMaskValue || maskRow[x + 1u] != nonMaskValue || maskRowTop[x] != nonMaskValue || maskRowBottom[x] != nonMaskValue)) { outlinePixels4.emplace_back(x, y); }