Method and device for automatically extracting and quantifying plant root phenotypes
Patent Information
- Application Number
- CN202610921959.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-25
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2046-06-25
AI Technical Summary
因为根系并非是完全平铺在图像(玻璃板)上,根系之间一定存在的重叠,因此基于2D图像的Zhang-Suen算法无法准确提取根系骨架拓扑结构
本发明实现了从原始照片到量化指标输出的全流程自动化,涵盖了图像分割、目标检测和指标计算三个核心步骤,能够自动处理指定文件夹下的所有图像文件,显著降低了人工处理海量表型数据的时间成本。
Smart Images

Figure CN122473470B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of root phenotyping technology, and more particularly to a fully automated method and apparatus for extracting and quantifying plant root phenotypic patterns. Background Technology
[0002] Seg Net network model, U Seg-Net network models require training with a large number of labeled images. Seg-Net typically converges slowly. In root identification tasks, if the dataset is small, Seg-Net is prone to underfitting, struggling to distinguish subtle color differences between dark soil and fine roots. U-Net tends to overfit to specific lighting or soil backgrounds, resulting in poor generalization ability; its recognition rate drops significantly when changing soil types. Essentially, they are convolutional neural networks, with the core being the convolution kernel. The size of the convolution kernel limits the model to extracting only local features, lacking constraints on long-distance geometric structures, making it prone to root fragmentation or breakage, affecting the extraction of topological structures.
[0003] A binary image of the root system is generated by fusing bilateral filtering for noise reduction, local thresholding, and edge extraction. This process is affected by environmental factors; impurities such as soil particles, water stains, and light reflections in the image may be misidentified as roots. Even with subsequent "feature removal of impurities," impurities "adhered" to the root system may still be incorrectly identified as part of it. Small roots, due to their low contrast, are easily lost during local thresholding.
[0004] The Zhang-Suen algorithm was used to extract the root system skeleton topology. Because the root system is not completely flat on the image (glass plate), there must be overlap between the roots. Therefore, the Zhang-Suen algorithm based on 2D images cannot accurately extract the root system skeleton topology. Summary of the Invention
[0005] The main objective of this invention is to provide a fully automated method for extracting and quantifying plant root phenotypes.
[0006] Another objective of this invention is to provide a fully automated device for extracting and quantifying plant root phenotypes.
[0007] The third objective of this invention is to provide an electronic device.
[0008] A fourth objective of this invention is to provide a non-transitory computer-readable storage medium.
[0009] To achieve the above objectives, a first aspect of the present invention provides a fully automated method for extracting and quantifying plant root phenotypes, comprising:
[0010] S1, acquire the original plant image and perform image segmentation to obtain the root mask image; S2, based on the original plant image, uses an open vocabulary object detection model to automatically detect the seed location and output the seed bounding box coordinates; S3. The root system mask image is preprocessed. Based on the seed bounding box coordinates and the preprocessed root system mask image, various root system phenotypic indices are calculated to obtain quantitative index data.
[0011] Optionally, the original plant image is acquired and segmented to obtain a root mask image, including: The original plant image is converted from the RGB color space to the HSV color space, and a background mask is generated based on a preset HSV threshold range. A morphological closing operation is performed on the background mask to obtain the plant foreground image; Based on the plant foreground image, white or bright areas are separated by a brightness threshold to obtain a root mask image.
[0012] Optionally, based on the original plant image, the seed location is automatically detected using an open-vocabulary object detection model, and the seed bounding box coordinates are output, including: Using the original plant image as image data, and inputting the text prompt TEXT_PROMPT="seed", the Grounding DINO open vocabulary object detection model is used to associate the text prompt with the image region in the original plant image to locate the seed target. After the location is completed, a JSON object containing the seed bounding box coordinates [x0,y0,x1,y1] and the label is returned. The open vocabulary target detection model Grounding DINO transmits the binary data of the original plant image by sending an HTTP POST request from the client. After receiving the request, the server performs target detection and returns the JSON object, thus achieving zero-sample automatic detection of seed locations.
[0013] Optionally, the root mask image may be preprocessed, including: Based on the seed bounding box coordinates, the effective root system map is cropped from the root system mask image, invalid pixels that exceed the seed bounding box coordinates are filtered out, and the effective root system area within the bounding box is retained to obtain the effective root system map. The cropped effective root system map is converted into a single-channel root system grayscale map, and the coordinate set of all non-zero root system pixels in the image is extracted to obtain the coordinates of all root system pixels. The np.where function filters all root pixel coordinates with pixel values > 0, removes pure background zero-value pixels, and outputs non_zero_coords to store the coordinates of root pixels in all directions; Based on the omnidirectional non-zero pixel coordinates, 8-neighborhood connectivity analysis is used to divide all spatially connected non-zero pixels into independent root segments.
[0014] Optionally, based on the seed bounding box coordinates and the preprocessed root mask image, various root phenotypic indices are calculated to obtain quantitative index data, including: Preset pixel physical size PIXEL_SIZE, count the total number of non-zero pixels contained in all root system connected regions in root_segments after omnidirectional segmentation, and calculate the total root length and coverage area of the root system; Calculate root depth, root width, and aspect ratio based on seed bounding box coordinates; The root system skeleton was detected using the 8-connected neighborhood method. Pixels with only one neighbor pixel were counted as root tips, and the root tip set was determined. for:
[0015] Where x is the pixel width and y is the pixel height. For skeleton points, This represents the number of connected neighbors. The number of bifurcation points is calculated by counting pixels that have two or more neighboring pixels. for:
[0016] in, The cardinality symbol for a set indicates the number of elements in the set. The cv2.findContours() function extracts all external contours of the root system, selects the contour with the largest area as the core root system contour, and generates a convex hull point set and calculates the convex hull pixel area using cv2.convexHull(). The calculated total root length, coverage area, root depth, root width, aspect ratio, number of root tips, number of branching points, convex hull area, and root density are integrated to obtain quantitative index data.
[0017] To achieve the above objectives, a second aspect of the present invention provides a fully automated plant root phenotypic extraction and quantification device, comprising: The segmentation module is used to acquire the original plant image and segment the image to obtain the root mask image; The detection module is used to automatically detect seed locations based on the original plant image using an open vocabulary target detection model, and output the coordinates of the seed bounding box. The calculation module is used to preprocess the root system mask image. Based on the seed bounding box coordinates and the preprocessed root system mask image, it calculates various root system phenotypic indices to obtain quantitative index data.
[0018] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0019] To achieve the above objectives, a third aspect of this application provides an electronic device, including a processor and a memory; wherein the processor reads executable program code stored in the memory to run a program corresponding to the executable program code, for implementing the fully automated extraction and quantification method of plant root phenotype as described in the first aspect embodiment.
[0020] To achieve the above objectives, a fourth aspect of this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the fully automated extraction and quantification method for plant root phenotypes as described in the first aspect embodiment.
[0021] The embodiments of the present invention have the following beneficial effects: This invention automates the entire process from raw photos to quantitative index output, covering three core steps: image segmentation, object detection, and index calculation. It can automatically process all image files in a specified folder, significantly reducing the time cost of manually processing massive amounts of phenotypic data. Attached Figure Description
[0022] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 A flowchart of a fully automated method for extracting and quantifying plant root phenotypes provided in an embodiment of the present invention; Figure 2 A flowchart of another fully automated method for extracting and quantifying plant root phenotypes provided in an embodiment of the present invention; Figure 3 An original diagram of a plant root system provided in an embodiment of the present invention; Figure 4 An image segmentation map provided in an embodiment of the present invention; Figure 5 A seed detection diagram provided in an embodiment of the present invention; Figure 6 A root index calculation diagram provided in an embodiment of the present invention; Figure 7 This is a structural diagram of a fully automated plant root phenotypic extraction and quantification device provided in an embodiment of the present invention. Detailed Implementation
[0023] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0025] The fully automated method and apparatus for extracting and quantifying plant root phenotypes according to embodiments of the present invention are described below with reference to the accompanying drawings.
[0026] Example 1 This invention provides a fully automated method for extracting and quantifying plant root phenotypes. Figure 1 This is a schematic flowchart illustrating a fully automated method for extracting and quantifying plant root phenotypes according to an embodiment of the present invention. Figure 1 As shown, the method includes the following steps: S1: Acquire the original plant image and perform image segmentation to obtain the root mask image.
[0027] In order to accurately segment the plant body and root system and obtain dedicated basic image data, this application completes the separation and extraction of the plant and root system through color space conversion, morphological operations and layered extraction.
[0028] In this application embodiment, the source of the original data used for plant and root system segmentation is clearly defined. The original data used in this application is the original photograph of the plant taken in front of a blue background. The photograph format includes .png and .jpg formats. This background setting method can provide a clear color distinction basis for subsequent background segmentation and foreground extraction, effectively reduce the probability of confusion between the background and the plant subject, and improve the convenience and accuracy of segmentation.
[0029] In this embodiment, the separation of the plant and its root system is achieved step by step through a multi-step standardized technical implementation. First, an HSV spatial transformation operation is performed, such as... Figure 3The image shown is the original image of the plant roots. This application chose to convert the original image to the HSV color space because, compared to the traditional RGB color space, the HSV space is more robust to changes in lighting conditions. It effectively avoids interference from variations in lighting intensity on image segmentation and makes it easier to stably identify and segment the blue background area using the hue (H) channel. In this embodiment, for the identification of the blue background, this application sets precise value ranges for the three channels of the HSV space: hue (H) ranges from 95 to 130, saturation (S) ranges from 100 to 255, and lightness (V) ranges from 50 to 255. These threshold ranges allow for precise selection of the blue background area, laying the foundation for subsequent foreground extraction.
[0030] In this embodiment, after HSV spatial transformation and initial background screening, mask optimization is performed. Specifically, morphological closing operations are used to optimize the mask. Morphological closing operations follow a "dilation-erosion" logic, effectively filling holes in the mask and connecting broken fine roots, ensuring the integrity of the plant body and root mask. In this embodiment, the "opening operation" step is intentionally removed from the mask optimization process. The core purpose is to prevent the erosion operation of the opening operation from losing the finest roots of the plant, ensuring the integrity of root segmentation and preserving the detailed features of the root system to the greatest extent. In this embodiment, the application constructs structuring elements for morphological closing operations by defining the structuring function cv2.getStructuringElement(shape,ksize). The shape parameter is set to a rectangle, which can better fill the regular holes in the mask and effectively connect the continuous areas of the plant body and the root system. The size parameter is precisely set to (5,5). This size setting can effectively connect broken small roots while finely repairing the holes in the mask. It will not cause the mask to over-expand and blur the details due to excessive size, nor will it fail to fill the holes and connect the roots due to insufficient size, thus ensuring the effect of mask optimization.
[0031] In this embodiment of the application, after mask optimization is completed, the plant foreground and root system are accurately separated by layer extraction. The core logic of layer extraction is to first extract the plant foreground based on the results of the aforementioned HSV space transformation and mask optimization, completely separating the plant body from the blue background. Then, from the extracted plant foreground, the white / light areas are further separated by filtering the brightness threshold, and the white / light areas are identified as the plant roots, thus achieving layered differentiation between the plant body and the root system. In this embodiment, the white / light root region is extracted by calling the function cv2.inRange(src,lowerb,upperb). The parameter src of this function is the input HSV format plant foreground image, the parameter lowerb is set to np.array([0,0,100]) as the lower threshold array of the white / light region, and the parameter upperb is set to np.array([180,80,255]) as the upper threshold array of the white / light region. By accurately setting these upper and lower thresholds, the white / light root region can be accurately screened from the plant foreground, and the roots can be effectively separated from other parts of the plant.
[0032] In this embodiment, after the aforementioned HSV spatial transformation, mask optimization, and hierarchical extraction, the plant and root segmentation outputs two core results: one is a plant image with an alpha channel, such as... Figure 4 As shown, the first image clearly presents the complete shape of the plant body, while the blue background is masked through the transparency channel, which facilitates subsequent image analysis and processing. The second image is a mask image containing only the root system. This mask image can accurately present the complete outline and detailed features of the plant root system, providing accurate and pure basic mask data for subsequent quantitative analysis, morphological analysis and other related operations of the plant root system, ensuring the accuracy and effectiveness of subsequent analysis work.
[0033] In this embodiment, by performing HSV spatial transformation, morphological closing operation optimization, and layer extraction on a plant image with a blue background, accurate segmentation of the plant and its roots is achieved, outputting a plant image with an alpha channel and a mask image containing only the roots, laying the foundation for obtaining the seed bounding box coordinates.
[0034] S2, based on the original plant image, uses an open vocabulary object detection model to automatically detect the seed location and output the seed bounding box coordinates.
[0035] To achieve accurate detection of seed targets in images, this application uses a remote AI service combined with the GroundingDINO model to complete zero-sample seed identification, data interaction, and visualization of detection results.
[0036] In this embodiment of the application, in order to achieve accurate detection of seed targets in images, a seed target detection stage is set up. In this embodiment of the application, the detection system is built using remote AI services, and the seed target is identified with "zero sample" by relying on the open vocabulary target detection model. Through standardized data interaction process and visualization verification method, the efficiency and accuracy of seed target detection are ensured, and accurate seed target location information is provided for subsequent related analysis work.
[0037] In this application embodiment, the core implementation method of the seed target detection stage is a remote AI service, and the core model is the Grounding DINO open vocabulary target detection model. The characteristics of this model enable this application to achieve "zero-sample" object recognition of seed targets. The detection work can be completed without special model training for seed targets, which greatly reduces the training cost and time cost of the model and improves the convenience and versatility of seed target detection.
[0038] In this embodiment, the working principle of the Grounding DINO model for zero-shot seed detection is detailed. During the detection process, the user provides a remote AI server with an image containing the seed and a specified text prompt. This text prompt is uniformly set to TEXT_PROMPT="seed". This text prompt serves as the core basis for model recognition, guiding the model to complete the association matching between the text description and the image region. Because the Grounding DINO model possesses the characteristic of open vocabulary recognition, in this embodiment, the model does not require specific training and parameter tuning for the "seed" target. It can accurately locate the corresponding seed target in the image based on the input text description, achieving zero-shot seed target detection and effectively improving the adaptability and efficiency of the detection.
[0039] In this embodiment, a standardized client-server data interaction process is established to ensure efficient and stable data transmission and processing during seed target detection. In this embodiment, the client, as the data sender, sends the seed image to be detected as binary data to the remote AI server via an HTTP POST request. This data transmission method ensures the integrity of the image data and avoids data loss during transmission. Figure 5The image shown is a seed detection map. After receiving and completing the seed target detection, the server returns the detection results in a preset format. In this embodiment, the detection results returned by the server are JSON objects containing the bounding box coordinates and labels of the seed targets. The bounding box coordinates are specifically [x0, y0, x1, y1], which can accurately represent the location range of the seed targets in the image. The labels are used to identify the detected target categories. This data format is concise and standardized, making it easy for the client to parse and use the detection results.
[0040] In this embodiment, a visualization verification step is set up for the seed target detection results to improve the verifiability and intuitiveness of the detection results. In this embodiment, after receiving the seed target detection results returned by the server, the system draws a colored bounding box and corresponding label on the original image of the seed to be detected based on the returned bounding box coordinates and labels. The colored bounding box can accurately select each detected seed target, and the label can clearly identify the target information. Through this visualization method, staff can directly and intuitively verify the detection effect of the seed targets, quickly determine whether the detection results are accurate, and whether there are any missed or false detections. This facilitates timely adjustments and optimizations to the detection process, ensuring the reliability of the seed target detection results.
[0041] In this embodiment, a remote AI service is built based on the Grounding DINO model to complete zero-sample seed identification, HTTP data interaction, and visualization of detection results, thereby achieving accurate positioning of seed targets in images and intuitive verification of detection effects.
[0042] S3. The root system mask image is preprocessed. Based on the seed bounding box coordinates and the preprocessed root system mask image, various root system phenotypic indices are calculated to obtain quantitative index data.
[0043] In this embodiment of the application, based on the transparent channel root mask image generated in stage one and the bounding box coordinates [x0,y0,x1,y1] returned by the GroundingDINO model in stage two, the root phenotypic index is accurately quantified and calculated using image thinning technology.
[0044] In this embodiment, the root system region is first segmented. Based on the bounding box coordinates [x0, y0, x1, y1], the effective root system region is cropped from the root system mask image of the alpha channel. All invalid pixels that exceed the bounding box are filtered out, and only the effective root system region within the bounding box is retained. This eliminates background noise interference and provides a clean and effective data foundation for subsequent analysis.
[0045] In this embodiment, the cropped effective root system color image is converted to grayscale and transformed into a single-channel root system grayscale image, simplifying the subsequent pixel calculation process and providing standardized data format support for omnidirectional pixel extraction.
[0046] In this embodiment, an omnidirectional root pixel extraction step replaces the traditional single-row horizontal extraction method, achieving full-area capture without omission. It iterates through all rows and columns of the effective root region after grayscale conversion, extracting the coordinate set of all non-zero root pixels in the entire image, and outputting an all_root_pixels two-dimensional coordinate array to store the (x-column index, y-row index) coordinates of all root pixels, thus achieving omnidirectional capture of root pixels in the horizontal, vertical, and diagonal directions.
[0047] In this embodiment, an omnidirectional non-zero pixel filtering operation is performed. The entire grayscale image is used as the analysis object. All root pixel coordinates with pixel values > 0 are filtered by np.where, and pure background zero-value pixels are removed. If there are no non-zero pixels in the image, i.e. there are no roots, an empty result is returned. Finally, a two-dimensional array non_zero_coords is output to store the coordinates of the omnidirectional root pixels, such as [[10,5],[11,5],[12,5],[15,6],[16,6]], so as to achieve accurate separation of roots and background.
[0048] In this embodiment, an omnidirectional root segmentation step is adopted. Based on the omnidirectional non-zero pixel coordinates, through 8-neighbor connected component analysis, it covers horizontal, vertical, and diagonal continuous pixels, dividing all spatially connected non-zero pixels into independent root segments or root segments. Each connected component corresponds to a complete root system, replacing the original logic of only horizontal continuous segmentation. In specific implementation, all non-zero pixel coordinates are initialized and traversed. Unassigned pixels are marked as the starting point of new segments. Continuous pixels connected in 8 directions (up, down, left, right + four diagonal angles) are identified and merged into a root segment. The root_segments list is output. Each element is the minimum bounding coordinate tuple (min_x, min_y, max_x, max_y) of the root segment, representing the omnidirectional boundary of a root, such as [(10,5,12,5),(15,6,16,6)].
[0049] In this embodiment of the application, based on the above processing results, quantitative calculations of root phenotypic indicators are performed, such as... Figure 6 As shown, the relevant indicators and calculation methods are as follows.
[0050] In this embodiment, the basic parameter pixel size is defined as PIXEL_SIZE, the number of non-zero pixels is np.count_nonzero(root grayscale image), the total length of the pixel outline is sum(cv2.arcLength(outline,True)), the bounding rectangle parameter x is the pixel width, y is the pixel height, and cv2.boundingRect is the outline point.
[0051] In this embodiment, the total root length (mm) is calculated by counting the total number of non-zero pixels contained in all root connected regions of root_segments after omnidirectional segmentation. The calculation formula is as follows:
[0052] This metric is the product of the total number of non-zero pixels in all connected root segments of the root system and the physical size of a single pixel, which can intuitively reflect the overall length of the root system.
[0053] The formula for calculating the coverage area (mm²) is:
[0054] In this embodiment, the root depth, width, and aspect ratio (mm, dimensionless) are calculated based on the original clipping bounding box [x0,y0,x1,y1], directly reflecting the overall spatial scale of the root system.
[0055]
[0056]
[0057]
[0058] The formula for calculating aspect ratio is:
[0059] An anomaly protection mechanism is set when the width is 0 to avoid calculation errors.
[0060] In this embodiment, the number of root tips is accurately identified based on omnidirectional 8-connected neighborhood analysis of the root skeleton. 8-connectivity is defined as the target pixel having 8 effective neighbors (top, bottom, left, right, and four diagonals). A root tip is determined as a point in the skeleton that has only one 8-connected neighbor pixel. The total number of root tips is the number of all pixels that meet this condition. The root tip set is defined as follows. for:
[0061] in, Mark the skeleton. It is 8 - the number of connected neighbors.
[0062] In this embodiment, the number of branch points is also based on the 8-connected neighborhood rule to count the root skeleton branch nodes. All pixels in the skeleton are traversed, and the number of 8-connected neighbors for each pixel is calculated. A branch point is determined as a pixel with ≥2 8-connected neighbor pixels. The total number of these branches is the root system branch point count. The definition of the number of branch points is as follows. for:
[0063] in, The cardinality symbol for a set indicates the number of elements in the set.
[0064] In this embodiment, the convex hull area (mm²) is calculated based on the contour extracted from the omnidirectional root grayscale image to determine the minimum convex polygon area. The specific steps are as follows: All external contours are extracted using `cv2.findContours()`, and the largest core root contour is selected using `max(contours,key=cv2.contourArea)`; the convex hull point set `hull` is generated using `cv2.convexHull()`; the convex hull pixel area is calculated using `cv2.contourArea(hull)`. The final calculation formula is:
[0065] In this embodiment, root density (dimensionless) reflects the degree to which the root system fills the growth space, and is directly related to the coverage area and the convex hull area. The calculation formula is as follows:
[0066] An anomaly protection mechanism is set when the convex hull area is 0 to avoid calculation errors.
[0067] In this embodiment, the core optimization steps of omnidirectional root pixel extraction, omnidirectional non-zero pixel screening, and omnidirectional root segment segmentation replace the traditional single-row horizontal extraction method, achieving complete capture of root pixels in all directions (horizontal, vertical, and diagonal). This effectively improves the accuracy and comprehensiveness of root phenotypic index calculation and can be widely applied to scenarios such as plant root morphology analysis and crop stress resistance evaluation.
[0068] Example 2 This invention provides a fully automated plant root phenotypic extraction and quantification device 10, such as... Figure 7 As shown, the device includes: The segmentation module 100 is used to acquire the original plant image and perform segmentation processing on the image to obtain a root mask image; The detection module 200 is used to automatically detect seed locations based on the original plant image using an open vocabulary target detection model and output the coordinates of the seed bounding box. The calculation module 300 is used to preprocess the root system mask image, and calculate various root system phenotypic indicators based on the seed bounding box coordinates and the preprocessed root system mask image to obtain quantitative indicator data.
[0069] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0070] Example 3 To implement the methods of the above embodiments, the present invention also provides an electronic device, which includes a memory and a processor; wherein the processor reads executable program code stored in the memory to run a program corresponding to the executable program code, so as to implement the various steps of the methods described above.
[0071] Example 4 To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the method described in the foregoing embodiments.
[0072] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0073] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0074] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
Claims
1. A fully automated method for extracting and quantifying plant root phenotypes, characterized in that, include: S1, acquire the original plant image and perform image segmentation to obtain the root mask image; S2, based on the original plant image, uses an open vocabulary object detection model to automatically detect the seed location and output the seed bounding box coordinates; S3. Preprocess the root system mask image. Based on the seed bounding box coordinates and the preprocessed root system mask image, calculate various root system phenotypic indices to obtain quantitative index data. The preprocessing process includes: cropping the effective root system map from the root system mask image based on the seed bounding box coordinates, filtering out invalid pixels that exceed the seed bounding box coordinates, and retaining the effective root system area within the bounding box to obtain the effective root system map; converting the cropped effective root system map into a single-channel root system grayscale image, extracting the coordinate set of all non-zero root system pixels in the image, and obtaining a set of coordinates to store the coordinates of all root system pixels. Specifically, this includes filtering all root system pixel coordinates with pixel values > 0 using the np.where function, removing pure background zero-value pixels, and outputting a two-dimensional array containing non_zero_coords to store the coordinates of root system pixels in all directions; based on the coordinates of non-zero pixels in all directions, using the 8-connected neighborhood method for analysis, dividing all spatially connected non-zero pixels into independent root system segments.
2. The method according to claim 1, characterized in that, The process of acquiring the original plant image and segmenting it to obtain a root mask image includes: The original plant image is converted from the RGB color space to the HSV color space, and a background mask is generated based on a preset HSV threshold range. A morphological closing operation is performed on the background mask to obtain the plant foreground image; Based on the plant foreground image, white or bright areas are separated by a brightness threshold to obtain a root mask image.
3. The method according to claim 1, characterized in that, The method of automatically detecting seed locations based on original plant images using an open-vocabulary object detection model and outputting seed bounding box coordinates includes: Using the original plant image as image data, and inputting the text prompt TEXT_PROMPT="seed", the Grounding DINO open vocabulary object detection model is used to associate the text prompt with the image region in the original plant image to locate the seed target. After the location is completed, a JSON object containing the seed bounding box coordinates [x0,y0,x1,y1] and the label is returned. The open vocabulary target detection model Grounding DINO transmits the binary data of the original plant image by sending an HTTP POST request from the client. After receiving the request, the server performs target detection and returns the JSON object, thus achieving zero-sample automatic detection of seed locations.
4. The method according to claim 1, characterized in that, Based on the seed bounding box coordinates and the preprocessed root mask image, various root phenotypic indices are calculated to obtain quantitative index data, including: Preset pixel physical size PIXEL_SIZE, count the total number of non-zero pixels contained in all root system connected regions in root_segments after omnidirectional segmentation, and calculate the total root length and coverage area of the root system; Calculate root depth, root width, and aspect ratio based on seed bounding box coordinates; The root system skeleton was detected using the 8-connected neighborhood method. Pixels with only one neighbor pixel were counted as root tips, and the root tip set was determined. for: Where x is the pixel width and y is the pixel height. For skeleton points, This represents the number of connected neighbors. The number of bifurcation points is calculated by counting pixels that have two or more neighboring pixels. for: in, The cardinality symbol for a set indicates the number of elements in the set. The cv2.findContours() function extracts all external contours of the root system, selects the contour with the largest area as the core root system contour, and generates a convex hull point set and calculates the convex hull pixel area using cv2.convexHull(). The calculated total root length, coverage area, root depth, root width, aspect ratio, number of root tips, number of branching points, convex hull area, and root density are integrated to obtain quantitative index data.
5. A fully automated device for extracting and quantifying plant root phenotypes, characterized in that, include: The segmentation module is used to acquire the original plant image and segment the image to obtain the root mask image; The detection module is used to automatically detect seed locations based on the original plant image using an open vocabulary target detection model, and output the coordinates of the seed bounding box. The calculation module is used to preprocess the root system mask image. Based on the seed bounding box coordinates and the preprocessed root system mask image, it calculates various root system phenotypic indicators to obtain quantitative indicator data. The preprocessing process includes: cropping the effective root system map from the root system mask image based on the seed bounding box coordinates, filtering out invalid pixels that exceed the seed bounding box coordinates, and retaining the effective root system area within the bounding box to obtain the effective root system map; converting the cropped effective root system map into a single-channel root system grayscale image, extracting the coordinate set of all non-zero root system pixels in the image, and obtaining a set of coordinates to store the coordinates of all root system pixels. Specifically, this includes filtering all root system pixel coordinates with pixel values > 0 using the np.where function, removing pure background zero-value pixels, and outputting a two-dimensional array containing non_zero_coords to store the coordinates of root system pixels in all directions; based on the coordinates of non-zero pixels in all directions, the 8-connected neighborhood method is used for analysis to divide all spatially connected non-zero pixels into independent root system segments.
6. An electronic device, characterized in that, Including processor and memory; The processor reads executable program code stored in the memory to run a program corresponding to the executable program code, so as to implement the method as described in any one of claims 1-4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-4.
Citation Information
Patent Citations
Seed bud length and root length detection method based on image processing
CN112907545A
Rice root lossless acquisition method, device, storage medium and system
CN117789201A