A method for visual segmentation and recognition of Agaricus bisporus

Through grayscale, noise reduction processing and watershed transformation algorithm combined with edge detection templates, the segmentation recognition problem in the complex background of Agaricus bisporus images is solved, and efficient and low-cost mushroom segmentation and recognition are achieved, which is suitable for factory production.

CN114049365BActive Publication Date: 2025-07-08YANGZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111362847.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-17
Publication Date
2025-07-08
Estimated Expiration
2041-11-17

AI Technical Summary

Technical Problem

The prior art is difficult to effectively overcome the interference of uneven light, weeds and mycelium in the Agaricus bisporus images, resulting in poor mushroom segmentation recognition effect, and deep learning-based solutions are costly and not real-time.

Method used

After using grayscale and noise reduction treatment, combined with the watershed transformation algorithm and edge detection template, the Agaricus bisporus monomers are identified through the minimum external rectangle algorithm, and the tunable filter and global threshold strategy are used for preliminary segmentation to accurately segment the adhesion mushroom group.

Benefits of technology

It realizes the precise segmentation and identification of Agaricus bisporus in a complex context, improves the accuracy and efficiency of segmentation identification, reduces costs, and is suitable for factory production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114049365B_ABST
    Figure CN114049365B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for visual segmentation and recognition of Agaricus bisporus, including collecting images of Agaricus bisporus and preprocessing the images of Agaricus bisporus to obtain a mushroom foreground image; performing a marking process on the mushroom foreground image to produce a watershed marking image; using the watershed marking image as a seed growth point to divide similar regions in the watershed marking image to complete the segmentation of Agaricus bisporus; extracting the contours of the divided regions and obtaining the center and diameter of a single Agaricus bisporus monomer through the minimum circumscribed rectangle algorithm to complete the recognition of Agaricus bisporus; the present invention accurately filters out complex backgrounds by designing a tunable filter, and combines the watershed transformation algorithm and an edge detection template to achieve precise segmentation and recognition of Agaricus bisporus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of mushroom segmentation, and particularly to a method for visual segmentation and recognition of Agaricus bisporus. Background Art

[0002] Agaricus bisporus, also known as white mushroom or button mushroom, is one of the most common and widely consumed mushrooms in the world. With the gradual transition of the cultivation mode of Agaricus bisporus in China to the factory cultivation mode, large-scale and factory production has become an inevitable trend and means for the high-speed development of the future Agaricus bisporus industry. Factory cultivation can precisely control factors such as the temperature, humidity, and carbon dioxide concentration in the mushroom house, thereby increasing the yield and quality of Agaricus bisporus and achieving year-round balanced supply. However, the current picking process still relies on a large amount of manual labor. Manual picking has many deficiencies, such as high labor costs, low picking efficiency, and inconsistent size standards of Agaricus bisporus. At the same time, the environment in the mushroom house is characterized by low temperature and high humidity, and the negative impact on the health of the picking workers who work in this environment for years cannot be ignored. Therefore, realizing the automatic picking of Agaricus bisporus has important practical significance for promoting high-efficiency factory production, and the image recognition of Agaricus bisporus based on machine vision is one of the key technologies.

[0003] Due to the interference of soil, weeds, a large number of hyphae, and uneven illumination, the background of Agaricus bisporus images is very complex, making it difficult to filter and process. The scales and shapes of Agaricus bisporus communities vary greatly, and there are also problems of a large number of mushroom individuals adhering to and blocking each other. Traditional segmentation methods based on the Hough circle transform or the classical watershed algorithm have poor segmentation and recognition effects on adhering mushroom groups, and some deep learning-based recognition schemes have problems such as high costs and the inability to balance simplicity and real-time performance. Summary of the Invention

[0004] The purpose of this part is to outline some aspects of the embodiments of the present invention and briefly introduce some preferred embodiments. Simplifications or omissions may be made in this part, as well as in the abstract and title of the present application, to avoid obscuring the purpose of this part, the abstract, and the title. However, such simplifications or omissions shall not be used to limit the scope of the present invention.

