CN112862841A - Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold - Google Patents
Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold Download PDFInfo
- Publication number
- CN112862841A CN112862841A CN202110382656.4A CN202110382656A CN112862841A CN 112862841 A CN112862841 A CN 112862841A CN 202110382656 A CN202110382656 A CN 202110382656A CN 112862841 A CN112862841 A CN 112862841A
- Authority
- CN
- China
- Prior art keywords
- image
- cotton
- reconstruction
- segmentation
- morphological reconstruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 229920000742 Cotton Polymers 0.000 title claims abstract description 91
- 238000000034 method Methods 0.000 title claims abstract description 67
- 230000000877 morphologic effect Effects 0.000 title claims abstract description 43
- 238000003709 image segmentation Methods 0.000 title claims abstract description 32
- 230000003044 adaptive effect Effects 0.000 title claims abstract description 22
- 230000011218 segmentation Effects 0.000 claims abstract description 35
- 230000009466 transformation Effects 0.000 claims abstract description 30
- 238000001914 filtration Methods 0.000 claims abstract description 18
- 238000012545 processing Methods 0.000 claims abstract description 13
- 230000015654 memory Effects 0.000 claims description 18
- 239000003550 marker Substances 0.000 claims description 11
- 230000008569 process Effects 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 9
- 238000003860 storage Methods 0.000 claims description 5
- 238000000605 extraction Methods 0.000 claims description 3
- 230000007797 corrosion Effects 0.000 claims description 2
- 238000005260 corrosion Methods 0.000 claims description 2
- 238000005286 illumination Methods 0.000 description 4
- 239000006002 Pepper Substances 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 230000001186 cumulative effect Effects 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000002708 enhancing effect Effects 0.000 description 2
- 230000001965 increasing effect Effects 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 235000002566 Capsicum Nutrition 0.000 description 1
- 235000016761 Piper aduncum Nutrition 0.000 description 1
- 235000017804 Piper guineense Nutrition 0.000 description 1
- 244000203593 Piper nigrum Species 0.000 description 1
- 235000008184 Piper nigrum Nutrition 0.000 description 1
- 238000012271 agricultural production Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000006740 morphological transformation Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 150000003839 salts Chemical class 0.000 description 1
- 238000012549 training Methods 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/77—Retouching; Inpainting; Scratch removal
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/155—Segmentation; Edge detection involving morphological operators
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a cotton image segmentation method and a system based on morphological reconstruction and adaptive threshold, comprising the following steps: acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space; extracting a saturation S component of a cotton image in an HSV color space; filtering the saturation component image to remove random noise in the image; performing morphological reconstruction on the filtered image to remove dark points and flaws in the image; carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region; and performing threshold segmentation on the image subjected to gray level transformation to obtain a segmentation result of the cotton image. Improve the cotton segmentation precision in natural environment.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a cotton image segmentation method and system based on morphological reconstruction and adaptive threshold.
Background
The statements in this section merely provide background information related to the present disclosure and may not constitute prior art.
With the rapid development of scientific technology, the intelligent picking robot is increasingly applied to agricultural production, and the research and development of the cotton picking robot have great practical significance and wide application prospect. The cotton picking robot firstly solves the problem of segmenting a cotton image from a complex environment background in the cotton picking process. The quality of the cotton image segmentation effect directly influences the accuracy of the picking system.
The current cotton target segmentation method is still in the research and exploration stage: many traditional image processing methods are greatly influenced by illumination and environmental background, and are difficult to accurately segment cotton in various complex natural environments; the image segmentation method based on deep learning needs to be based on a large number of marked images, and has the disadvantages of large calculated amount, long model training time, high requirement on hardware configuration and difficult application to cotton image segmentation.
Disclosure of Invention
In order to solve the defects of the prior art, the invention provides a cotton image segmentation method and a cotton image segmentation system based on morphological reconstruction and adaptive threshold; improve the cotton segmentation precision in natural environment.
In a first aspect, the invention provides a cotton image segmentation method based on morphological reconstruction and adaptive threshold;
the cotton image segmentation method based on morphological reconstruction and adaptive threshold comprises the following steps:
acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space;
extracting a saturation S component of a cotton image in an HSV color space;
filtering the saturation component image to remove random noise in the image;
performing morphological reconstruction on the filtered image to remove dark points and flaws in the image;
carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region;
and performing threshold segmentation on the image subjected to gray level transformation to obtain a segmentation result of the cotton image.
In a second aspect, the present invention provides a cotton image segmentation system based on morphological reconstruction and adaptive thresholding;
a cotton image segmentation system based on morphological reconstruction and adaptive threshold comprises:
an acquisition module configured to: acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space;
a saturation component extraction module configured to: extracting a saturation S component of a cotton image in an HSV color space;
a filtering module configured to: filtering the saturation component image to remove random noise in the image;
a morphological reconstruction module configured to: performing morphological reconstruction on the filtered image to remove dark points and flaws in the image;
a grayscale transformation module configured to: carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region;
an image segmentation module configured to: and performing threshold segmentation on the image subjected to gray level transformation to obtain a segmentation result of the cotton image.
In a third aspect, the present invention further provides an electronic device, including: one or more processors, one or more memories, and one or more computer programs; wherein a processor is connected to the memory, the one or more computer programs are stored in the memory, and when the electronic device is running, the processor executes the one or more computer programs stored in the memory, so as to make the electronic device execute the method according to the first aspect.
In a fourth aspect, the present invention also provides a computer-readable storage medium for storing computer instructions which, when executed by a processor, perform the method of the first aspect.
Compared with the prior art, the invention has the beneficial effects that:
the S saturation channel is extracted based on the HSV color space, so that the cotton and the background can be better distinguished, and the influence of illumination factors can be eliminated. Speckle noise and salt and pepper noise brought in during image acquisition can be effectively removed based on median filtering. The image reconstruction based on the open operation and the closed operation can effectively remove small flaws in the image, does not influence the overall shape of the segmentation target, and generates an image which is uniform in gray quality and easy to segment. The contrast between the cotton object and the background can be effectively increased based on the gray scale transformation. Threshold segmentation is carried out on the image based on an Otsu method, and the cotton image can be effectively segmented. The method can be suitable for segmenting the cotton image in the natural environment.
Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the invention and together with the description serve to explain the invention and not to limit the invention.
FIG. 1 is a flow chart of the method of the first embodiment.
Detailed Description
It is to be understood that the following detailed description is exemplary and is intended to provide further explanation of the invention as claimed. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the invention. As used herein, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and it should be understood that the terms "comprises" and "comprising", and any variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiments and features of the embodiments of the present invention may be combined with each other without conflict.
Example one
The embodiment provides a cotton image segmentation method based on morphological reconstruction and adaptive threshold;
as shown in fig. 1, the cotton image segmentation method based on morphological reconstruction and adaptive threshold includes:
s101: acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space;
s102: extracting a saturation S component of a cotton image in an HSV color space;
s103: filtering the saturation component image to remove random noise in the image;
s104: performing morphological reconstruction on the filtered image to remove dark points and flaws in the image;
s105: carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region;
s106: and performing threshold segmentation on the image subjected to gray level transformation to obtain a segmentation result of the cotton image.
Further, the step S101: acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space; the method specifically comprises the following steps:
wherein R, G, B are the original image color components respectively,h is the transformed image hue component, S is the transformed image saturation component, and V is the transformed image luminance component.
It should be understood that the present invention is based on processing RGB cotton images acquired by a vision sensor. Because the cotton area in the original RGB image is easily interfered by uneven illumination and complex background, the segmentation effect of the cotton image is affected, and the image needs to be adjusted to a color space capable of effectively extracting a cotton target. The HSV color space more closely resembles the way human eyes perceive colors.
It should be understood that, the S102: extracting a saturation S component of a cotton image in an HSV color space; the method specifically comprises the following steps:
in natural environment, cotton and background have large difference in color, and the white color of cotton is an important characteristic for segmentation. In HSV color space, white features can be taken from the luminance V, but the luminance V is greatly affected by illumination changes, which should be excluded from image segmentation. The S saturation channel is extracted based on the HSV color space, the S value of a cotton area in the image is far smaller than that of a background area, and image segmentation is facilitated.
Further, the step S103: filtering the saturation component image to remove random noise in the image; the method specifically comprises the following steps:
and performing median filtering processing on the saturation component image to remove random noise in the image.
Illustratively, the invention performs median filtering denoising based on the extracted S-channel image to remove random noise possibly brought in during image acquisition. The median filtering is a nonlinear digital filter which can effectively remove speckle noise and salt-pepper noise and has small ambiguity. Median filtering is the replacement of the pixel value by the grey median in a predefined neighborhood of pixels, i.e.
Wherein S isxyIs a sub-image (neighborhood) of the center (x, y), r and c are neighborhoods SxyThe row coordinates and the column coordinates of the pixels included in (c), and the pixel value at (x, y) is included in calculating the median.
Further, the S104: performing morphological reconstruction on the filtered image to remove dark points and flaws in the image; the method specifically comprises the following steps:
s1041: performing open operation reconstruction on the image;
s1042: and performing closed operation reconstruction on the image subjected to the open operation reconstruction.
Further, the S1041: performing open operation reconstruction on the image; the method specifically comprises the following steps:
the open operation reconstruction is a process of firstly corroding and then reconstructing: firstly, the structural element is used for carrying out corrosion operation on an original image, namely a template image, and then reconstruction operation is carried out on the corroded image as a marked image.
Further, the S1042: performing closed operation reconstruction on the image subjected to the open operation reconstruction; the method specifically comprises the following steps:
the closed operation reconstruction is to process the image after the open operation reconstruction, firstly perform expansion operation on the image, then respectively perform negation operation on the image before expansion and the image after expansion, and take the result of the negation operation on the image before expansion as a new template image; taking the result of the inverse operation of the expanded image as a marked image; and then carrying out reconstruction operation.
Further, the reconstructing; the method specifically comprises the following steps:
(1): initializing h1 to marker image f; the label image f must be a subset of the template image g, i.e.h1 represents the most primitive label image;
(2): creating a structural element b, and adopting a disc-shaped structural element with the radius of 10 pixels;
(3): iteration hk+1=(hk^ b) # g, up to hk+1=hk,hkRepresenting the marker image that passed the k-th iteration; b is a structural element. And the intersection operation ensures that the template image g limits the growth of the marker image h until the marker image h is not changed after iteration, and the reconstruction is finished.
The marker image refers to the starting point of the morphological reconstruction transform, and the template image refers to the image used to constrain the transformation process.
In the process of open operation reconstruction, the original image is used as a template image to restrict the reconstruction transformation process, and the template image is corroded by using the structural elements. The eroded image is taken as a marker image, i.e. the starting point of the reconstruction transformation. And then carrying out reconstruction operation under the condition of the constraint of the template image.
Unlike open and closed operations, which involve only one image and one structural element, reconstruction is a morphological transformation involving two images and one structural element. In reconstruction, one image is a marker image, is a starting point of reconstruction, and is denoted by f; the other image is a template image which is used for constraining reconstruction and is represented by g; the structural element is used to define connectivity, denoted by b.
It should be understood that the present invention performs morphological reconstruction based on the denoised image, and aims to simplify the image, remove noise in the image and some information that is not meaningful for segmentation, and make the image easier to segment.
It will be appreciated that the open and close operation reconstructions are more effective in removing small defects, progressively merging light and dark flattened regions smaller than the structural elements into surrounding regions, and without affecting the overall shape of the segmented object, as compared to standard open and close operations, and produce images that are uniform in grayscale quality and easy to segment.
Further, the step S105: carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region; the method specifically comprises the following steps:
setting the gray value of a pixel point below 200 as 0, and mapping the gray value of the pixel between 200 and 255 to a gray space.
It will be appreciated that the present invention performs a grey scale transformation on the morphologically reconstructed image with the aim of increasing the contrast between the cotton object and the background. The gray scale conversion is a method of changing the gray scale value of each pixel in the original image point by point according to a certain conversion relation based on a certain target condition. Enhancing image contrast is actually enhancing the contrast between parts in the image by changing the dynamic range between gray values in the image, i.e. contrast stretching.
Since the pixel gray values of cotton are mostly concentrated between 200 and 255, the contrast is not high. The invention sets the gray value of the pixel point below 200 as 0, and maps the gray value of the pixel point between 200 and 255 to a larger gray space, and the formula is as follows:
where f (x, y) is the gray scale value of a certain point of the original image, and g (x, y) is the gray scale value after mapping. The image after the gray level transformation can effectively increase the image contrast and is beneficial to subsequent image segmentation.
Further, the step S106: performing threshold segmentation on the image after gray level transformation to obtain a segmentation result of the cotton image; the method specifically comprises the following steps:
and performing threshold segmentation on the image subjected to gray level transformation based on an Otsu method to obtain a segmentation result of the cotton image.
Further, the step S106: performing threshold segmentation on the image after gray level transformation to obtain a segmentation result of the cotton image; the method specifically comprises the following steps:
s1061: taking the image after gray level transformation as an input image, and calculating a normalized histogram of the input image;
s1062: respectively selecting one of all L possible k values; assume that a threshold k, c has been selected1Is a gray scale value of [0,1,2, …, k]A group of pixels of c2Is a gray value of [ k +1, …, L-1]A group of pixels within. The pixels are divided into c1Probability P of class1(k) The cumulative sum is calculated from:
s1063: the cumulative average gray value m (k) up to k levels, k being 0,1,2, …, L-1, is calculated as follows:
s1064: calculating the average gray value m of the whole imageGK is 0,1,2, …, L-1, calculated as follows:
s1065: calculating the between-class variance σB 2(k) K is 0,1,2, …, L-1, calculated as follows:
s1066: calculating to obtain sigmaB 2(k) The k value at the maximum is used as a segmentation threshold of the Otsu method; if it is the most importantIf the large value is not unique, then the threshold used is the average of all the best k values found;
s1067: and segmenting the image into two parts, namely cotton and background, based on the threshold obtained in the step S1066, thereby obtaining a cotton image segmentation result.
Normalized histogram refers to the division of the number of pixels per gray value on the image histogram by the sum of the number of pixels of all gray values, the component of the normalized histogram being an estimate of the probability of the gray value appearing in the image.
The invention performs threshold segmentation by adopting an Otsu method based on the image after gray level transformation. The Otsu method is a global adaptive threshold segmentation method which takes a variance method between maximum classes as a threshold selection criterion.
The idea of the maximization of the between-class variance is that the larger the variance, the closer to the threshold for correctly segmenting the image. This optimal measure is based entirely on the parameters derived from the histogram of the image.
Using piI-0, 1,2, …, L-1 represents each component of the histogram. The threshold k is the interval [0, L-1 ]]An integer within, find the largest between-class variance σB 2(k) The process comprises the following steps:
one of all L possible k values is selected, respectively, and the corresponding variance of each k value is calculated.
Selection giving maximum σB 2(k) K value, which is the optimal threshold.
If the maximum is not unique, then the threshold used is the average of all the best k values found.
Example two
The embodiment provides a cotton image segmentation system based on morphological reconstruction and adaptive threshold;
a cotton image segmentation system based on morphological reconstruction and adaptive threshold comprises:
an acquisition module configured to: acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space;
a saturation component extraction module configured to: extracting a saturation S component of a cotton image in an HSV color space;
a filtering module configured to: filtering the saturation component image to remove random noise in the image;
a morphological reconstruction module configured to: performing morphological reconstruction on the filtered image to remove dark points and flaws in the image;
a grayscale transformation module configured to: carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region;
an image segmentation module configured to: and performing threshold segmentation on the image subjected to gray level transformation to obtain a segmentation result of the cotton image.
It should be noted here that the acquiring module, the saturation component extracting module, the filtering module, the morphological reconstructing module, the gray scale transforming module and the image dividing module correspond to steps S101 to S106 in the first embodiment, and the modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the modules described above as part of a system may be implemented in a computer system such as a set of computer-executable instructions.
In the foregoing embodiments, the descriptions of the embodiments have different emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The proposed system can be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the above-described modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules may be combined or integrated into another system, or some features may be omitted, or not executed.
EXAMPLE III
The present embodiment also provides an electronic device, including: one or more processors, one or more memories, and one or more computer programs; wherein, a processor is connected with the memory, the one or more computer programs are stored in the memory, and when the electronic device runs, the processor executes the one or more computer programs stored in the memory, so as to make the electronic device execute the method according to the first embodiment.
It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general purpose processors, digital signal processors DSP, application specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and so on. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may include both read-only memory and random access memory, and may provide instructions and data to the processor, and a portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information.
In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software.
The method in the first embodiment may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor. The software modules may be located in ram, flash, rom, prom, or eprom, registers, among other storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor. To avoid repetition, it is not described in detail here.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
Example four
The present embodiments also provide a computer-readable storage medium for storing computer instructions, which when executed by a processor, perform the method of the first embodiment.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. The cotton image segmentation method based on morphological reconstruction and adaptive threshold is characterized by comprising the following steps:
acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space;
extracting a saturation S component of a cotton image in an HSV color space;
filtering the saturation component image to remove random noise in the image;
performing morphological reconstruction on the filtered image to remove dark points and flaws in the image;
carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region;
and performing threshold segmentation on the image subjected to gray level transformation to obtain a segmentation result of the cotton image.
2. The cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 1, wherein the saturation component image is filtered to remove random noise in the image; the method specifically comprises the following steps:
and performing median filtering processing on the saturation component image to remove random noise in the image.
3. The cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 1, wherein the filtered image is morphologically reconstructed to remove dark spots and flaws in the image; the method specifically comprises the following steps:
performing open operation reconstruction on the image;
and performing closed operation reconstruction on the image subjected to the open operation reconstruction.
4. The cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 3, wherein the image is reconstructed by an open operation; the method specifically comprises the following steps:
the open operation reconstruction is a process of firstly corroding and then reconstructing: firstly, the structural element is used for carrying out corrosion operation on an original image, namely a template image, and then reconstruction operation is carried out on the corroded image as a marked image.
5. The cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 3, wherein the reconstructed image is reconstructed by closed operation; the method specifically comprises the following steps:
the closed operation reconstruction is to process the image after the open operation reconstruction, firstly perform expansion operation on the image, then respectively perform negation operation on the image before expansion and the image after expansion, and take the result of the negation operation on the image before expansion as a new template image; and taking the result of the inverse operation of the expanded image as a marked image, and then performing reconstruction operation.
6. The cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 4 or 5, characterized in that the reconstruction; the method specifically comprises the following steps:
(1): initializing h1 to marker image f; the label image f must be a subset of the template image g, i.e.h1 represents the most primitive label image;
(2): creating a structural element b, and adopting a disc-shaped structural element with the radius of 10 pixels;
(3): iteration hk+1=(hk^ b) # g, up to hk+1=hk,hkRepresenting the marker image that passed the k-th iteration; b is a structural element;
and the intersection operation ensures that the template image g limits the growth of the marker image h until the marker image h is not changed after iteration, and the reconstruction is finished.
7. The cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 1, wherein the segmentation of the gray-level transformed image is performed by a threshold to obtain the segmentation result of the cotton image; the method specifically comprises the following steps:
and performing threshold segmentation on the image subjected to gray level transformation based on an Otsu method to obtain a segmentation result of the cotton image.
8. The cotton image segmentation system based on morphological reconstruction and adaptive threshold is characterized by comprising the following steps:
an acquisition module configured to: acquiring an image of cotton to be processed; converting the cotton image to be processed from RGB color space to HSV color space;
a saturation component extraction module configured to: extracting a saturation S component of a cotton image in an HSV color space;
a filtering module configured to: filtering the saturation component image to remove random noise in the image;
a morphological reconstruction module configured to: performing morphological reconstruction on the filtered image to remove dark points and flaws in the image;
a grayscale transformation module configured to: carrying out gray level transformation on the image subjected to morphological reconstruction processing so as to enhance the contrast between the cotton region and the background region;
an image segmentation module configured to: and performing threshold segmentation on the image subjected to gray level transformation to obtain a segmentation result of the cotton image.
9. An electronic device, comprising: one or more processors, one or more memories, and one or more computer programs; wherein a processor is connected to the memory, the one or more computer programs being stored in the memory, the processor executing the one or more computer programs stored in the memory when the electronic device is running, to cause the electronic device to perform the method of any of the preceding claims 1-7.
10. A computer-readable storage medium storing computer instructions which, when executed by a processor, perform the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110382656.4A CN112862841A (en) | 2021-04-09 | 2021-04-09 | Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110382656.4A CN112862841A (en) | 2021-04-09 | 2021-04-09 | Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112862841A true CN112862841A (en) | 2021-05-28 |
Family
ID=75992370
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110382656.4A Pending CN112862841A (en) | 2021-04-09 | 2021-04-09 | Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112862841A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113658143A (en) * | 2021-08-19 | 2021-11-16 | 济南大学 | Method and system for detecting impurity content of mechanically-harvested seed cotton |
CN114463308A (en) * | 2022-02-09 | 2022-05-10 | 广东数字生态科技有限责任公司 | Visual detection method, device and processing equipment for visual angle photovoltaic module of unmanned aerial vehicle |
CN116668862A (en) * | 2022-12-08 | 2023-08-29 | 荣耀终端有限公司 | Image processing method and electronic equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102930547A (en) * | 2012-11-13 | 2013-02-13 | 中国农业大学 | Cotton foreign fiber image online segmentation method and system on the condition of wind power delivery |
CN106296702A (en) * | 2016-08-15 | 2017-01-04 | 中国农业科学院农业信息研究所 | Cotton Images dividing method and device under natural environment |
CN109146878A (en) * | 2018-09-30 | 2019-01-04 | 安徽农业大学 | A kind of method for detecting impurities based on image procossing |
-
2021
- 2021-04-09 CN CN202110382656.4A patent/CN112862841A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102930547A (en) * | 2012-11-13 | 2013-02-13 | 中国农业大学 | Cotton foreign fiber image online segmentation method and system on the condition of wind power delivery |
CN106296702A (en) * | 2016-08-15 | 2017-01-04 | 中国农业科学院农业信息研究所 | Cotton Images dividing method and device under natural environment |
CN109146878A (en) * | 2018-09-30 | 2019-01-04 | 安徽农业大学 | A kind of method for detecting impurities based on image procossing |
Non-Patent Citations (4)
Title |
---|
吴晓元 等: "Faster R-CNN定位后的工业CT图像缺陷分割算法", 《计算机技术与应用》 * |
邓超 等: "《数字图像处理与模式识别研究》", 30 June 2018 * |
韦皆顶 等: "基于HSV彩色模型的自然场景下棉花图像分割策略研究", 《棉花学报》 * |
黄靖 等: "基于形态学重建与OTSU的极耳焊缝图像分割的方法" * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113658143A (en) * | 2021-08-19 | 2021-11-16 | 济南大学 | Method and system for detecting impurity content of mechanically-harvested seed cotton |
CN114463308A (en) * | 2022-02-09 | 2022-05-10 | 广东数字生态科技有限责任公司 | Visual detection method, device and processing equipment for visual angle photovoltaic module of unmanned aerial vehicle |
CN116668862A (en) * | 2022-12-08 | 2023-08-29 | 荣耀终端有限公司 | Image processing method and electronic equipment |
CN116668862B (en) * | 2022-12-08 | 2024-04-12 | 荣耀终端有限公司 | Image processing method and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112862841A (en) | Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold | |
CN109558806B (en) | Method for detecting high-resolution remote sensing image change | |
CN105654436B (en) | A kind of backlight image enhancing denoising method based on prospect background separation | |
CN109903301B (en) | Image contour detection method based on multistage characteristic channel optimization coding | |
CN110232389B (en) | Stereoscopic vision navigation method based on invariance of green crop feature extraction | |
CN106709964B (en) | Sketch generation method and device based on gradient correction and multidirectional texture extraction | |
CN103699900B (en) | Building horizontal vector profile automatic batch extracting method in satellite image | |
CN107038416B (en) | Pedestrian detection method based on binary image improved HOG characteristics | |
CN107169977B (en) | Self-adaptive threshold color image edge detection method based on FPGA and Kirsch | |
CN110070548B (en) | Deep learning training sample optimization method | |
CN111223110B (en) | Microscopic image enhancement method and device and computer equipment | |
CN112767369A (en) | Defect identification and detection method and device for small hardware and computer readable storage medium | |
CN112288726B (en) | Method for detecting foreign matters on belt surface of underground belt conveyor | |
CN106157266A (en) | A kind of orchard fruit image acquiring method | |
CN111476758A (en) | Defect detection method and device for AMO L ED display screen, computer equipment and storage medium | |
Srinivas et al. | Remote sensing image segmentation using OTSU algorithm | |
CN106529535A (en) | License plate positioning method in complex lighting environment based on wavelet transform | |
CN113592782A (en) | Method and system for extracting X-ray image defects of composite carbon fiber core rod | |
CN110276759A (en) | A kind of bad line defect diagnostic method of Mobile phone screen based on machine vision | |
CN105373798B (en) | One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor | |
CN118015064A (en) | Image technology-based elliptical target detection method and computer-readable storage medium | |
CN112991359A (en) | Pavement area extraction method, pavement area extraction system, electronic equipment and storage medium | |
Hua et al. | Image segmentation algorithm based on improved visual attention model and region growing | |
CN111739047A (en) | Tongue image segmentation method and system based on bispectrum reconstruction | |
CN116563582A (en) | Image template matching method and device based on domestic CPU and opencv |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210528 |
|
RJ01 | Rejection of invention patent application after publication |