Phenotype data measurement method and system in semi-automatic field scene

By using a pre-trained SAM model and image processing algorithms, the problems of low efficiency, poor accuracy, and high cost in phenotypic data measurement in field settings are solved. This enables efficient and accurate automatic calculation of phenotypic parameters and data acquisition, supporting high-precision phenotypic quantification in breeding research.

CN121053548AActive Publication Date: 2025-12-02XIANGJIANG LAB

Patent Information

Application Number
CN202511593636.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-03
Publication Date
2025-12-02
Estimated Expiration
2045-11-03

AI Technical Summary

Technical Problem

Existing technologies suffer from inefficiency, large subjective bias, high risk of crop damage, and poor model generalization ability in phenotypic data measurement in field settings. In particular, it is difficult to obtain complete phenotypic data efficiently and at low cost under intensive planting conditions.

Method used

A pre-trained SAM model is used for image segmentation and feature extraction. Combined with morphological feature judgment and skeletonization, plant phenotypic parameters are automatically calculated, including the length and width of upright and curved forms and the angle between leaves. Leaf orientation vectors are obtained through PCA dimensionality reduction, enabling zero-sample data labeling and model training.

Benefits of technology

It enables efficient and accurate measurement of phenotypic data in field scenarios, improving measurement efficiency by more than 10 times, achieving a complete phenotypic data acquisition rate of over 95%, and generalization ability covering major food crops and any growth cycle, while reducing data annotation and model training costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121053548A_ABST
    Figure CN121053548A_ABST
Patent Text Reader

Abstract

The invention provides a phenotype data measurement method and system in a semi-automatic field scene, and belongs to the field of phenotype data measurement in an outdoor field scene, and the method comprises the steps: collecting a crop image, and obtaining a target phenotype center coordinate point specified by a user according to the crop image; segmenting the crop image and a target phenotype center coordinate point specified by a user through a pre-trained SAM model to obtain a target phenotype mask image; the morphological characteristics of the mask image are obtained by judging the bending characteristics of the mask image, and the morphological characteristics comprise an upright form and a bending form. According to the plant phenotype data calculation method, data collection, calibration and model training are not needed, the method can be widely applied to various plants and scenes, and a large amount of cost caused by data annotation and model training can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of phenotypic data measurement in outdoor field scenarios. Specifically, it relates to a method for collecting crop image data in field scenarios using imaging equipment, applying deep learning knowledge to segment crop phenotypes and calculate phenotypic data, and particularly to a semi-automatic method and system for measuring phenotypic data in field scenarios. Background Technology

[0002] In crop genetics and breeding research, high-throughput acquisition of phenotypic data is the core foundation for establishing genotype-phenotype associations. Currently, phenotypic measurement in field settings mainly relies on two types of technologies: 1. Manual field measurement: Staff need to carry tools such as rulers and protractors to the field to measure parameters such as leaf length, leaf width, panicle length, and leaf angle on a plant-by-plant basis. This method has significant drawbacks: Low efficiency: Breeding trials often involve hundreds of varieties and tens of acres of planting area, requiring 5-8 repeated measurements per growth cycle, and manual data collection can only be completed on 20 acres per day; Subjective bias in data: It is difficult to reach the target phenotype in areas where plants overlap (such as during the tillering stage of rice), and the leaf angle measurement error can reach ±7°; Risk of crop damage: Manual entry into densely planted fields can easily trample crops, affecting the continuity of long-term observation.

[0003] 2. Traditional Algorithm Models: While computer vision-based automatic measurement methods (such as YOLO and UNet) reduce human intervention, they have fundamental limitations: Poor generalization ability: The model is sensitive to changes in crop growth stages. For example, for the same rice variety, the heading stage (erect green panicles) and maturity stage (bent yellow panicles) require separate model training, with cross-stage recognition accuracy less than 40%; Strong data dependence: Training requires tens of thousands of precisely labeled images, while complete phenotypic labeling is extremely difficult in dense field scenes. Leaf occlusion results in 70% of the labels only covering partial organs (such as half a leaf), and after training the model based on this, the complete phenotypic detection rate in the inference results is <35%; High cost: Labeling a single crop requires the workload of 20 people per month, and the labeling quality directly affects model performance. Even with high investment in labeling complete phenotypic data, the model is still prone to confusing similar backgrounds (such as misidentifying adjacent leaves as the target leaf), and the actual results that meet the requirements are less than 50%.

[0004] Existing technologies cannot simultaneously meet the triple requirements of "efficiency, accuracy, and generalization." The core contradiction lies in the following: difficulty in obtaining complete phenotypes: dense planting leads to organ occlusion, and less than 30% of the images can be measured to have complete phenotypes; high annotation and training costs: traditional algorithms require repeated annotation and training for each crop and each growth stage; and poor universality of measurement methods: curved phenotypes (such as rice ears during the grain-filling stage) lack automatic measurement methods and rely on manual stringing with large errors. Summary of the Invention

[0005] The technical problem to be solved by this invention is to provide a semi-automatic method and system for measuring phenotypic data in field scenarios. This method can be widely applied to the calculation of plant phenotypic data in various plants and scenarios without the need for data collection, calibration and model training, thus avoiding the large costs associated with data labeling and model training.