[0005] In view of the above existing problems, the present invention is proposed.

[0006] Therefore, the present invention provides a method for visual segmentation and recognition of Agaricus bisporus, which can overcome the interference of uneven light, weeds, hyphae, etc., and precisely segment and recognize densely adhering mushrooms.

[0007] To solve the above technical problems, the present invention provides the following technical solutions: including collecting images of twin mushrooms, preprocessing the images of twin mushrooms to obtain a mushroom foreground image; performing a labeling process on the mushroom foreground image to produce a watershed labeling image; using the watershed labeling image as a seed growth point to divide similar regions of the watershed labeling image to complete the segmentation of the button mushrooms; extracting the contours of the divided regions and obtaining the center and diameter of a single button mushroom through the minimum bounding rectangle algorithm to complete the recognition of the button mushrooms.

[0008] As a preferred embodiment of the visual segmentation and recognition method for button mushrooms of the present invention, wherein: the preprocessing includes graying and noise reduction processing of the images of twin mushrooms to generate a gray image of twin mushrooms; performing histogram equalization on the gray image of twin mushrooms to generate an equalized image of twin mushrooms; based on a global threshold strategy, performing preliminary threshold segmentation on the equalized image of twin mushrooms to obtain a mushroom foreground image.

[0009] As a preferred embodiment of the visual segmentation and recognition method for button mushrooms of the present invention, wherein: the graying and noise reduction processing includes converting the images of twin mushrooms into CIELab format images of twin mushrooms and normalizing the dimensions of the CIELab format images of twin mushrooms; using a tunable filter to perform noise reduction processing on the normalized image to generate a gray image of twin mushrooms; wherein, the tunable filter is composed of two autofocus lenses.

[0010] As a preferred embodiment of the visual segmentation and recognition method for button mushrooms of the present invention, wherein: the preliminary threshold segmentation includes calculating the gradient magnitude of the equalized image of twin mushrooms and calculating the between-class variance according to the gradient magnitude; setting a threshold based on the between-class variance, setting the pixel values higher than the threshold to 1, and setting the remaining pixel values to zero to obtain a binary image; multiplying the binary image by the equalized image of twin mushrooms to obtain a new image; performing upsampling on the new image to obtain the mushroom foreground image; wherein, the between-class variance is:

[0011]

[0012] In the formula, η 2 is the between-class variance, T is the gradient magnitude of the equalized image of twin mushrooms, β1 and β2 are the gray means corresponding to the maximum pixel and the minimum pixel respectively, and N is the total number of gray-level pixels.

[0013] As a preferred embodiment of the visual segmentation and recognition method for Agaricus bisporus of the present invention, the following steps are included: generating a watershed marker map includes performing an opening operation and a closing operation on the foreground image of the mushroom successively to obtain a morphological image; taking the pixel maximum value in the morphological image as the foreground marker, eroding the image with the foreground marker to obtain image A; performing binarization, distance transformation, and watershed transformation on the morphological image successively to obtain image B, taking the dividing line between adjacent regions in image B as the background marker, and adding the image with the background marker and image A to obtain the watershed marker map.

[0014] As a preferred embodiment of the visual segmentation and recognition method for Agaricus bisporus of the present invention, the following steps are included: the similar region division includes extracting the contour of the watershed marker map and removing the false edges of the contour; initializing the contour tracking points, tracking the contour using the eight-chain code until returning to the initial contour tracking point and then stopping the tracking; calculating the perimeter of each contour and performing similar region division according to the perimeter.

[0015] As a preferred embodiment of the visual segmentation and recognition method for Agaricus bisporus of the present invention, the following steps are included: further including defining the contour of the watershed marker map as g(i,j), and removing the false edges of the contour through the edge detection template Q:

[0016]

[0017] where α is the template coefficient, δ is the double gray-scale reconstruction operator, and θ is the angle between the pixel point vector and the x-axis.

