Image processing-based automatic analysis method and system for pleurotus eryngii phenotype

By employing real-time image processing and robust fusion methods, the phenotypic analysis of king oyster mushrooms in dynamic environments was solved, achieving high-precision and stable online automatic analysis, thereby improving the sorting efficiency and measurement accuracy of king oyster mushrooms.

CN122115494APending Publication Date: 2026-05-29WUHAN GOOALGENE TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN GOOALGENE TECH CO LTD
Filing Date
2026-03-10
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing phenotypic analysis methods for king oyster mushrooms cannot adapt to dynamic industrial scenarios, resulting in large measurement errors and low measurement efficiency, making it difficult to achieve high-precision and robust online automatic analysis.

Method used

By acquiring multi-frame image sequences of king oyster mushrooms through real-time imaging, the target trajectory was established, target segmentation and shape contour extraction were performed, key phenotypic parameters were calculated using weighted aggregation and geometric measurement algorithms, and attitude correction and scale normalization were performed using Kalman filtering and Hungarian algorithm. Parameter statistical analysis was then conducted using robust fusion methods.

Benefits of technology

It achieves high-precision and high-stability online automatic analysis in dynamic industrial environments, significantly improving sorting efficiency and measurement accuracy, and providing a reliable technical foundation for automated grading of king oyster mushrooms and intelligent management and control of production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115494A_ABST
    Figure CN122115494A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of pleurotus eryngii detection, and proposes a pleurotus eryngii phenotype automatic analysis method and system based on image processing, which comprises the following steps: real-time imaging of continuously moving pleurotus eryngii on a conveying belt, acquisition of a plurality of image sequences, establishment of a target trajectory and segmentation of a contour; fusion of the main shaft direction of the plurality of images and estimation of the actual direction of the quality index, and correction of the virtual posture of the image and normalization of the scale according to the actual direction; calculation of parameters such as the stem length and cap diameter of the image on the corrected image, and reduction of errors through multi-frame data fusion; and finally, real-time statistical analysis of the parameters of the batch of pleurotus eryngii, output of the mean value, standard deviation and coefficient of variation to represent the uniformity of the group. Through multi-frame tracking, correction and fusion, the method suppresses dynamic interference, realizes high-precision online analysis, improves the sorting accuracy, stability and efficiency, and provides a technical basis for the automatic grading and production line control of pleurotus eryngii.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of king oyster mushroom detection technology, and in particular to an automatic phenotypic analysis method and system for king oyster mushrooms based on image processing. Background Technology

[0002] As a common edible fungus, the phenotypic characteristics of king oyster mushrooms, such as cap size and stipe shape, are of great significance for quality assessment, breeding selection, and production management. Traditional phenotypic analysis mainly relies on manual contact measurements using tools such as calipers and rulers. This method is inefficient, highly subjective, and difficult to achieve rapid and consistent evaluation of large batches of samples, which has become a bottleneck restricting the intelligent upgrading of the industry.

[0003] With the development of image processing technology, vision-based automatic phenotypic analysis methods for king oyster mushrooms have emerged, aiming to improve efficiency and objectivity through non-contact measurement. However, existing image analysis methods are mostly designed for static, controlled laboratory environments. These methods typically require samples to be fixed in place and imaged and analyzed under ideal lighting conditions. Their algorithms cannot adapt to the fundamental challenges posed by the continuous movement of king oyster mushrooms on conveyor belts in industrial sorting scenarios: random rolling and offset of samples during movement introduce huge measurement errors; and interference factors inherent in dynamic environments, such as motion blur and temporary occlusion, are problems that existing static analysis schemes have not fully considered in their design, resulting in insufficient stability and robustness in actual production lines.

[0004] Therefore, existing technologies suffer from significant application gaps: on the one hand, traditional manual measurement is inefficient and cannot meet the needs of large-scale production; on the other hand, existing static image analysis methods are ill-equipped to handle dynamic interference in real-world industrial environments. The goal is to develop a method capable of overcoming posture changes and complex interference during continuous sample movement, enabling high-precision and robust online automatic analysis of Pleurotus eryngii phenotypes, thus providing reliable quantitative data for quality grading, breeding screening, and production management of Pleurotus eryngii. Summary of the Invention

[0005] In view of this, this application proposes an automatic phenotypic analysis method and system for Pleurotus ostreatus based on image processing, which solves the problem that existing Pleurotus ostreatus phenotypic analysis technologies are limited to static environments and cannot adapt to dynamic industrial scenarios, resulting in large measurement errors and low measurement efficiency.

[0006] The technical solution of this application is implemented as follows: Firstly, this application provides an online automatic analysis method for phenotypic parameters of Pleurotus ostreatus var. prawns in a dynamic industry, comprising the following steps: In the acquisition area of ​​the conveyor belt, image acquisition equipment is used to perform real-time imaging of the king oyster mushrooms that move continuously with the conveyor belt, and to obtain a multi-frame image sequence of the target king oyster mushrooms. A target trajectory is established for the target king oyster mushroom based on the multi-frame image sequence, and target segmentation is performed in each frame image corresponding to the target trajectory to obtain the shape contour of the target king oyster mushroom. Based on the shape contour of the target king oyster mushroom, the candidate principal axis direction of each frame is extracted. The candidate principal axis direction is the orientation of the stipe of the king oyster mushroom in a single frame image. The candidate principal axis directions of each frame in the target trajectory are weighted and aggregated with the corresponding image quality indicators to obtain the reference principal axis direction of the target king oyster mushroom in the image. The reference principal axis direction is the reference direction determined after fusing the candidate directions of multiple frames in the target trajectory, and is used for image pose correction. The image pose of the king oyster mushroom is virtually corrected according to the reference main axis direction so that the main axis direction coincides with the preset reference direction. The scale of the virtually corrected image is then normalized to obtain an image with corrected pose and normalized scale. Based on the pose-corrected and scale-normalized image, key phenotypic parameters are calculated using a geometric measurement algorithm. The key phenotypic parameters include at least one of the stipe length and the maximum diameter of the cap. The key phenotypic parameters in multiple pose-corrected and scale-normalized image frames within the target trajectory are robustly fused to obtain the final phenotypic parameters of the target king oyster mushroom. Real-time statistical analysis is performed on the final phenotypic parameters of multiple king oyster mushrooms that continuously pass through the collection area in the same batch. The mean, standard deviation and coefficient of variation are calculated to obtain the population uniformity of the king oyster mushrooms in that batch, which is used for quality grading.

[0007] In some embodiments, the step of establishing a target trajectory for the target king oyster mushroom based on the multi-frame image sequence includes: Construct a uniform linear or uniformly accelerated motion model based on the linear velocity and direction of motion of the conveyor belt; Kalman filtering is used for state prediction and observation update, and the Hungarian algorithm, which combines cross-union geometric constraints and appearance embedding features, is used to achieve cross-frame target association. For targets that are briefly occluded, the trajectory is recovered by forward and backward bidirectional Kalman trajectory interpolation and re-identification. The start, maintenance and termination of the trajectory are dynamically controlled by the target confidence and the threshold of the number of consecutive unmatched frames, thereby obtaining a continuous and complete target trajectory.