[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: Firstly, a method for measuring phenotypic data in a semi-automatic field setting, the method comprising: Step 1: Acquire crop images and, based on the crop images, obtain the center coordinates of the target phenotype specified by the user; Step 2: Segment the crop image and the center coordinates of the target phenotype specified by the user using a pre-trained SAM model to obtain the target phenotype mask image; Step 3: By judging the curvature features of the mask image, the morphological features of the mask image are obtained, including upright and curved shapes. Step 4: Extract the minimum bounding rectangle from the upright morphology mask image, use the long side of the rectangle as the target morphology length and the short side as the target morphology width, and obtain the upright morphology parameters; Step 5: Generate a skeleton map by performing binarization, morphological denoising and skeletonization on the curved shape mask image in sequence, and construct a graph structure based on the skeleton map and identify the endpoints. The longest path between the endpoints is used as the bending length of the target phenotype to obtain the bending phenotype length. Step 6: Using Step 1 and Step 2, obtain the independent mask for each blade. Perform binarization, denoising, skeletonization, connected component labeling, and extract region attributes for each blade mask in sequence. Then, perform PCA dimensionality reduction on the extracted region attributes to obtain the blade direction vector. Calculate the angle between the blades based on the inverse cosine value of the two direction vectors to obtain the angle parameter between the blades.

[0007] Further, in step 2, the crop image and the user-specified target phenotypic center coordinates are segmented using a pre-trained SAM model to obtain a target phenotypic mask image, including: Crop images are encoded using the SAM model to obtain depth image features; The user-specified target phenotype center coordinates are processed by the prompt encoder of the SAM model to obtain the spatial location code; The depth image features and spatial location are encoded and then passed through the mask decoder of the SAM model to obtain a binary mask image corresponding to the target phenotype.

[0008] Further, in step 3, the morphological features of the mask image are obtained by judging the curvature features of the mask image. These morphological features include both upright and curved shapes, including: Contour detection is performed on the target phenotypic mask image to extract the outer boundary polygon of the mask region; Calculate the minimum bounding rectangle of the outer boundary polygon, and obtain the length of the long side and the length of the short side of the rectangle; Calculate the ratio of the actual area of ​​the mask region to the area of ​​the minimum circumscribed rectangle based on the lengths of the long and short sides of the rectangle. A preset threshold is used to compare the ratio with the threshold and obtain the morphological features of the mask image. If the ratio is less than the preset threshold, it is determined to be a curved shape; otherwise, it is determined to be an upright shape.

[0009] Further, in step 4, the minimum bounding rectangle is extracted from the upright morphology mask image. Using the longer side of the rectangle as the target phenotype length and the shorter side as the target phenotype width, the upright phenotype parameters are obtained, including: Edge detection is performed on the upright morphological mask image to obtain the closed contour of the mask region; By calculating the minimum bounding rectangle of the closed contour, the direction of the major axis and its length, and the direction of the minor axis and its width are determined. The upright phenotype parameter set is generated by using the length of the major axis as the target phenotype length value and the width of the minor axis as the target phenotype width value.

[0010] Further, in step 5, a skeleton map is generated by sequentially performing binarization, morphological denoising, and skeletonization on the curved morphology mask image. Based on the skeleton map, a graph structure is constructed and endpoints are identified. The longest path between endpoints is used as the target phenotype curvature length to obtain the curvature phenotype length, including: Convert the curved shape mask image into a binary image to obtain a binary image, where the phenotypic region is the foreground pixel and the background is the background pixel; Dilation and erosion operations are performed sequentially on the binary image to eliminate noise points and fill holes, generating a smooth binary image. The smooth binary image is thinned, the central skeleton line of the phenotypic region is extracted, and a skeleton map with a single pixel width is generated. Each pixel in the skeleton graph is used as a graph node, and edges are established between adjacent pixels to construct the skeleton graph structure. In the skeleton graph structure, identify all nodes with a degree of 1 as endpoints, select the node with the largest y-coordinate as the starting point, and the node with the smallest y-coordinate as the ending point. Calculate all possible paths from the starting point to the ending point, and select the pixel length of the longest path as the target phenotype bending length.

[0011] Further, in step 6, through steps 1 and 2, an independent mask for each blade is obtained. Each blade mask is then binarized, denoised, skeletonized, connected component labeled, and region attributes extracted sequentially. The extracted region attributes are then subjected to PCA dimensionality reduction to obtain the blade direction vector. Based on the inverse cosine value of the two direction vectors, the angle between the blades is calculated to obtain the blade angle parameters, including: Perform steps 1-2 on the first target blade to obtain the first blade mask image; Perform steps 1-2 on the second target blade to obtain the mask image of the second blade; The first leaf mask image and the second leaf mask image are binarized to generate a binary mask; Dilation and erosion operations are performed sequentially on each binary mask to eliminate noise and smooth the boundaries, so as to obtain the denoised mask; The denoised mask is thinned to extract the leaf skeleton with a single pixel width, and the leaf skeleton image is obtained. Connected component labeling is performed on the skeleton image to identify independent skeleton regions and obtain each connected component; By extracting the geometric properties of each connected region, region property extraction is obtained. The region properties include the pixel coordinate set and the centroid position.

[0012] Further, in step 6, through steps 1 and 2, an independent mask for each blade is obtained. Each blade mask is then binarized, denoised, skeletonized, connected component labeled, and region attributes extracted sequentially. The extracted region attributes are then subjected to PCA dimensionality reduction to obtain the blade direction vector. Based on the inverse cosine value of the two direction vectors, the angle between the blades is calculated to obtain the blade angle parameter. This also includes: Extract the coordinate set of all pixels from the marked connected regions, perform principal component analysis on the pixel coordinate set, and extract the first principal component vector as the main direction of the blade; Normalize the principal direction vectors of the two blades to unit vectors, calculate the dot product of the two unit vectors, and obtain the cosine value of the included angle. The inverse cosine function is used to calculate the angle between the blades, thus obtaining the angle parameters between the blades.

[0013] Secondly, a semi-automatic phenotypic data measurement system for field scenarios includes: The acquisition module is used for step 1: acquiring crop images and obtaining the center coordinates of the target phenotype specified by the user based on the crop images; step 2: segmenting the crop images and the center coordinates of the target phenotype specified by the user using a pre-trained SAM model to obtain the target phenotype mask image. The judgment module is used in step 3: judging the curvature features of the mask image to obtain the morphological features of the mask image, where the morphological features include upright morphology and curved morphology; step 4: extracting the minimum bounding rectangle from the upright morphological mask image, using the long side of the rectangle as the target phenotype length and the short side as the target phenotype width to obtain the upright phenotype parameters; step 5: performing binarization, morphological denoising and skeletonization processing on the curved morphological mask image in sequence to generate a skeleton map, constructing a graph structure based on the skeleton map and identifying the endpoints, using the longest path between the endpoints as the target phenotype curvature length to obtain the curved phenotype length; The calculation module is used in step 6: through steps 1 and 2, obtain the independent mask of each blade, and perform binarization, denoising, skeletonization, connected component labeling and extracting region attributes on each blade mask in sequence; and perform PCA dimensionality reduction on the extracted region attributes to obtain the blade direction vector, and calculate the angle between the blades based on the inverse cosine value of the two direction vectors to obtain the angle parameter between the blades.

[0014] Thirdly, a computing device, comprising: One or more processors; A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method.

[0015] Fourthly, a computer-readable storage medium storing a program that, when executed by a processor, implements the method.

[0016] The above-described solution of the present invention has at least the following beneficial effects: This invention uses computer vision and machine learning technologies to replace manual measurement. By using image processing algorithms and pattern recognition technology, it can achieve rapid measurement and statistics of plant phenotypes, thereby improving efficiency, reducing subjectivity, and automating processing on large-scale datasets.

[0017] The SAM of this invention, as a pre-trained model, can process image data zero-shot using only prompt words, eliminating the need for extensive manual data annotation for model training and avoiding the large amount of manual and time costs associated with data annotation. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating a semi-automatic field data measurement method provided by an embodiment of the present invention.

[0019] Figure 2 This is a schematic diagram of a semi-automatic field data measurement system provided by an embodiment of the present invention.

[0020] Figure 3 This is a flowchart of the overall process of SAM segmentation of objects, which is a semi-automatic method for measuring phenotypic data in a field setting, provided by an embodiment of the present invention.

[0021] Figure 4 This is a curved mask object length map provided by an embodiment of the present invention for a semi-automatic field scene phenotypic data measurement method.

[0022] Figure 5 This is a two-leaf segmentation diagram of a semi-automatic field data measurement method provided by an embodiment of the present invention.

[0023] Figure 6 This is a leaf angle diagram of a semi-automatic field data measurement method provided by an embodiment of the present invention. Detailed Implementation

[0024] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0025] like Figure 1 As shown, an embodiment of the present invention proposes a method for measuring phenotypic data in a semi-automatic field setting, the method comprising the following steps: Step 1: Acquire crop images and, based on the crop images, obtain the center coordinates of the target phenotype specified by the user; Step 2: Segment the crop image and the center coordinates of the target phenotype specified by the user using a pre-trained SAM model to obtain the target phenotype mask image; Step 3: By judging the curvature features of the mask image, the morphological features of the mask image are obtained, including upright and curved shapes. Step 4: Extract the minimum bounding rectangle from the upright morphology mask image, use the long side of the rectangle as the target morphology length and the short side as the target morphology width, and obtain the upright morphology parameters; Step 5: Generate a skeleton map by performing binarization, morphological denoising and skeletonization on the curved shape mask image in sequence, and construct a graph structure based on the skeleton map and identify the endpoints. The longest path between the endpoints is used as the bending length of the target phenotype to obtain the bending phenotype length. Step 6: Using Step 1 and Step 2, obtain the independent mask for each blade. Perform binarization, denoising, skeletonization, connected component labeling, and extract region attributes for each blade mask in sequence. Then, perform PCA dimensionality reduction on the extracted region attributes to obtain the blade direction vector. Calculate the angle between the blades based on the inverse cosine value of the two direction vectors to obtain the angle parameter between the blades.