[0018] As a preferred embodiment of the visual segmentation and recognition method for Agaricus bisporus of the present invention, the following steps are included: the center and diameter of the single Agaricus bisporus include taking the center of the minimum circumscribed rectangle of each region as the center of the single Agaricus bisporus in this region, and taking the long side of the rectangle as the diameter of the single Agaricus bisporus.

[0019] The beneficial effects of the present invention: By designing a tunable filter, the present invention accurately filters out the complex background, and combines the watershed transformation algorithm and the edge detection template to achieve precise segmentation and recognition of Agaricus bisporus. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. Among them:

[0021] Figure 1 is an image of Agaricus bisporus;

[0022] Figure 2Foreground image of the mushroom in the first embodiment of the visual segmentation and recognition method for Agaricus bisporus of the present invention;

[0023] Figure 3 Watershed marker map of the visual segmentation and recognition method for Agaricus bisporus of the first embodiment of the present invention;

[0024] Figure 4 Schematic diagram of the recognition result of mushroom group segmentation by the traditional segmentation method based on Hough circle transformation in the second embodiment of the present invention;

[0025] Figure 5 Schematic diagram of the recognition result of mushroom group segmentation by the visual segmentation and recognition method for Agaricus bisporus of the second embodiment of the present invention. Detailed implementation manners

[0026] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will describe the detailed implementation manners of the present invention with reference to the accompanying drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0027] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.

[0028] Secondly, the so-called "one embodiment" or "embodiment" herein refers to specific features, structures, or characteristics that may be included in at least one implementation manner of the present invention. The appearances of "in one embodiment" in different places in this specification do not all refer to the same embodiment, nor are they separate or alternative embodiments that exclude each other with other embodiments.

[0029] The present invention is described in detail with reference to the schematic diagrams. When describing the embodiments of the present invention in detail, for ease of explanation, the cross-sectional views showing the device structure will be enlarged locally out of the general proportion, and the schematic diagrams are only examples and should not limit the protection scope of the present invention herein. In addition, in actual production, three-dimensional spatial dimensions including length, width, and depth should be included.

[0030] Meanwhile, in the description of the present invention, it should be noted that the orientation or positional relationship indicated by terms such as "upper, lower, inner and outer" is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be construed as a limitation to the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.

[0031] Unless otherwise clearly defined and limited in the present invention, the terms "installed, connected, connected" should be understood in a broad sense. For example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, and can also be indirectly connected through an intermediate medium, or can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0032] Embodiment 1

[0033] This embodiment provides a method for visual segmentation and recognition of Agaricus bisporus, including:

[0034] S1: Collect images of Agaricus bisporus and preprocess the images of Agaricus bisporus to obtain a mushroom foreground image.

[0035] In this embodiment, a CCD camera is used to collect images of Agaricus bisporus, and the collected images of Agaricus bisporus are as Figure 1 shown.

[0036] Furthermore, preprocess the images of Agaricus bisporus to obtain a mushroom foreground image.

[0037] Specifically, (1) Grayscale and denoise the images of Agaricus bisporus to generate grayscale images of Agaricus bisporus;

[0038] ① Convert the images of Agaricus bisporus into Agaricus bisporus images in CIELab format, and normalize the dimensions of the Agaricus bisporus images in CIELab format, effectively enhancing the contrast of the grayscale images. Compared with the RGB color space, it is more conducive to distinguishing Agaricus bisporus from the images.

[0039] ② Use a tunable filter to denoise the normalized image to generate grayscale images of Agaricus bisporus; among them, the tunable filter consists of two autofocus lenses, avoiding the diffraction loss of light in the air gap.

[0040] (2) Perform histogram equalization on the grayscale images of Agaricus bisporus to generate equalized images of Agaricus bisporus;

[0041] To address the problem of highlighted and shaded areas caused by uneven illumination in images, in this embodiment, a histogram is used to equalize the grayscale image of the twin mushrooms, enhancing the image contrast.

[0042] (3) Based on the global threshold strategy, perform preliminary threshold segmentation on the equalized image of the twin mushrooms to obtain the mushroom foreground image.

