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 PDF

Info

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
Application number
CN202110382656.4A
Other languages
Chinese (zh)
Inventor
杨公平
王冲
孙启玉
宋成秀
褚德峰
张同心
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Fengshi Information Technology Co ltd
Shandong University
Original Assignee
Shandong Fengshi Information Technology Co ltd
Shandong University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shandong Fengshi Information Technology Co ltd, Shandong University filed Critical Shandong Fengshi Information Technology Co ltd
Priority to CN202110382656.4A priority Critical patent/CN112862841A/en
Publication of CN112862841A publication Critical patent/CN112862841A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/155Segmentation; 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

Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold
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:
Figure BDA0003013560050000051
Figure BDA0003013560050000052
Figure BDA0003013560050000053
wherein R, G, B are the original image color components respectively,
Figure BDA0003013560050000054
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.
Figure BDA0003013560050000061
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.
Figure BDA0003013560050000071
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:
Figure BDA0003013560050000081
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:
Figure BDA0003013560050000091
s1063: the cumulative average gray value m (k) up to k levels, k being 0,1,2, …, L-1, is calculated as follows:
Figure BDA0003013560050000092
s1064: calculating the average gray value m of the whole imageGK is 0,1,2, …, L-1, calculated as follows:
Figure BDA0003013560050000093
s1065: calculating the between-class variance σB 2(k) K is 0,1,2, …, L-1, calculated as follows:
Figure BDA0003013560050000094
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.基于形态学重构和自适应阈值的棉花图像分割方法,其特征是,包括:1. A cotton image segmentation method based on morphological reconstruction and adaptive threshold, characterized in that it comprises: 获取待处理棉花图像;将待处理棉花图像由RGB颜色空间转换为HSV颜色空间;Obtain the cotton image to be processed; convert the cotton image to be processed from RGB color space to HSV color space; 提取HSV颜色空间的棉花图像的饱和度S分量;Extract the saturation S component of the cotton image in the HSV color space; 对饱和度分量图像进行滤波处理,以去除图像中的随机噪声;Filter the saturation component image to remove random noise in the image; 对滤波处理后的图像进行形态学重构,以去除图像中的暗点和瑕疵;Morphological reconstruction is performed on the filtered image to remove dark spots and imperfections in the image; 对形态学重构处理后的图像进行灰度变换,以增强棉花区域与背景区域之间的对比度;Perform grayscale transformation on the image after morphological reconstruction to enhance the contrast between the cotton area and the background area; 对灰度变换后的图像进行阈值分割,得到棉花图像的分割结果。Threshold segmentation is performed on the grayscale transformed image to obtain the segmentation result of the cotton image. 2.如权利要求1所述的基于形态学重构和自适应阈值的棉花图像分割方法,其特征是,对饱和度分量图像进行滤波处理,以去除图像中的随机噪声;具体包括:2. the cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 1, it is characterised in that the saturation component image is filtered to remove random noise in the image; specifically comprising: 对饱和度分量图像进行中值滤波处理,以去除图像中的随机噪声。Median filter the saturation component image to remove random noise in the image. 3.如权利要求1所述的基于形态学重构和自适应阈值的棉花图像分割方法,其特征是,对滤波处理后的图像进行形态学重构,以去除图像中的暗点和瑕疵;具体包括:3. the cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 1, is characterized in that, the image after filtering is carried out morphological reconstruction, to remove dark spots and flaws in the image; Specifically include: 对图像进行开运算重构;The image is reconstructed by opening operation; 对开运算重构后的图像,进行闭运算重构。The image reconstructed by the opening operation is reconstructed by the closing operation. 4.如权利要求3所述的基于形态学重构和自适应阈值的棉花图像分割方法,其特征是,对图像进行开运算重构;具体包括:4. the cotton image segmentation method based on morphological reconstruction and self-adaptive threshold as claimed in claim 3, is characterized in that, image is carried out to open arithmetic reconstruction; Concrete comprises: 开运算重构就是先腐蚀后进行重构的过程:首先是利用结构元对原图像,即模板图像进行腐蚀操作,然后将腐蚀后的图像作为标记图像进行重构运算。Open operation reconstruction is the process of first eroding and then reconstructing: first, the original image, that is, the template image, is eroded by using structural elements, and then the eroded image is used as a marked image for reconstruction. 5.如权利要求3所述的基于形态学重构和自适应阈值的棉花图像分割方法,其特征是,对开运算重构后的图像,进行闭运算重构;具体包括:5. the cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 3, it is characterized in that, carry out closing operation reconstruction to the image after opening operation reconstruction; Concrete comprises: 闭运算重构则是基于开运算重构之后的图像进行处理,先对图像进行膨胀操作,然后分别对膨胀前和膨胀后的图像分别进行取反运算,将膨胀前的图像进行反运算的结果,作为新的模板图像;将膨胀后的图像进行反运算的结果,作为标记图像,再进行重构运算。The closed operation reconstruction is to process the image after reconstruction based on the open operation, first perform the dilation operation on the image, and then perform the inverse operation on the image before and after expansion respectively, and inverse the result of the inverse operation on the image before expansion. , as a new template image; the result of inverse operation of the expanded image is used as a marked image, and then the reconstruction operation is performed. 6.如权利要求4或5所述的基于形态学重构和自适应阈值的棉花图像分割方法,其特征是,所述重构;具体包括:6. the cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 4 or 5, it is characterized in that, described reconstruction; Specifically comprises: (1):将h1初始化为标记图像f;标记图像f必须是模板图像g的一个子集,即
Figure FDA0003013560040000021
h1表示最原始的标记图像;
(1): Initialize h1 as the marker image f; the marker image f must be a subset of the template image g, that is
Figure FDA0003013560040000021
h1 represents the most original marked image;
(2):创建结构元b,采用半径为10像素的圆盘形结构元;(2): Create a structure element b, using a disk-shaped structure element with a radius of 10 pixels; (3):迭代hk+1=(hk⊕b)∩g,直到hk+1=hk,hk表示经过第k次迭代的标记图像;b是结构元;(3): Iterate h k+1 =(h k ⊕b)∩g until h k+1 =h k , where h k represents the marked image after the k-th iteration; b is a structural element; 交集运算保证模板图像g限制标记图像h的生长,直到标记图像h迭代之后不再发生变化,重构结束。The intersection operation ensures that the template image g restricts the growth of the marked image h until the marked image h does not change after iteration, and the reconstruction ends.
7.如权利要求1所述的基于形态学重构和自适应阈值的棉花图像分割方法,其特征是,对灰度变换后的图像进行阈值分割,得到棉花图像的分割结果;具体包括:7. the cotton image segmentation method based on morphological reconstruction and adaptive threshold as claimed in claim 1, is characterized in that, the image after grayscale transformation is carried out threshold segmentation, obtains the segmentation result of cotton image; Concrete comprises: 基于Otsu方法,对灰度变换后的图像进行阈值分割,得到棉花图像的分割结果。Based on the Otsu method, threshold segmentation is performed on the grayscale transformed image to obtain the segmentation result of cotton image. 8.基于形态学重构和自适应阈值的棉花图像分割系统,其特征是,包括:8. A cotton image segmentation system based on morphological reconstruction and adaptive threshold, characterized by comprising: 获取模块,其被配置为:获取待处理棉花图像;将待处理棉花图像由RGB颜色空间转换为HSV颜色空间;an acquisition module, which is configured to: acquire the cotton image to be processed; convert the cotton image to be processed from the RGB color space to the HSV color space; 饱和度分量提取模块,其被配置为:提取HSV颜色空间的棉花图像的饱和度S分量;a saturation component extraction module configured to: extract the saturation S component of the cotton image in the HSV color space; 滤波模块,其被配置为:对饱和度分量图像进行滤波处理,以去除图像中的随机噪声;a filtering module, which is configured to: filter the saturation component image to remove random noise in the image; 形态学重构模块,其被配置为:对滤波处理后的图像进行形态学重构,以去除图像中的暗点和瑕疵;a morphological reconstruction module, which is configured to: perform morphological reconstruction on the filtered image to remove dark spots and flaws in the image; 灰度变换模块,其被配置为:对形态学重构处理后的图像进行灰度变换,以增强棉花区域与背景区域之间的对比度;a grayscale transformation module, which is configured to: perform grayscale transformation on the morphologically reconstructed image to enhance the contrast between the cotton area and the background area; 图像分割模块,其被配置为:对灰度变换后的图像进行阈值分割,得到棉花图像的分割结果。The image segmentation module is configured to: perform threshold segmentation on the grayscale transformed image to obtain the segmentation result of the cotton image. 9.一种电子设备,其特征是,包括:一个或多个处理器、一个或多个存储器、以及一个或多个计算机程序;其中,处理器与存储器连接,上述一个或多个计算机程序被存储在存储器中,当电子设备运行时,该处理器执行该存储器存储的一个或多个计算机程序,以使电子设备执行上述权利要求1-7任一项所述的方法。9. An electronic device, characterized in that it comprises: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are Stored in a memory, when the electronic device is running, the processor executes one or more computer programs stored in the memory to cause the electronic device to perform the method of any one of claims 1-7 above. 10.一种计算机可读存储介质,其特征是,用于存储计算机指令,所述计算机指令被处理器执行时,完成权利要求1-7任一项所述的方法。10. A computer-readable storage medium, characterized by being used for storing computer instructions, which, when executed by a processor, perform the method according to any one of claims 1-7.
CN202110382656.4A 2021-04-09 2021-04-09 Cotton image segmentation method and system based on morphological reconstruction and adaptive threshold Pending CN112862841A (en)

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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113658143A (en) * 2021-08-19 2021-11-16 济南大学 Method and system for detecting impurity content of machine-picked 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
CN114581661A (en) * 2022-01-25 2022-06-03 山东锋士信息技术有限公司 Cotton boll detection method and system under complex natural scene
CN116668862A (en) * 2022-12-08 2023-08-29 荣耀终端有限公司 Image processing method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Title
吴晓元 等: "Faster R-CNN定位后的工业CT图像缺陷分割算法", 《计算机技术与应用》 *
邓超 等: "《数字图像处理与模式识别研究》", 30 June 2018 *
韦皆顶 等: "基于HSV彩色模型的自然场景下棉花图像分割策略研究", 《棉花学报》 *
黄靖 等: "基于形态学重建与OTSU的极耳焊缝图像分割的方法" *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113658143A (en) * 2021-08-19 2021-11-16 济南大学 Method and system for detecting impurity content of machine-picked seed cotton
CN114581661A (en) * 2022-01-25 2022-06-03 山东锋士信息技术有限公司 Cotton boll detection method and system under complex natural scene
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
US9117262B2 (en) Learned piece-wise patch regression for image enhancement
CN107169977B (en) Self-adaptive threshold color image edge detection method based on FPGA and Kirsch
CN107851193B (en) Hybrid machine learning system
CN112767369A (en) Defect identification and detection method and device for small hardware and computer readable storage medium
CN109241973B (en) A fully automatic soft segmentation method of characters under texture background
CN111223110B (en) Microscopic image enhancement method and device and computer equipment
CN110070548B (en) Deep learning training sample optimization method
CN111681198A (en) A morphological attribute filtering multimode fusion imaging method, system and medium
CN112288726B (en) Method for detecting foreign matters on belt surface of underground belt conveyor
CN113962905B (en) Single image rain removing method based on multi-stage characteristic complementary network
CN110570381B (en) Semi-decoupling image decomposition dark light image enhancement method based on Gaussian total variation
CN111145105A (en) Image rapid defogging method and device, terminal and storage medium
Srinivas et al. Remote sensing image segmentation using OTSU algorithm
CN104616259B (en) A kind of adaptive non-local mean image de-noising method of noise intensity
CN113592782A (en) Method and system for extracting X-ray image defects of composite carbon fiber core rod
Zhao et al. Deep pyramid generative adversarial network with local and nonlocal similarity features for natural motion image deblurring
CN105205485B (en) Large scale image partitioning algorithm based on maximum variance algorithm between multiclass class
CN112070684B (en) Method for repairing characters of a bone inscription based on morphological prior features
CN112991359A (en) Pavement area extraction method, pavement area extraction system, electronic equipment and storage medium
CN108171705A (en) The foreign bodies detection algorithm of liquid in a kind of Clear glass bottles and jars
CN118015064A (en) Image technology-based elliptical target detection method and computer-readable storage medium
CN110930358A (en) Solar panel image processing method based on self-adaptive algorithm

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210528