[0026] In a preferred embodiment of the present invention, the user only needs to specify the target center coordinates. Combined with the zero-sample segmentation capability of the pre-trained SAM model, the massive amount of labeled data and model training costs required by traditional methods are completely avoided. Secondly, by intelligently judging the mask morphological features, the length and width parameters are quickly extracted using the minimum bounding rectangle for upright phenotypes, while the bending length is accurately obtained through skeletonization and graph path calculation for curved phenotypes, effectively solving the measurement inaccuracy problem caused by overlapping phenotypes in dense crops. Finally, based on the PCA direction vector and inverse cosine calculation of the double-leaf mask, the bottleneck of angle measurement in leaf-interlacing scenarios is overcome. This method, without completely eliminating data labeling and model training, improves measurement efficiency by more than 10 times, achieves a complete phenotype data acquisition rate of over 95%, and has generalization capabilities covering major food crops such as rice and wheat, as well as any growth cycle. It provides high-precision, fully automated phenotype quantification support for breeding research, significantly shortening the breeding cycle.

[0027] In a preferred embodiment of the present invention, step 1 above may include: The system acquires raw crop images in a field setting using a camera. Based on these raw images, the user manually calibrates the center position of the target phenotypic region via an interactive interface. The image pixel coordinates corresponding to the calibration command are then extracted as the center coordinates of the target phenotypic region.

[0028] In a preferred embodiment of the present invention, the user manually calibrates the physiological center of the crop directly on the interactive interface. Combined with the zero-sample segmentation capability of the pre-trained SAM model, a dual guarantee mechanism of "expert knowledge guidance + AI precision execution" is formed. This design addresses the core pain point of overlapping crop phenotypes in field scenarios. Breeding experts accurately locate the physiological center point of the target phenotype based on agronomic experience, completely avoiding incomplete phenotype segmentation caused by false detection of local features in traditional algorithms. At the same time, the sensitivity of the SAM model to coordinate prompts is utilized to achieve pixel-level complete phenotype extraction, which improves the accuracy of subsequent parameter calculation by more than 40%. Moreover, the user operation time is only 3 seconds per sample, which is 100 times more efficient than traditional annotation, providing a data collection entry point that is both authoritative and operable for high-density crop breeding research.

[0029] In a specific embodiment of the present invention, in step 1, a drone or handheld device equipped with a high-definition lens is used to vertically photograph field crops (such as rice and wheat) under natural lighting conditions. The shooting height is 0.8-1.5 meters above the canopy, ensuring that the coverage area of ​​a single image is ≤4 square meters (containing approximately 20-50 crop plants). The image is stored in RGB format with a resolution ≥1920×1080 pixels, and automatically appends a timestamp (e.g., "20240805_10:30") and geographic coordinates (GPS positioning, accuracy ±0.1 meters). The original image is imported into local analysis software (such as Python+OpenGL development). The original image is displayed on the left side of the interface, and the coordinate calibration panel is set on the right side. The image supports zoom (2x-8x) and panning functions to help users accurately locate target phenotypes (such as the base of specific leaves or the neck of rice panicles).

[0030] Manual calibration involves breeding experts observing the physiological characteristics of the target phenotype in the image: for leaf-like structures, clicking the junction of the leaf and leaf sheath (basal growth point); for panicle-like structures, clicking the junction of the panicle neck and main stem. After the user clicks the target location, the software generates a red crosshair (5 pixels in diameter) in real time and displays a confirmation dialog box. The software captures the mouse event coordinates, converts them to the image pixel coordinate system, and outputs the coordinate data in (x, y) format. For example, the typical coordinates of the base of the rice flag leaf are (654, ​​320), with an accuracy of ±1 pixel.

[0031] In a preferred embodiment of the present invention, step 2 above may include: Step 21: The crop image is processed by image encoding using the SAM model to obtain depth image features; Step 22: The target phenotype center coordinates specified by the user are processed by the prompt encoder of the SAM model to obtain the spatial location code; Step 23: Encode the depth image features and spatial location using the mask decoder of the SAM model to obtain the binary mask image corresponding to the target phenotype.

[0032] In a preferred embodiment of the invention, the core breakthrough of "accurate segmentation at zero cost" is achieved through the three-level encoder-decoder architecture of the SAM model: First, the deep features extracted by the image encoder retain multi-scale structural information of crop phenotypes, solving the feature loss problem caused by environmental interference in traditional algorithms; second, the prompt encoder converts the physiological center coordinates calibrated by the user into spatial location codes, enabling the model to accurately focus on the target phenotype entity (rather than similar background noise), improving the complete phenotype segmentation accuracy to 96.2% in dense scenes; finally, the mask decoder dynamically associates the location codes with image features through cross-modal feature fusion, generating pixel-level accurate binary masks—this process is entirely based on a pre-trained model to achieve zero-sample inference, eliminating the need for tens of thousands of labeled data for each crop type, reducing the cost of field phenotype analysis by 99%, and supporting generalized application across the growth cycle of 12 staple crops such as rice and wheat, providing a universal technical foundation for breeding research. In a specific embodiment of the present invention, the specific steps include: Step 21: The image encoder of the pre-trained SAM model extracts deep features from the input crop original image: the RGB image is scaled to 1024×1024 resolution and pixel normalization preprocessing is performed. A 64×64×1280 dimension deep image feature is generated through 16 layers of Transformer blocks. This feature fully preserves multi-scale phenotypic details such as leaf veins and ear grain structure.

[0033] Step 22: Input the target phenotypic center coordinates (e.g., rice spike neck point (654, ​​320)) into the encoder: The coordinate values ​​are normalized to the interval [-1, 1] and mapped to a 256-dimensional spatial position encoding vector through a fully connected layer, accurately representing the absolute position of the target in the image and its relative spatial relationship with surrounding organs.

[0034] Step 23: The mask decoder performs cross-modal feature fusion: it correlates the depth image features with the spatial location encoding at the pixel level, focuses the target phenotypic region through a cross-attention mechanism (such as suppressing soil background noise), and outputs a 1024×1024 resolution binary mask image after processing by two Transformer blocks and convolutional layers. The target phenotypic region is a white pixel (value 1), and the background is a black pixel (value 0), achieving sub-millimeter-level segmentation of microstructures such as rice spike branches (single pixel corresponds to 0.5mm² in the field).

[0035] In a preferred embodiment of the present invention, step 3 above may include: Step 31: Perform contour detection on the target phenotypic mask image and extract the outer boundary polygon of the mask region; Step 32: Calculate the minimum bounding rectangle of the outer boundary polygon, and obtain the length of the long side and the length of the short side of the rectangle; Step 33: Calculate the ratio of the actual area of ​​the mask region to the area of ​​the minimum bounding rectangle based on the length of the long side and the length of the short side of the rectangle; Step 34: Set a preset threshold, compare the ratio with the threshold, and obtain the morphological features of the mask image. If the ratio is less than the preset threshold, it is determined to be a curved shape; otherwise, it is determined to be an upright shape.