[0043] ① Calculate the gradient magnitude of the equalized image of the twin mushrooms, and calculate the between-class variance based on the gradient magnitude;

[0044] The between-class variance is:

[0045]

[0046] In the formula, η 2 is the between-class variance, T is the gradient magnitude of the equalized image of the twin mushrooms, β1 and β2 are the grayscale means corresponding to the maximum pixel and the minimum pixel respectively, and N is the total number of grayscale-level pixels.

[0047] ② Based on the between-class variance, set a threshold, set the pixel values higher than the threshold to 1, and the rest of the pixel values to zero to obtain a binary image;

[0048] In this embodiment, the maximum between-class variance is set as the threshold.

[0049] ③ Multiply the binary image by the equalized image of the twin mushrooms to obtain a new image;

[0050] ④ Upsample the new image to obtain the mushroom foreground image, as Figure 2 shown.

[0051] Preferably, in this embodiment, by combining the between-class variance to set the relevant threshold, the accuracy of the preliminary segmentation is improved.

[0052] S2: Perform marking processing on the mushroom foreground image to produce a watershed marking map.

[0053] (1) Perform opening operation and closing operation on the mushroom foreground image successively to obtain a morphological image;

[0054] In this embodiment, a rectangular structuring element with a size of 7*7 is used to perform morphological opening operation and closing operation on the mushroom foreground image successively to further remove noise and most of the background interference and obtain a morphological image.

[0055] (2) Take the pixel maximum value in the morphological image as the foreground marker, and erode the image marking the foreground to obtain image A;

[0056] (3) Perform binarization, distance transformation, and watershed transformation on the morphological image successively to obtain image B. Take the boundary line between adjacent regions in image B as the background marker, and add the image marking the background and image A to obtain the watershed marking map, asFigure 3 As shown

[0057] S3: Use the watershed marker map as the seed growth point, divide the similar regions of the watershed marker map, and complete the segmentation of the Agaricus bisporus.

[0058] (1) Extract the contour of the watershed marker map and remove the false edges of the contour;

[0059] Define the contour of the watershed marker map as g(i,j), and remove the false edges of the contour through the edge detection template Q. In this embodiment, the edge detection template Q (template size is 7*7) is built based on Zernike moment edge detection:

[0060]

[0061] Among them, α is the template coefficient, δ is the double gray-scale reconstruction operator, and θ is the angle between the pixel point vector and the x-axis.

[0062] Preferably, in this embodiment, by designing a 7*7 edge detection template Q, it has strong anti-noise ability and can protect the edge to a great extent.

[0063] (2) Initialize the contour tracking point, use the eight-chain code to track the contour until it returns to the initial contour tracking point and then stop tracking;

[0064] The position of the initial contour tracking point is at the bottom of the contour.

[0065] (3) Calculate the perimeter of each contour and divide the similar regions according to the perimeter.

[0066] S4: Extract the contour of the divided region, and obtain the center and diameter of the single Agaricus bisporus through the minimum circumscribed rectangle algorithm to complete the recognition of the Agaricus bisporus.

[0067] Take the center of the minimum circumscribed rectangle of each region as the center of the single Agaricus bisporus of the region, and the long side of the rectangle as the diameter of the single Agaricus bisporus, as the basis for mechanical picking.

[0068] Embodiment 2

[0069] In order to verify and illustrate the technical effects adopted in this method, in this embodiment, a traditional segmentation method based on the Hough circle transform and this method are selected for comparative testing, and the experimental results are compared by means of scientific demonstration to verify the real effects of this method.

[0070] The traditional segmentation method based on the Hough circle transform is vulnerable to environmental interference and has poor segmentation and recognition effects on the adherent mushroom groups.

