Method and system for segmenting sporocarp and fungus bag based on edible fungi
By performing coarse segmentation and void detection on edible mushroom point cloud data and tracing the stipe remnants in reverse, the problem of low segmentation accuracy between edible mushroom fruiting bodies and mushroom bags was solved, achieving high-precision segmentation between mushroom bags and fruiting bodies and improving the accuracy of phenotypic parameter measurement.
Patent Information
- Application Number
- CN202511516723.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-10-23
AI Technical Summary
现有技术中,食用菌子实体与菌包的三维重建分割方法无法实现高精度分割,导致表型参数测量误差较大。
By coarsely segmenting the edible mushroom point cloud data, the initial point cloud of the mushroom bag and the initial point cloud of the fruiting body are obtained. Then, by using hole detection and reverse tracing of the stipe residue, the stipe residue point cloud is further segmented to construct the actual mushroom bag and fruiting body point cloud, thereby improving the segmentation accuracy.
It achieves high-precision segmentation of edible fungi fruiting bodies and fungal bags, reduces segmentation errors, and improves the accuracy of phenotypic parameter measurements.
Smart Images

Figure CN120997241A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of mushroom bag and fruiting body segmentation technology, and particularly to a method and system for segmenting fruiting bodies and mushroom bags based on edible fungi. Background Technology
[0002] Mushroom bags, also known as mushroom logs or cultivation bags, are the core carriers for the artificial cultivation of edible fungi (such as shiitake and tea tree mushrooms). The core components of a mushroom bag include a culture medium and a spawn, which are typically packaged with breathable materials to form the bag. The culture medium (nutrients) is sterilized and inoculated with spawn to provide suitable nutrition, humidity, and environmental conditions for the mycelial growth and fruiting body (edible part) development of edible fungi. It is a key tool for the large-scale, standardized production of edible fungi in modern agriculture and is widely used in both home and commercial cultivation. Obtaining phenotypic parameters of fruiting bodies and changes in the morphology of mushroom bags during the growth process is crucial for optimizing edible fungi cultivation techniques and mushroom bag preparation processes.
[0003] Due to occlusion issues, extracting phenotypic parameters from edible mushroom fruiting bodies using 2D images is often incomplete. Therefore, 3D reconstruction is considered. However, because fruiting bodies grow on mushroom bags, and the bags and stipes are similar in color and have an uneven surface, the point clouds of the mushroom bags and fruiting bodies are closely related after 3D reconstruction, regardless of whether Neural Radiance Fields (NERF), Multi-View Stereo (MVS), or other methods are used. This leads to poor segmentation by conventional methods, resulting in errors in subsequent phenotypic parameter measurements. Therefore, a technical solution is needed to achieve high-precision segmentation of the point clouds of edible mushroom fruiting bodies and mushroom bags. Summary of the Invention
[0004] Based on this, the purpose of the present invention is to provide a method and system for segmenting fruiting bodies and mushroom bags based on edible fungi, in order to solve the technical problem that the existing methods for segmenting fruiting bodies and mushroom bags cannot achieve high-precision segmentation.
[0005] This invention provides a method for separating fruiting bodies and mushroom bags based on edible fungi, comprising: The edible fungi point cloud data is acquired and coarsely segmented to obtain the initial point cloud of the fungi bag and the initial point cloud of the fruiting body. The initial point cloud of the fruiting body includes the initial point cloud of the stipe and the point cloud of the cap. The triangulation cavity detection method is used to detect cavities in the initial point cloud of the fungi bag to obtain multiple surface cavities in the initial point cloud of the fungi bag. The surface cavities are filtered according to size and height to obtain the cavity boundary. The cavity boundary is the uppermost ring structure of the stipe remnant. The stipe remnant is the part of the stipe in the fruiting body that remains on the fruiting bag after coarse division. Starting from the cavity boundary, all points are traced backward along the stipe growth direction until the end point of the stipe remnant is detected to construct a stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting body are used to construct the actual point cloud of the fruiting body. The initial point cloud of the fruiting bag is used to form the actual point cloud of the fruiting bag after removing the stipe remnant point cloud. The edible fungus point cloud data is segmented based on the actual point cloud of the mushroom bag and the actual point cloud of the sub-entity to obtain the actual mushroom bag point cloud and the actual sub-entity point cloud.
[0006] The above-mentioned method for segmenting fruiting bodies and fruiting bags based on edible fungi first performs coarse segmentation of the edible fungi point cloud data to obtain initial point clouds of fruiting bags and fruiting bodies. Since stipe remnants remain on the fruiting bags after coarse segmentation, to improve segmentation accuracy, void detection is performed on the initial point cloud of the fruiting bags to obtain multiple surface voids and void boundaries. Then, starting from the void boundaries, all points are traced backward along the growth direction of the stipe until the termination point of the stipe remnant is detected to construct a stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting bodies are combined to construct the actual point cloud of the fruiting bodies. The initial point cloud of the fruiting bags is then deducted from the stipe remnant point cloud to form the actual point cloud of the fruiting bags. Finally, the edible fungi point cloud data is segmented based on the actual point cloud of the fruiting bags and the actual point cloud of the fruiting bodies to obtain the actual point cloud of the fruiting bags and the actual point cloud of the fruiting bodies. Through coarse segmentation and secondary segmentation of the stipe remnant, accurate segmentation of fruiting bags and fruiting bodies is achieved, improving segmentation accuracy.
[0007] In addition, the above-described method for dividing fruiting bodies and mushroom bags based on edible fungi according to the present invention may also have the following additional technical features: Furthermore, the steps of acquiring edible mushroom point cloud data and performing coarse segmentation to obtain the initial point cloud of the mushroom bag and the initial point cloud of the sub-entities include: The original point cloud data of edible fungi is acquired and preprocessed to obtain the preprocessed original point cloud data of edible fungi. The normal vector of the points is calculated based on the preprocessed original point cloud data of edible fungi to preliminarily determine the total set of top surface points. The total set of top surface points includes the top surface point set of the mushroom bag and the top surface point set of the mushroom cap. Clustering is performed on the top surface point set to obtain multiple connected regions. Based on the area and height of the connected regions, the top surface point set of the mushroom bag and the top surface point set of the mushroom cap are obtained, thus obtaining the original top surface of the mushroom bag and the original top surface of the mushroom cap. A cylindrical model of the mushroom bag is constructed based on the position of the original top surface of the mushroom bag, the position of the bottom of the original mushroom bag, and a preset diameter. The original point cloud data of edible fungi is updated through the cylindrical model of the mushroom bag to obtain the point cloud data of edible fungi. The point cloud data of edible fungi is coarsely segmented to obtain the initial point cloud of the mushroom bag and the initial point cloud of the sub-entities.
[0008] Furthermore, the steps of obtaining the top surface point set of the fungal bag and the top surface point set of the cap based on the area and height of the connected region, and thus obtaining the original top surface of the fungal bag and the original top surface of the cap, include: Calculate the area of each connected region and determine its height. Sort the areas in descending order. The connected region with the lowest and largest area is the top point set of the fungal bag, and the other connected regions are the top point sets of the fungal cap.
[0009] Furthermore, the method for obtaining the preset diameter includes: The lowest point of the point cloud is determined based on the original point cloud data of edible fungi to determine the bottom of the mushroom bag; A sampling point set is obtained by taking samples along the outer side of the mushroom bag at a preset height above the bottom of the mushroom bag. The sampling point set is then fitted with a least-squares circle to obtain the center and the radius is calculated. The diameter is obtained based on the calculated radius to obtain the preset diameter.
[0010] Furthermore, in the step of tracing all points backward along the growth direction of the stipe from the boundary of the cavity until the termination point of the stipe remnant is detected, and constructing a stipe remnant point cloud from all the traced points: When tracking all points, it is necessary to determine whether each point simultaneously satisfies all constraints, including spatial continuity, height constraints, normal vector constraints, and curvature constraints, among which: Spatial continuity requires that the new point must be within the neighborhood of the current point and move in the opposite direction of the stipe growth; The height constraint requires that the height of the new point must be lower than that of the current point. The normal vector constraint is that the angle between the normal vector direction of a point on the stipe and the growth direction of the stipe meets the first angle threshold, while the angle between the normal vector direction of a point on the top surface of the mushroom bag and the growth direction of the stipe is less than the second angle threshold. The curvature constraint is that the curvature value of the point where the stipe connects to the substrate bag is greater than a curvature threshold. Further, the step of calculating the normal vectors of points based on the preprocessed original point cloud data of edible fungi to initially determine the total set of top surface points includes: The normal vector of each point in the preprocessed raw point cloud data of edible fungi is calculated to extract its component value in the positive direction of the Z-axis; The surface of the mushroom bag is initially located based on the component values of the pre-processed original point cloud data of edible fungi in the positive Z-axis direction to obtain the initially located original point cloud data of edible fungi. The top surface point set is obtained based on the initially located original point cloud data of edible fungi.
[0011] Another aspect of the present invention provides a fruiting body and mushroom bag segmentation system based on edible fungi, the system comprising: The acquisition module is used to acquire edible fungi point cloud data and perform coarse segmentation to obtain the initial point cloud of the fungus bag and the initial point cloud of the fruiting body. The initial point cloud of the fruiting body includes the initial point cloud of the stipe and the point cloud of the cap. The triangulation cavity detection method is used to detect cavities in the initial point cloud of the fungus bag to obtain multiple surface cavities in the initial point cloud of the fungus bag. The filtering module is used to filter the surface cavities according to size and height to obtain the cavity boundary. The cavity boundary is the uppermost ring structure of the stipe remnant. The stipe remnant is the part of the stipe in the fruiting body that remains on the fruiting bag after coarse division. Starting from the cavity boundary, all points are traced backward along the stipe growth direction until the end point of the stipe remnant is detected to construct a stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting body are used to construct the actual point cloud of the fruiting body. The initial point cloud of the fruiting bag is used to remove the stipe remnant point cloud to form the actual point cloud of the fruiting bag. The segmentation module is used to segment the edible fungus point cloud data according to the actual point cloud of the mushroom bag and the actual point cloud of the sub-entity to obtain the actual mushroom bag point cloud and the actual sub-entity point cloud.
[0012] In another aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method for segmenting fruiting bodies and fungal bags based on edible fungi.
[0013] In another aspect, the present invention provides a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method for segmenting fruiting bodies and fungal bags based on edible fungi. Attached Figure Description
[0014] Figure 1 This is a flowchart of the method for segmenting fruiting bodies and mushroom bags based on edible fungi in an embodiment of the present invention; Figure 2 This is a flowchart of step S101 in an embodiment of the present invention; Figure 3 This is a heat map of the positive Z-axis component of the normal vector in an embodiment of the present invention; Figure 4 This is a rough extraction effect diagram of the surface of the fungal bag and the cap based on the Z-axis component in an embodiment of the present invention; Figure 5This is a schematic diagram illustrating the principle of normal vector calculation in an embodiment of the present invention; Figure 6 This is a visualization of the point normal vectors in an embodiment of the present invention; Figure 7 This is a diagram illustrating the segmentation effect of the mushroom bag and the top surface of the mushroom cap in an embodiment of the present invention; Figure 8 This is a fitting effect diagram of the top surface of the mushroom bag in an embodiment of the present invention; Figure 9 This is a diagram showing the positioning effect of the top surface of the mushroom bag in an embodiment of the present invention; Figure 10 This is a schematic diagram of sampling within a specified height in an embodiment of the present invention; Figure 11 This is a schematic diagram of the fitting of the fungal bag radius in an embodiment of the present invention; Figure 12 This is a schematic diagram of a cylindrical model of a fungal bag in an embodiment of the present invention; Figure 13 This is a schematic diagram of boundary edges and non-boundary edges in an embodiment of the present invention; Figure 14 This is a diagram illustrating the cavity extraction effect in an embodiment of the present invention. Figure 15 This is a diagram illustrating the effect of cavitation filtration in an embodiment of the present invention; Figure 16 This is a schematic diagram of the normal vector direction of the stipe root region in an embodiment of the present invention; Figure 17 This is a schematic diagram of the residue at the base of the stipe in an embodiment of the present invention; Figure 18 This is a diagram illustrating the separation effect between the fungal bag and the fruiting body in an embodiment of the present invention; The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation
[0015] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
[0016] Unless otherwise defined, 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 pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0017] To address the technical problem that existing methods for segmenting fruiting bodies and fruiting bags cannot achieve high-precision segmentation, this application provides a method and system for segmenting fruiting bodies and fruiting bags based on edible fungi. The method involves first performing coarse segmentation on the edible fungi point cloud data to obtain initial point clouds for the fruiting bags and fruiting bodies. Since some stipe remnants remain on the fruiting bags after coarse segmentation, to improve segmentation accuracy, void detection is performed on the initial point cloud of the fruiting bags to obtain multiple surface voids and thus void boundaries. These void boundaries then serve as the starting point for further segmentation. All points are traced in reverse along the growth direction of the stipe until the termination point of the stipe remnant is detected to construct a stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting body are then combined to construct the actual point cloud of the fruiting body. The initial point cloud of the mushroom bag is then deducted from the stipe remnant point cloud to form the actual point cloud of the mushroom bag. The edible fungus point cloud data is then segmented based on the actual point cloud of the mushroom bag and the actual point cloud of the fruiting body to obtain the actual point cloud of the mushroom bag and the actual point cloud of the fruiting body. Through coarse segmentation and secondary segmentation of the stipe remnant, accurate segmentation of the mushroom bag and the fruiting body is achieved, improving the segmentation accuracy.
[0018] To facilitate understanding of the present invention, several embodiments are given below. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of the present invention will be more thorough and complete.
[0019] Example 1 Please see Figure 1 The figure shows a method for segmenting fruiting bodies and mushroom bags based on edible fungi in the first embodiment of the present invention, the method comprising steps S101 to S104: S101. Obtain the point cloud data of edible fungi and perform coarse segmentation to obtain the initial point cloud of the fungi bag and the initial point cloud of the sub-entities.
[0020] As a concrete example, the initial point cloud of the sub-entity includes the initial point cloud of the stipe and the point cloud of the cap. Further, as... Figure 2 As shown, step S101 specifically includes steps S1011-S1013: S1011. Obtain the original point cloud data of edible fungi and perform preprocessing to obtain the preprocessed original point cloud data of edible fungi. Calculate the normal vector of the points based on the preprocessed original point cloud data of edible fungi to preliminarily determine the total set of top surface points. The total set of top surface points includes the top surface point set of the mushroom bag and the top surface point set of the mushroom cap.
[0021] As a specific example, to better perform coarse segmentation on the acquired raw point cloud data of edible fungi, preprocessing is required. Specifically, the preprocessing methods include: first, uniformly downsampling the acquired raw point cloud data; second, determining the centroid of the point cloud and translating all points until the centroid moves to the origin to center the coordinates; then, using statistical filtering and conditional filtering to remove outlier noise points from the reconstructed point cloud data to achieve denoising; and finally, employing PCA (Principal Component Analysis). The PCA (Programmable Point Analysis) algorithm calculates the principal direction of the point cloud, corresponding to the horizontal diameter and vertical direction of the mushroom bag, respectively. The principal direction of the point cloud is then aligned with the coordinate axes to correct the point cloud orientation. The coordinate system is set as follows: O is the origin, XOY is the horizontal plane, and the Z-axis is perpendicular to the XOY plane, with the positive direction of the Z-axis pointing upwards perpendicular to the XOY plane. The vertical direction of the mushroom bag corresponds to the Z-axis, ensuring the spatial position of the edible fungi above the mushroom bag, thus correcting the principal direction. Furthermore, a pass-through filter is used to separate the corrected platform and the calibration object, obtaining the pre-processed original point cloud data of the edible fungi. Further, after calculating the scale using the calibration object as a reference, the point cloud coordinates are restored to their true dimensions. The calculation formula is as follows: ; In the formula, l real , w real as well as h real These represent the actual length, width, and height of the calibrated object, respectively. l reco , w reco as well as h reco These represent the length, width, and height of the calibrated object in the reconstructed 3D point cloud, respectively; (x, y, z) are the original coordinates; (x', y', z') are the transformed coordinate values; and * is the scalar multiplication operator.
[0022] In this embodiment, the point cloud normal vector is calculated, and its component value in the positive Z-axis direction is extracted. Based on the component value of the normal vector in the positive Z-axis direction (threshold > 0.9), the point set of the top surface of the mushroom bag and the point set of the top surface of the mushroom cap are initially determined. Specifically, the normal vector of the preprocessed edible fungus original point cloud data is calculated to extract its component value in the positive Z-axis direction; among them, the component values of the normal vector of the top surface of the mushroom bag and the normal vector of the top surface of the mushroom cap in the positive Z-axis direction are larger, while the component values of the normal vector of the side surface of the mushroom bag and the normal vector of the side surface of the stipe in the positive Z-axis direction are smaller. The surface of the mushroom bag is initially located based on the component values of the preprocessed edible fungus original point cloud data in the positive Z-axis direction to obtain the initially located edible fungus original point cloud data, and the total set of top surface points is obtained based on the initially located edible fungus original point cloud data.
[0023] As a specific example, normal vectors are calculated from the preprocessed raw point cloud data of edible fungi, and their components in the positive Z-axis direction are extracted. Since the normal vectors of the top surface of the mushroom bag and the top surface of the cap have larger components in the positive Z-axis direction, while those of the sides of the mushroom bag and the stipe are smaller, this characteristic allows for preliminary localization of the mushroom bag surface. Specifically, as follows... Figure 3 As shown, after initial positioning, the set of points on the top surface of the mushroom bag and cap was obtained, specifically as follows: Figure 4 As shown. It should be further explained that, due to the unevenness of the top surface of the mushroom bag, this is only a partial top surface point of the actual mushroom bag, i.e., a preliminary location.
[0024] Furthermore, the method for calculating the point cloud normal vector based on the preprocessed original point cloud data of edible fungi is as follows: for each scan point in the point cloud... p i The search found Q nearest neighbor points. q i , i =1,2,3,…,N, where N is a positive integer. Then, calculate the local plane P in the least squares sense for these points. This plane P can be represented as: ; In the formula, Let be the normal vector of plane P. d Let P be the distance from plane P to the origin of the coordinate system.
[0025] Since the normal vector calculated above... This is ambiguous, as it only provides the line containing the normal vector without determining which direction of the line represents the final direction of the normal vector. Therefore, a simple heuristic method is used to set the direction of the normal vector: from the origin to the outside of the surface. For example... Figure 5 As shown, the calculated normal vector By performing directional decomposition, the component in the positive Z-axis direction is obtained. Furthermore, the visualization of point cloud normal vectors is as follows: Figure 6 As shown.
[0026] S1012. Cluster the top surface point set to obtain multiple connected regions. Based on the area and height of the connected regions, obtain the top surface point set of the mushroom bag and the top surface point set of the mushroom cap, and then obtain the original top surface of the mushroom bag and the original top surface of the mushroom cap. Based on the position of the original top surface of the mushroom bag, the position of the bottom of the original mushroom bag, and the preset diameter, construct a cylindrical model of the mushroom bag.
[0027] In this embodiment, the original point cloud data of edible fungi includes the original point cloud of the mushroom bag. The bottom position of the mushroom bag can be obtained based on the coordinates of the lowest point of the original mushroom bag point cloud in the Z-axis direction. Since the component values of the normal vectors of the top surface of the cap and the top surface of the mushroom bag in the positive Z-axis direction are similar (close to 1), it is difficult to distinguish them based on the normal vector direction alone. Therefore, based on connectivity analysis and height filtering, further segmentation is performed by clustering area, as follows: Figure 7 As shown, Figure 7 This image shows the segmentation results for the top surfaces of the mushroom bags and caps. Specifically, the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) method is used to cluster the top surface points obtained earlier. The top surfaces of the mushroom bags form a large connected region, while the top surfaces of the caps consist of multiple smaller connected regions. The area of each connected region is calculated, and its height is determined. Based on the area of each connected region and sorted in descending order, the connected region corresponding to the region with the lowest height and the largest area is the mushroom bag, constructed from the top surface point set of the mushroom bag. The connected regions corresponding to the areas of the other regions are the caps, constructed from the top surface point set of the caps.
[0028] Furthermore, statistical filtering is used to remove noise from the top surface points of non-sterile bags, and RANSAC plane fitting (Random Sample Consensus, RANSAC) is performed on the denoised top surface point set of the bags to determine the approximate location of the top surface. For example... Figure 8 The image shown is a fitting result of the top surface of the mushroom bag. Figure 9 The image shown is a diagram illustrating the positioning effect of the top surface of the mushroom bag.
[0029] In this embodiment, the method for obtaining the preset diameter includes: determining the lowest point of the point cloud in the Z-axis direction based on the original point cloud data of edible fungi to determine the bottom of the fungus bag; sampling along the outer side of the stipe at a preset height above the bottom of the fungus bag to obtain a sampling point set; performing least squares circle fitting on the sampling point set to obtain the center and calculating the radius; and obtaining the diameter based on the calculated radius to obtain the preset diameter.
[0030] like Figure 10 As shown, the bottom of the mushroom bag is determined using the lowest Z-coordinate of the entire point cloud. Samples are taken within a specified height range above the bottom of the mushroom bag. The center of the sampled points is obtained by least-squares circle fitting, and the radius r is calculated. Figure 11 As shown. In this embodiment, the specified height range is 3cm-5cm.
[0031] A cylindrical model of the mushroom bag is constructed based on the original top and bottom positions and a preset diameter. Then, the edible mushroom point cloud data is coarsely segmented based on this cylindrical model to obtain the initial point cloud of the mushroom bag and the initial point cloud of its sub-entities. Specifically, as follows... Figure 12 As shown.
[0032] S1013. The original point cloud data of edible fungi is updated by updating the cylindrical model of the mushroom bag to obtain the point cloud data of edible fungi. The point cloud data of edible fungi is coarsely segmented to obtain the initial point cloud of the mushroom bag and the initial point cloud of the sub-entities.
[0033] S102. The initial point cloud of the mushroom bag is detected by the triangulation void detection method to obtain multiple surface voids in the initial point cloud of the mushroom bag.
[0034] Because the stipe is seamlessly connected to the substrate bag, after initial segmentation, the root of the stipe will remain on the top surface of the substrate bag, creating a cavity. The remaining stipe root extends downwards from the boundary of this cavity until it connects with the top surface of the substrate bag. To achieve high-precision segmentation, the remaining stipe point cloud needs to be further segmented.
[0035] Therefore, void detection is required in the initially segmented point cloud of the mushroom bag. Specifically, a void detection method based on Delaunay triangulation is used: the point cloud model of the mushroom bag is converted into a triangular mesh to triangulate the point cloud. The topological relationships between each point in the meshed point cloud model are then used to find the void boundary points, thereby detecting voids on the surface of the initial point cloud of the mushroom bag. Specifically, as follows... Figure 13 As shown, the edges of void regions in a point cloud appear as a loop of continuous, closed "boundary edges" in the triangular mesh. Finding these closed boundary loops allows us to locate the void. We find the boundary based on the topological properties of each edge in the mesh: if an edge is shared by two adjacent triangles, it is a non-boundary edge. If an edge belongs to only one triangle, it is a void boundary, and the two points connecting the boundary are the void boundary points. The extracted boundary edges are scattered and need to be connected to form closed loops. Starting from the origin of one boundary edge and moving clockwise, we find the next boundary edge that shares a vertex with it. We continue this process, searching for the next boundary edge sharing a vertex, until the end of the path coincides with the starting point, forming a closed loop, i.e., the void boundary. Figure 14 The image shown is an illustration of the surface void extraction result.
[0036] S103. Based on the size and height, filter the surface voids to obtain the void boundaries. Starting from the void boundaries, trace all points in reverse along the growth direction of the stipe until the end point of the stipe residue is detected to construct the stipe residue point cloud. The stipe residue point cloud and the initial point cloud of the fruiting body are combined to construct the actual point cloud of the fruiting body. The initial point cloud of the fruiting body is used to remove the stipe residue point cloud to form the actual point cloud of the fruiting body.
[0037] Specifically, the boundary of the cavity is the uppermost ring-shaped structure of the stipe remnant, which is the portion of the stipe remaining on the fruiting body after the coarse separation of the bag and the fruiting body. Since the cavities on the bag surface include cavities at the bottom and tiny cavities at the top caused by noise, size and height are used for screening and filtration. Figure 15 This is an illustration of the surface void filtration effect. The termination point of the stipe remnant is the connection point between the stipe remnant and the fungal bag. Further, in the step of tracing all points backward along the stipe growth direction from the void boundary until the termination point of the stipe remnant is detected, and constructing a stipe remnant point cloud from all traced points: When tracking all points, each tracked point must simultaneously satisfy all constraints, including spatial continuity constraints, height constraints, normal vector constraints, and curvature constraints. Specifically: spatial continuity requires the new point to be within the neighborhood of the current point and to move in the opposite direction of the stipe growth direction; height constraint requires the new point to be lower than the current point; normal vector constraint requires the angle between the normal vector direction of a point on the stipe and the stipe growth direction to meet a first angle threshold. In this embodiment, the first angle threshold is 90°±2°. This means the normal vector direction of a point on the stipe must be approximately perpendicular to the stipe growth direction. Furthermore, the angle between the normal vector direction of a point on the top surface of the substrate bag and the stipe growth direction is less than a second angle threshold. In this embodiment, the second angle threshold is 30°. This means the angle between the normal vector direction of the substrate bag surface and the stipe growth direction must be small, less than 30°. The curvature constraint is that the curvature value of the point where the stipe connects to the bag is greater than the curvature threshold, so that the point where the stipe connects to the bag has a high curvature value. In this embodiment, the curvature threshold is 0.3.
[0038] Specifically, such as Figure 16 As shown, firstly, for each void boundary ring, the reverse growth direction of the stipe perpendicular to it is calculated based on the normal vector information of the points in the boundary ring, and this is defined as the extension direction of the region growth. Secondly, the void boundary points are added to the seed queue, marked as visited, and added to the stipe point set. Starting from the void boundary points, the region growth proceeds in reverse along the stipe growth direction, determining whether the traversed points satisfy all the above constraints. At this point, the height value no longer decreases continuously but tends to flatten out, and the local normal vector and curvature will change significantly, indicating that the top surface of the fungal bag has been reached.
[0039] It needs to be further explained that, such as Figure 17 As shown, since there may be local protrusions on the top surface of the mushroom bag, and these protrusions are close to the stipe, they are easily included during regional growth. To avoid this, a height constraint is imposed on the growth conditions. The height of the new point must be lower than that of the current point; that is, the height of the new point must not be higher than that of the current point, and the decrease must not exceed the maximum allowable height difference δ. hThis is to prevent growth from spreading to the entire top surface of the substrate bag. In this embodiment, the maximum allowable height difference δ h Take 0.002m.
[0040] S104. Segment the edible fungus point cloud data according to the actual point cloud of the mushroom bag and the actual point cloud of the fruiting body to obtain the actual mushroom bag point cloud and the actual fruiting body point cloud.
[0041] like Figure 18 As shown, the residual point cloud of the stipe and the initial point cloud of the fruiting body are integrated to construct the actual point cloud of the fruiting body. Then, the actual point cloud of the mushroom bag is combined to segment the edible mushroom point cloud data, resulting in the actual fruiting body point cloud and the actual mushroom bag point cloud.
[0042] In summary, the method for segmenting fruiting bodies and fruiting bags based on edible fungi in the above embodiments of the present invention first performs coarse segmentation of edible fungi point cloud data to obtain initial point clouds of fruiting bags and fruiting bodies. Since there will be stipe remnants left on the fruiting bags after coarse segmentation of fruiting bags and fruiting bodies, in order to improve segmentation accuracy, void detection is performed on the initial point cloud of fruiting bags to obtain multiple surface voids in the initial point cloud of fruiting bags and thus obtain void boundaries. Then, starting from the void boundaries, all points are traced backward along the growth direction of the stipe until the termination point of the stipe remnant is detected to construct the stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of fruiting bodies are combined to construct the actual point cloud of fruiting bodies. The initial point cloud of fruiting bags is then deducted from the stipe remnant point cloud to form the actual point cloud of fruiting bags. Finally, the edible fungi point cloud data is segmented according to the actual point cloud of fruiting bags and the actual point cloud of fruiting bodies to obtain the actual point cloud of fruiting bags and the actual point cloud of fruiting bodies. Through coarse segmentation and secondary segmentation of the stipe remnant, accurate segmentation of fruiting bags and fruiting bodies is achieved, improving segmentation accuracy.
[0043] Example 2 The second embodiment of the present invention provides a fruiting body and mushroom bag segmentation system based on edible fungi, comprising: The acquisition module is used to acquire edible fungi point cloud data and perform coarse segmentation to obtain the initial point cloud of the fungus bag and the initial point cloud of the fruiting body. The initial point cloud of the fruiting body includes the initial point cloud of the stipe and the point cloud of the cap. The triangulation cavity detection method is used to detect cavities in the initial point cloud of the fungus bag to obtain multiple surface cavities in the initial point cloud of the fungus bag. The filtering module is used to filter the surface cavities according to size and height to obtain the cavity boundary. The cavity boundary is the uppermost ring structure of the stipe remnant. The stipe remnant is the part of the stipe in the fruiting body that remains on the fruiting bag after coarse division. Starting from the cavity boundary, all points are traced backward along the stipe growth direction until the end point of the stipe remnant is detected to construct a stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting body are used to construct the actual point cloud of the fruiting body. The initial point cloud of the fruiting bag is used to remove the stipe remnant point cloud to form the actual point cloud of the fruiting bag. The segmentation module is used to segment the edible fungus point cloud data according to the actual point cloud of the mushroom bag and the actual point cloud of the sub-entity to obtain the actual mushroom bag point cloud and the actual sub-entity point cloud.
[0044] In summary, the edible fungus-based fruiting body and fruiting body segmentation system in the above embodiments of the present invention first performs coarse segmentation of the edible fungus point cloud data to obtain the initial point cloud of the fruiting body and the initial point cloud of the fruiting body. Since the fruiting body and fruiting body will have stipe remnants left on the fruiting body after coarse segmentation, in order to improve the segmentation accuracy, void detection is performed on the initial point cloud of the fruiting body to obtain multiple surface voids and thus obtain void boundaries. Then, starting from the void boundaries, all points are traced backward along the growth direction of the stipe until the termination point of the stipe remnant is detected to construct the stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting body are combined to construct the actual point cloud of the fruiting body. The initial point cloud of the fruiting body is then deducted from the stipe remnant point cloud to form the actual point cloud of the fruiting body. Finally, the edible fungus point cloud data is segmented according to the actual point cloud of the fruiting body and the actual point cloud of the fruiting body to obtain the actual point cloud of the fruiting body and the actual point cloud of the fruiting body. Through coarse segmentation and secondary segmentation of the stipe remnant, accurate segmentation of the fruiting body and the fruiting body is achieved, thus improving the segmentation accuracy.
[0045] Furthermore, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the methods described above.
[0046] Furthermore, embodiments of the present invention also propose a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the methods described above.
[0047] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0048] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0049] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0050] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0051] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for separating fruiting bodies and mushroom bags based on edible fungi, characterized in that, include: The edible fungi point cloud data is acquired and coarsely segmented to obtain the initial point cloud of the fungi bag and the initial point cloud of the fruiting body. The initial point cloud of the fruiting body includes the initial point cloud of the stipe and the point cloud of the cap. The triangulation cavity detection method is used to detect cavities in the initial point cloud of the fungi bag to obtain multiple surface cavities in the initial point cloud of the fungi bag. The surface cavities are filtered according to size and height to obtain the cavity boundary. The cavity boundary is the uppermost ring structure of the stipe remnant. The stipe remnant is the part of the stipe in the fruiting body that remains on the fruiting bag after coarse division. Starting from the cavity boundary, all points are traced backward along the stipe growth direction until the end point of the stipe remnant is detected to construct a stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting body are used to construct the actual point cloud of the fruiting body. The initial point cloud of the fruiting bag is used to form the actual point cloud of the fruiting bag after removing the stipe remnant point cloud. The edible fungus point cloud data is segmented based on the actual point cloud of the mushroom bag and the actual point cloud of the sub-entity to obtain the actual mushroom bag point cloud and the actual sub-entity point cloud.
2. The method for separating fruiting bodies and mushroom bags based on edible fungi according to claim 1, characterized in that, The steps for acquiring edible mushroom point cloud data and performing coarse segmentation to obtain the initial point cloud of the mushroom bag and the initial point cloud of the sub-entities include: The original point cloud data of edible fungi is acquired and preprocessed to obtain the preprocessed original point cloud data of edible fungi. The normal vector of the points is calculated based on the preprocessed original point cloud data of edible fungi to preliminarily determine the total set of top surface points. The total set of top surface points includes the top surface point set of the mushroom bag and the top surface point set of the mushroom cap. Clustering is performed on the top surface point set to obtain multiple connected regions. Based on the area and height of the connected regions, the top surface point set of the mushroom bag and the top surface point set of the mushroom cap are obtained, thus obtaining the original top surface of the mushroom bag and the original top surface of the mushroom cap. A cylindrical model of the mushroom bag is constructed based on the position of the original top surface of the mushroom bag, the position of the bottom of the original mushroom bag, and a preset diameter. The original point cloud data of edible fungi is updated through the cylindrical model of the mushroom bag to obtain the point cloud data of edible fungi. The point cloud data of edible fungi is coarsely segmented to obtain the initial point cloud of the mushroom bag and the initial point cloud of the sub-entities.
3. The method for dividing fruiting bodies and mushroom bags based on edible fungi according to claim 2, characterized in that, The steps to obtain the top surface point set of the mushroom bag and the top surface point set of the mushroom cap based on the area and height of the connected region, and then to obtain the original top surface of the mushroom bag and the original top surface of the mushroom cap, include: Calculate the area of each connected region and determine its height. Sort the areas in descending order. The connected region with the lowest and largest area is the top point set of the fungal bag, and the other connected regions are the top point sets of the fungal cap.
4. The method for separating fruiting bodies and mushroom bags based on edible fungi according to claim 2, characterized in that, Methods for obtaining the preset diameter include: The lowest point of the point cloud is determined based on the original point cloud data of edible fungi to determine the bottom of the mushroom bag; A sampling point set is obtained by taking samples along the outer side of the mushroom bag at a preset height above the bottom of the mushroom bag. The sampling point set is then fitted with a least-squares circle to obtain the center and the radius is calculated. The diameter is obtained based on the calculated radius to obtain the preset diameter.
5. The method for dividing fruiting bodies and mushroom bags based on edible fungi according to claim 1, characterized in that, In the step of tracing all points backward along the growth direction of the stipe from the boundary of the cavity until the termination point of the stipe remnant is detected, and constructing a stipe remnant point cloud from all the traced points: When tracking all points, it is necessary to determine whether each point simultaneously satisfies all constraints, including spatial continuity, height constraints, normal vector constraints, and curvature constraints, among which: Spatial continuity requires that the new point must be within the neighborhood of the current point and move in the opposite direction of the stipe growth; The height constraint requires that the height of the new point must be lower than that of the current point. The normal vector constraint is that the angle between the normal vector direction of a point on the stipe and the growth direction of the stipe meets the first angle threshold, while the angle between the normal vector direction of a point on the top surface of the mushroom bag and the growth direction of the stipe is less than the second angle threshold. The curvature constraint is that the curvature value of the point where the stipe connects to the bag is greater than the curvature threshold.
6. The method for dividing fruiting bodies and mushroom bags based on edible fungi according to claim 2, characterized in that, The steps involved in calculating the normal vectors of points based on the preprocessed raw point cloud data of edible fungi to preliminarily determine the total set of points on the top surface include: The normal vector of each point in the preprocessed raw point cloud data of edible fungi is calculated to extract its component value in the positive direction of the Z-axis; The surface of the mushroom bag is initially located based on the component values of the pre-processed original point cloud data of edible fungi in the positive Z-axis direction to obtain the initially located original point cloud data of edible fungi. The top surface point set is obtained based on the initially located original point cloud data of edible fungi.
7. A fruiting body and mushroom bag segmentation system based on edible fungi, characterized in that, The system includes: The acquisition module is used to acquire edible fungi point cloud data and perform coarse segmentation to obtain the initial point cloud of the fungus bag and the initial point cloud of the fruiting body. The initial point cloud of the fruiting body includes the initial point cloud of the stipe and the point cloud of the cap. The triangulation cavity detection method is used to detect cavities in the initial point cloud of the fungus bag to obtain multiple surface cavities in the initial point cloud of the fungus bag. The filtering module is used to filter the surface cavities according to size and height to obtain the cavity boundary. The cavity boundary is the uppermost ring structure of the stipe remnant. The stipe remnant is the part of the stipe in the fruiting body that remains on the fruiting bag after coarse division. Starting from the cavity boundary, all points are traced backward along the stipe growth direction until the end point of the stipe remnant is detected to construct a stipe remnant point cloud. The stipe remnant point cloud and the initial point cloud of the fruiting body are used to construct the actual point cloud of the fruiting body. The initial point cloud of the fruiting bag is used to remove the stipe remnant point cloud to form the actual point cloud of the fruiting bag. The segmentation module is used to segment the edible fungus point cloud data according to the actual point cloud of the mushroom bag and the actual point cloud of the sub-entity to obtain the actual mushroom bag point cloud and the actual sub-entity point cloud.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the method for segmenting the fruiting bodies and mushroom bags based on edible fungi as described in any one of claims 1-6.
9. A data processing apparatus, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method for segmenting the fruiting bodies and mushroom bags based on edible fungi as described in any one of claims 1-6.
Citation Information
Patent Citations
Pleurotus ostreatus growth monitoring method based on point cloud deep learning
CN115439655A
Method and device for detecting internal void defect of chip resistor welding spot and void detection equipment of resistor
CN117094955A
System and method for diagnosing defects in random flow systems
WO2015157641A1