[0036] In a preferred embodiment of the present invention, the morphological intelligent judgment mechanism achieves a major technological breakthrough by replacing human experience with quantified features: First, contour detection and minimum bounding rectangle calculation accurately capture the spatial distribution features of phenotypes, solving the 30% misclassification rate caused by visual errors in traditional manual judgment; Second, the area ratio method innovatively abstracts complex morphology into a quantifiable filling degree index, enabling the machine recognition accuracy of bent rice panicles (ratio ≈ 0.6) and upright leaves (ratio ≈ 0.85) to reach 98.7%, completely overcoming the morphological misclassification problem caused by the overlapping of phenotypes in dense crops; Finally, the threshold judgment mechanism provides an adaptive diversion channel for upright / bent phenotypes—when the filling degree < 0.75 (preset threshold), the bending processing flow is automatically triggered, reducing the measurement error of the bent length of rice panicles from ±15mm to ±2.1mm, while avoiding upright phenotypes from being mistakenly included in complex calculation chains, improving the overall processing efficiency by 22 times, and establishing a high-precision, fully automated decision-making foundation for multimodal phenotype analysis.

[0037] In a specific embodiment of the present invention, the specific steps include: Step 31: Contour detection and boundary extraction implementation process: A boundary tracing algorithm is performed on the target phenotypic mask image (binary image, target area is white pixels): starting from the top left corner of the image, the first white pixel is located as the starting point of the contour. The Moore-Neighbor Tracing method is used to search for the next boundary point in a clockwise direction of 8-neighbors. The pixel coordinates of each turning point are recorded (e.g., the outline of a rice leaf contains about 80-150 coordinate points) to form a closed polygon. The polygon vertex sequence is output to ensure that the distance between adjacent vertices is ≤√2 pixels (diagonal adjacency) and to fully preserve the detailed features such as leaf serrations or rice spike awns.

[0038] Step 32: Calculation process of minimum bounding rectangle: Based on the vertex set of the outer boundary polygon: The Rotating Calipers algorithm is used to rotate the virtual coordinate axis in 1° increments. After each rotation, the axial bounding box (AABB) of the polygon in the rotated coordinate system is calculated, and the area of ​​the rectangle is recorded. Traversing the range of 0°-180°, the bounding box with the smallest area is selected as the final circumscribed rectangle. The major axis direction of the rectangle (deviation from the blade main vein direction < ±2°) and its physical dimensions are extracted. Long side length L (unit: pixel, corresponding to leaf physiological length); Short side width W (in pixels, corresponding to the maximum width of the blade). Step 33: Implementation process of morphological feature quantification: Calculation of the actual area of ​​the mask: Count the total number of white pixels A in the mask image (1 pixel = 0.25 mm² field area); Calculate the area of ​​the circumscribed rectangle: Based on L and W output in step 32, calculate the area of ​​the rectangle S = L × W; Filling ratio calculation: The quantitative index is generated according to the formula R=A / S, where R≈0.82-0.88 for upright leaves (leaf spread out, high filling rate) and R≈0.58-0.68 for curved rice ears (space curled, low filling rate).

[0039] Step 34: Implementation process of intelligent morphology determination: Threshold setting: Based on the statistics of 100,000 field samples, the preset empirical threshold is 0.75: R>0.8 for upright leaves of rice and R<0.7 for curved ears of wheat. If R≥0.75, it is judged as an upright shape, and the minimum bounding rectangle parameter output process is started. If R<0.75, it is judged as a curved shape, and the skeleton graph path calculation process is triggered. When 0.72≤R≤0.78, a second judgment is performed to ensure that the classification accuracy is >99.1%.

[0040] In a preferred embodiment of the present invention, step 4 above may include: Step 41: Perform edge detection on the upright shape mask image to obtain the closed contour of the mask region; Step 42: Calculate the minimum bounding rectangle of the closed contour to determine the direction of the major axis and its length, and the direction of the minor axis and its width. Step 43: Use the major axis length as the target phenotypic length value and the minor axis width as the target phenotypic width value to generate an upright phenotypic parameter set.

[0041] In a preferred embodiment of the present invention, the intelligent extraction mechanism of upright phenotypic parameters achieves a major breakthrough in "precise structural mapping of agronomic indicators": the closed contour obtained by edge detection (step 1) accurately locks the complete physical boundary of the target phenotypic, completely solving the problem of contour fragmentation caused by leaf breakage or occlusion in traditional image algorithms, so that the boundary integrity rate of key phenotypic such as rice flag leaf reaches 99.2%; the minimum bounding rectangle calculation based on the contour (step 2) innovatively transforms biological morphology into agronomic standard parameters - the long axis direction is automatically aligned with the direction of the leaf midrib, and its length value directly corresponds to the physiological length defined by agronomists (such as from leaf tip to leaf sheath base), and the short axis width accurately reflects the maximum width of the leaf. The measured parameters have an error of less than ±0.8mm compared with manual measurement, which is 5 times more accurate than traditional algorithms; the final parameter set (step 3) fully complies with the data standards of the International Plant Phenotyping Union (IPPN) and can be directly connected to the breeding analysis system, reducing the time for single-plant phenotypic analysis from 3 minutes to 0.5 seconds, providing a high-precision, fully automatic quantitative engine for breeding experiments of tens of thousands of acres.

[0042] In a specific embodiment of the present invention, the specific steps include: Step 41: Closed contour extraction process: Mask preprocessing: The upright morphological mask image (binary image, the target phenotypic area is white pixels) is subjected to boundary enhancement processing. The edges are sharpened by a 3×3 pixel convolution kernel to eliminate micro-aliasing that may be caused by SAM segmentation.

[0043] Edge tracking initialization: Start scanning line by line from the top left corner of the image (coordinates (0, 0)) and locate the first white pixel as the starting point of the contour (e.g., the base of a rice leaf at coordinates (120, 300)).

[0044] Moore's Neighborhood Tracking: Search for the next boundary point clockwise using the 8-neighborhood connectivity rule (up, top right, right, bottom right, bottom, bottom left, left, top left). If the current point is P, start the detection from the neighborhood directly above P. When a white pixel is detected, set it as the new boundary point and update the search starting direction. Repeat until the starting point is returned to form a closed path.

[0045] Contour optimization: The Douglas-Puk algorithm is used to compress redundant vertices and a tolerance threshold of 0.5 pixels is set to reduce the leaf contour from the original 200+ vertices to 50-80 key points, ensuring that physiological curvature features (such as leaf tip curvature) are fully preserved.

[0046] Output closed polygons: Store contour coordinates by vertex sequence (e.g., [(120, 300), (125, 295), ..., (120, 300)]), with adjacent point spacing ≤ √2 pixels and subpixel accuracy.

[0047] Step 42: Calculation of the minimum bounding rectangle: Convex hull construction: Calculate the convex hull of the closed contour vertex set (Graham scan method), remove concave points (such as depressions caused by local defects in the leaf), and generate convex polygons (the typical number of convex hull points for rice leaves is 30-50).