[0008] In some embodiments, the step of segmenting the target within each frame image corresponding to the target trajectory to obtain the shape contour of the target king oyster mushroom includes: The target mask is obtained by using a lightweight instance segmentation network or background modeling and foreground extraction methods, and morphological closing and thinning operations are performed to correct holes and contour burrs. Image quality metrics are calculated for subsequent weighting. These metrics include at least contour integrity, sharpness based on Laplacian variance, and visible area ratio. The weights are obtained by multiplying each image quality metric value by its corresponding weighting coefficient, summing the results, and then normalizing them to eliminate scale bias.

[0009] In some embodiments, the weighted aggregation is an aggregation based on weighted circle statistics, including: Candidate principal axis direction angles for each frame within the trajectory i k and their weights w k Calculate the weighted statistic: , , C The sum of the weighted cosine components. S The sum of weighted sine components is used to estimate the direction of the principal axis. And truncation is performed on extremely low weights or outlier angles to suppress outliers; For the estimated principal axis direction i * The sequence is subjected to time-series filtering using an exponential smoothing algorithm.

[0010] In some embodiments, the step of virtually correcting the image pose of the king oyster mushroom according to the reference principal axis direction, so that the principal axis direction coincides with the preset reference direction, and normalizing the scale of the virtually corrected image includes: Apply rotation transformation to each frame of the image to align the main axis of the king oyster mushroom with the preset reference direction, and use the target centroid as the center of rotation; Based on the homography matrix obtained from the plane calibration of the acquisition system, the image pixel coordinates are mapped to the physical coordinates of the conveyor belt; In the physical coordinate system of the conveyor belt, the measurement endpoints for the phenotypic parameters of king oyster mushrooms are selected. , The lengths of key phenotypic parameters are obtained by calculating the Euclidean distance between the endpoints; When the camera drifts or the focal length changes, the homography matrix is ​​dynamically updated by reference markers within the field of view to achieve online scale correction.

[0011] In some embodiments, the method for calculating key phenotypic parameters using a geometric measurement algorithm includes: The skeleton of the segmented target region is refined, and the main path of the stipe is identified by the endpoints and bifurcation points. The stipe length is defined as the length of the skeleton path along the main axis, which is obtained by the geodesic distance from the base end to the connection point of the cap. The geodesic distance is calculated by accumulating the Euclidean distance between the skeleton pixels. The maximum diameter of the cap is calculated in a direction orthogonal to the principal axis after posture correction. Specifically, for each ordinate, the difference between the abscissas of the leftmost and rightmost points of the contour on the horizontal line is calculated, and the maximum abscissa difference corresponding to all ordinates is taken as the cap diameter. The connection between the stipe and the cap is determined by detecting the peak value of the contour curvature or the extreme value of the gray-scale gradient. When the contrast is low, shape prior is used for correction.

[0012] In some embodiments, the robust integration includes the following steps: Parameter values ​​for multiple frames of the same trajectory x i and the corresponding weights w i We employ a fusion of weighted M-estimation and quantile strategy to minimize the objective function. To solve for the robust center value m ,in, u=x i -m , representing the residual of the parameter estimation; The Huber loss function is defined as follows: Scale parameters ,s Estimated by the absolute deviation of the median; For key phenotypic parameters that are susceptible to occlusion and thus have lower measured values, the upper quantile is used to calculate the final value; for length parameters, the weighted median is used to calculate the final value; the weights... w i It is also used for M estimation and quantile weighting calculation to adjust the contribution of each frame parameter according to the intra-frame image quality.

[0013] In some embodiments, the real-time statistical analysis of the final measurement values ​​of multiple king oyster mushrooms that continuously pass through the collection area in the same batch includes: monitoring the final parameter values ​​within a sliding time window, calculating the mean, standard deviation, and the ratio of the standard deviation to the mean, and setting thresholds τ and Δ. Threshold τ is the upper limit of the allowable coefficient of variation, and threshold Δ is the upper limit of the absolute deviation between the batch mean and the preset target value. When the coefficient of variation is greater than τ or the absolute difference between the mean and the target value is greater than Δ, an alarm is generated and the timestamp and workstation information are recorded.

[0014] Secondly, this application discloses an automatic phenotypic analysis system for Pleurotus eryngii based on image processing, comprising: An image acquisition module is configured in the acquisition area of ​​the conveyor belt and is used to perform real-time imaging of the target king oyster mushroom that moves continuously with the conveyor belt, and to acquire a multi-frame image sequence of the target king oyster mushroom. The target trajectory processing module is used to establish a target trajectory for the target king oyster mushroom based on the multi-frame image sequence, and to perform target segmentation in each frame image corresponding to the target trajectory to obtain the shape outline of the target king oyster mushroom. The principal axis direction estimation module is used to extract candidate principal axis directions for each frame based on the shape contour of the target king oyster mushroom. The candidate principal axis direction is the orientation of the stipe of the king oyster mushroom in a single frame image. The module also performs weighted aggregation of the candidate principal axis directions of each frame within the target trajectory with the corresponding image quality indicators to obtain the reference principal axis direction of the king oyster mushroom in the image. The reference principal axis direction is the reference direction for image pose correction determined after fusing the candidate directions of multiple frames within the target trajectory. The pose correction and scale normalization module is used to virtually correct the pose of the king oyster mushroom image based on the reference main axis direction, so that the main axis direction coincides with the preset reference direction, and normalize the scale of the virtually corrected image to obtain a pose-corrected and scale-normalized image. The phenotypic parameter calculation and fusion module is used to calculate key phenotypic parameters based on the pose-corrected and scale-normalized image using a geometric measurement algorithm. The key phenotypic parameters include at least one of the stipe length and the maximum diameter of the cap. The module also robustly fuses the key phenotypic parameters from multiple pose-corrected and scale-normalized image frames within the target trajectory to obtain the final phenotypic parameters of the target king oyster mushroom. The statistical analysis module is used to perform real-time statistical analysis on the final phenotypic parameters of multiple king oyster mushrooms that continuously pass through the collection area in the same batch, calculate the mean, standard deviation and coefficient of variation, and obtain the population uniformity of the king oyster mushrooms in the batch for quality grading.

[0015] Thirdly, this application discloses an electronic device, including a processor and a memory; the memory stores a computer program, wherein the computer program, when executed by the processor, implements the image processing-based automatic phenotypic analysis method for Pleurotus eryngii described in the first aspect.

[0016] This application has the following advantages over the prior art: (1) The online automatic analysis method for phenotypic parameters of king oyster mushrooms disclosed in this application acquires multi-frame image sequences of king oyster mushrooms moving continuously on a conveyor belt in real time and constructs a target trajectory to achieve continuous tracking and data processing of the same target; then, a robust estimation algorithm based on image quality weighting is used to accurately correct the attitude error caused by sample rolling or offset; furthermore, through robust fusion of multi-frame parameters, the measurement deviation caused by dynamic interference such as occlusion and blurring in a single frame image is effectively suppressed; finally, the population uniformity is statistically analyzed based on the final parameter values ​​of the batch of king oyster mushrooms. This method achieves high-precision and high-stability online automatic analysis without interrupting the continuous operation of the production line, significantly improving sorting efficiency and measurement accuracy, and providing a reliable technical foundation for the automated grading of king oyster mushrooms and intelligent management and control of the production line.

