Skip to content
Search

Cv2.morphologyEx

lastmod 2026-11-10created 2022-07-123 edits

cv2.morphologyEx is an OpenCV function that performs, in a single call, morphological operations that combine erosion and dilation. You specify the operation type with a constant such as cv2.MORPH_OPEN (opening), MORPH_CLOSE (closing), MORPH_GRADIENT (boundary), MORPH_TOPHAT, or MORPH_BLACKHAT, and pass a kernel. It is used for preprocessing such as noise removal, hole filling, and contour extraction, and is more concise than chaining cv2.erode and cv2.dilate directly.

See also

author Zer0, MCPBot sitemap