Biographies Characteristics Analysis

Exercise. Methods of mathematical morphology in image processing

Mathematical morphology

The shape (blue) and its morphological expansion (green) and contraction (yellow) by a rhombic structural element.

Mathematical morphology(MM) - (Morphology from Greek. μορφή "form" and λογία "science") - the theory and technique of analysis and processing of geometric structures, based on set theory, topology and random functions. Mainly used in processing digital images, but can also be applied to graphs, polygonal meshes, stereometry and many other spatial structures.

Binary morphology

In binary morphology, a binary image, represented as an ordered set (ordered set) of black and white dots (pixels), or 0 and 1. An image area is usually understood to be some subset of image points. Each operation of binary morphology is some transformation of this set. The input data is a binary image B and some structural element S. The result of the operation is also a binary image.

Structural element

A structural element is a binary image (geometric shape). It can be of any size and structure. Most often, symmetrical elements are used, such as a rectangle of a fixed size (BOX(l, w)), or a circle of some diameter (DISK (d)). Each element is highlighted singular point, called initial (origin). It can be located anywhere in the element, although in symmetrical ones it is usually the central pixel.

The most common structural elements: BOX - a rectangle of a given size, DISK[R] - a disk of a given size, RING[R] - a ring of a given size.

Basic Operations

At the beginning, the resulting surface is filled with 0, producing a completely white image. Then probing or scanning of the original image is carried out pixel by pixel by structural element. To probe each pixel, a structural element is “overlaid” on the image so that the probed and starting points are aligned. Then a certain condition is checked for the correspondence of the pixels of the structural element and the image points “under it”. If the condition is met, then 1 is placed in the corresponding place in the resulting image (in some cases, not just one single pixel will be added, but all the ones from the structural element).

According to the scheme discussed above, basic operations. Such operations are expansion and contraction. Derived operations are some combination of basic operations performed sequentially. The main ones are opening and closing.

Basic Operations

Transfer

An example of transfer at t=(2,1).

The operation of transferring X t of a set of pixels X to a vector t is specified as X t =(x+t|x∈X). Consequently, moving a set of single pixels in a binary image shifts all the pixels of the set by specified distance. The translation vector t can be specified as an ordered pair (∆r,∆c), where ∆r is the component of the translation vector in the row direction, and ∆c is the component of the translation vector in the direction of the columns of the image.

Building up

Enhancing the image with a square structural element.

The extension of a binary image A by a structuring element B is denoted and given by the expression:

.

In this expression, the union operator can be considered an operator applied in the neighborhood of pixels. The structuring element B is applied to all pixels of the binary image. Each time the origin of a structuring element is aligned with a single binary pixel, a translation and subsequent logical addition (logical OR) is applied to the entire structuring element with the corresponding pixels of the binary image. The results of logical addition are written to the output binary image, which is initially initialized with zero values.

Extension of a dark blue square with a disk structure element, resulting in a bright blue square with rounded ends.

Erosion

Erosion of an image by a square structural element.

The erosion of a binary image A by a structuring element B is denoted and given by the expression:

.

When performing the erosion operation, the structural element also passes through all the pixels of the image. If at some position each single pixel of the structural element coincides with a single pixel of the binary image, then a logical addition of the central pixel of the structural element is performed with the corresponding pixel of the output image. As a result of applying the erosion operation, all objects smaller than the structural element are erased, objects connected thin lines become disconnected and the sizes of all objects decrease.

Erosion of a dark blue square by a disk structural element, resulting in a bright blue square.

Derivative operations

Closure

Closing a dark blue shape (combining two squares) with a disk structural element resulting in a dark blue uniform and light blue squares.

The closure of a binary image A by a structural element B is denoted and given by the expression:

.

The snapping operation "closes" small internal "holes" in the image, and removes indentations at the edges of the area. If we first apply the growth operation to the image, then we can get rid of small holes and cracks, but at the same time the outline of the object will increase. This increase can be avoided by erosion surgery performed immediately after extension with the same structural element.

Opening

Opening a dark blue square with a disk structure element, resulting in a light blue square with rounded corners.

