A mushroom morphology data acquisition method, system, storage medium and device
By preprocessing and edge detection of mushroom images, segmenting and calculating mushroom morphological data, the problem of time-consuming, labor-intensive and low-accuracy manual measurement is solved, and fast and accurate measurement of mushroom morphological parameters is achieved.
Patent Information
- Application Number
- CN202410851955.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-28
AI Technical Summary
In the prior art, the measurement of mushroom morphological parameters mainly relies on manual methods, which is time-consuming, labor-intensive and low in accuracy. In particular, the complex edge lines of the mushroom shape and the depression at the connection between the stipe and the cap make measurement difficult.
By obtaining the original image of the mushroom for preprocessing, the cap vertex and the lowest point of the stipe are segmented, and the edge detection algorithm and the minimum circumscribed rotated rectangle algorithm are used to calculate the morphological data of the mushroom as a whole, the cap and the stipe, including the projected perimeter. Characteristics such as length, projected area, plant height, umbrella opening angle, etc.
It achieves fast and accurate measurement of mushroom morphological parameters, avoids the time and accuracy problems of manual measurement, and improves measurement efficiency and accuracy.
Smart Images

Figure CN118397028B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition and data processing, and in particular to a method, system, storage medium and device for acquiring mushroom morphological data. Background Art
[0002] my country has rich edible fungi resources, among which the most common ones are shiitake mushrooms, tea tree mushrooms, black-skinned Alpinia oxysporum and mushrooms. These edible fungi are not only nutritious, but also have many health benefits. Eating edible fungi in moderation can supplement the nutrients needed by the human body, such as protein, polysaccharides, polyphenols and dietary fiber, which helps to enhance human immunity and reduce the risk of cardiovascular diseases. Therefore, edible fungi occupy an important position in people's diet and are widely loved and sought after.
[0003] The morphological parameters of mushrooms can reflect the growth and development process and results of plants, help people identify the key factors affecting plant growth and development, help people better understand and utilize edible fungi, and provide important scientific basis for agricultural production, ecological protection and other fields.
[0004] However, the current measurement of mushroom morphological parameters is generally done manually, which is complex, time-consuming and labor-intensive, limiting its practical application. In addition, mushrooms have complex shapes and their edge lines are not smooth, especially at the junction of the stem and the cap, which poses a huge challenge to obtaining their morphological parameters and results in low measurement accuracy. Summary of the invention
[0005] Based on this, the purpose of the present invention is to provide a mushroom morphology data acquisition method, system, storage medium and device, which are used to solve the technical problems of the current manual measurement of mushroom morphology parameters, which is time-consuming, labor-intensive and has low accuracy of results.
[0006] In one aspect, the present invention provides a method for acquiring mushroom morphological data, comprising:
[0007] Get the original image of the mushroom I And preprocessing, the original image I Including the stem and the cap, obtaining the pre-processed overall contour data of the mushroom to obtain the cap vertex according to the overall contour data of the mushroom M top and the lowest point of the stipe M bottom , with the cap vertex M top The lowest point of the stipe M bottom The connecting line of is used as a dividing line to segment the overall contour data of the mushroom to obtain segmented contour data, and edge detection is performed on the segmented contour data to obtain the left contourC ml and the right side profile C mr ;
[0008] According to the left side profile C ml and the right side profile C mr Obtain the left target concave point and the right target concave point respectively, and connect the left target concave point and the right target concave point to obtain a segmentation line l s According to the dividing line l s Segment the overall contour data of the mushroom to obtain the stipe contour data and the cap contour data;
[0009] Applying edge detection algorithm to the mushroom overall contour data, the stem contour data and the cap contour data to obtain the mushroom overall contour C mush , cap outline C cap and the outline of the stem C stalk , and obtain the contour projection perimeter and contour projection area through the contour perimeter function and the area function, and then determine the contour length and contour width in combination with the minimum circumscribed rotation rectangle algorithm, and obtain the mushroom morphological data according to the contour projection perimeter, the contour projection area, the contour length and the contour width, the morphological data including the overall characteristics of the mushroom MC 、Cap characteristics CC and stipe characteristics SC .
[0010] The mushroom morphology data acquisition method is to obtain the original image of the mushroom I Preprocessing is performed to obtain the preprocessed mushroom overall contour data, and the cap vertex is obtained based on the mushroom overall contour data. M top and the lowest point of the stipe M bottom , with the cap apex M top The lowest point of the stem M bottom The connecting line is the dividing line to segment the overall contour data of the mushroom to obtain the left contour of the segmented contour C ml and the right side profile C mr , to achieve accurate segmentation of mushrooms; then the overall outline of the mushrooms C mush , cap outline C cap and the outline of the stemC stalk Data processing is performed to obtain the morphological data of mushrooms, which avoids manual measurement and improves measurement efficiency and accuracy.
[0011] In addition, the mushroom morphology data acquisition method according to the present invention may also have the following additional technical features:
[0012] Further, according to the left side profile C ml and the right side profile C mr In the steps of obtaining the left target concave point and the right target concave point respectively:
[0013] Define each original image I The lower left corner is the coordinate origin O (0,0), establish the xy coordinate system, the upper left corner coordinate is (0,y max ), the coordinate of the lower right corner is (x max ,0), the coordinate of the upper right corner is (x max ,y max ), in which x and y are both greater than 0;
[0014] The methods for obtaining the left target concave point include:
[0015] Get the cap vertex M top The lowest point M of the stipe bottom Connection l l , the left contour C ml Rotate counterclockwise until l l The left rotation profile is parallel to the x-axis of the xy coordinate system for the first time to obtain the left rotation profile, wherein the left rotation profile includes a plurality of discrete points C’ ml ;
[0016] At the top of the cap M top The lowest point of the stipe M bottom The average value P of the horizontal axis is the boundary, and multiple discrete points are found respectively. C’ ml The minimum vertical coordinate point on the left side of position P M tmin and the right ordinate minimum point M bmin ;
[0017] Connect the left ordinate minimum point M tmin and the right ordinate minimum pointM bmin Make a straight line l out1 ; Find the minimum value point of the left ordinate M tmin and the right ordinate minimum point M bmin All discrete points between the l out1 The longest vertical distance M lh , the longest vertical distance point M lh is a left preliminary concave point, and a left target concave point is obtained according to the left preliminary concave point;
[0018] The method for obtaining the target concave point on the right side includes:
[0019] Get the cap vertex M top The lowest point M of the stipe bottom Connection l r , the right side contour C mr Rotate counterclockwise until l r The x-axis of the xy coordinate system is parallel to the x-axis of the xy coordinate system to obtain a right-side rotation profile, wherein the right-side rotation profile includes a plurality of discrete points. C’ mr ;
[0020] At the top of the cap M top The lowest point of the stipe M bottom The average value of the horizontal axis P ’ As the boundary, find multiple discrete points C’ mr In P ’ The maximum value point of the left vertical coordinate of the position M tmax and the maximum value point of the vertical coordinate on the right M bmax ;
[0021] Connect the maximum value point of the left ordinate M tmax and the right ordinate maximum point M bmax Make a straight line l out2 ; Find the maximum value point of the left ordinate M tmax and the right ordinate maximum point M bmaxAll discrete points between the l out2 The longest vertical distance M rh , the longest vertical distance point M rh is a right preliminary concave point, and a right target concave point is obtained according to the right preliminary concave point.
[0022] Further, the left target concave point and the right target concave point constitute a target concave point, the left preliminary concave point and the right preliminary concave point constitute a preliminary concave point, in the step of obtaining the left target concave point according to the left preliminary concave point / obtaining the right target concave point according to the right preliminary concave point:
[0023] The determination methods of the target depression point include:
[0024] Determine whether the preliminary concave point meets the calculation formula of the rising edge and falling edge of the discrete point;
[0025] If it meets the requirements, the current discrete point is the target concave point;
[0026] If it does not match, search to the left and right sides of the current discrete point until the rising edge and falling edge calculation formula of the discrete point are met;
[0027] The calculation formula for the rising and falling edges of the left target depression point is:
[0028] ;
[0029] The calculation formula for the rising and falling edges of the right target depression point is:
[0030] ;
[0031] In the formula, k is the point number, ( k +1, f ( k +1)) is the coordinate of the current point, ( k , f ( k )) is the point to the left of the current point, ( k +2, f ( k +2)) is the point to the right of the current point.
[0032] Furthermore, the overall characteristics of the mushroom MC Including mushroom projection area MA , Mushroom projection circumference MP , Plant height MH ;
[0033] Mushroom overall characteristics MC The calculation methods include:
[0034] Getting the overall outline of the mushroom C mush Finally, the mushroom projection perimeter is obtained through the contour perimeter function MP ;
[0035] Use the area function to get the mushroom projection area MA ;
[0036] Overall outline of mushrooms C mush Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect0, and use the long side of the circumscribed rotated rectangle Rect0 d max As the height of mushrooms MH ;
[0037] Among them, the mushroom projection perimeter is obtained by the contour perimeter function MP , mushroom projection circumference MP The methods for obtaining include:
[0038] Overall outline of mushrooms C mush Interpolate each point to calculate the fitting curve S ;
[0039] According to the fitting curve S Calculate the Euclidean distance between every two adjacent points d i And summing, we get MP .
[0040] Furthermore, the cap characteristics CC Including cap projection area CA , cap projection circumference CP , opening angle KA , cap diameter CD and cap height CH ;
[0041] Cap characteristics CC The calculation methods include:
[0042] Getting the cap outline C cap Then, the cap projection perimeter is calculated by the contour perimeter function. CP , ,in, d cpi The cap outline C capThe Euclidean distance between two adjacent points in is n1, and n1 is the number of discrete points of the cap contour;
[0043] Use the area function to get the cap projection area CA ;
[0044] Pileus cap outline C cap Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect1, and use the long side of the circumscribed rotated rectangle Rect1 D cmax and wide edge D cmin As the cap diameter CD and cap height CH ;
[0045] Use the minimum circumscribed rotated rectangle algorithm to select the cap outline C cap Then, connect the cap vertices M top and the two ends of the base of the minimum circumscribed rectangle Rect1 to form a triangle △ABC, where A is the vertex of the cap M top , BC are the left and right points of the bottom edge, ∠A is the opening angle of the parachute KA , opening angle KA The calculation formula is:
[0046] ;
[0047] Where AC, AB and BC are the sides of triangle △ABC respectively.
[0048] Furthermore, the stipe characteristics SC Including stipe projection area SA , stipe projection circumference SP 、Average thickness of stipe SAT , the thickest stem SMT , stem length SH and stipe curvature SCU ;
[0049] Stipe characteristics SC The calculation methods include:
[0050] Obtaining the stipe outline C stalk Then, the stipe projection perimeter is calculated by the contour perimeter function. SP , ,in, d spi The outline of the stem C stalkThe Euclidean distance between two adjacent points in the figure, n2 is the number of discrete points of the stipe contour;
[0051] Use the area function to get the stipe projection area SA ;
[0052] To the stipe outline C stalk Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect2, and then use the long side of the circumscribed rotated rectangle Rect2 D smax As stipe length SH ;
[0053] Slice the stipe outline in pixels along the long side of the circumscribed rotated rectangle Rect2, calculate the width of each slice along the short side of the circumscribed rotated rectangle Rect2, and use it as the stipe width ST i , and ST i The maximum value is the thickest value of the stem SMT , SMT = ST max , and then according to ST i Get the average thickness of the stipe SAT , ,in, ST i represents the stipe width calculated at a certain slice, n 3 indicates the number of slices;
[0054] Stem curvature SCU The calculation formula is:
[0055] ;
[0056] In the formula, SH is the stipe length; ST 1 The width of the stipe in the first section is the width of the stipe section where the stipe and cap are connected; SP is the projected circumference of the stipe; SCU The curvature of the stipe.
[0057] Further, get the original image of the mushroom I The steps of preprocessing and obtaining the preprocessed mushroom overall contour data include:
[0058] Get the original image of the mushroom I , using edge detection algorithm to identify the original image I All edges of the image are broken. I c, and for the disconnected edge image I c Perform morphological operations to obtain complete closed contour images I o ;
[0059] Analyze the closed contour image I o To determine the mushroom area Area mush and background area, marking the mushroom area Area mush with the background region to create a mask image;
[0060] The mask image is combined with the original image I Perform bitwise operations to separate the mushroom regions Area mush The target mask image is obtained by comparing the background area I m , the target mask image I m The overall outline data of the mushroom.
[0061] Another aspect of the present invention provides a mushroom morphology data acquisition system, comprising:
[0062] Acquisition module, used to obtain the original image of mushrooms I And preprocessing, the original image I Including the stem and the cap, obtaining the pre-processed overall contour data of the mushroom to obtain the cap vertex according to the overall contour data of the mushroom M top and the lowest point of the stipe M bottom , with the cap vertex M top The lowest point of the stipe M bottom The connecting line of is used as a dividing line to segment the overall contour data of the mushroom to obtain segmented contour data, and edge detection is performed on the segmented contour data to obtain the left contour C ml and the right side profile C mr ;
[0063] A segmentation module is used to segment the left side contour according to the C ml and the right side profile C mr Obtain the left target concave point and the right target concave point respectively, and connect the left target concave point and the right target concave point to obtain a segmentation line l sAccording to the dividing line l s Segment the overall contour data of the mushroom to obtain the stipe contour data and the cap contour data;
[0064] A calculation module is used to apply an edge detection algorithm to the mushroom overall contour data, the stem contour data and the cap contour data to obtain the mushroom overall contour C mush , cap outline C cap and the outline of the stem C stalk , and obtain the contour projection perimeter and contour projection area through the contour perimeter function and the area function, and then determine the contour length and contour width in combination with the minimum circumscribed rotation rectangle algorithm, and obtain the mushroom morphological data according to the contour projection perimeter, the contour projection area, the contour length and the contour width, the morphological data including the overall characteristics of the mushroom MC 、Cap characteristics CC and stipe characteristics SC .
[0065] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the mushroom morphology data acquisition method as described above.
[0066] On the other hand, the present invention also provides a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the mushroom morphology data acquisition method as described above is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 Flow chart of a method for acquiring mushroom morphology data in an embodiment of the present invention;
[0068] Figure 2 This is a schematic diagram of the preprocessing results in an embodiment of the present invention;
[0069] Figure 3 A schematic diagram of scattered points of the left and right contours of a mushroom in an embodiment of the present invention;
[0070] Figure 4 A schematic diagram of obtaining a target concave point after obtaining a preliminary concave point in an embodiment of the present invention;
[0071] Figure 5 It is a schematic diagram when the preliminary depression point obtained in the embodiment of the present invention is the target depression point;
[0072] Figure 6 Schematic diagram of the mushroom stipe and cap segmentation process in an embodiment of the present invention;
[0073] Figure 7 A schematic diagram of mushroom morphological parameters in an embodiment of the present invention;
[0074] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0075] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0076] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0077] In order to solve the technical problems of the current manual measurement of mushroom morphological parameters, which is time-consuming and labor-intensive and has low accuracy, the present application provides a method, system, storage medium and device for obtaining mushroom morphological data. I Preprocessing is performed to obtain the preprocessed mushroom overall contour data, and the cap vertex is obtained based on the mushroom overall contour data. M top and the lowest point of the stipe M bottom , with the cap apex M top The lowest point of the stem M bottom The connecting line is the dividing line to segment the overall contour data of the mushroom to obtain the left contour of the segmented contour C ml and the right side profile C mr , to achieve accurate segmentation of mushrooms; then the overall outline of the mushrooms C mush , cap outline C cap and the outline of the stem C stalk Data processing is performed to obtain the morphological data of mushrooms, which avoids manual measurement and improves measurement efficiency and accuracy.
[0078] In order to facilitate understanding of the present invention, several embodiments of the present invention are provided below. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0079] Embodiment 1
[0080] See also Figure 1 , which shows a mushroom morphology data acquisition method in a first embodiment of the present invention, and the method comprises steps S101 to S103:
[0081] S101. Obtaining the original image of the mushroom I And preprocess the original image I Including the stem and cap, obtain the preprocessed mushroom overall contour data to obtain the cap vertex according to the mushroom overall contour data M top and the lowest point of the stipe M bottom , with the cap apex M top The lowest point of the stem M bottom The connecting line is the dividing line to segment the overall contour data of the mushroom to obtain the segmented contour data, and the edge detection is performed on the segmented contour data to obtain the left contour C ml and the right side profile C mr .
[0082] As a specific example, the preprocessing method includes:
[0083] Get the original image of the mushroom I , using edge detection algorithm to identify the original image I All edges of the image are broken. I c , and for disconnected edge images I c Perform morphological operations to obtain complete closed contour images I o ; Analyze closed contour images I o To determine the mushroom area Area mush and background areas, marking the mushroom areas separately Area mush and background area to create a mask image; the mask image is combined with the original image I Perform bitwise operations to separate mushroom regions Area mush The target mask image is obtained by combining the target mask image with the background area Im , target mask image I m The overall outline data of the mushroom.
[0084] Furthermore, the edge detection algorithm uses the Canny edge detection algorithm to identify the original image I The Canny edge detection algorithm is a multi-stage algorithm, including noise filtering, image gradient calculation, non-maximum suppression and dual threshold detection. The Canny edge detection algorithm uses a Gaussian filter to smooth the image to reduce the impact of noise on edge detection. The standard form of the Gaussian function is:
[0085] ;
[0086] In the formula, f ( x , y ) represents the value obtained after the Gaussian function is calculated, σ is the width parameter of the Gaussian function, which controls the width of the function shape, ( x , y ) represents the corresponding position of each element.
[0087] Since the Gaussian function has a smoothing property and can perform a weighted average of the surrounding pixel values, it can smooth the noise points in the image, thereby reducing the impact of noise and improving the quality and clarity of the image. By convolving the Gaussian convolution kernel with each pixel of the image, we get the image I G . Then, calculate the image I G The gradient magnitude and direction of each pixel in the image are used to obtain the edge strength and direction at each pixel. Then the non-maximum suppression step is used to identify the true edges. This step will eliminate those pixels that are not true edges and only retain those points with the largest intensity changes. Finally, two thresholds are used to determine which edges are strong edges and weak edges. The two thresholds are generally low thresholds. Th min and high threshold Th max , above the high threshold Th max Pixels below the lower threshold are considered strong edges, pixels between the two thresholds are considered weak edges, and pixels below the lower threshold are considered weak edges. Th min Pixels with .
[0088] After edge detection on an image, we usually get a disconnected edge image containing many disconnected edges. I c In order to connect these disconnected edges to form a complete closed contour, the disconnected edge image needs to be Ic Perform morphological operations. Closing operation is a commonly used morphological operation, which includes two steps: dilation and corrosion. Closing operation helps to connect disconnected small objects, fill small holes and slender protrusions, while maintaining the integrity of large objects to obtain a complete closed contour image. I o .
[0089] After getting the complete closed contour image I o Finally, you need to create a mushroom mask image to achieve the mushroom area Area mush Complete separation of the image and background areas to obtain the target mask image I m . Specifically:
[0090] First, by analyzing the closed contour image I o , determine the mushroom area Area mush The mask image is a binary image in which the mushroom area Area mush Marked as foreground, and background area marked as background, specifically, the foreground is usually white, the mushroom area Area mush Usually white; background areas are usually black. Apply the created mask image to the original image I By combining the mask image with the original image I A bit operation is performed to separate the mushrooms from the background. In this embodiment, the bit operation includes an AND operation. Area mush will be extracted, while the background area will be excluded. Figure 2 shown.
[0091] Due to the complex morphology of mushrooms, the directions of the stipe and cap are often inconsistent, which poses a challenge to accurately measure morphological parameters. In order to obtain the characteristics of the stipe and cap more accurately, the stipe and cap need to be separated first so that they can be calculated separately. Through careful observation of mushrooms, the concave point at the junction of the stipe and cap is used as the ideal segmentation point. The detailed segmentation steps are as follows:
[0092] (1) Obtaining the contour data of the mushroom. Through the edge detection algorithm, the overall contour data of the mushroom can be obtained. This data usually represents the shape of the mushroom in the form of a series of discrete points.
[0093] (2) Determine the boundary line of the mushroom. As a specific example, the mushroom photographed is approximately an axisymmetric shape. Therefore, the vertex of the cap is M topand the lowest point of the stipe M bottom Connection line l As the dividing line, the mushroom is divided into the left outline C ml and the right side profile C mr After dividing it into left and right data, the depression points on each side can be located more accurately.
[0094] S102, according to the left side contour C ml and the right side profile C mr Get the left target concave point and the right target concave point respectively, and connect the left target concave point and the right target concave point to get the segmentation line l s According to the dividing line l s The overall contour data of the mushroom is segmented to obtain the stipe contour data and the cap contour data.
[0095] Specifically, the left side outline C ml For example, in order to facilitate subsequent processing, obtain the cap vertex M top The lowest point of the stem M bottom Connection l l , the left contour C ml Rotate counterclockwise until l l The left rotation profile is obtained by first being parallel to the x-axis of the xy coordinate system. The left rotation profile includes multiple discrete points. C’ ml . Specific: Figure 3 As shown, the left side contour C ml Transform to obtain a left-side rotation profile, which includes multiple discrete points C’ ml ; As a specific example, the left contour C ml The concave point at the cap of the stipe needs to satisfy the condition that the left side of the concave point is the rising edge of the discrete contour point, and the right side of the concave point is the falling edge of the discrete contour point; similarly, the right side contour C mr The concave point at the cap of the stipe needs to satisfy the condition that the left side of the concave point is the falling edge of the discrete contour point, and the right side of the concave point is the rising edge of the discrete contour point. C mlFor example, the obtained mushroom outline is jagged with multiple rising edge points. By observation, it can be found that the concave point is located between the cap and the outermost point of the stem. In order to further locate the concave point, the cap vertex is used as the M top The lowest point of the stem M bottom The average value P of the horizontal axis is the boundary, and multiple discrete points are found respectively. C’ ml The minimum vertical coordinate point on the left side of position P M tmin and the right ordinate minimum point M bmin ; Connect the left ordinate minimum point M tmin and the right ordinate minimum point M bmin Make a straight line l out1 ; Find the minimum value point of the left vertical coordinate M tmin and the right ordinate minimum point M bmin All discrete points between l out1 The longest vertical distance M lh , the point with the longest vertical distance M lh is the left preliminary concave point, and the left target concave point is obtained according to the left preliminary concave point;
[0096] Similarly, the method for obtaining the target concave point on the right side includes:
[0097] Get the cap vertex M top The lowest point of the stem M bottom Connection l r , the right contour C mr Rotate counterclockwise until l r Parallel to the x-axis of the xy coordinate system for the first time to obtain the right-hand rotation profile, which includes multiple discrete points C’ mr ; At the top of the cap M top The lowest point of the stem M bottom The average value of the horizontal axis P ’ As the boundary, find multiple discrete points C’ mr In P ’ The maximum value point of the left vertical coordinate of the position M tmaxand the maximum value point of the vertical coordinate on the right M bmax ; Connect the maximum value point of the left vertical coordinate M tmax and the maximum value point of the vertical coordinate on the right M bmax Make a straight line l out2 ; Find the maximum value point of the left vertical coordinate M tmax and the maximum value point of the vertical coordinate on the right M bmax All discrete points between l out2 The longest vertical distance M rh , the point with the longest vertical distance M rh is the preliminary concave point on the right side, and the target concave point on the right side is obtained according to the preliminary concave point on the right side.
[0098] In the present embodiment, the target concave point includes a left target concave point and a right target concave point, that is, the left target concave point and the right target concave point both belong to the target concave point, and the preliminary concave point includes a left preliminary concave point and a right preliminary concave point, that is, the left preliminary concave point and the right preliminary concave point both belong to the preliminary concave point. Specifically, the method for determining the target concave point includes: determining whether the preliminary concave point meets the rising edge and falling edge calculation formulas of the discrete point; if it meets, the current discrete point is the target concave point; if it does not meet, searching to the left and right sides of the current discrete point until it meets the rising edge and falling edge calculation formulas of the discrete point. Specifically, if it does not meet, searching with a range value (k-σ, k+σ), σ is a positive integer, and in the present embodiment, σ is a very small positive integer. After determining the left target concave point and the right target concave point, connect the left target concave point and the right target concave point to obtain a dividing line l s According to the dividing line l s Segment the overall contour data of the mushroom to obtain the stipe and cap.
[0099] As a specific example, a preprocessed image I is selected from the entire mushroom library. m , define each original image I The lower left corner is the coordinate origin O (0,0), establish the xy coordinate system, the coordinates of the upper left corner are (0, y max ), the coordinate of the lower right corner is (x max ,0), the coordinate of the upper right corner is (x max ,y max), in which x and y are both greater than 0. Traverse each pixel in the image, compare the coordinates of each white pixel, and record the maximum y coordinate of all white pixels. max and the minimum value y min , get the cap vertex M top (x1,y max ) and the lowest point of the stem M bottom (x2,y min ), with a line connecting two points l l :(yy max ) / (y min -y max )=(x-x1) / (x2-x1) as the boundary, dividing the mushroom into the left contour C ml and the right side profile C mr And along the cap apex M top The lowest point of the stem M bottom The line of the counterclockwise rotation until l l Parallel to the x-axis of the xy coordinate system for the first time, and update the cap vertex M top The lowest point of the stem M bottom The coordinates of the cap vertex M are updated top The lowest point of the stem M bottom After obtaining the coordinates of the left and right rotation contours, the left and right rotation contours are obtained respectively.
[0100] For the left side contour, the cap vertex M top and the lowest point of the stem M bottom The average value P of the horizontal axis is used as the boundary to find discrete points C’ ml The minimum value point of the left vertical coordinate M tmin ( x tmin , y tmin ) and the right ordinate minimum point M bmin ( x bmin , y bmin ), connect the left ordinate minimum point M tmin and the right ordinate minimum point M bmin , two points make a straight line l out1 : (y- y bmin ) / (ytmin -y bmin )=(xx bmin ) / (x tmin -x bmin ) , and traverse the minimum value point of the left ordinate M tmin and the right ordinate minimum point M bmin For all discrete points between M lh , the point with the longest vertical distance M lh Determined as the initial depression point on the left side, due to the left contour C ml Therefore, the point must satisfy the rising edge of the discrete contour point on the left side of the concave point and the falling edge of the discrete contour point on the right side of the concave point. The following calculation formulas for the rising and falling edges of discrete points should be satisfied:
[0101] ;
[0102] in, k is the point number, ( k +1, f ( k +1)) is the coordinate of the current point, ( k , f ( k )) is the point to the left of the current point, ( k +2, f ( k +2)) is the point to the right of the current point.
[0103] Specifically, Figure 4 As shown, in the connection M tmin and M bmin Make a straight line from two points l out1 Then, find the straight line between two points l out1 The longest vertical distance M lh ,Will M lh Determine the initial depression point on the left side, such as Figure 4 In (a), the point with the longest vertical distance M lh Substitute the rising and falling edge calculation formulas of the above discrete points into the calculation formulas. If the point with the longest vertical distance is found M lhIf it is not satisfied, search to the left and right sides (k-σ, k+σ) until the point is found. M l Satisfy the above rising edge point conditions, such as Figure 4 (b) in the figure; if the point with the longest vertical distance is found M lh Satisfied, there is no need to search to the left and right sides of the initial depression point. Figure 5 As shown; the target concave point on the left is finally obtained M l , which provides the basis for the subsequent accurate segmentation of the stipe and cap.
[0104] Similarly, the right side profile C mr The concave point at the stipe cap satisfies the requirement that the left side of the concave point is the falling edge of the discrete contour point, and the right side of the concave point is the rising edge of the discrete contour point. The following calculation formula for the rising and falling edges of discrete points should be satisfied:
[0105] ;
[0106] In the formula, k is the point number, ( k +1, f ( k +1)) is the coordinate of the current point, ( k , f ( k )) is the point to the left of the current point, ( k +2, f ( k +2)) is the point to the right of the current point.
[0107] After the left target concave point is determined, the discrete points C’ mr Perform corresponding operations to obtain the target concave point on the right side and determine the target concave points on the left and right sides. M l ( x l ,y l )and M r ( x r ,y r ), and finally connect the target concave points on both sides to get the segmentation line l s :( yy r ) / ( y l -y r )= ( xx r ) / ( x l -x r ), l s The general formula is A S x + B S y + C S =0 (where A S = y r -y l ,B S = x l -x r ,C S =x r y l -x l y r ), so as to accurately separate the stem and cap. A S x i + B S y i + C S <0, indicating that the point is on the stem. A S x i + B S y i + C S When >0, it means that the point is on the cap. Figure 6 shown.
[0108] S103, applying edge detection algorithm to the mushroom overall contour data, the stem contour data and the cap contour data to obtain the mushroom overall contour Cmush , cap outline C cap and the outline of the stem C stalk The contour projection perimeter and contour projection area are obtained through the contour perimeter function and the area function, and then the contour length and contour width are determined by combining the minimum circumscribed rotated rectangle algorithm. The morphological data of the mushroom are obtained according to the contour projection perimeter, contour projection area, contour length and contour width.
[0109] Specifically, morphological data includes the overall characteristics of the mushroom MC 、Cap characteristics CC and stipe characteristics SC As a specific example, the morphological data includes three categories with a total of 14 traits, and the three categories are specifically the overall traits of mushrooms. MC 、Cap characteristics CC and stipe characteristics SC Among them, the overall characteristics of mushrooms MC Including mushroom projection area MA , Mushroom projection circumference MP , Plant height MH ; Cap characteristics CC Including cap projection area CA , cap projection circumference CP , opening angle KA , cap diameter CD and cap height CH ;Stipe characteristics SC Including stipe projection area SA , stipe projection circumference SP 、Average thickness of stipe SAT , the thickest stem SMT , stem length SH and stipe curvature SCU . Description of properties Figure 7 shown.
[0110] As a specific example, the overall characteristics of mushrooms MC The calculation methods include:
[0111] First, get the overall outline of the mushroom C mush Finally, the mushroom projection perimeter is obtained through the contour perimeter function MP ; Secondly, use the area function to get the mushroom projection area MA .
[0112] Specifically, for a single mushroom, the overall outline of the mushroom C mush , use the contour perimeter function to get the overall mushroom projection perimeter MP The principle is to measure the overall outline of the mushroomC mush Interpolate each point to calculate the fitting curve S According to the fitting curve S Calculate the Euclidean distance between every two adjacent points d i And sum them up to get MP , the summation formula is:
[0113] ;
[0114] Where n is the number of discrete points of the mushroom's overall contour.
[0115] Then use the area function to get the mushroom projection area of the entire mushroom MA , the principle is:
[0116] The overall outline of the mushroom C mush Each point (x i ,y i ) is set to the vector field at ( P1 ( x i , y i ), Q1 ( x i , y i )) is calculated using Green's formula, and the expression is:
[0117] ;
[0118] Finally, the overall outline of the mushroom C mush Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect0. d max As the height of mushrooms MH ;
[0119] In this embodiment, further, the cap characteristics CC The calculation methods include:
[0120] First, obtain the cap contour C cap Then, the cap projection perimeter is calculated by the contour perimeter function. CP , ,in, d cpi The cap outline C cap The Euclidean distance between two adjacent points in is n1, and n1 is the number of discrete points of the cap contour;
[0121] Secondly, use the area function to get the cap projection area CA Specific:
[0122] ;
[0123] In the formula, P 2( x j , y j ), Q 2( x j , y j ) is the cap outline C cap Each point ( x j , y j ) is a vector field.
[0124] Furthermore, the cap contour C cap Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect1, and use the long side of the circumscribed rotated rectangle Rect1 D cmax and short side D cmin As the cap diameter CD and cap height CH ;
[0125] Finally, the minimum circumscribed rotated rectangle algorithm is used to select the cap outline. C cap Then, connect the cap vertices M top ( x 1, y min ) and the two ends of the base of the minimum circumscribed rotated rectangle Rect1 to form a triangle △ABC, where A is the vertex of the cap. M top , BC are the left and right points of the bottom edge, ∠A is the opening angle of the parachute KA Using the cosine theorem, we can get 2AC•AB•cosA=AC 2 +AB 2 -BC 2 , after sorting, we can get the parachute opening angle KA The calculation formula is:
[0126] ;
[0127] Where AC, AB and BC are the sides of triangle △ABC respectively.
[0128] In this embodiment, further, the stipe characteristics SC The calculation methods include:
[0129] First, obtain the stipe outline C stalk Then, the stipe projection perimeter is calculated by the contour perimeter function. SP , ,in, d spi The outline of the stem C stalk The Euclidean distance between any two adjacent points in is n2, and n2 is the number of discrete points of the stipe contour;
[0130] Secondly, use the area function to get the stipe projection area SA Specific:
[0131] ;
[0132] In the formula, P 3( x k , y k ), Q 3( x k , y k ) is the outline of the stipe C stalk Each point ( x k , y k ) is a vector field.
[0133] Furthermore, the outline of the stem C stalk Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect2, and then use the long side of the circumscribed rotated rectangle Rect2 D smax As stipe length SH ;
[0134] Finally, slice the stipe outline in pixels along the long side of the circumscribed rotated rectangle Rect2, calculate the width of each slice along the short side of the circumscribed rotated rectangle Rect2, and use it as the stipe width ST i , and ST i The maximum value is the thickest value of the stem SMT , SMT = ST max , and then according to STi Get the average thickness of the stipe SAT , ,in, ST i represents the stipe width calculated at a certain slice, n 3 indicates the number of slices;
[0135] Stem curvature SCU The calculation formula is:
[0136] ;
[0137] In the formula, SH is the stipe length; ST 1 is the width of the stipe in the first section, i.e. the width of the stipe section where the stipe and cap are connected; SP is the projected circumference of the stipe; SCU The curvature of the stipe.
[0138] In summary, the mushroom morphology data acquisition method in the above embodiment of the present invention is to obtain the original image of the mushroom by I Preprocessing is performed to obtain the preprocessed mushroom overall contour data, and the cap vertex is obtained based on the mushroom overall contour data. M top and the lowest point of the stipe M bottom , with the cap apex M top The lowest point of the stem M bottom The connecting line is the dividing line to segment the overall contour data of the mushroom to obtain the left contour of the segmented contour C ml and the right side profile C mr , to achieve accurate segmentation of mushrooms; then the overall outline of the mushrooms C mush , cap outline C cap and the outline of the stem C stalk Data processing is performed to obtain the morphological data of mushrooms, which avoids manual measurement and improves measurement efficiency and accuracy.
[0139] Embodiment 2
[0140] The second embodiment of the present invention provides a mushroom morphology data acquisition system, comprising:
[0141] Acquisition module, used to obtain the original image of mushrooms I And preprocessing, the original image IIncluding the stem and the cap, obtaining the pre-processed overall contour data of the mushroom to obtain the cap vertex according to the overall contour data of the mushroom M top and the lowest point of the stipe M bottom , with the cap vertex M top The lowest point of the stipe M bottom The connecting line of is used as a dividing line to segment the overall contour data of the mushroom to obtain segmented contour data, and edge detection is performed on the segmented contour data to obtain the left contour C ml and the right side profile C mr ;
[0142] A segmentation module is used to segment the left side contour according to the C ml and the right side profile C mr Obtain the left target concave point and the right target concave point respectively, and connect the left target concave point and the right target concave point to obtain a segmentation line l s According to the dividing line l s Segment the overall contour data of the mushroom to obtain the stipe contour data and the cap contour data;
[0143] A calculation module is used to apply an edge detection algorithm to the mushroom overall contour data, the stem contour data and the cap contour data to obtain the mushroom overall contour C mush , cap outline C cap and the outline of the stem C stalk , and obtain the contour projection perimeter and contour projection area through the contour perimeter function and the area function, and then determine the contour length and contour width in combination with the minimum circumscribed rotation rectangle algorithm, and obtain the mushroom morphological data according to the contour projection perimeter, the contour projection area, the contour length and the contour width, the morphological data including the overall characteristics of the mushroom MC 、Cap characteristics CC and stipe characteristics SC .
[0144] In summary, the mushroom morphology data acquisition system in the above embodiment of the present invention is to obtain the original image of the mushroom by I Preprocessing is performed to obtain the preprocessed mushroom overall contour data, and the cap vertex is obtained based on the mushroom overall contour data. M top and the lowest point of the stipe Mbottom , with the cap apex M top The lowest point of the stem M bottom The connecting line is the dividing line to segment the overall contour data of the mushroom to obtain the left contour of the segmented contour C ml and the right side profile C mr , to achieve accurate segmentation of mushrooms; then the overall outline of the mushrooms C mush , cap outline C cap and the outline of the stem C stalk Data processing is performed to obtain the morphological data of mushrooms, which avoids manual measurement and improves measurement efficiency and accuracy.
[0145] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0146] In addition, an embodiment of the present invention further provides a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method in the above embodiment when executing the program.
[0147] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0148] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or processing in another suitable manner as necessary, and then stored in a computer memory.
[0149] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0150] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0151] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for acquiring mushroom morphological data, characterized in that: include: Get the original image of the mushroom I And preprocessing, the original image I Including the stem and the cap, obtaining the pre-processed overall contour data of the mushroom to obtain the cap vertex according to the overall contour data of the mushroom M top and the lowest point of the stipe M bottom , with the cap vertex M top The lowest point of the stipe M bottom The connecting line of is used as a dividing line to segment the overall contour data of the mushroom to obtain segmented contour data, and edge detection is performed on the segmented contour data to obtain the left contour C ml and the right side profile C mr ; According to the left side profile C ml and the right side profile C mr Obtain the left target concave point and the right target concave point respectively, and connect the left target concave point and the right target concave point to obtain a segmentation line l s According to the dividing line l s Segment the overall contour data of the mushroom to obtain the stipe contour data and the cap contour data; Applying edge detection algorithm to the mushroom overall contour data, the stem contour data and the cap contour data to obtain the mushroom overall contour C mush , cap outline C cap and the outline of the stem C stalk , and obtain the contour projection perimeter and contour projection area through the contour perimeter function and the area function, and then determine the contour length and contour width in combination with the minimum circumscribed rotation rectangle algorithm, and obtain the mushroom morphological data according to the contour projection perimeter, the contour projection area, the contour length and the contour width, the morphological data including the overall characteristics of the mushroom MC 、Cap characteristics CC and stipe characteristics SC ; Overall characteristics of mushrooms MC Including mushroom projection area MA , Mushroom projection perimeter MP , Plant height MH ; Cap characteristics CC Including cap projection area CA , cap projection circumference CP , opening angle KA , cap diameter CD and cap height CH ;Stipe characteristics SC Including stipe projection area SA , stipe projection circumference SP 、Average thickness of stipe SAT , the thickest stem SMT , stem length SH and stipe curvature SCU ; Among them, according to the left profile C ml and the right side profile C mr In the steps of obtaining the left target concave point and the right target concave point respectively: Define each original image I The lower left corner is the coordinate origin O (0,0), establish the xy coordinate system, the upper left corner coordinate is (0,y max ), the coordinate of the lower right corner is (x max ,0), the coordinate of the upper right corner is (x max ,y max ), in which x and y are both greater than 0; The methods for obtaining the left target concave point include: Get the cap vertex M top The lowest point M of the stipe bottom Connection l l , the left contour C ml Rotate counterclockwise until l l The left rotation profile is parallel to the x-axis of the xy coordinate system for the first time to obtain the left rotation profile, wherein the left rotation profile includes a plurality of discrete points C’ ml ; At the top of the cap M top The lowest point of the stipe M bottom The average value P of the horizontal axis is the boundary, and multiple discrete points are found respectively. C’ ml The minimum vertical coordinate point on the left side of position P M tmin and the right ordinate minimum point M bmin ; Connect the left ordinate minimum point M tmin and the right ordinate minimum point M bmin Make a straight line l out1 ; Find the minimum value point of the left ordinate M tmin and the right ordinate minimum point M bmin All discrete points between the l out1 The longest vertical distance M lh , the point with the longest vertical distance M lh is a left preliminary concave point, and a left target concave point is obtained according to the left preliminary concave point; The method for obtaining the right target concave point includes: Get the cap vertex M top The lowest point M of the stipe bottom Connection l r , the right side contour C mr Rotate counterclockwise until l r The x-axis of the xy coordinate system is parallel to the x-axis of the xy coordinate system to obtain a right-side rotation profile, wherein the right-side rotation profile includes a plurality of discrete points. C’ mr ; At the top of the cap M top The lowest point of the stipe M bottom The average value of the horizontal axis P ’ As the boundary, find multiple discrete points C’ mr In P ’ The maximum value point of the left vertical coordinate of the position M tmax and the maximum value point of the vertical coordinate on the right M bmax ; Connect the maximum value point of the left ordinate M tmax and the right ordinate maximum point M bmax Make a straight line l out2 ; Find the maximum value point of the left ordinate M tmax and the right ordinate maximum point M bmax All discrete points between the l out2 The longest vertical distance M rh , the longest vertical distance point M rh is a right preliminary concave point, and a right target concave point is obtained according to the right preliminary concave point; Wherein, the left target concave point and the right target concave point constitute a target concave point, the left preliminary concave point and the right preliminary concave point constitute a preliminary concave point, in the step of obtaining the left target concave point according to the left preliminary concave point / obtaining the right target concave point according to the right preliminary concave point: The determination methods of the target depression point include: Determine whether the preliminary concave point meets the calculation formula of the rising edge and falling edge of the discrete point; If it meets the requirements, the current discrete point is the target concave point; If it does not match, search to the left and right sides of the current discrete point until the rising edge and falling edge calculation formula of the discrete point are met; The calculation formula for the rising and falling edges of the left target depression point is: ; The calculation formula for the rising and falling edges of the right target depression point is: ; In the formula, k is the point number, ( k +1, f ( k +1)) is the coordinate of the current point, ( k , f ( k )) is the point to the left of the current point, ( k +2, f ( k +2)) is the point to the right of the current point.
2. The mushroom morphology data acquisition method according to claim 1, characterized in that: Mushroom overall characteristics MC The calculation methods include: Getting the overall outline of the mushroom C mush Finally, the mushroom projection perimeter is obtained through the contour perimeter function MP ; Use the area function to get the mushroom projection area MA ; Overall outline of mushrooms C mush Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect0, and use the long side of the circumscribed rotated rectangle Rect0 d max As the height of mushrooms MH ; Among them, the mushroom projection perimeter is obtained by the contour perimeter function MP , mushroom projection circumference MP The methods for obtaining include: Overall outline of mushrooms C mush Interpolate each point to calculate the fitting curve S ; According to the fitting curve S Calculate the Euclidean distance between every two adjacent points d i And summing, we get MP .
3. The mushroom morphology data acquisition method according to claim 1, characterized in that: Cap characteristics CC The calculation methods include: Getting the cap outline C cap Then, the cap projection perimeter is calculated by the contour perimeter function. CP , ,in, d cpi The cap outline C cap The Euclidean distance between two adjacent points in is n1, and n1 is the number of discrete points of the cap contour; Use the area function to get the cap projection area CA ; Pileus cap outline C cap Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect1, and use the long side of the circumscribed rotated rectangle Rect1 D cmax and short side D cmin As the cap diameter CD and cap height CH ; Use the minimum circumscribed rotated rectangle algorithm to select the cap outline C cap Then, connect the cap vertices M top and the two ends of the base of the circumscribed rotated rectangle Rect1 to form a triangle △ABC, where A is the vertex of the cap. M top , BC are the left and right points of the bottom edge, ∠A is the opening angle of the parachute KA , opening angle KA The calculation formula is: ; Where AC, AB and BC are the sides of triangle △ABC respectively.
4. The mushroom morphology data acquisition method according to claim 1, characterized in that: Stipe characteristics SC The calculation methods include: Obtaining the stipe outline C stalk Then, the stipe projection perimeter is calculated by the contour perimeter function. SP , ,in, d spi The outline of the stem C stalk The Euclidean distance between two adjacent points in the figure, n2 is the number of discrete points of the stipe contour; Use the area function to get the stipe projection area SA ; Outline of stipe C stalk Use the minimum circumscribed rotated rectangle algorithm to get the circumscribed rotated rectangle Rect2, and then use the long side of the circumscribed rotated rectangle Rect2 D smax As stipe length SH ; Slice the stipe outline in pixels along the long side of the circumscribed rotated rectangle Rect2, calculate the width of each slice along the short side of the circumscribed rotated rectangle Rect2, and use it as the stipe width ST i , and ST i The maximum value is the thickest value of the stem SMT , SMT = ST max , and then according to ST i Get the average thickness of the stipe SAT , ,in, ST i represents the stipe width calculated at a certain slice, n 3 indicates the number of slices; Stem curvature SCU The calculation formula is: ; In the formula, SH is the stipe length; ST 1 is the width of the stipe in the first section, i.e. the width of the stipe section where the stipe and cap are connected; SP is the projected circumference of the stipe; SCU The curvature of the stipe.
5. The mushroom morphology data acquisition method according to claim 1, characterized in that: Get the original image of the mushroom I The steps of preprocessing and obtaining the preprocessed mushroom overall contour data include: Get the original image of the mushroom I , using edge detection algorithm to identify the original image I All edges of the image are broken. I c , and for the disconnected edge image I c Perform morphological operations to obtain complete closed contour images I o ; Analyze the closed contour image I o To determine the mushroom area Area mush and background area, marking the mushroom area Area mush with the background region to create a mask image; The mask image is combined with the original image I Perform bitwise operations to separate the mushroom regions Area mush The target mask image is obtained by comparing the background area I m , the target mask image I m The overall outline data of the mushroom.
6. A mushroom morphology data acquisition system, characterized in that: The system comprises: Acquisition module, used to obtain the original image of mushrooms I And preprocessing, the original image I Including the stem and the cap, obtaining the pre-processed overall contour data of the mushroom to obtain the cap vertex according to the overall contour data of the mushroom M top and the lowest point of the stipe M bottom , with the cap vertex M top The lowest point of the stipe M bottom The connecting line of is used as a dividing line to segment the overall contour data of the mushroom to obtain segmented contour data, and edge detection is performed on the segmented contour data to obtain the left contour C ml and the right side profile C mr ; A segmentation module is used to segment the left side contour according to the C ml and the right side profile C mr Obtain the left target concave point and the right target concave point respectively, and connect the left target concave point and the right target concave point to obtain a segmentation line l s According to the dividing line l s Segment the overall contour data of the mushroom to obtain the stipe contour data and the cap contour data; A calculation module is used to apply an edge detection algorithm to the mushroom overall contour data, the stem contour data and the cap contour data to obtain the mushroom overall contour C mush , cap outline C cap and the outline of the stem C stalk , and obtain the contour projection perimeter and contour projection area through the contour perimeter function and the area function, and then determine the contour length and contour width in combination with the minimum circumscribed rotation rectangle algorithm, and obtain the mushroom morphological data according to the contour projection perimeter, the contour projection area, the contour length and the contour width, the morphological data including the overall characteristics of the mushroom MC 、Cap characteristics CC and stipe characteristics SC ; Overall characteristics of mushrooms MC Including mushroom projection area MA , Mushroom projection perimeter MP , Plant height MH ; Cap characteristics CC Including cap projection area CA , cap projection circumference CP , opening angle KA , cap diameter CD and cap height CH ;Stipe characteristics SC Including stipe projection area SA , stipe projection circumference SP 、Average thickness of stipe SAT , the thickest stem SMT , stem length SH and stipe curvature SCU ; Among them, according to the left profile C ml and the right side profile C mr In the steps of obtaining the left target concave point and the right target concave point respectively: Define each original image I The lower left corner is the coordinate origin O (0,0), establish the xy coordinate system, the upper left corner coordinate is (0,y max ), the coordinate of the lower right corner is (x max ,0), the coordinate of the upper right corner is (x max ,y max ), in which x and y are both greater than 0; The methods for obtaining the left target concave point include: Get the cap vertex M top The lowest point M of the stipe bottom Connection l l , the left contour C ml Rotate counterclockwise until l l The left rotation profile is parallel to the x-axis of the xy coordinate system for the first time to obtain the left rotation profile, wherein the left rotation profile includes a plurality of discrete points C’ ml ; At the top of the cap M top The lowest point of the stipe M bottom The average value P of the horizontal axis is the boundary, and multiple discrete points are found respectively. C’ ml The minimum vertical coordinate point on the left side of position P M tmin and the right ordinate minimum point M bmin ; Connect the left ordinate minimum point M tmin and the right ordinate minimum point M bmin Make a straight line l out1 ; Find the minimum value point of the left ordinate M tmin and the right ordinate minimum point M bmin All discrete points between the l out1 The longest vertical distance M lh , the point with the longest vertical distance M lh is a left preliminary concave point, and a left target concave point is obtained according to the left preliminary concave point; The method for obtaining the right target concave point includes: Get the cap vertex M top The lowest point M of the stipe bottom Connection l r , the right side contour C mr Rotate counterclockwise until l r The x-axis of the xy coordinate system is parallel to the x-axis of the xy coordinate system to obtain a right-side rotation profile, wherein the right-side rotation profile includes a plurality of discrete points. C’ mr ; At the top of the cap M top The lowest point of the stipe M bottom The average value of the horizontal axis P ’ As the boundary, find multiple discrete points C’ mr In P ’ The maximum value point of the left vertical coordinate of the position M tmax and the maximum value point of the vertical coordinate on the right M bmax ; Connect the maximum value point of the left ordinate M tmax and the right ordinate maximum point M bmax Make a straight line l out2 ; Find the maximum value point of the left ordinate M tmax and the right ordinate maximum point M bmax All discrete points between the l out2 The longest vertical distance M rh , the longest vertical distance point M rh is a right preliminary concave point, and a right target concave point is obtained according to the right preliminary concave point; Wherein, the left target concave point and the right target concave point constitute a target concave point, the left preliminary concave point and the right preliminary concave point constitute a preliminary concave point, in the step of obtaining the left target concave point according to the left preliminary concave point / obtaining the right target concave point according to the right preliminary concave point: The determination methods of the target depression point include: Determine whether the preliminary concave point meets the calculation formula of the rising edge and falling edge of the discrete point; If it meets the requirements, the current discrete point is the target concave point; If it does not match, search to the left and right sides of the current discrete point until the rising edge and falling edge calculation formula of the discrete point are met; The calculation formula for the rising and falling edges of the left target depression point is: ; The calculation formula for the rising and falling edges of the right target depression point is: ; In the formula, k is the point number, ( k +1, f ( k +1)) is the coordinate of the current point, ( k , f ( k )) is the point to the left of the current point, ( k +2, f ( k +2)) is the point to the right of the current point.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the mushroom morphology data acquisition method as described in any one of claims 1 to 5 is implemented.
8. A data processing device 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, the mushroom morphology data acquisition method as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method for automatically detecting low-quality mushrooms
CN108171693A
Agaricus blazei murill sporocarp growth parameter detection method based on image processing technology
CN110610506A
Segmentation and identification method of overlapped agaricus bisporus
CN111445482A
Method and system for automatically acquiring morphological data of pileus
CN116434225A
Pleurotus eryngii volume calculation method
CN117611657A