[0017] (2) A target trajectory tracking scheme adapted to dynamic industrial environments was constructed through motion modeling, filtering prediction, multi-feature association, and occlusion recovery mechanisms. This scheme significantly improved the trajectory stability of king oyster mushrooms under continuous motion, provided a high-precision time-series data foundation for subsequent phenotypic parameter analysis, and enhanced the practicality of the system in complex scenarios.

[0018] (3) By using weighted circular statistical aggregation and exponential smoothing filtering, the robustness and temporal consistency of the principal axis direction estimation are significantly improved. Weighted circular statistics solve the problems of angle periodicity and outliers, while exponential smoothing ensures smooth output in dynamic environments, providing a reliable foundation for subsequent attitude correction and parameter calculation, and enhancing the practicality of the system in industrial scenarios.

[0019] (4) By refining the skeleton, scanning in orthogonal directions, and fusing multiple features, the measurement challenges posed by the complexity of the morphology of Pleurotus eryngii and the fluctuation of image quality in dynamic environments are solved. Compared with relying solely on simple binary contour analysis or using static geometric methods such as minimum bounding rectangle, this scheme significantly improves the adaptability and accuracy of parameter calculation, providing key technical support for industrial grading and quality control.

[0020] (5) The robust fusion method disclosed in this application effectively improves the measurement robustness and accuracy of Pleurotus eryngii phenotypic parameters in dynamic industrial environments by combining weighted M-estimation and quantile strategy. When fusing parameter values ​​from multiple frames of the same trajectory, this method uses weighted M-estimation to suppress outlier interference and uses quantile strategy to differentiate parameter characteristics, reducing systematic bias caused by occlusion or motion blur. At the same time, the weights are dynamically adjusted based on image quality indicators to ensure that high-quality frames dominate the fusion results, thereby outputting stable and reliable parameter values ​​in continuous motion scenes, providing a solid data foundation for subsequent batch analysis. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart of the image processing-based automatic phenotypic analysis method for Pleurotus eryngii disclosed in this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] In the description of the embodiments of this application, it should be noted that, unless otherwise explicitly specified and limited, the terms "connected" and "linked" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms in the embodiments of this application based on the specific circumstances.

[0025] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0026] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed. In addition, various specific examples of processes and materials are provided in this application; however, those skilled in the art will recognize the applicability of other processes and / or the use of other materials.

[0027] In industrial-scale king oyster mushroom sorting, the mushrooms move continuously along the conveyor belt, and their position, orientation, and posture exhibit randomness. (See attached diagram) Figure 1 As shown, to achieve high-precision phenotypic parameter analysis, this application discloses an automatic phenotypic analysis method for Pleurotus eryngii based on image processing, including the following steps:

[0028] Step S1: In the acquisition area of ​​the conveyor belt, image acquisition equipment is used to perform real-time imaging of the king oyster mushrooms that are continuously moving with the conveyor belt, obtaining a multi-frame image sequence of the target king oyster mushrooms. This step, by continuously capturing multiple frames of images in motion, provides a data foundation for subsequent dynamic analysis, effectively overcoming the limitation of fixed sample placement in static photography, and directly adapting to the needs of high-speed continuous operation on the production line.

[0029] Specifically, in the dynamic sorting production line, king oyster mushrooms move at a constant speed, such as 0.5-1.0 m / s, along with the conveyor belt. To achieve continuous tracking, a high-frequency industrial camera, with a frame rate ≥30 fps, captures a sequence of multiple images. The acquisition area needs to be equipped with uniform light sources to reduce shadows and reflections. The core function of the multiple-frame sequence is to capture the posture and position of the same king oyster mushroom at different times, providing a data foundation for subsequent trajectory establishment.

[0030] In some specific examples, if the conveyor belt speed is 0.8 m / s and the camera frame rate is 50 fps, the displacement of the king oyster mushroom between adjacent frames is approximately 16 mm. Motion blur can be suppressed by adjusting the exposure time to ensure image sharpness.

[0031] Step S2: Based on the acquired multi-frame image sequence, a target trajectory is established for the target king oyster mushroom, and target segmentation is performed within each frame corresponding to the target trajectory to obtain the shape contour of the target king oyster mushroom. After contour extraction, based on the geometric features of the shape contour of the target king oyster mushroom, candidate principal axis directions for each frame are extracted. This direction is defined as the main orientation of the king oyster mushroom stipe estimated from a single frame image. Subsequently, the candidate principal axis directions of each frame within the target trajectory are weighted and aggregated with the corresponding image quality indicators to obtain the actual principal axis direction of the king oyster mushroom in the image. This actual direction is defined as the reference direction determined after fusing multiple candidate directions, and is used for image pose correction. Weighted aggregation optimizes the direction estimation by combining image quality indicators (such as sharpness and occlusion degree), reducing errors introduced by single-frame image quality fluctuations or pose randomness, and improving the robustness and accuracy of direction estimation.

[0032] The target trajectory is dynamically tracked by associating multiple frames of images of the same target, the king oyster mushroom. After target segmentation and contour extraction, candidate principal axis directions for each frame are extracted based on the geometric features of the contour. These are then weighted and aggregated using image quality metrics (such as sharpness and occlusion level) to optimize the direction estimation. For example, candidate principal axis directions are calculated for each frame's contour, and a weighted average is performed based on the frame's sharpness weight to improve the estimation robustness. If a frame's contour is blurred due to temporary occlusion, its quality weight is reduced, while the candidate direction weight of a clear frame is higher, thus suppressing the impact of outliers on the final direction estimation.

[0033] Step S3: Perform virtual correction on the image posture of the king oyster mushroom according to the actual main axis direction, so that the main axis direction coincides with the preset reference direction, and normalize the scale of the virtually corrected image to obtain an image with posture correction and scale normalization.

[0034] Virtual correction aligns the image to a reference orientation through rotational transformation, while scale normalization converts pixel coordinates into physical dimensions using camera calibration parameters (such as focal length and object distance). Its principle is geometric transformation and coordinate mapping, which aims to eliminate pose deviations and perspective distortions during sample movement, ensuring all images are on a unified measurement reference and improving the consistency of parameter calculations. For example, after correction, the stipe direction is parallel to the image's vertical axis, facilitating length measurement; and after normalization, the dimensions are in millimeters, avoiding pixel ratio distortion.

[0035] Step S4: Based on the pose-corrected and scale-normalized image, key phenotypic parameters are calculated using a geometric measurement algorithm. The key phenotypic parameters include at least one of the stipe length and the maximum diameter of the cap. The key phenotypic parameters in multiple pose-corrected and scale-normalized image frames within the target trajectory are robustly fused to obtain the final phenotypic parameters of the target king oyster mushroom.

[0036] This step aims to eliminate measurement fluctuations caused by transient interference (such as local occlusion, motion blur, or minor pose deviations) in single-frame images, and improve the accuracy and reliability of the final phenotypic parameters of individual king oyster mushrooms through multi-frame data fusion. The geometric measurement algorithm directly quantifies parameters such as stipe length and cap diameter from the corrected images, while robust fusion, based on image quality indicators of each frame, weights and integrates multiple measurements of the same king oyster mushroom at different times, suppressing the influence of outliers. This results in stable and reliable individual parameter values ​​in a dynamic industry environment, providing a high-quality data foundation for subsequent batch statistical analysis.