The opening of the binary image A by the structuring element B is denoted and given by the expression:

.

The erosion operation is useful for removing small objects and various noises, but this operation has the disadvantage that all remaining objects are reduced in size. This effect can be avoided if, after the erosion operation, a build-up operation is used with the same structural element. Unlocking eliminates all objects smaller than the structural element, but at the same time helps to avoid greatly reducing the size of objects. Breaking is also ideal for removing lines whose thickness is less than the diameter of the structural element. It is also important to remember that after this operation the contours of objects become smoother.

Conditional buildup

Border selection

see also

Links

Literature

  • L. Shapiro, J. Stockman. Computer vision. ed. - M.: BINOM. Knowledge Laboratory, 2006. - 752 p.
  • D. Forsyth, J. Pons. Computer vision. Modern approach. ed. - M.: Williams, 2004. - 928 p.

Wikimedia Foundation. 2010.

Translation from English: Ivanova I. I.
Source: [Electronic resource]// Access mode: http://link.springer.com/chapter/10.1007%2F978-1-4419-0211-5_23

annotation

Mathematical morphology is nonlinear method image processing using two-dimensional convolution operations, including binary morphology, grayscale morphology, and color morphology. Erosion, dilatation, opening and exploitation closing operations are the basis mathematical morphology. Mathematical morphology can be used for edge detection, image segmentation, noise, elimination, feature extraction and other image processing tasks. It is widely used in the field of image processing. Based on current progress, this thesis provides a comprehensive explanation of mathematical morphological classification and application to disease recognition. As a result, the discovery of the problem and further research mathematical morphology are relevant.

Keywords:

morphology of binary, halftone images, morphology, color morphology, erosion, dilatation, development of crop diseases.

INTRODUCTION

Mathematical morphology is new theory and a method that is used in the field of digital image processing and recognition. Her mathematical basis and language is a set of theory. Mathematical morphology appeared in 1964, it was first proposed by student scientist J. Serra and his supervisor G. Mazon. They proposed “hitting/skipping transformations,” introduced the expression of morphology at the theoretical level, and established a method for particle analysis. In 1968 they discovered Research institute mathematical morphology of Fontainebleau. Based on the hard work of researchers at this institute and researchers from another country, mathematical morphology gradually developed and became a science in its own right. In the 1970s, with commercial applications of the grain analyzer and Mazon's publication on "random and inherent set", development of mathematical morphology focused on gray-level aspects. In 1982, with the publication of "image analysis and mathematical morphology" by J. Serra, mathematical morphology became world famous. Mathematical morphology developed rapidly subsequently. Because the mathematical morphology algorithm has a parallel implementation structure that understands morphology analysis and parallel process algorithms, and the method can be implemented easily from a hardware point of view, which improves the speed of the image analysis process.

In mathematical morphology, an independent mathematical theory has been discovered and its ideas and methods have a great influence on the theory of images and technologies, and have also been used in the process of image analysis in many fields. Moreover, the application of mathematical morphology has led to significant improvements in the field Agriculture. The application focuses on recognizing diseases of crops, including wheat, cotton, vegetables, etc. In this article, the author summarizes the application of mathematical morphology in the field of agriculture and discusses open problems and future research.

Classification of mathematical morphology

Thanks to the efforts of people, mathematical morphology is used in binary images, although morphology was originally only applicable to grayscale images. But rapid progress in theory, and already mathematical morphology could be applied in other studies. Recently, research in mathematical morphology has relied on color images and this moment there are some achievements. According to the description method and display format of the research object, this article classifies mathematical morphology into trace types: binary morphology, grayscale morphology and color morphology.

Binary morphology

Mathematical morphology, put forward by Majorne and Serra, studied binary images and was called binary. Morphological transformations of a binary image in mathematical morphology are a set of formulas that describe these transformations. The meaning of the morphological operator is in the interaction between sets that describe the object, its shape and structure; the shape of an element of the structure may contain information about the shape of the signal, the operation performed. Morphological image processing is a set of operations of moving a structural element in an image, and then transforming or combining between the structure of the element and the binary image. Basic morpho logical operations– erosion and expansion (dilatation).

