Fix findOutline4 emitting interior mask pixels as outline pixels - #81
Draft
rootkiller6788 wants to merge 1 commit into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
MaskAnalyzer::findOutline4(impl/ocean/cv/segmentation/MaskAnalyzer.cpp) documents its result as: "the pixel itself is not a mask pixel but has at least one neighbor mask pixel in the four-neighborhood" (see MaskAnalyzer.h).However, the center-rows pass only checked the four-neighborhood of each pixel:
It never verified that the pixel itself is a non-mask pixel. As a result, every interior mask pixel that has at least one mask neighbor is incorrectly reported as an outline pixel, so
outlinePixels4contains the full mask interior in addition to the true outline.Fix
Gate the check on the pixel being a non-mask pixel, matching the top/bottom row and left/right column passes already present in the same function:
Verification
maskRow[x] != nonMaskValue/elsestructure, i.e. they correctly skip mask pixels.