[OpenCV] ⚠️ Masters don't enter! Learn the basics in half an hour ⚠️ Corrosion Expansion
summarize
OpenCV is a cross-platform computer vision library with multi-language support and powerful features. Today, Xiaobai will bring you into the world of OpenCV together. (Lesson 10)
corrode (degrade chemically)
Eroding removes boundary points by shrinking inward along the image boundary.
Original image.
Example.
# Read the picture img = ("") # Corrosion erode = (img, kernel=(3, 3), iterations=5) # Pictures to show ("erode", erode) (0) ()
Output.
We can see that the circle of lines next to it is basically gone.
dilatation
Dilating expands outward along the image boundaries.
Example.
# Read the picture img = ("") # Swell dilate = (img, kernel=(3, 3), iterations=5) # Pictures to show ("dilate", dilate) (0) ()
Output.
open operator (computing)
Calculation: Eroding before dilating.
Example.
# Open operations open = (img, cv2.MORPH_OPEN, (3, 3), iterations=5) # Image presentation ('open', open) (0) ()
Output.
closed operation
Calculation: Dilating, then Eroding.
Example.
# Read the picture img = ("") # Closed operations close = (img, cv2.MORPH_CLOSE, (3, 3), iterations=5) # Image presentation ('close', close) (0) ()
Output.
To this article on OpenCV half an hour to master the basic operation of the corrosion expansion of the article is introduced to this, more related to OpenCV corrosion expansion content, please search for my previous articles or continue to browse the following articles hope that you will support me in the future!