In morphological operation, structure element is the most basic and important component, which plays the role of wave filtering in the signal process. If B(x) expresses an element of structure, for each point X of the working area E, erosion and expansion are defined respectively as:

Figure 1 – Formulas for determining erosion and dilatation

Due to the possibility of implementing parallel processing and hardware, a binary image can be processed in several ways, such as edge extraction, image segmentation, thinning, feature extraction, and shape analysis. However, under other conditions, the choice of design element and the corresponding algorithm is different. The size of the structure element and the choice of shape will influence the result of the image of the morphological operation.

Huang et al.'s morphology has been adapted for round, triangular, square and other basic geometric shapes as an element of the structure of binary files in some cases, they extract hexagons using a filter image segmentation method with a morphological pattern. The result showed that the segmentation algorithm can have a better result and can establish the initial location for disease recognition in the image.

Bouyanaya et al. in 2008 discovered the spatial-variant mathematical morphology operator in Euclidean space and presented the geometric structure of elements based on the spatial variable, the result simulated the theory and proved huge potential in many kinds of image processing applications.

Morphology for Grayscale Images

Morphology of this type natural development binary images in grayscale, it does not have sets of expressions, but there is an image function. For such a morphology, intersection and union, which are used in binary morphology, are replaced by the maximum and minimum operations. The erosion and expansion of a grayscale image can be calculated directly from the function of such an image and the structure element. If g(x,y) expresses a structural element, for one point f(x,y) per image, erosion and expansion are calculated as:

Figure 2 – Formulas for determining erosion and dilatation

To make practical use of this kind of morphology, some scientists are proposing much improved algorithms. Kahn et al. in 2006 proposed an extended definition of mathematical morphology for the problem, which, although edge detection methods are based on classical morphology, has good ability noise removal, but his algorithm could not determine all the boundaries of objects. And they proposed a method for determining boundaries based on advanced mathematical morphology.

The simulation result showed that this method is not only effective at eliminating noise, but also good at detecting object boundaries. Bowyanaya et al. in 2008 proposed spatially variable mathematical morphology and presented a geometric concept structural function. The simulation results showed the potential power of this theory in image analysis applications.

Morphology of color images

There are not many studies on morphologies in the field of color image processing. Although some scientists have presented some morphology techniques used for color imaging. Most of them consider each image vector separately, neglecting the relationships between vectors. This is an efficient and smart research approach to process pixel colors using vector methods, describing the relationship between each vector. The study of transformations in the morphology of color space can indicate its connection with the morphology of grayscale images.

For a color image (V(x), x є X, X є DV), where DV is the image area in the RGB color space. Erosion and dilatation in color morphology for the structure of element B are defined as:

IN last years Many scientists pay attention to their research on color morphology. Zhang in 2006 proposed a method for determining boundaries based on mathematical morphology. In this method, the image is pre-processed and then the gradient transformation is done using mathematical morphology. Then, the edges are detected by edge detection method based on statistical data. The method eliminates shadow edges caused by lighting, extracts object boundaries directly, and has an effect on background noise suppression.

Applications using mathematical morphology

The basic idea of ​​mathematical morphology and its methods can be used in any aspect in the field of image processing. With the development of computers, image processing, pattern recognition and computer vision, mathematical morphology is developing rapidly and the field of application is becoming wider. Especially in the field of crop disease recognition. In existing systems software many implementations of mathematical morphology. Mathematical morphology is applied in many fields such as object edge detection, image segmentation, noise removal, feature extraction, etc.

Highlighting object boundaries

Mathematical morphology depicts and analyzes the image based on set angles, makes a geometric transformation for target objects using a "trial" set (structural element) in order to discard necessary information. Along with continuous development and improvement mathematical theory morphology, Mathematical morphology is researched and widely applied in image edge detection.

Compared with traditional image edge detection algorithms (Sobel operator or Pruitt operator etc.), morphology has a unique advantage in edge detection and achieves best results. Morphological image edge detection method can preserve detailed image characteristics, and solves the problem of coordinating edge detection accuracy and anti-noise performance.