[0037] Step S5: Perform real-time statistical analysis on the final measurement values ​​of multiple king oyster mushrooms that continuously pass through the collection area in the same batch, calculate the mean, standard deviation and coefficient of variation, and obtain the population uniformity of the king oyster mushrooms in that batch for quality grading.

[0038] By monitoring parameter distribution through a sliding time window, the mean reflects average quality, the standard deviation quantifies dispersion, and the coefficient of variation characterizes relative uniformity. Its function is to extend from individual measurements to batch evaluation, providing quantitative data for production line sorting, breeding, and production process adjustments, thus achieving population-level quality control. For example, if the coefficient of variation exceeds a threshold, it indicates poor population uniformity, which can trigger sorting adjustments; statistical analysis results provide quantitative data for production line process optimization.

[0039] This application discloses an online automatic analysis method for the phenotypic parameters of king oyster mushrooms. It acquires multi-frame image sequences of king oyster mushrooms continuously moving on a conveyor belt in real time and constructs a target trajectory to achieve continuous tracking and data processing of the same target. Then, a robust estimation algorithm based on image quality weighting is used to accurately correct attitude errors caused by sample rolling or offset. Furthermore, robust fusion of multi-frame parameters effectively suppresses measurement deviations caused by dynamic interference such as occlusion and blurring in single-frame images. Finally, statistical analysis of population evenness is performed based on the final parameter values ​​of the batch of king oyster mushrooms. This method achieves high-precision and high-stability online automatic analysis without interrupting the continuous operation of the production line, significantly improving sorting efficiency and measurement accuracy, and providing a reliable technical foundation for automated grading and intelligent production line management of king oyster mushrooms.

[0040] In some embodiments, to address the tracking challenges of king oyster mushrooms during continuous movement on a conveyor belt due to factors such as posture changes and occlusion, and to ensure the accuracy and robustness of trajectory association, this application discloses a step for establishing a target trajectory for the target king oyster mushroom based on the multi-frame image sequence.

[0041] First, a uniform linear motion model or a uniformly accelerated motion model is constructed based on the calibrated linear velocity and direction of motion of the conveyor belt. This step is based on the laws of physical motion. By calibrating the operating parameters of the conveyor belt, such as velocity and acceleration, the motion of the king oyster mushroom is simplified into a predictable model. The uniform linear model is suitable for scenarios where the conveyor belt is running stably, while the uniformly accelerated model can adapt to situations where the conveyor belt starts, stops, or changes speed. This modeling provides initial motion priors for subsequent target tracking, reducing the randomness of position prediction. For example, if the conveyor belt runs at a constant speed of 0.5 m / s, the motion of the king oyster mushroom can be regarded as uniform linear motion; if the conveyor belt decelerates in the sorting area with an acceleration of -0.1 m / s², then a uniformly accelerated model is needed to more accurately predict position changes.

[0042] Secondly, Kalman filtering is used for state prediction and observation update. Kalman filtering is a recursive algorithm that dynamically estimates the target's state, such as position and velocity, by combining a motion model and actual observation data. In the state prediction stage, the expected position in the next frame is calculated based on the motion model, while in the observation update stage, the predicted value is corrected using image detection results, thereby suppressing noise interference and improving tracking stability. For example, assuming the king oyster mushroom's coordinates in the current frame are (x, y), Kalman filtering predicts the coordinates in the next frame based on the uniform velocity model, then compares them with the actual coordinates obtained from image segmentation, and outputs the optimal estimate through weighted averaging, effectively addressing motion blur or detection errors.

[0043] Next, a Hungarian algorithm combining Intersection over Union (IoU) geometric constraints and appearance embedding features is used to achieve cross-frame target association. IoU measures the overlap of target bounding boxes, providing geometric consistency constraints; appearance embedding features extract semantic information such as texture and color of the target through a deep learning model, enhancing recognizability. The Hungarian algorithm, based on the principle of cost minimization, assigns detected targets from multiple frames to corresponding trajectories. This combination takes into account both spatial relationships and appearance similarity, avoiding false associations caused by similar appearances or proximity of targets. In the example, for two consecutive frames, the IoU and cosine similarity of appearance features between the detected king oyster mushroom in the current frame and existing trajectories are calculated. These two factors are combined as the matching cost, and the Hungarian algorithm is used to solve for the optimal assignment scheme, ensuring that the same king oyster mushroom is correctly associated in different frames.

[0044] For targets experiencing brief occlusion, a bidirectional Kalman trajectory interpolation and re-identification method is used to recover the trajectory. Forward interpolation uses historical trajectory data to predict the target's position during the occlusion period, while backward interpolation uses observation data after the occlusion ends to extrapolate the missing position. The re-identification method reconfirms the target's identity by comparing appearance features. This method effectively fills the gaps in trajectory interruptions and maintains data integrity. For example, if a king oyster mushroom is temporarily occluded between frames 10 and 15, the trajectory of frames 1-9 can be used to predict the position of frames 10-15 forward, and then backward interpolation can be performed based on the detection results of frames 16-20. Finally, the target can be re-matched in frame 16 using features such as the stipe texture, achieving seamless trajectory recovery.

[0045] The initiation, maintenance, and termination of a trajectory are dynamically controlled by the target confidence level and a threshold for the number of consecutive unmatched frames, thereby obtaining a continuous and complete target trajectory. The target confidence level reflects the reliability of the detection result, and the threshold for the number of consecutive unmatched frames sets the upper limit for trajectory loss tolerance. The initiation of a new trajectory must meet the confidence threshold, trajectory maintenance depends on continuous matching, and a termination mechanism is triggered if the threshold for unmatched frames is exceeded. This dynamic management avoids the generation and persistence of false trajectories and optimizes system resource allocation. In specific applications, the confidence threshold is set to 0.7, and the threshold for the number of unmatched frames is set to 5: when a new target appears in the image and the detection confidence level is ≥0.7, a new trajectory is initialized; if the trajectory fails to match successfully for 5 consecutive frames, the target is determined to be lost and the trajectory is terminated.

[0046] By employing motion modeling, filtering prediction, multi-feature association, and occlusion recovery mechanisms, a target trajectory tracking scheme adapted to dynamic industrial environments was constructed. This scheme significantly improves the trajectory stability of king oyster mushrooms under continuous motion, provides a high-precision time-series data foundation for subsequent phenotypic parameter analysis, and enhances the system's practicality in complex scenarios.

[0047] In some embodiments, this application further discloses the step of segmenting the target within each frame image corresponding to the target trajectory to obtain the shape outline of the target king oyster mushroom.

[0048] In the target segmentation stage, a lightweight instance segmentation network or a background modeling and foreground extraction method is used to obtain the target mask. Lightweight instance segmentation networks, such as the Mask R-CNN variant based on MobileNet, directly output pixel-level masks through convolutional neural networks, balancing speed and accuracy, and are suitable for real-time processing. Background modeling methods, such as Gaussian mixture models, use continuous frame difference to separate moving targets, suitable for fixed camera scenes. Morphological closing operations fill small holes to connect breakpoints, and refinement operations smooth contour edges, collectively correcting contour defects caused by lighting changes, reflections, or occlusions. For example, when the conveyor belt speed is 0.5 m / s, the lightweight segmentation network processes each frame in less than 30 milliseconds. The closing operation (3×3 rectangular kernel) fills the holes formed by reflections on the mushroom cap, and the refinement algorithm eliminates jagged edges, making the king oyster mushroom contour continuous and complete.

