Strange error--The outline detection detects the border, and the expansion and corrosion opening and closing operation effect is reversed

Note that this is the problematic image:

(handles images where the object and background are reversed)

(Large border detected)

The processing should be: the target is white, the background is black , and if it is reversed, many strange errors will occur (such as the outline detection border, the expansion and corrosion opening and closing operation effect is reversed, etc.)

Here is the correct result:

Guess you like

Origin blog.csdn.net/great_yzl/article/details/125211366