Zhou was the first to do color image processing using grayscale morphology, then used the mathematical morphology method to detect edges, where the structural element was a 3x3 square. This method was able to solve the problems of eliminating noise and detecting pest boundaries in stored grain. Kang in 2006 proposed an advanced method for detecting object contours using mathematical morphology in order to solve the problem of the quality of object boundary recognition. The choice of operator distance definition was given and the concept of multi-resolution analysis was applied in an extended morphological method. The results showed that this method has good efficiency.

Feature extraction

In general, feature extraction is a transformation that maps or transfers patterns from high-dimensional spaces to low-dimensional spaces in order to reduce the degree of dimensionality. In the application of agricultural disease recognition, plant characteristics such as color, texture, and shape are widely used. Using mathematical morphology, the IS will extract not only disease texture properties such as energy, entropy, moment of inertia, but also disease shape features such as perimeter, area, degree of roundness, length-to-width ratio. Huang (2007) applied the same method to Phalaenopsis diseases of Phalaenopsis seedlings and obtained functions such as focal point, area, degree of roundness. Zheng et al. used mathematical morphology to achieve four shape functions of cotton using a 3x3 square pattern matrix as the structure element in processing.

Using a search, I was surprised to find that there are no articles on Habré describing the apparatus of mathematical morphology, but this apparatus is indispensable in the field of low-level image processing. If you are interested, please see cat.

Basic definitions

The term morphology refers to the description of the properties of the form and structure of any objects. In the context of computer vision, the term refers to the description of the shape properties of regions in an image. The operations of mathematical morphology were originally defined as operations on sets, but it soon became clear that they were also useful in problems of processing a set of points in two-dimensional space. Sets in mathematical morphology represent objects in an image. It is easy to see that the set of all background pixels of a binary image is one of the options for its complete description.
Primarily, mathematical morphology is used to extract certain properties of an image that are useful for its representation and description. For example, contours, skeletons, convex hulls. Also of interest are morphological methods used at the stages of preliminary and final image processing. For example, morphological filtering, thickening or thinning.
The input data for the apparatus of mathematical morphology are two images: a processed one and a special one, depending on the type of operation and the problem being solved. Such a special image is usually called a primitive or structural element. As a rule, the structural element is much smaller than the image being processed. A structural element can be considered a description of an area with some form. It is clear that the shape can be any, the main thing is that it can be represented as a binary image of a given size. In many image processing packages, the most common structural elements have special names: BOX - a rectangle of a given size, DISK[R] - a disk of a given size, RING[R] - a ring of a given size.

The result of morphological processing depends both on the size and configuration of the original image, and on the structural primitive.
The size of the structural element is usually 3*3, 4*4 or 5*5 pixels. This is due to the main idea of ​​morphological processing, during which characteristic details of the image are found. The desired detail is described by a primitive, and as a result of morphological processing, such details can be emphasized or removed from the entire image.
One of the main advantages of morphological processing is its simplicity: at both the input and output of the processing procedure we receive a binarized image. Other methods, as a rule, first obtain a grayscale image from the original image, which is then reduced to binary using a threshold function.

Basic Operations

The main operations of mathematical morphology are growth, erosion, closure and opening. These names reflect the essence of the operations: growing enlarges the image area, and eroding makes it smaller; the closing operation allows you to close the internal holes of the area and eliminate fills along the border of the area; the opening operation helps to get rid of small fragments protruding out of the area near its border. Next we will present mathematical definitions morphological operations.
Union, intersection, addition, difference
Before moving on to the operations of morphology, it makes sense to consider the set-theoretic operations that underlie mathematical morphology.
The union of two sets A and B, which is denoted by C=A∪B, is by definition the set of all elements belonging to either set A, or set B, or both sets simultaneously. Similarly, the intersection of two sets A and B, which is denoted by C=A∩B, is by definition the set of all elements that simultaneously belong to both sets A and B. The complement of a set A is the set of elements not contained in A: A c =(w| w∉A). The difference of two sets A and B is denoted by A\B and is defined as follows: A\B=(w│w∈A,w∉B)=A∩B c . This set consists of elements of A that are not included in set B.
Let's consider all the above operations on specific example.
Transfer
The operation of transferring X t of a set of pixels X to a vector t is specified as X t =(x+t|x∈X). Therefore, moving a set of single pixels in a binary image shifts all the pixels of the set by a given distance. The translation vector t can be specified as an ordered pair (∆r,∆c), where ∆r is the component of the translation vector in the row direction, and ∆c is the component of the translation vector in the direction of the columns of the image.
Buildup, erosion, short circuit, open circuit
We will consider the following operations using a specific example. Let us have the following binary image and structural element:

Building up
The structure element S is applied to all pixels of the binary image. Each time the origin of a structural element is aligned with a single binary pixel, a translation and subsequent logical addition is applied to the entire structural element with the corresponding pixels of the binary image. The results of logical addition are written to the output binary image, which is initially initialized with zero values.
Erosion
When performing the erosion operation, the structural element also passes through all the pixels of the image. If at some position each single pixel of the structural element coincides with a single pixel of the binary image, then a logical addition of the central pixel of the structural element is performed with the corresponding pixel of the output image.

As a result of applying the erosion operation, all objects smaller than the structural element are erased, objects connected by thin lines become disconnected, and the sizes of all objects are reduced.
Opening
The erosion operation is useful for removing small objects and various noises, but this operation has the disadvantage that all remaining objects are reduced in size. This effect can be avoided if, after the erosion operation, a build-up operation is used with the same structural element.
Unlocking eliminates all objects smaller than the structural element, but at the same time helps to avoid greatly reducing the size of objects. Breaking is also ideal for removing lines whose thickness is less than the diameter of the structural element. It is also important to remember that after this operation the contours of objects become smoother.
Closure
If we first apply the growth operation to the image, then we can get rid of small holes and cracks, but at the same time the outline of the object will increase. This increase can be avoided by erosion surgery performed immediately after extension with the same structural element.

Conditional buildup

One of the typical applications of binary morphology is the selection of components in a binary image whose shape and size satisfy given restrictions. In many similar problems, it is possible to construct a structural element that, when applied to a binary image, removes components that do not satisfy the constraints and leaves a few single pixels corresponding to the components that satisfy the constraints. But subsequent processing may require entire components, and not just their fragments remaining after erosion. To solve this problem, a conditional increment operation was introduced.
The set obtained as a result of erosion is cyclically increased by the structural element S, and at each step the result is reduced to a subset of pixels that have unit values ​​in the original image B. The operation of conditional increasing is explained in the figure below. In this figure, binary image B has been eroded by V to extract components containing 3-pixel-high vertical fragments. The resulting image C has two such components. To highlight these components entirely, image C is conditionally augmented by element D relative to the original image B.

Border selection

Morphological operations can also be used to highlight the boundaries of a binary object. This operation is very important because the boundary is a complete and at the same time very compact description of the object.
It is easy to notice that the boundary points have at least one background pixel in their vicinity. Thus, by applying the erosion operator with a structural element containing all possible neighboring elements, we will remove all the boundary points... Then the boundary is obtained using the set difference operation between the original image and the image obtained as a result of erosion.

Thus, we have looked at the basic operations of mathematical morphology, and several ways to apply them. I hope this device will be useful to you in your future activities.

Definition Morphology (from the Greek morphe - form) can
stands for “form”, “structure”.
Mathematical morphology is intended for
studies of the structure of some sets
objects of the same type. Any image in
computer graphics are also usually
is represented as a set of pixels, so
operations of mathematical morphology can
be applied to the image - for
research of some properties of its form and
structure, as well as for its processing.

Definition 2

Mathematical morphology (MM) -
(Morphology from Greek μορφή “form” and λογία
"science") - theory and technology of analysis and processing
geometric structures based on theory
sets, topology and random functions. IN
Mainly used in digital processing
images, but can also be applied
on graphs, polygonal mesh, stereometry and
many other spatial structures.

Basic operations on sets

