Opencv learning notes (IV)-mathematical morphology 1 (expansion, corrosion, open and closed operations of binary images)

Source: Internet
Author: User

1. Basic morphological concepts

It is an image analysis subject based on the theory of lattice and topology, and is the basic theory of mathematical morphology image processing. Its basic operations include: binary corrosion and expansion, binary open and closed operation, skeleton extraction, ultimate corrosion, tumble-blow transformation, morphological gradient, top-hat transformation, particle analysis, Watershed Transformation, gray-value corrosion and expansion, gray value opening/closing, gray value morphological gradient, etc.

In many neighborhoods, such as preprocessing, Object Shape segmentation, and object quantization, morphological methods have better results and faster speed than other standard algorithms.

Main objectives of morphological operations:

(1) image preprocessing (de-noise and simplified shape)

(2) Enhancing Object Structures (extracting bones, refining, roughening, convex hull, and object tags)

(3) Split objects from the background

(4) quantitative description of objects (area, perimeter, projection, Euler-Poincare)

Binary expansion and Corrosion

2.1 Expansion

2.1.1 basic description

Consider two binary images A and B. Their foreground is black and the background is white. In addition, FA and Fb indicate the set of their respective foreground points. Defines the expansion operation:

Dilation (a, B) = {A + B | a, B }.

For example: a = )}

B = {(0, 0), (0, 1 )}

Dilation (a, B) = ), (6, 4), (6, 5), (7, 6), (7, 7), (8, 8), (8, 9 )}

That is, the expansion operation is the set of the sum of all vectors in two sets.

2.1.2 basic nature

Expansion is an expansion of the same nature, which is sometimes called filling or growth. Using the expansion operation of the element of the same-sex structure, it can be described as a transformation that converts all background pixels adjacent to the object into the object pixel. It can be used to fill small holes and narrow seams in objects. At the same time, it has some interesting properties.

(1) meet the exchange law (2) meet the combination Law (3) can be expressed as a translation point set and (4) expansion does not change the translation

Corrosion 2.2

2.2.1 basic description

Corrosion uses vector subtraction to merge two sets. corrosion is the dual operation of expansion. Defined corrosion calculation:

Erosion (a, B) = {p | (p + B) records a, a records a, B records B }.

For example: a = )}

B = {(0, 0), (1, 0 )}

Erosion (a, B) = {(0, 3), (1, 3), (2, 3 )}

That is, any element in B is added to an element A, that is, this element is an expanded element.

2.2.2 basic nature

For the corrosion operation, you can find the object contour in the image, and the speed is very fast. The specific implementation method is to calculate the difference between the original image and the image after corrosion. At the same time, corrosion can also be used to simplify the structure of objects. The parts of objects or objects with only one pixel width will be removed. This complex object can be divided into several simple parts.

In addition, corrosion has several properties like expansion.

(1) reverse expansion Transformation (2) Translation unchanged (3) incremental Transformation

2.3 open and closed operations

Open Operation: Corrosion first and then expansion

Closed Operation: First expands before corrosion

The on-line operation of the structure element is used to remove the details of the image smaller than the structure element, that is, the local shape of the object remains unchanged. Closed operations are used to connect adjacent objects, fill in small holes, and fill in narrow gaps to make the edge of objects smoother. However, unlike corrosion and expansion, open and closed operations do not have immutability for the translation of structural elements.

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.