[0049] Image quality metrics include contour integrity, sharpness, and visible area ratio. Contour integrity quantifies continuity by the ratio of the contour perimeter to the perimeter of an ideal closed contour; a high value indicates no contour breaks. Sharpness is calculated based on the second derivative of the image using Laplacian variance; a larger variance indicates richer details. Visible area ratio is the ratio of the visible area of ​​the target to the theoretical area, reflecting the degree of occlusion. Weighting formula: Integrating the three, weighted coefficients a,b,c The settings are configured according to the needs of the scenario, such as focusing on clarity and anti-blurring in dynamic environments, and normalization processing to eliminate differences in dimensions.

[0050] In some instances, for a single frame with slight motion blur, q c =0.9、 q f =80、q o =0.95, let α=0.3,β= 0.5,γ=0.2, Then w = 0.3 × 0.9 + 0.5 × 0.8 + 0.2 × 0.95 = 0.27 + 0.4 + 0.19 = 0.86, which is normalized and used to adjust the contribution weight of this frame in the trajectory.

[0051] In some embodiments, this application defines the weighted aggregation method as an aggregation based on weighted circle statistics, which includes the following steps: First, the candidate principal axis direction angles for each frame within the trajectory are... i k and their weights w k Calculate the weighted statistics C and S, where C is the sum of the weighted cosine components: S is the sum of the weighted sine components: Weighted circular statistics handles the periodicity of angles by doubling the angle transformation, avoiding directional ambiguity caused by direct averaging.

[0052] Subsequently, according to the formula The principal axis direction is estimated using a formula based on vector composition, converting the weighted cosine and sine components into an average angle. Extremely low weights or outlier angles are truncated, for example, by ignoring frames with weights below a threshold or using statistical methods to remove outliers, thus suppressing errors caused by noise or occlusion. For instance, if a frame's weights are affected by motion blur... w k Extremely low, its angle i k They will be excluded from the aggregation calculation to ensure that the direction estimation relies more on high-quality data.

[0053] Secondly, to improve the time stability of the estimation results, the estimated principal axis directions are... i * The series is filtered using an exponential smoothing algorithm. Exponential smoothing recursively weights historical data, assigning higher weights to recent data to smooth short-term fluctuations. The filtering formula can be expressed as follows: ,in, Indicates the current time t The smoothed principal axis direction; Indicates the current time t The original estimated principal axis direction; Indicates the previous moment t-1 Smoothed main axis direction,α For smoothing factors, such as 0 < α≤1 This is used to control the weight ratio between the current observation and the historical smoothed values. This processing reduces inter-frame directional jumps, making the output more continuous. For example, when the conveyor belt speed fluctuates, the direction sequence may jitter; exponential smoothing can effectively attenuate high-frequency noise and output a stable principal axis direction.

[0054] By employing weighted circular statistical aggregation and exponential smoothing filtering, the robustness and temporal consistency of principal axis direction estimation are significantly improved. Weighted circular statistics address the issues of angle periodicity and outliers, while exponential smoothing ensures smooth output under dynamic conditions, providing a reliable foundation for subsequent attitude correction and parameter calculation, and enhancing the system's practicality in industrial applications.

[0055] In some embodiments, this application further discloses the steps of virtually correcting the image pose of the king oyster mushroom according to the reference main axis direction, so that the main axis direction coincides with the preset reference direction, and normalizing the scale of the virtually corrected image.