An example of combining images based on logical operations

Basic Concepts

Binary data is taken as input data
image B and some structural element S.
The result of the operation is also binary
image.
A structural element is also some kind of binary
image ( geometric shape– shape). He can
be of arbitrary size and arbitrary structure.
Most often, symmetrical elements are used, such as
fixed size rectangle or circle
some diameter. Each element is highlighted
a special point called origin. She can
be located anywhere in the element, although
symmetrical this is usually the central pixel.

SE = strel(shape, parameters)

Examples of structural elements

Algorithm

At the beginning, the resulting surface is filled with 0, forming
fully black image. Then probing is carried out
(probing) or scanning the original image pixel by pixel
pixel structural element. To probe everyone
pixel a structural element is “superimposed” on the image so that
so that the probed and starting points are aligned. Then
a certain condition is checked for matching pixels
structural element and image points “underneath it”. If the condition
is performed, then on the resulting image in the corresponding
place 1 is placed (in some cases more than one will be added
single pixel, and all ones are from a structural element).

Dilatation - building up

B S Sb
b B
filling the “holes” with a certain
shape and size specified
structural element

Erosion - narrowing

B S (b | b s B s S)
deleting objects of a certain
shape and size specified
structural element

Closing

B S (B S) S
smooths out the contours of an object
“fills” narrow gaps and narrow
recesses
eliminates small holes
fills the gaps of the outline

Opening

B S (B S) S
smooths out the contours of an object
breaks off narrow isthmuses
eliminates narrow ledges

Comparison of making and breaking

Border selection

A pair of binary images can also be
apply ordinary set-theoretic
logical operations like AND, OR, NOT, MINUS.
Border selection:
В\(B-S) – internal boundary;
(B S)\B is the outer boundary.

Conversion success/failure (hit-or-miss)

The task is to find in the image
location of objects given
forms
Composite structural is used
element: B1 – to highlight the object, B2 to highlight the background

Examples

– Get outer and inner boundaries
– Carry out skeletonization
– Select objects and compare with your results
(additionally)
For work you can use a binary image
https://yadi.sk/i/jXKrtZcTbskTR
Process newspaper article headlines

- no pictures)

Introduction:

The word “Morphology” can be deciphered as “form”, “structure”. Mathematical morphology is intended to study the structure of certain sets of similar objects. Any image in computer graphics is also usually represented as a set of pixels, so the operations of mathematical morphology can be applied to the image to study some of the properties of its shape and structure.

The meaning of morphology operations

We will consider the morphology of binary images. A binary image is represented as an ordered set (ordered set) of black-and-white dots (pixels), or 0s and 1s. Below the area ( region ) images are usually understood to be some subset of a 1-check image. Each operation of binary morphology is some transformation of this set. A binary image is taken as input data B and some structural element S . The result of the operation is also a binary image.

Structural element essence is also some binary image (geometric form - shape ). It can be of any size and structure. Most often, symmetrical elements are used, such as a rectangle of a fixed size ( BOX(l,w )), or a circle of some diameter ( DISK (d )). Each element has a special point called primary (origin ). It can be located anywhere in the element, although in symmetrical ones it is usually the central pixel.

At the beginning, the resulting surface is filled with 0, producing a completely black image. Then it is carried out probing (probing ) or scanning the original image pixel by pixel with a structural element. To probe each pixel, a structural element is “overlaid” on the image so that the probed and starting points are aligned. Then a certain condition is checked for the correspondence of the pixels of the structural element and the image points “under it”. If the condition is met, then 1 is placed in the corresponding place in the resulting image (in some cases, not just one single pixel will be added, but all the ones from the structural element).

According to the scheme discussed above, basic (basic ) operations. Such operations are expansion ( dilation) and narrowing (erosion). Derived operations are some combination of basic operations performed sequentially. The main ones are the discovery ( opening) and closing (closing).

Basic Operations

Def: Transfer(translation ) set of pixels X by vector t defined as

Transfer t can be defined as an ordered pair of numbers, where is the movement along the x-axis, and is the movement along the x-axis y.