[0071] To verify that the proposed method can accurately segment and identify adherent mushroom clusters compared with the traditional Hough circle transform-based segmentation method, in this embodiment, the traditional Hough circle transform-based segmentation method and the proposed method are respectively used to segment and identify the twin mushroom images captured by the CCD camera ( Figure 1 ), and the results are shown in Figure 4 and Figure 5 . As can be seen from Figure 4 , the traditional Hough circle transform-based segmentation method cannot segment adherent mushroom clusters and has a poor recognition effect. Referring to Figure 5 , it can be clearly seen that the proposed method can accurately segment and identify the mushroom clusters in the twin mushroom images compared with the traditional Hough circle transform-based segmentation method.

[0072] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.

Claims

1. A method for visual segmentation and recognition of Agaricus bisporus, characterized in that: including collecting images of the twin mushrooms, preprocessing the images of the twin mushrooms to obtain a mushroom foreground image performing a labeling process on the mushroom foreground image to produce a watershed labeling image using the watershed labeling image as a seed growth point, dividing similar regions of the watershed labeling image to complete the segmentation of the button mushrooms extracting the contours of the divided regions, and obtaining the center and diameter of the single button mushroom through the minimum bounding rectangle algorithm to complete the recognition of the button mushrooms the preprocessing includes performing graying and noise reduction processing on the images of the twin mushrooms to generate a gray image of the twin mushrooms performing histogram equalization on the gray image of the twin mushrooms to generate an equalized image of the twin mushrooms performing preliminary threshold segmentation on the equalized image of the twin mushrooms based on a global threshold strategy to obtain a mushroom foreground image the graying and noise reduction processing includes converting the images of the twin mushrooms into CIELab format twin mushroom images, and normalizing the dimensions of the CIELab format twin mushroom images using an adjustable filter to perform noise reduction processing on the normalized image to generate a gray image of the twin mushrooms wherein, the adjustable filter is composed of two autofocus lenses the similar region division includes extracting the contours of the watershed labeling image and removing the false edges of the contours initializing the contour tracking points, using the eight-chain code to track the contours until returning to the initial contour tracking points and then stopping the tracking calculating the perimeters of the contours, and dividing similar regions according to the perimeters 2. The method for visual segmentation and recognition of Agaricus bisporus according to claim 1, characterized in that: the preliminary threshold segmentation includes calculating the gradient magnitude of the equalized image of the twin mushrooms, and calculating the between-class variance according to the gradient magnitude setting a threshold based on the between-class variance, setting the pixel values higher than the threshold to 1, and setting the remaining pixel values to zero to obtain a binary image multiplying the binary image by the equalized image of the twin mushrooms to obtain a new image performing upsampling on the new image to obtain the mushroom foreground image wherein, the between-class variance is ; Wherein, is the between-class variance, T is the gradient amplitude of the equilibrium image of Pleurotus tuoliensis, are the gray mean values corresponding to the maximum pixel and the minimum pixel respectively, and N is the total number of gray-level pixels.

3. The visual segmentation and recognition method of Agaricus bisporus according to claim 2, wherein: producing the watershed labeling image includes performing opening operation and closing operation on the mushroom foreground image successively to obtain a morphological image taking the pixel maximum value in the morphological image as the foreground label, and performing erosion on the image with the foreground label to obtain image A performing binarization, distance transformation and watershed transformation on the morphological image successively to obtain image B, taking the dividing line between adjacent regions in image B as the background label, and adding the image with the background label and image A to obtain the watershed labeling image 4. The visual segmentation and recognition method of Agaricus bisporus according to claim 3, wherein: also including Define the outline of the watershed marker map as , and remove the spurious edges of the outline by the edge detection template Q: ; Among them, is the template coefficient, is the double gray level reconstruction operator, is the angle between the pixel point vector and the x-axis.

5. The visual segmentation and recognition method of Agaricus bisporus according to any one of claims 1 to 4, characterized in that: the center and diameter of the single button mushroom include taking the center of the minimum bounding rectangle of each region as the center of the single button mushroom in the region, and taking the long side of the rectangle as the diameter of the single button mushroom

Citation Information

Patent Citations

  • Agaricus bisporus grading method based on image processing

    CN107527343A

  • Human contour extraction method based on superpixel-multicolor space

    CN107578035A