[0048] Rotating Caliper Algorithm Execution: Establish an initial coordinate system: Using the leftmost point of the convex hull as the reference, connect it to the rightmost point to form a reference axis; rotate the coordinate system in 1° increments (range 0° to 180°). For each 1° rotation, calculate the axial bounding box of the convex hull in the current coordinate system: X min / X max It is the extreme value of the vertex's X coordinate, Y min / Y max It is the extreme value of the Y-coordinate of the vertex, where X min It is the minimum value of the vertex X coordinate, X max It is the maximum value of the vertex's X coordinate, Y min It is the minimum value of the vertex's Y coordinate, Y max It is the maximum value of the vertex's Y-coordinate; the bounding box area S = (X max - X min ) × (Y max - Y min After traversing all rotation angles, select the bounding box with the smallest bounding box area as the final bounding rectangle.

[0049] Agronomic parameter extraction: Major axis direction: the angle α of the straight line containing the long side of the rectangle (relative to the horizontal axis), with a deviation from the physiological direction of the leaf midrib < ±1.5°; Length value L: number of pixels on the long side × proportional coefficient (e.g., 0.25mm / pixel), typical value for rice flag leaf L = 650 pixels to 162.5mm; Minor axis width W: number of pixels on the short side × proportional coefficient, typical value W = 85 pixels to 21.25mm.

[0050] Step 43: Implementation process for generating phenotypic parameter sets: Parameter standardization conversion: Length value L is converted to international standard units (millimeters) and one decimal place is retained (e.g., 162.5mm); Width value W is converted simultaneously (e.g., 21.3mm); Major axis direction α is converted to the range of [0°, 180°) (to avoid 360° redundancy).

[0051] Associated image acquisition information: timestamp, GPS coordinates (38.26°N, 115.25°E), recording crop genotype numbers (e.g., rice variety 'Zhongjiazao 17'); generating structured data objects: In a preferred embodiment of the present invention, step 5 above may include: Step 51: Convert the curved shape mask image into a binary image to obtain a binary image, where the phenotypic region is the foreground pixel and the background is the background pixel; Step 52: Perform dilation and erosion operations on the binary image sequentially to eliminate noise points and fill holes, generating a smooth binary image; Step 53: Thin the smooth binary image, extract the central skeleton line of the phenotypic region, and generate a skeleton map with a single pixel width. Step 54: Treat each pixel in the skeleton graph as a graph node, establish edge connections between adjacent pixels, and construct the skeleton graph structure. Step 55: Identify all nodes with a degree of 1 in the skeleton graph structure as endpoints, select the node with the largest y-coordinate as the starting point and the node with the smallest y-coordinate as the ending point from the endpoints. Step 56: Calculate all possible paths from the starting point to the ending point, and select the pixel length of the longest path as the target phenotype bending length.

[0052] In a preferred embodiment of the present invention, the bending phenotypic length calculation mechanism achieves a revolutionary breakthrough in the industry through a dual-engine approach of "noise-resistant skeleton extraction + intelligent path navigation": First, binarization and morphological operations (steps 1-2) eliminate inherent light noise and leaf breakage interference from field photography, enabling a 99.5% continuity restoration rate for bending phenotypic features such as rice panicles, thus solving the skeleton breakage problem caused by holes in traditional algorithms; Second, single-pixel skeletonization (step 3) accurately captures the physiological midline, abstracting complex morphology into a topological structure, improving efficiency by 200 times compared to manual string measurement; Most importantly, graph structure path calculation (steps 4-6) – by identifying physiological endpoints (panicle neck and panicle tip) and navigating the longest central path, the measurement error of bending panicle length in rice is reduced to ±1.2mm (compared to ±15mm for traditional manual measurement), especially for drooping panicles during the grain-filling stage, achieving a breakthrough 8-fold improvement in measurement accuracy, providing breeders with a key quantitative foundation for genotype-phenotype association research. This technology has completely changed the field operation mode of agronomists who rely on rulers / protractors. The measurement time for a single plant has been reduced from 3 minutes to 0.8 seconds, supporting high-throughput phenotypic analysis of tens of millions of breeding materials.

[0053] In a specific embodiment of the present invention, the specific steps include: Step 51: Binary Image Conversion: The curved morphology mask image is remapped pixel by pixel: the image transparency channel value is read, a threshold (α≥128) is set to distinguish the foreground from the background, the target phenotypic region is converted to pure white (pixel value 255), and the non-target region is converted to pure black (pixel value 0), generating a black and white binary image. This process ensures that curved phenotypic features such as rice ears are treated as independent connected components. If fragmented regions exist (probability <0.3%), the largest connected component is automatically preserved to meet the requirements of agronomic entity integrity.

[0054] Step 52: Morphological denoising: Sequential morphological operations were performed on the binary image: First, a 3×3 circular kernel was used for dilation to fill gaps smaller than 3 pixels caused by occlusion (such as panicle necks covered by leaves); then, homo-nucleus erosion was performed to remove isolated noise points caused by reflections; finally, the internal closed regions were scanned, and background pixels completely surrounded by foreground pixels were converted into foreground pixels, thoroughly repairing the holes in rice panicle lesions. After this processing, the continuity of the phenotypic region reached 99.5%, meeting the morphological basis for skeleton extraction.

[0055] Step 53: Skeleton Extraction: Iterative thinning is performed based on smoothed binary images: the Zhang-Suen algorithm is applied to peel away boundary pixels layer by layer, retaining internal points that conform to the neighborhood connectivity rule (2-6 adjacent points and a topological connection number of 1), and generating a single-pixel wide skeleton line after 8 rounds of iteration. This skeleton accurately represents the physiological midline of the rice panicle, completely preserving the curved morphology of the panicle axis (including 15-30 turning points), with a curvature error of less than ±0.5°, providing a topological framework for path calculation.

[0056] Step 54: Graph Structure Construction: The skeletal pixels are transformed into graph nodes: an independent node is created for each foreground pixel and its coordinates are recorded; an 8-neighborhood is scanned to establish undirected edge connections (excluding diagonal adjacencies), and the edge weights are the Euclidean distances between nodes. The generated graph structure is a tree-connected acyclic graph, with node attributes including spatial location and adjacency, and edge attributes encoding physiological segment lengths, thus realizing digital modeling of rice spike morphology.

[0057] Step 55: Start and Endpoint Identification: In the graph structure, nodes with a degree of 1 are selected as physiological endpoints (corresponding to the panicle neck and panicle tip). The start and end points are determined according to the vertical axis of the image coordinate system (origin at the top left, downwards is positive): the node with the maximum vertical coordinate is designated as the starting point (panicle neck near the bottom of the image), and the node with the minimum vertical coordinate is designated as the ending point (panicle tip near the top). This rule ensures that the length measurement direction conforms to agronomic standards (base → apex), and the accuracy of the measured vertical coordinate sorting is 100%.

[0058] Step 56: Calculation of bending length: Explore all paths from start to finish: Employ a depth-first search traversal graph structure, accumulating the sum of edge weights (i.e., physical length) for each path; compare the path set and select the maximum value as the target bending length (e.g., the longest path of the main diameter of a rice spike), outputting millimeter-level results using a pixel-to-physical-size conversion factor (0.25mm / pixel). If the length value exceeds the reasonable range for the crop (80-280mm for rice spikes), an automatic manual verification mechanism is triggered to ensure the agronomic validity of the data.

[0059] In a preferred embodiment of the present invention, step 6 above may include: Step 61: Perform steps 1-2 on the first target blade to obtain the first blade mask image; Step 62: Perform steps 1-2 on the second target blade to obtain the mask image of the second blade; Step 63: Binarize the first leaf mask image and the second leaf mask image to generate a binary mask; Step 64: Perform dilation and erosion operations on each binary mask in sequence to eliminate noise and smooth the boundaries to obtain the denoised mask; Step 65: Refine the denoised mask, extract the leaf skeleton with a single pixel width, and obtain the leaf skeleton image. Step 66: Mark the connected components of the skeleton image, identify independent skeleton regions, and obtain each connected component; Step 67: Extract the geometric attributes of each connected region to obtain the region attribute extraction. The region attributes include the pixel coordinate set and the centroid position.

[0060] In a preferred embodiment of the present invention, the dual-blade angle measurement mechanism achieves three major breakthroughs through the "anti-interference skeleton reconstruction + intelligent main-direction capture" technology chain: Complete mask guarantee: SAM segmentation is performed independently on both blades to ensure that staggered blades are accurately separated, solving the mask fusion problem caused by blade overlap in traditional algorithms (actual mask independent acquisition rate is 100%). Noise immunity treatment: Binarization and morphological manipulation eliminate the inherent light reflection and edge burrs in field photography, making the leaf skeleton continuity reach 99.3%, which is 8 times more effective in noise resistance than the traditional edge detection method; Precise physiological orientation mapping: The innovative framework and connected component analysis transform leaf morphology into topological structure. By extracting the pixel coordinate set of connected regions (instead of traditional manual midline calibration), the error between the principal direction calculated by PCA and the direction of the leaf's physiological midrib is less than ±1.5° (compared to ±7° for manual measurement), laying a millimeter-level precision foundation for subsequent angle calculations. This technology overcomes the measurement bottleneck of interlaced and bent leaves in field scenarios, improving the efficiency of leaf angle measurement during rice tillering from 10 minutes / plant manually to 0.6 seconds / plant, supporting breeders to complete the analysis of the physiological status of tens of thousands of plants daily.

[0061] In a specific embodiment of the present invention, the specific steps include: Step 61: Obtain the first leaf mask: Field images containing the first target leaf (such as the flag leaf of a rice main stem) are captured using imaging equipment. The user clicks on the growth point at the base of the leaf (coordinate example: (320, 580)) on the interactive interface, and inputs these coordinates into a pre-trained SAM model. The model extracts depth features through an image encoder, prompting the encoder to convert the coordinate points into spatial location codes. The mask decoder then fuses the features and outputs a binary mask image of the first leaf (the leaf area is pure white, and the background is pure black), achieving a segmentation integrity rate of 98.5%.

[0062] Step 62: Obtain the second leaf mask: In the same field image, a second target leaf (such as a tillering leaf) is located, and the user clicks on its leaf sheath connection point (coordinate example: (480, 620)). The SAM model processes the data independently with the same parameters: the image encoder reuses the extracted features, prompts the encoder to convert to the new coordinate point, and the mask decoder generates the mask for the second leaf. The dual-leaf mask spatial isolation completely avoids the mask fusion caused by leaf overlap in traditional algorithms.

[0063] Step 63: Double mask binarization processing: The two leaf mask images (RGBA format) are separated by channel separation: the Alpha channel values ​​are read, pixels ≥128 are set as foreground (pure white, value 255), and the remaining pixels are set as background (pure black, value 0), generating two independent black and white binary images. The file size is then compressed to the original size. Figure 4 %, preserving leaf morphological details (such as leaf edge serrations).

[0064] Step 64: Morphological boundary optimization: Perform the following sequentially for each binary mask: Expansion operation: Expand the leaf edge by 1.5 pixels with a 3×3 circular core to repair micro-fractures caused by occlusion (such as insect holes). Erosion operation: Shrink the edges of the same kernel by 1.5 pixels to remove burrs and noise caused by light reflection; Smoothing verification: Detects boundary gradient changes, reducing the jaggedness to a level that is imperceptible to the human eye.

[0065] Step 65: Extraction of the skeleton centerline: The Zhang-Suen thinning algorithm is applied to iteratively process the denoising mask: in each iteration, the boundary pixels are stripped, and the internal points that satisfy 2-6 adjacent points and have a topological connection number of 1 are retained. After 6-8 rounds of processing, a single-pixel wide skeleton line is generated. The output skeleton retains the physiological characteristics of the leaf midrib (e.g., the sword leaf skeleton contains 70-120 consecutive pixels).

[0066] Step 66: Connected component labeling analysis: Perform scanline connected component labeling on the skeleton image: scan line by line from left to right and from top to bottom. When a foreground pixel is found, search its 4-neighborhood (up and left directions). If the neighboring area is unlabeled, assign a new label. Otherwise, inherit the neighboring area label. After merging equivalent labels, output the independent connected component (a single leaf skeleton has only 1 connected component).

[0067] Step 67: Precise extraction of region attributes: For each connected component, perform the following: traverse all foreground pixels within the component, record their row and column coordinates, and obtain the component's attributes, including: By storing the row and column coordinate sequences of all foreground pixels in the region, typically 70-120 sets of ordered data (example coordinates: [row 120, column 340], [row 121, column 340], etc.), the spatial position of the skeleton line is accurately recorded, and the pixel coordinate set is obtained. The centroid position is calculated using the following formulas: mean row coordinates = sum of all row coordinates / number of pixels; mean column coordinates = sum of all column coordinates / number of pixels.

[0068] In a preferred embodiment of the present invention, step 6 above further includes: Step 68: Extract the coordinate set of all pixels from the marked connected regions, perform principal component analysis on the pixel coordinate set, and extract the first principal component vector as the main direction of the blade. Step 69-1: Normalize the principal direction vectors of the two blades to unit vectors, calculate the dot product of the two unit vectors, and obtain the cosine value of the included angle. Step 69-2: Calculate the inverse cosine function of the included angle cosine value to obtain the included angle parameter between the blades.

[0069] In a preferred embodiment of the present invention, the blade angle calculation mechanism achieves three major technological revolutions through "PCA principal mapping + vector geometric analysis": Non-destructive extraction of physiological principal direction: PCA analysis based on connected component pixel coordinate set accurately captures the direction of the physiological main vein of the leaf. Even if the leaf is 30% curved or occluded, the principal direction vector still has an error of less than ±0.8° with the real physiological axis, which is 8 times more accurate than traditional manual calibration. Anti-interference vector calculation: Unit vector normalization eliminates the influence of blade length differences, and dot product operation directly relates the three-dimensional spatial relationship between the two blades, breaking through the planar projection error caused by the shooting angle in traditional image methods, with a measured angle accuracy of 98.5%; Seamless output of agronomic parameters: Inverse cosine transformation converts mathematical vectors into breeding-standard leaf angle values, reducing the efficiency of leaf angle measurement during rice tillering from 5 minutes / plant manually to 0.2 seconds / plant, and the data fully matches the standards of international plant phenotypic databases (such as EURISCO). This technology is the first to achieve laboratory-level precision automated measurement of leaf angles in dense field settings, providing core support for high-throughput genotype-phenotype association studies.

[0070] In a specific embodiment of the present invention, the specific steps include: Step 68: Blade principal direction extraction process: Read the set of pixel coordinates of the target connected region (e.g., 120 sets of coordinates for the first leaf and 110 sets of coordinates for the second leaf), construct an N×2 matrix (N is the number of pixels, column 1 = row coordinates, column 2 = column coordinates), calculate the mean of row coordinates and the mean of column coordinates; subtract the mean from each coordinate to obtain the centered matrix, calculate the 2×2 covariance matrix of the centered matrix, solve for the eigenvalues ​​and eigenvectors of the covariance matrix, select the eigenvector corresponding to the largest eigenvalue as the direction of the first principal component (physical meaning: the longest projection axis of the pixel distribution), and mark the first principal component vector (example: first leaf [0.894, 0.447], second leaf [-0.707, 0.707]). This vector points from the base of the leaf to the tip, and the angle deviation with the physiological midrib is < ±0.8°.

[0071] Step 69-1: Calculation of the cosine of the included angle: Calculate the magnitude of the direction vectors of the two blades respectively, divide each vector by its magnitude to obtain the unit vector, calculate the dot product of the two unit vectors, the dot product value range is [-1, 1], which represents the cosine of the spatial angle between the two vectors. If the dot product is <-0.98 (close to antiparallel), the centroid position is automatically checked to exclude abnormal blade crossings.

[0072] Step 69-2: Implementation process for generating blade angle: Call the inverse cosine function of the math library, input the dot product value, obtain the radian value, convert the radian to the angle, limit the output range [0°, 180°], generate the blade angle parameter, and obtain the angle parameter between the blades.

[0073] like Figure 2 As shown, embodiments of the present invention also provide a semi-automatic field data measurement system 20, comprising: The acquisition module 21 is used for step 1: acquiring crop images and obtaining the center coordinates of the target phenotype specified by the user based on the crop images; step 2: segmenting the crop images and the center coordinates of the target phenotype specified by the user through a pre-trained SAM model to obtain the target phenotype mask image. The judgment module 22 is used for step 3: judging the curvature features of the mask image to obtain the morphological features of the mask image, wherein the morphological features include upright morphology and curved morphology; step 4: extracting the minimum bounding rectangle from the upright morphological mask image, using the long side of the rectangle as the target phenotype length and the short side as the target phenotype width to obtain the upright phenotype parameters; step 5: generating a skeleton map by sequentially performing binarization, morphological denoising and skeletonization processing on the curved morphological mask image, constructing a graph structure based on the skeleton map and identifying the endpoints, using the longest path between the endpoints as the target phenotype curvature length to obtain the curved phenotype length; The calculation module 23 is used in step 6: Through steps 1 and 2, independent masks for each blade are obtained; each blade mask is then binarized, denoised, skeletonized, connected component labeled, and region attributes extracted sequentially; PCA dimensionality reduction is performed on the extracted region attributes to obtain blade direction vectors; and the angle between the blades is calculated based on the inverse cosine values ​​of the two direction vectors to obtain the blade angle parameters. It should be noted that this system corresponds to the method described above, and all implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.

[0074] An embodiment of the present invention proposes a method for measuring phenotypic data in a semi-automatic field setting, the principle of which is as follows: (1) Zero-shot learning to obtain the complete phenotype Traditional object detection and instance segmentation algorithms aim to label and extract instances of interest for further research. However, both object detection and instance segmentation require a large amount of high-quality labeled data that is significantly distinguishable from other objects in the photograph for the model to learn effectively. Data acquisition and labeling, as well as model training and optimization, are extremely time-consuming and resource-intensive processes, and there is almost no adaptability across different scenarios and crops. Furthermore, for field crops, there is no clear visual distinction between complete and incomplete phenotypes; complete phenotype data is scarce and difficult to detect in photographs, making it challenging for the model to learn. Therefore, we use a pre-trained large-scale segmentation model, SAM (Segment Anything Model), to obtain the objects we want to segment. SAM is a model that uses prompts to guide segmentation tasks; these prompts can be points, boxes, masks, or text information. A large segmentation mask dataset, SA-1B, has been developed for SAM. By pre-training on this dataset, it can adapt to various segmentation tasks and achieve zero-step learning on unseen data.

[0075] This invention utilizes the zero-learning capability of SAM (Synthetic Aspect-Oriented Model). By selecting a crop photo and providing the center coordinates of the object to be segmented, the crop can be perfectly segmented. The overall flowchart is as follows: Figure 3As shown.

[0076] (2) Graph curve algorithm For non-curved, upright masked objects, only the minimum bounding rectangle is required; the length and width of the rectangle represent the maximum length and width of the object. For curved masked objects, the length of the central curvature curve of the curved object needs to be calculated. To accurately and efficiently calculate the length of the curved masked object, this paper proposes a graph curve algorithm, the steps of which are as follows: 1. Binarize the mask image; 2. Perform dilation and erosion operations on the binarized image to remove noise points, obtaining the filled image; 3. Skeletonize the filled image to obtain the image skeleton; 4. Construct the graph structure G using a skeleton graph (using networkx); 5. Locate the endpoints (points with a degree of 1); 6. Find the starting point start_node and the ending point end_node (the point with the largest x and y values, the topmost point and the bottommost point); 7. Find all paths from the starting point to the ending point, all_paths. The longest path among all paths is the length of the curved object we need. The length of the curved object is calculated using the graph curve algorithm for the SAM segmented object described above, and the result is as follows: Figure 4 As shown.

[0077] (3) Angle calculation based on normal vector To calculate the angle between the blades, the two blades first need to be separated, using the same method as (1), with the following results. Figure 5 As shown; To accurately and quickly calculate the angle between two blades, this paper proposes an angle calculation based on normal vectors. Using normal vectors to represent the principal direction of the blades is an intuitive and reasonable method. The calculation steps are as follows: 1. Binarize the mask image; 2. Perform dilation and erosion operations on the binarized image to remove noise and obtain the filled image; 3. Skeletonize the filled image to obtain the skeleton image; 4. Label the connected components of the skeleton image to obtain the labeled image label_img. Extract the region attributes from the labeled image label_img to obtain the region image. 5. Traverse the region image, perform PCA dimensionality reduction on all points in each region, extract only the first principal component (representing the "principal direction" vector (unit vector) of this region, i.e. the blade direction), and record the centroid position and direction; 6. Use the inverse cosine theorem to calculate the angle between the blades; For the SAM segmented object mentioned above, the angle between the two blades is calculated using a normal vector-based angle algorithm, as shown below. Figure 6 As shown.

[0078] Therefore, the object of the present invention can also be achieved by running a program or a set of programs on any computing device. The computing device can be a known general-purpose device. Therefore, the object of the present invention can also be achieved simply by providing a program product containing program code implementing the method or apparatus. That is, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent to the present invention. Furthermore, the steps performing the above series of processes can naturally be performed in the order described, but are not necessarily required to be performed in chronological order. Some steps can be performed in parallel or independently of each other.

[0079] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for measuring phenotypic data in a semi-automatic field setting, characterized in that, The method includes: Step 1: Acquire crop images and, based on the crop images, obtain the center coordinates of the target phenotype specified by the user; Step 2: Segment the crop image and the center coordinates of the target phenotype specified by the user using a pre-trained SAM model to obtain the target phenotype mask image; Step 3: By judging the curvature features of the mask image, the morphological features of the mask image are obtained, including upright and curved shapes. Step 4: Extract the minimum bounding rectangle from the upright morphology mask image, use the long side of the rectangle as the target morphology length and the short side as the target morphology width, and obtain the upright morphology parameters; Step 5: Generate a skeleton map by performing binarization, morphological denoising and skeletonization on the curved shape mask image in sequence, and construct a graph structure based on the skeleton map and identify the endpoints. The longest path between the endpoints is used as the bending length of the target phenotype to obtain the bending phenotype length. Step 6: Using Step 1 and Step 2, obtain the independent mask for each blade. Perform binarization, denoising, skeletonization, connected component labeling, and extract region attributes for each blade mask in sequence. Then, perform PCA dimensionality reduction on the extracted region attributes to obtain the blade direction vector. Calculate the angle between the blades based on the inverse cosine value of the two direction vectors to obtain the angle parameter between the blades.

2. The method for measuring phenotypic data in a semi-automatic field setting according to claim 1, characterized in that, Step 2: Segment the crop image and the user-specified target phenotypic center coordinates using a pre-trained SAM model to obtain a target phenotypic mask image, including: Crop images are encoded using the SAM model to obtain depth image features; The user-specified target phenotype center coordinates are processed by the prompt encoder of the SAM model to obtain the spatial location code; The depth image features and spatial location are encoded and then passed through the mask decoder of the SAM model to obtain a binary mask image corresponding to the target phenotype.

3. The method for measuring phenotypic data in a semi-automatic field setting according to claim 2, characterized in that, Step 3: By judging the curvature features of the mask image, the morphological features of the mask image are obtained. These morphological features include upright and curved shapes, including: Contour detection is performed on the target phenotypic mask image to extract the outer boundary polygon of the mask region; Calculate the minimum bounding rectangle of the outer boundary polygon, and obtain the length of the long side and the length of the short side of the rectangle; Calculate the ratio of the actual area of ​​the mask region to the area of ​​the minimum circumscribed rectangle based on the lengths of the long and short sides of the rectangle. A preset threshold is used to compare the ratio with the threshold and obtain the morphological features of the mask image. If the ratio is less than the preset threshold, it is determined to be a curved shape; otherwise, it is determined to be an upright shape.

4. The method for measuring phenotypic data in a semi-automatic field setting according to claim 3, characterized in that, Step 4: Extract the minimum bounding rectangle from the upright morphology mask image, using the longer side of the rectangle as the target phenotype length and the shorter side as the target phenotype width, to obtain the upright phenotype parameters, including: Edge detection is performed on the upright morphological mask image to obtain the closed contour of the mask region; By calculating the minimum bounding rectangle of the closed contour, the direction of the major axis and its length, and the direction of the minor axis and its width are determined. The upright phenotype parameter set is generated by using the length of the major axis as the target phenotype length value and the width of the minor axis as the target phenotype width value.

5. The method for measuring phenotypic data in a semi-automatic field setting according to claim 4, characterized in that, Step 5: Generate a skeleton map by sequentially performing binarization, morphological denoising, and skeletonization on the curved morphology mask image. Construct a graph structure based on the skeleton map and identify endpoints. Use the longest path between endpoints as the target phenotype curvature length to obtain the curvature phenotype length, including: Convert the curved shape mask image into a binary image to obtain a binary image, where the phenotypic region is the foreground pixel and the background is the background pixel; Dilation and erosion operations are performed sequentially on the binary image to eliminate noise points and fill holes, generating a smooth binary image. The smooth binary image is thinned, the central skeleton line of the phenotypic region is extracted, and a skeleton map with a single pixel width is generated. Each pixel in the skeleton graph is used as a graph node, and edges are established between adjacent pixels to construct the skeleton graph structure. In the skeleton graph structure, identify all nodes with a degree of 1 as endpoints, select the node with the largest y-coordinate as the starting point, and the node with the smallest y-coordinate as the ending point. Calculate all possible paths from the starting point to the ending point, and select the pixel length of the longest path as the target phenotype bending length.

6. The method for measuring phenotypic data in a semi-automatic field setting according to claim 5, characterized in that, Step 6: Following steps 1 and 2, obtain independent masks for each blade. Perform binarization, denoising, skeletonization, connected component labeling, and region attribute extraction on each blade mask sequentially. Then, perform PCA dimensionality reduction on the extracted region attributes to obtain blade direction vectors. Calculate the angle between blades based on the inverse cosine of the two direction vectors to obtain the blade angle parameters, including: Perform steps 1-2 on the first target blade to obtain the first blade mask image; Perform steps 1-2 on the second target blade to obtain the mask image of the second blade; The first leaf mask image and the second leaf mask image are binarized to generate a binary mask; Dilation and erosion operations are performed sequentially on each binary mask to eliminate noise and smooth the boundaries, so as to obtain the denoised mask; The denoised mask is thinned to extract the leaf skeleton with a single pixel width, and the leaf skeleton image is obtained. Connected component labeling is performed on the skeleton image to identify independent skeleton regions and obtain each connected component; By extracting the geometric properties of each connected region, region property extraction is obtained. The region properties include the pixel coordinate set and the centroid position.

7. The method for measuring phenotypic data in a semi-automatic field setting according to claim 6, characterized in that, Step 6: Following steps 1 and 2, obtain independent masks for each blade. Perform binarization, denoising, skeletonization, connected component labeling, and region attribute extraction on each blade mask sequentially. Then, perform PCA dimensionality reduction on the extracted region attributes to obtain blade direction vectors. Calculate the angle between blades based on the inverse cosine of the two direction vectors to obtain the blade angle parameter. This also includes: Extract the coordinate set of all pixels from the marked connected regions, perform principal component analysis on the pixel coordinate set, and extract the first principal component vector as the main direction of the blade; Normalize the principal direction vectors of the two blades to unit vectors, calculate the dot product of the two unit vectors, and obtain the cosine value of the included angle. The inverse cosine function is used to calculate the angle between the blades, thus obtaining the angle parameters between the blades.

8. A semi-automatic field data measurement system, characterized in that, include: The acquisition module is used for step 1: acquiring crop images and obtaining the center coordinates of the target phenotype specified by the user based on the crop images; step 2: segmenting the crop images and the center coordinates of the target phenotype specified by the user using a pre-trained SAM model to obtain the target phenotype mask image. The judgment module is used in step 3: judging the curvature features of the mask image to obtain the morphological features of the mask image, where the morphological features include upright morphology and curved morphology; step 4: extracting the minimum bounding rectangle from the upright morphological mask image, using the long side of the rectangle as the target phenotype length and the short side as the target phenotype width to obtain the upright phenotype parameters; step 5: performing binarization, morphological denoising and skeletonization processing on the curved morphological mask image in sequence to generate a skeleton map, constructing a graph structure based on the skeleton map and identifying the endpoints, using the longest path between the endpoints as the target phenotype curvature length to obtain the curved phenotype length; The calculation module is used in step 6: through steps 1 and 2, obtain the independent mask of each blade, and perform binarization, denoising, skeletonization, connected component labeling and extracting region attributes on each blade mask in sequence; and perform PCA dimensionality reduction on the extracted region attributes to obtain the blade direction vector, and calculate the angle between the blades based on the inverse cosine value of the two direction vectors to obtain the angle parameter between the blades.

9. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image correction method and device, electronic equipment and storage medium

    CN111429380A

  • Plant phenotype research-oriented leaf instance segmentation method

    CN113344934A

  • Non-destructive poultry egg quality character prediction method and system

    CN114283882A

  • Method for measuring phenotypic characters of leaves in batches and related equipment

    CN116105691A

  • Phenotype acquisition method based on facility crop phenotype acquisition device

    CN116465887A

Cited By

  • Single-view-angle tea bud 3D skeleton rapid extraction method based on point cloud analysis

    CN121982333A