Def: Binary image extension B per structural element S is written in the form and defined as:

If, during probing, the starting point of a structural element is superimposed on 1, then the entire structural element is recorded in the resulting image. Thus, when performing expansion, the image dimensions increase.

Def: Binary image narrowing B per structural element S

Those. it checks that every 1 in the structural element overlaps with the 1 in the original image. If this condition is met, then the pixel under the starting point of the structural element is written to the resulting image.

Def: Closing binary B per structural element S is written as and defined:

The close operation “closes” small internal “holes” in the image, and removes indentations ( bays ) along the edges of the area.

Def: Open binary B per structural element S written as and defined as:

Opening allows you to get rid of small pieces of the image that extend beyond the border of the area.

The usual set-theoretic logical operations can also be applied to a pair of binary images, such as AND, OR, NOT, MINUS.

Skeletonization

To recognize an object, it is often necessary to study its shape. It is convenient to represent it in the form of some “skeleton” (in other words, the median, or the middle axis of the form). It turned out that by combining several operations of mathematical morphology, one can obtain a derivative that allows one to isolate its “skeleton” from an object, and it, accordingly, received the name “skeletonization”.

nth element of the skeleton S images X by structural element Q is called

where N- max(n: X-nQ != /0),

Not equal

/0 – empty set

/ - set-theoretic subtraction

(X*nQ , where * is the sign of the operation, denotes the sequential application of the operation to the image n times)

Then partial skeleton S(k) images X by structural element Q let's call the union

The method of mathematical morphology for selecting a skeleton is convenient in that by applying the expansion operation using the same structural element to the skeleton, we can restore the original image. Therefore, the concept of reconstructing a discovery based on the skeleton is introduced. S structural element Q:

If k equals 0, then , and the reconstruction is called accurate. If , then we get partial reconstruction, i.e. opening (smoothing) X to kQ. Varying k we can receive various degrees smoothing the original image X.

On the image:

(a) - Constrictions

(b ) - Expansion openings

(с) – n -th elements of the skeleton

(d ) – extended skeletal elements

(e ) – partial unions of skeletal elements

(f ) – partial extensions

Example of using operations :

Application of binary morphology

Most images obtained during processing and studying real objects contain many small errors and inaccuracies. Individual parts or components of images that carry the most important information for us can easily be identified by the eye based on specific features of their structure and organization. At the same time, these components in the image may not have clearly defined boundaries or be connected by jumpers or transitions, which significantly complicates their machine processing. In this case, the tools of mathematical morphology come to the rescue.

Closing and opening operations allow you to get rid of small “holes”, thin bridges and protrusions. Combinations of expansion and contraction using different structural elements can “select” from the image areas of units of the required size that meet certain shape criteria, and “smooth” the contours of the components.

Mathematical morphology is also used for pattern recognition. Its operations make it possible to extract the simplest properties of an object’s geometry from an image, which can later serve as the basis for its recognition. For example, if an area with sharp corners will be opened using a structural element - a disk, an image with rounded corners will be obtained. If you subtract the result from the original, only the angles will remain.

Conditional expansion

Def : Conditional expansion binary image C per structural element S from the original binary image B defined as:

where index m – the minimum index at which

Conditional expansion is used when, after narrowing the image, it is necessary to expand it only with those pixels that were included in the original image

Exercise

Purpose of the task:

Solve a certain problem (skeleton selection - skeletonization) using mathematical morphology. Thus, the task can be divided into two:
Task No. 1 Implement basic operations of mathematical morphology (expansion, contraction, opening, closing) (5 points)
Task No. 2 Implement the skeletonization operation and expand it along the same structural element to the original image. (+ 5 points)

The convenience of the interface and the beauty of the data output are taken into account.

Interface:

The program interface must allow the input of an image and the application of a sequence of operations to it. There should be two images on the screen - the original and the received. If the source image is not entered, then the previously obtained image becomes the source image for the operation. It should be possible to enter an arbitrary structural element. The default structural element is square
3*3, filled with ones with the starting point in the center of the square.

Formatting the assignment:

See previous assignment and faq.