[0056] First, apply a rotation transformation to each frame of the image. R (- i * Align the main axis of the king oyster mushroom with the preset reference direction, and minimize the translation error with the target centroid as the rotation center.

[0057] Rotation transformation uses matrix operations to rotate the image by a specific angle, aligning the main axis direction of the king oyster mushroom (e.g., the direction of the stipe) with a preset reference direction (e.g., the vertical axis of the image). This step eliminates directional deviations caused by the sample rolling or shifting on the conveyor belt, ensuring that subsequent parameter measurements are based on a unified reference. Using the target centroid as the center of rotation avoids the accumulation of image translation errors caused by rotation. For example, if the centroid coordinates of the king oyster mushroom are (… x c , y c The rotation operation is centered on this point, maintaining the target's stable position in the image. In the example, when the king oyster mushroom tilts 45 degrees due to movement, by applying... R A rotational transformation of (-45°) is used to correct it to the vertical direction, which facilitates the standardized calculation of length and diameter.

[0058] Secondly, the homography matrix obtained based on the plane calibration of the acquisition system. H , to image pixels p Mapped to conveyor belt plane coordinates P, Its mapping relationship is as follows: P=H·p. Homography matrix HIt is a 3×3 projection transformation matrix, obtained through camera calibration, such as using a checkerboard calibration board, to describe the mapping relationship from the image pixel plane to the physical world plane. This step transforms the image coordinates into the true size in the physical coordinate system, overcoming scale distortion caused by perspective distortion and shooting angle.

[0059] In the physical coordinate system, the measurement endpoints for the phenotypic parameters of Pleurotus ostreatus are selected. P 1 and P 2 ,in P 1 and P 2 These represent the starting and ending coordinates of key phenotypic parameters (such as stipe length or cap diameter) in the physical coordinate system. The length of the key phenotypic parameter is calculated using Euclidean distance. The Euclidean distance formula is... It directly calculates the straight-line distance between two points, reflecting the true physical dimensions. For example, for the length of the stipe, P 1 It may be located at the base of the stipe. P 2 Located at the junction of the cap, the precise length value is obtained through Euclidean distance, avoiding errors caused by pixel distance variations due to resolution changes.

[0060] When camera drift or focal length changes, the homography matrix is ​​dynamically updated using reference markers within the field of view. H This enables online scale correction. Reference markers include symbols with known geometric features, such as checkerboard patterns or ArUco codes, whose physical locations are fixed. The system detects the marker positions in the image in real time; if camera movement causes a mapping deviation, the matrix is ​​recalculated. H The system adapts to changes in camera parameters. For example, if conveyor belt vibration causes the camera to shift by 2 millimeters, the system updates matrix H by detecting changes in the corner points of the ArUco code, ensuring the continued accuracy of scale mapping. The update frequency is set according to camera stability; a high update rate is set for high-frequency vibration environments, and a low frequency is set for static environments, balancing computational efficiency and accuracy.

[0061] By employing rotational transformation, homography matrix mapping, physical coordinate measurement, and dynamic correction, the system systematically addresses the challenges posed by pose variations in Pleurotus eryngii and camera instability in dynamic industrial environments. This provides a robust geometric basis for phenotypic parameter analysis and significantly improves the repeatability and practicality of measurements.

[0062] In some embodiments, this application also discloses a method for calculating key phenotypic parameters using a geometric measurement algorithm.

[0063] Regarding the calculation of stipe length, the skeleton of the segmented target region is refined, and the main path of the stipe is identified by endpoints and bifurcation points. The stipe length is then calculated. L Defined as the length of the skeleton path along the main axis, it is obtained from the geodesic distance from the base to the connection point of the cap. The skeleton thinning algorithm compresses the pixel region of the Pleurotus eryngii stipe into a single-pixel-wide centerline, extracting the main path by tracing the endpoints (stipe base) and bifurcation points (connection point between the stipe and cap). The geodesic distance is calculated by accumulating the Euclidean distances of adjacent skeleton pixels along the path, effectively reflecting the actual bending length of the stipe. For example, if the stipe is arc-shaped in the image, the skeleton path can accurately capture its curved trajectory. After accumulating the pixel distances, multiplying by a scale parameter, such as 1 pixel = 0.1 mm, the true physical length is obtained, avoiding the error of directly measuring straight-line distances.

[0064] Regarding the calculation of the cap diameter, the maximum cap diameter D is calculated along a direction orthogonal to the principal axis after posture correction. Specifically, for each ordinate y, the x-coordinate of the leftmost point of the contour on that horizontal line is taken. and the x-coordinate of the rightmost point ,but Posture correction aligns the main axis of the king oyster mushroom with the vertical axis of the image, ensuring that the diameter measurement direction is consistent with the actual width direction of the cap. Horizontal scanning of the contour acquires the difference between the left and right boundary x-coordinates of each y-coordinate, and the maximum value is taken as the cap diameter, overcoming measurement bias caused by sample tilt. For example, if the actual maximum width of the cap is 50 mm, but appears as 45 mm in the image due to tilt, horizontal scanning after correction can accurately capture the maximum span.

[0065] Regarding the location of the connection between the stipe and cap, this connection is determined through contour curvature peak value or grayscale gradient extremum detection, with shape priors used for correction in low-contrast scenarios. Curvature peak values ​​reflect changes in the degree of contour curvature, while gradient extrema capture texture or color abrupt changes; both can identify the location of the connection point. In low-contrast scenes, where the stipe and cap are similar in color, shape priors are introduced to constrain the detection range. For example, the connection point is typically located in the curvature abrupt change region at the top of the stipe, improving the reliability of the location. For instance, if the boundary between the stipe and cap is blurred in the image, curvature detection may fail. In this case, combining prior knowledge limits the search range to the top region of the stipe, avoiding false detections.

[0066] By employing skeleton refinement, orthogonal scanning, and multi-feature fusion, this approach addresses the measurement challenges posed by the morphological complexity and image quality fluctuations of *Pleurotus eryngii* in dynamic environments. Compared to relying solely on simple binary contour analysis or static geometric methods such as minimum bounding rectangles, this solution significantly improves the adaptability and accuracy of parameter calculation, providing crucial technical support for industrial grading and quality control.

[0067] In some embodiments, this application also discloses a specific method for robustly fusing phenotypic parameters of King Oyster Mushroom.

[0068] Parameter values ​​for multiple frames of the same trajectory x i and the corresponding weights w i We employ a fusion of weighted M-estimation and quantile strategy to minimize the objective function. To solve for the robust center value m ,in, u=x i -m , representing the residual of the parameter estimation; The Huber loss function is defined as follows: .

[0069] The loss function is defined as a piecewise function, when... When, a double loss is used, that is, to smooth out small errors, when At that time, linear loss is used to suppress the transient effect of large errors, and dimensional parameters are adjusted accordingly. ,s The absolute deviation of the median is estimated to ensure adaptability to outliers.

[0070] In this embodiment, M is estimated through weights w i Adjust the contribution of each frame's data, combining the Huber loss function to balance the sensitivity to small errors with the robustness to large errors. For example, if a frame's cap diameter measurement is affected by occlusion... x i The weight is abnormally low. w i To reduce this, the Huber loss function treats the error as a linear deviation, thus reducing its bias towards the center value. m The impact.

[0071] As specific examples, the stipe length was measured across 10 consecutive frames, with outliers appearing in frames 3 and 7 due to occlusion (e.g., 20% smaller than other frames). The length was then calculated using M-estimation. m At that time, the weight of abnormal frames w i The error is reduced, and the Huber function linearizes it, resulting in the final value. m It is closer to the actual length.

[0072] For key phenotypic parameters that are easily obscured and thus have lower measured values, such as cap diameter, the final value is calculated using the upper quantile or upper truncated mean; for length parameters (such as stipe length), the final value is calculated using the weighted median. w iIt is also used for quantile weighting calculations, and the contribution is further adjusted based on the intra-frame image quality.

[0073] In this embodiment, the quantile strategy addresses the differences in parameter characteristics. Upper quantiles avoid underestimation caused by occlusion, such as for diameter parameters, while the weighted median counteracts symmetry errors in length parameters. This is combined with weighting... w i This ensures that high-quality frames dominate the final result.

[0074] As some specific examples, if the cap diameter is [45, 48, 50, 52, 30] (unit: mm) in multiple frame measurements due to local occlusion, the direct mean is greatly affected by the outlier 30, while the upper quantile Q3 (52) or the upper truncated mean (calculated after removing 30) is closer to the true value, and the stipe length parameter is eliminated by weighted median to eliminate bidirectional error.

[0075] In this embodiment, weight w i Simultaneously used for M The estimation and quantile calculation are based on image quality metrics such as contour completeness. q c Clarity based on Laplace variance q f and visible area ratio q o 。 For example, frames with severe occlusion or blurriness have reduced weights to minimize their negative impact on the fusion result. Image quality in dynamic environments is quantified and incorporated into the statistical model, making the fusion process adaptive to data reliability.

[0076] As some specific examples, a frame's sharpness is affected by motion blur. q f Lower, weight w i The weight is set to 0.1, while the weight of the clear frame is 0.9; in M ​​estimation and quantile calculation, the contribution of low-weight frames is suppressed, improving the overall fusion accuracy.

[0077] The robust fusion method disclosed in this application effectively improves the measurement robustness and accuracy of Pleurotus eryngii phenotypic parameters in dynamic industrial environments by combining weighted M-estimation and a quantile strategy. When fusing parameter values ​​from multiple frames of the same trajectory, this method uses weighted M-estimation to suppress outlier interference and employs a quantile strategy to differentiate parameter characteristics, reducing systematic biases caused by occlusion or motion blur. Simultaneously, the weights are dynamically adjusted based on image quality indicators to ensure that high-quality frames dominate the fusion result, thereby outputting stable and reliable parameter values ​​in continuous motion scenes and providing a solid data foundation for subsequent batch analysis.

[0078] In some embodiments, this application also discloses a specific method for real-time statistical analysis of the final measurement values ​​of multiple king oyster mushrooms that continuously pass through the collection area in the same batch.

[0079] In this embodiment, the system sets a sliding time window W, such as 60 seconds, within which the final parameter values ​​of continuously passing king oyster mushrooms are dynamically monitored. The window slides in real time as the production line runs, ensuring that the latest batch of sample data is always analyzed. For example, when the conveyor belt speed is 0.5 m / s, window W can cover all king oyster mushrooms passing within a length of approximately 30 meters, thus reflecting the consistency of production over a short period of time.

[0080] Within window W, calculate the mean of key phenotypic parameters (such as stipe length). m b Standard deviation s s With coefficient of variation CV = s s / m b Mean m b Reflects the average quality and standard deviation of the batch. s s Quantifying the degree of dispersion of individuals, coefficient of variation CV This eliminates the influence of dimensions and more intuitively reflects uniformity.

[0081] Set threshold t Δ represents the application of statistical quality control theory to the king oyster mushroom production line: t By controlling the dispersion and Δ controlling the center offset, both ensure that batches of products simultaneously meet the requirements of uniformity and accuracy.

[0082] in, t It is the coefficient of variation. CV The maximum allowed limit. CV = s s / m b The standard deviation is the ratio of the standard deviation to the mean. It is used to eliminate the influence of dimensions and measure the relative dispersion of phenotypic parameters (such as length) of king oyster mushrooms within a batch.

[0083] like CV > t This indicates poor size uniformity of king oyster mushrooms within the batch, such as excessive individual differences. For example, τ=0.15 This indicates that a relative fluctuation of 15% is allowed; exceeding this indicates production instability.

[0084] Δ is the batch mean. m b The allowable absolute deviation from the preset target value, if This indicates that the average size of the entire batch of king oyster mushrooms deviates from the standard. For example, when Δ=5mm, if the average... m b =45mm (target value 50mm), indicating that the batch is generally small, possibly due to abnormal growing environment or premature harvesting.

[0085] Monitor CV or mean separately m b All of these could potentially miss issues, for example: if the CV is normal but the mean is off, i.e. This indicates an overall production deviation but uniformity in individual samples. If the mean is normal but the individual CV is excessively high, then... CV > t This indicates significant individual differences. When an alarm is triggered, the system can automatically adjust the sorting equipment or provide feedback to the cultivation process to achieve closed-loop control.

[0086] The second embodiment of this application also discloses an automatic phenotypic analysis system for king oyster mushrooms based on image processing, including: An image acquisition module is configured in the acquisition area of ​​the conveyor belt and is used to perform real-time imaging of the target king oyster mushroom that moves continuously with the conveyor belt, and to acquire a multi-frame image sequence of the target king oyster mushroom. The target trajectory processing module is used to establish a target trajectory for the target king oyster mushroom based on the multi-frame image sequence, and to perform target segmentation in each frame image corresponding to the target trajectory to obtain the shape outline of the target king oyster mushroom. The principal axis direction estimation module is used to extract candidate principal axis directions for each frame based on the shape contour of the target king oyster mushroom. The candidate principal axis direction is the orientation of the stipe of the king oyster mushroom in a single frame image. The module also performs weighted aggregation of the candidate principal axis directions of each frame within the target trajectory with the corresponding image quality indicators to obtain the reference principal axis direction of the king oyster mushroom in the image. The reference principal axis direction is the reference direction for image pose correction determined after fusing the candidate directions of multiple frames within the target trajectory. The pose correction and scale normalization module is used to virtually correct the pose of the king oyster mushroom image based on the reference main axis direction, so that the main axis direction coincides with the preset reference direction, and normalize the scale of the virtually corrected image to obtain a pose-corrected and scale-normalized image. The phenotypic parameter calculation and fusion module is used to calculate key phenotypic parameters based on the pose-corrected and scale-normalized image using a geometric measurement algorithm. The key phenotypic parameters include at least one of the stipe length and the maximum diameter of the cap. The module also robustly fuses the key phenotypic parameters from multiple pose-corrected and scale-normalized image frames within the target trajectory to obtain the final phenotypic parameters of the target king oyster mushroom. The statistical analysis module is used to perform real-time statistical analysis on the final phenotypic parameters of multiple king oyster mushrooms that continuously pass through the collection area in the same batch, calculate the mean, standard deviation and coefficient of variation, and obtain the population uniformity of the king oyster mushrooms in the batch for quality grading.

[0087] In some embodiments, an electronic device provided in this application includes a processor and a memory; the memory stores a computer program, wherein the computer program, when executed by the processor, implements the above-described image processing-based automatic phenotypic analysis method for Pleurotus eryngii.

[0088] Specifically, the processor may include, for example, a general-purpose microprocessor, an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor may also include onboard memory for caching purposes. The processor may be a single processing unit or multiple processing units for performing different actions of the method flow according to embodiments of this application.

[0089] Memory can be any medium capable of containing, storing, transmitting, propagating, or transmitting instructions. For example, memory can include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, instruments, or propagation media. Specific examples of memory include: magnetic storage devices such as magnetic tape or hard disk drives (HDDs); optical storage devices such as optical discs (CD-ROMs); and also random access memory (RAM) or flash memory; and / or wired / wireless communication links.

[0090] This application also provides a computer-readable medium storing a computer program that, when executed by a processor, implements the above-described image processing-based automatic phenotypic analysis method for Pleurotus eryngii. This computer-readable medium may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into that device / apparatus / system. The aforementioned computer-readable medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.

[0091] According to embodiments of this application, a computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wired, optical fiber, radio frequency signals, etc., or any suitable combination thereof.

[0092] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. An automatic phenotypic analysis method for Pleurotus eryngii based on image processing, characterized in that, The steps include the following: In the acquisition area of ​​the conveyor belt, image acquisition equipment is used to perform real-time imaging of the king oyster mushrooms that move continuously with the conveyor belt, and to obtain a multi-frame image sequence of the target king oyster mushrooms. A target trajectory is established for the target king oyster mushroom based on the multi-frame image sequence, and target segmentation is performed in each frame image corresponding to the target trajectory to obtain the shape contour of the target king oyster mushroom. Based on the shape contour of the target king oyster mushroom, the candidate principal axis direction of each frame is extracted. The candidate principal axis direction is the orientation of the stipe of the king oyster mushroom in a single frame image. The candidate principal axis directions of each frame in the target trajectory are weighted and aggregated with the corresponding image quality indicators to obtain the reference principal axis direction of the target king oyster mushroom in the image. The reference principal axis direction is the reference direction determined after fusing the candidate directions of multiple frames in the target trajectory, and is used for image pose correction. The image pose of the king oyster mushroom is virtually corrected according to the reference main axis direction so that the main axis direction coincides with the preset reference direction. The scale of the virtually corrected image is then normalized to obtain an image with corrected pose and normalized scale. Based on the pose-corrected and scale-normalized image, key phenotypic parameters are calculated using a geometric measurement algorithm. The key phenotypic parameters include at least one of the stipe length and the maximum diameter of the cap. The key phenotypic parameters in multiple pose-corrected and scale-normalized image frames within the target trajectory are robustly fused to obtain the final phenotypic parameters of the target king oyster mushroom. Real-time statistical analysis is performed on the final phenotypic parameters of multiple king oyster mushrooms that continuously pass through the collection area in the same batch. The mean, standard deviation and coefficient of variation are calculated to obtain the population uniformity of the king oyster mushrooms in that batch, which is used for quality grading.

2. The automatic phenotypic analysis method for Pleurotus eryngii based on image processing as described in claim 1, characterized in that, The step of establishing a target trajectory for the target king oyster mushroom based on the multi-frame image sequence includes: Construct a uniform linear or uniformly accelerated motion model based on the linear velocity and direction of motion of the conveyor belt; Kalman filtering is used for state prediction and observation update, and the Hungarian algorithm, which combines cross-union geometric constraints and appearance embedding features, is used to achieve cross-frame target association. For targets that are briefly occluded, the trajectory is recovered by forward and backward bidirectional Kalman trajectory interpolation and re-identification. The start, maintenance and termination of the trajectory are dynamically controlled by the target confidence and the threshold of the number of consecutive unmatched frames, thereby obtaining a continuous and complete target trajectory.

3. The automatic phenotypic analysis method for Pleurotus eryngii based on image processing as described in claim 1, characterized in that, The step of segmenting the target within each frame image corresponding to the target trajectory to obtain the shape contour of the target king oyster mushroom includes: The target mask is obtained by using a lightweight instance segmentation network or background modeling and foreground extraction methods, and morphological closing and thinning operations are performed to correct holes and contour burrs. Image quality metrics are calculated for subsequent weighting. These metrics include at least contour integrity, sharpness based on Laplacian variance, and visible area ratio. The weights are obtained by multiplying each image quality metric value by its corresponding weighting coefficient, summing the results, and then normalizing them to eliminate scale bias.

4. The automatic phenotypic analysis method for Pleurotus eryngii based on image processing as described in claim 3, characterized in that: The weighted aggregation is an aggregation based on weighted circle statistics, including: Candidate principal axis direction angles for each frame within the trajectory θ k and their weights w k Calculate the weighted statistic: , , C The sum of the weighted cosine components. S The sum of weighted sine components is used to estimate the actual principal axis direction. And truncation is performed on extremely low weights or outlier angles to suppress outliers; For the estimated actual principal axis direction θ * The sequence is subjected to time-series filtering using an exponential smoothing algorithm.

5. The automatic phenotypic analysis method for Pleurotus eryngii based on image processing as described in claim 4, characterized in that, The step of virtually correcting the image pose of the king oyster mushroom based on the reference principal axis direction, so that the principal axis direction coincides with the preset reference direction, and normalizing the scale of the virtually corrected image includes: Apply rotation transformation to each frame of the image to align the main axis of the king oyster mushroom with the preset reference direction, and use the target centroid as the center of rotation; Based on the homography matrix obtained from the plane calibration of the acquisition system, the image pixel coordinates are mapped to the physical coordinates of the conveyor belt; In the physical coordinate system of the conveyor belt, the measurement endpoints for the phenotypic parameters of king oyster mushrooms are selected. , The lengths of key phenotypic parameters are obtained by calculating the Euclidean distance between the endpoints; When the camera drifts or the focal length changes, the homography matrix is ​​dynamically updated by reference markers within the field of view to achieve online scale correction.

6. The automatic phenotypic analysis method for Pleurotus eryngii based on image processing as described in claim 1, characterized in that, The method for calculating key phenotypic parameters using a geometric measurement algorithm includes: The skeleton of the segmented target region is refined, and the main path of the stipe is identified by the endpoints and bifurcation points. The stipe length is defined as the length of the skeleton path along the main axis, which is obtained by the geodesic distance from the base end to the connection point of the cap. The geodesic distance is calculated by accumulating the Euclidean distance between the skeleton pixels. The maximum diameter of the cap is calculated in a direction orthogonal to the principal axis after posture correction. Specifically, for each ordinate, the difference between the abscissas of the leftmost and rightmost points of the contour on the horizontal line is calculated, and the maximum abscissa difference corresponding to all ordinates is taken as the cap diameter. The connection between the stipe and the cap is determined by detecting the peak value of the contour curvature or the extreme value of the gray-scale gradient. When the contrast is low, shape prior is used for correction.

7. The automatic phenotypic analysis method for Pleurotus eryngii based on image processing as described in claim 3, characterized in that, The robust integration includes the following steps: Parameter values ​​for multiple frames of the same trajectory x i and the corresponding weights w i We employ a fusion of weighted M-estimation and quantile strategy to minimize the objective function. To solve for the robust center value m ,in, u=x i -m , representing the residual of the parameter estimation; The Huber loss function is defined as follows: Scale parameters , σ Estimated by the absolute deviation of the median; For key phenotypic parameters that are susceptible to occlusion and thus have lower measured values, the upper quantile is used to calculate the final value; for length parameters, the weighted median is used to calculate the final value; the weights... w i It is also used for M estimation and quantile weighting calculation to adjust the contribution of each frame parameter according to the intra-frame image quality.

8. The automatic phenotypic analysis method for Pleurotus eryngii based on image processing as described in claim 1, characterized in that, The real-time statistical analysis of the final measurement values ​​of multiple king oyster mushrooms that continuously pass through the collection area in the same batch includes: monitoring the final parameter values ​​within a sliding time window, calculating the mean, standard deviation, and the ratio of the standard deviation to the mean, and setting thresholds τ and Δ. Threshold τ is the upper limit of the allowable coefficient of variation, and threshold Δ is the upper limit of the allowable absolute deviation between the batch mean and the preset target value. When the coefficient of variation is greater than τ or the absolute difference between the mean and the target value is greater than Δ, an alarm is generated and the timestamp and workstation information are recorded.

9. An automatic phenotypic analysis system for Pleurotus eryngii based on image processing, characterized in that, include: An image acquisition module is configured in the acquisition area of ​​the conveyor belt and is used to perform real-time imaging of the target king oyster mushroom that moves continuously with the conveyor belt, and to acquire a multi-frame image sequence of the target king oyster mushroom. The target trajectory processing module is used to establish a target trajectory for the target king oyster mushroom based on the multi-frame image sequence, and to perform target segmentation in each frame image corresponding to the target trajectory to obtain the shape outline of the target king oyster mushroom. The principal axis direction estimation module is used to extract candidate principal axis directions for each frame based on the shape contour of the target king oyster mushroom. The candidate principal axis direction is the orientation of the stipe of the king oyster mushroom in a single frame image. The module also performs weighted aggregation of the candidate principal axis directions of each frame within the target trajectory with the corresponding image quality indicators to obtain the reference principal axis direction of the king oyster mushroom in the image. The reference principal axis direction is the reference direction for image pose correction determined after fusing the candidate directions of multiple frames within the target trajectory. The pose correction and scale normalization module is used to virtually correct the pose of the king oyster mushroom image based on the reference main axis direction, so that the main axis direction coincides with the preset reference direction, and normalize the scale of the virtually corrected image to obtain a pose-corrected and scale-normalized image. The phenotypic parameter calculation and fusion module is used to calculate key phenotypic parameters based on the pose-corrected and scale-normalized image using a geometric measurement algorithm. The key phenotypic parameters include at least one of the stipe length and the maximum diameter of the cap. The module also robustly fuses the key phenotypic parameters from multiple pose-corrected and scale-normalized image frames within the target trajectory to obtain the final phenotypic parameters of the target king oyster mushroom. The statistical analysis module is used to perform real-time statistical analysis on the final phenotypic parameters of multiple king oyster mushrooms that continuously pass through the collection area in the same batch, calculate the mean, standard deviation and coefficient of variation, and obtain the population uniformity of the king oyster mushrooms in the batch for quality grading.

10. An electronic device, characterized in that: It includes a processor and a memory; the memory stores a computer program, wherein the computer program, when executed by the processor, implements the image processing-based automatic phenotypic analysis method for Pleurotus eryngii as described in any one of claims 1 to 8.