A method, device, equipment and storage medium for spike axis feature extraction
By graying, binarizing and segmenting the cob image, identifying the spike marking points and serial numbers, the problem of strong subjectivity and low efficiency of manual measurement of wheat cob features is solved, and automated and efficient cob feature extraction is achieved.
Patent Information
- Application Number
- CN202210982190.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-16
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-08-16
AI Technical Summary
The measurement of characteristic parameters of wheat cobs in the prior art mainly relies on manual measurement, which is highly subjective and inefficient, and cannot achieve automated and accurate measurement.
By acquiring the original cob image, performing grayscale and binarization processing, identifying the connecting area, calculating the distance between the foreground and background pixel points, determining the spike node marking points and serial numbers, generating spike node segmentation images, and extracting the spike node features.
Automatic measurement of wheat cob characteristics is realized, improving the accuracy and efficiency of measurement.
Smart Images

Figure CN115170643B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly relates to a method, device, equipment and storage medium for ear axis feature extraction. Background Art
[0002] The ear axis features of wheat reflect the growth status and yield of wheat, and are important parameters that need to be considered in the breeding process.
[0003] In the process of implementing the present invention, it is found that there are at least the following technical problems in the prior art: The existing methods for measuring ear axis feature parameters are mainly manual measurement, which is highly subjective and inefficient. Therefore, how to achieve automatic measurement of ear axis features is a technical problem to be solved urgently. Summary of the Invention
[0004] The present invention provides a method, device, equipment and storage medium for ear axis feature extraction to solve the technical problem that the ear axis features of wheat cannot be automatically measured, and to achieve automatic and accurate measurement of the ear axis features of wheat.
[0005] According to one aspect of the present invention, a method for ear axis feature extraction is provided, including:
[0006] Obtain an original ear axis image, process the original ear axis image to obtain a plurality of single ear axis binary images;
[0007] For each single ear axis binary image, obtain a single distance gray-scale image based on the distance between foreground pixel points and background pixel points in the single ear axis binary image, and determine a plurality of ear node marker points based on the pixel values of the gray-scale pixel points in the single distance gray-scale image;
[0008] In the single ear axis binary image, determine the ear node marker numbers of the respective ear node marker points according to the geodesic distances of the respective ear node marker points, and generate a single ear node segmentation image based on the respective ear node marker points and the respective ear node marker numbers according to the single distance gray-scale image;
[0009] Extract target ear axis features according to the image pixel information of each single ear node segmentation image.
[0010] Optionally, on the basis of the above solution, processing the original ear axis image to obtain a plurality of single ear axis binary images includes:
[0011] Perform gray-scale processing on the original ear axis image to obtain a gray-scale ear axis image;
[0012] Perform binary processing on the gray-scale ear axis image to obtain a complete ear axis binary image;
[0013] Segment the complete ear axis binary image based on the connected regions in the complete ear axis binary image to obtain a plurality of single ear axis binary images.
[0014] Optionally, based on the connected regions in the binary image of the complete ear axis, segment the binary image of the complete ear axis to obtain multiple binary images of single ear axes, including:
[0015] Determine multiple connected regions in the binary image of the complete ear axis;
[0016] For each connected region, use the image corresponding to the circumscribed geometric shape of the connected region as the binary image of a single ear axis.
[0017] Optionally, based on the above solution, obtain a single distance grayscale image based on the distances between foreground pixel points and background pixel points in the binary image of a single ear axis, including:
[0018] For each foreground pixel point in the binary image of a single ear axis, determine the shortest distance between the foreground pixel point and the background pixel point, and use the shortest distance as the pixel value of the foreground pixel point in the single distance grayscale image;
[0019] Set the pixel value of the background pixel point in the single distance grayscale image to a set pixel value to obtain the single distance grayscale image.
[0020] Optionally, based on the above solution, determine multiple ear node marking points based on the pixel values of the grayscale pixel points in the single distance grayscale image, including:
[0021] For each set pixel point among the grayscale pixel points, determine the first set neighborhood associated with the set pixel point;
[0022] According to the pixel values of the pixel points in the first set neighborhood, determine whether the set pixel point meets the marking point selection rule;
[0023] When the set pixel point meets the marking point selection rule, use the set pixel point as the ear node marking point.
[0024] Optionally, based on the above solution, determine the ear node marking numbers of each ear node marking point according to the geodesic distances of the marking points, including:
[0025] Use the pixel point with the smallest vertical coordinate in the binary image of a single ear axis as the reference pixel point;
[0026] For each ear node marking point, use the geodesic distance between the ear node marking point and the reference pixel point as the geodesic distance of the marking point of the ear node marking point;
[0027] Based on the geodesic distances of the marking points, perform a forward sorting on each ear node marking point, and use the sorting number of each ear node marking point in the forward sorting result as the ear node marking number of each ear node marking point.
[0028] Optionally, based on the above solution, a single ear segment segmentation image is generated from a single distance grayscale image according to each ear node marking point and each ear node marking serial number, including:
[0029] For each ear node marking point, in the single distance grayscale image, with the ear node marking point as the starting point, traverse the neighborhood pixel points within the second set neighborhood associated with the ear node marking point, and take the neighborhood pixel points whose pixel values are less than the pixel value of the ear node marking point as the ear node connection points associated with the ear node marking point, and take the area formed by the ear node connection points as the ear node associated area corresponding to the ear node marking point;
[0030] Based on the ear node marking serial numbers of each ear node marking point, set marks for the ear node associated areas corresponding to each ear node marking point to obtain a single ear segment segmentation image.
[0031] According to another aspect of the present invention, an ear axis feature extraction device is provided, including:
[0032] A binary image acquisition module, configured to acquire an original ear axis image, process the original ear axis image to obtain a plurality of single ear axis binary images;
[0033] An ear node marking point determination module, configured to, for each single ear axis binary image, obtain a single distance grayscale image based on the distance between the foreground pixel points and the background pixel points in the single ear axis binary image, and determine a plurality of ear node marking points based on the pixel values of the pixel points in the single distance grayscale image;
[0034] An ear segment segmentation image generation module, configured to, in the single ear axis binary image, determine the ear node marking serial numbers of each ear node marking point according to the marked geodesic distance of each ear node marking point, and generate a single ear segment segmentation image from the single distance grayscale image according to each ear node marking point and each ear node marking serial number;
[0035] An ear axis feature extraction module, configured to extract target ear axis features according to the image pixel information of each single ear segment segmentation image.
[0036] According to another aspect of the present invention, an electronic device is provided, and the electronic device includes:
[0037] At least one processor; and
[0038] A memory communicatively connected to the at least one processor; wherein,
[0039] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the ear axis feature extraction method of any embodiment of the present invention.
[0040] According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the spike axis feature extraction method according to any embodiment of the present invention when executed.
[0041] In the technical solution of the embodiment of the present invention, by obtaining an original spike axis image, processing the original spike axis image to obtain a plurality of single spike axis binary images; for each single spike axis binary image, obtaining a single distance grayscale image based on the distance between foreground pixel points and background pixel points in the single spike axis binary image, and determining a plurality of node marking points based on the pixel values of the grayscale pixel points in the single distance grayscale image; in the single spike axis binary image, determining the node marking serial numbers of each node marking point according to the geodesic distance of each node marking point, and generating a single node segmentation image based on each node marking point and each node marking serial number according to the single distance grayscale image; extracting target spike axis features according to the image pixel information of each single node segmentation image, obtaining a single node segmentation image through processing the original spike axis image, and extracting spike axis features based on the single node segmentation image, which solves the technical problems of manual measurement of spike axis features, low accuracy and low efficiency, and achieves the beneficial effects of automatically measuring spike axis features and improving the accuracy and efficiency of spike axis feature measurement.
[0042] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0044] Figure 1 is a flowchart of a spike axis feature extraction method provided in Embodiment 1 of the present invention;
[0045] Figure 2a is a schematic diagram of a spike axis color image provided in Embodiment 2 of the present invention;
[0046] Figure 2b is a schematic diagram of the image processing process for node region extraction provided in Embodiment 2 of the present invention;
[0047] Figure 3 is a schematic diagram of the structure of a spike axis feature extraction device provided in Embodiment 3 of the present invention;
[0048] Figure 4 It is a schematic structural diagram of an electronic device provided in Embodiment 4 of the present invention. Specific embodiments
[0049] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
[0050] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0051] Embodiment 1
[0052] Figure 1 It is a flowchart of a method for extracting rachis characteristics provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation of extracting wheat rachis characteristics. This method can be executed by a rachis characteristic extraction device, which can be implemented in the form of hardware and / or software, and the rachis characteristic extraction device can be configured in an electronic device. As Figure 1 shown, the method includes:
[0053] S110. Obtain an original rachis image, process the original rachis image to obtain a plurality of single rachis binary images.
[0054] In this embodiment, the rachis segmentation image can be obtained by photographing the wheat rachis image and processing the wheat rachis image, so that the rachis characteristic parameters of wheat can be calculated according to the image characteristics in the rachis segmentation image, and the automatic and accurate measurement of the rachis characteristic parameters based on the rachis image can be realized.
[0055] Optionally, a wheat ear axis image can be captured by an image capturing device as the original ear axis image, and a node segmentation image can be obtained based on the processing of the original ear axis image. An image including one or more wheat ear axes can be captured as the original ear axis image. The more the number of wheat ear axes in the original ear axis image, the more the ear axis characteristic parameters measured based on the original ear axis image can reflect the characteristics of the wheat ear axis.
[0056] It can be understood that the original ear axis image captured by the image capturing device is a multi-channel image. When processing the original ear axis image to obtain a node segmentation image, it is necessary to convert the multi-channel original ear axis image into a single-channel image and then perform operations such as threshold segmentation and node recognition based on the single-channel image to obtain the node segmentation image.
[0057] In an embodiment of the present invention, processing the original ear axis image to obtain a plurality of binary images of single ear axes includes: performing grayscale processing on the original ear axis image to obtain a grayscale ear axis image; performing binarization processing on the grayscale ear axis image to obtain a complete ear axis binary image; and segmenting the complete ear axis binary image based on the connected regions in the complete ear axis binary image to obtain a plurality of binary images of single ear axes. Optionally, the original ear axis image can be directly subjected to grayscale processing, binarization processing, and image segmentation to obtain a binary image of a single ear axis. Considering that the original ear axis image contains noise information, the original ear axis image can also be denoised and then subjected to grayscale processing, binarization processing, and image segmentation to obtain a binary image of a single ear axis. Optionally, in combination with the noise characteristics in the original ear axis image, Gaussian filtering can be used to remove the noise information in the original ear axis image.
[0058] Exemplarily, the original ear axis image can be first subjected to grayscale processing to convert the multi-channel color image into a single-channel image and perform Gaussian filtering for denoising. Then, on the denoised image, grayscale histogram analysis is performed, and the image is automatically threshold-segmented to obtain an initial ear axis binary image; then, hole filling and removal of small areas are performed on the initial ear axis binary image to obtain a complete ear axis binary image; then, the complete ear axis binary image is segmented to obtain binary images of single ear axes, and each binary image of a single ear axis is processed to obtain its corresponding node segmentation image. Among them, the method of threshold-segmenting the image can refer to the method of automatic image threshold segmentation in the prior art and will not be limited here. Exemplarily, the Otsu threshold segmentation method can be used to threshold-segment the image to obtain an initial ear axis binary image.
[0059] It can be understood that the number of single rachis binary images is the same as the number of wheat rachises in the original rachis image. Assume that the original rachis image includes m wheat rachises. Then, image segmentation is performed on the complete rachis binary image to obtain m wheat rachises. Among them, the method of performing image segmentation on the complete rachis binary image can refer to the image segmentation method in the prior art, such as identifying the rachis region in the complete rachis binary image and segmenting the complete rachis binary image based on the rachis region.
[0060] In one implementation, the complete rachis binary image is segmented based on the connected regions in the complete rachis binary image to obtain multiple single rachis binary images, including: determining multiple connected regions in the complete rachis binary image; for each connected region, taking the image corresponding to the circumscribed geometric shape of the connected region as a single rachis binary image. It can be understood that a wheat rachis is a continuous image. Therefore, the wheat rachises in the complete rachis binary image can be identified based on the connected regions. That is to say, by identifying the connected regions in the complete rachis binary image, each identified connected region is used as a single wheat rachis. However, considering that the connected region may not completely represent the wheat rachis, the connected region and its surrounding region can be used as the single rachis binary image of the wheat rachis, so as to obtain an accurate single node segmentation image based on the single rachis binary image. Based on this, the circumscribed geometric shape can be preset, and the image corresponding to the circumscribed geometric shape of the connected region is used as the single rachis binary image. Optionally, the circumscribed geometric shape can be set according to actual needs. For example, the circumscribed geometric shape can be set as a circle, a regular polygon, an irregular polygon, etc. To simplify the complexity of image processing and facilitate image processing operations, the circumscribed geometric shape can be set as a rectangle, and the image corresponding to the circumscribed rectangle of the connected region is used as the single rachis binary image.
[0061] S120. For each single rachis binary image, a single distance grayscale image is obtained based on the distance between the foreground pixel points and the background pixel points in the single rachis binary image, and multiple node marking points are determined based on the pixel values of the grayscale pixel points in the single distance grayscale image.
[0062] After obtaining multiple single rachis binary images, each single rachis binary image is processed respectively to obtain the single node segmentation image corresponding to each single rachis binary image. Taking a certain single rachis binary image as an example below, the method for processing the single rachis binary image to obtain the single node segmentation image will be described.
[0063] Optionally, the single distance grayscale image can be constructed by calculating the distance between the foreground pixel points and the background pixel points in the rachis binary image, and the node marking points are extracted based on the single distance grayscale image, so as to obtain the node segmentation image according to the extracted node marking points.
[0064] In one embodiment, a single distance grayscale image is obtained based on the distances between foreground pixel points and background pixel points in a binary image of a single ear axis, including: for each foreground pixel point in the binary image of the single ear axis, determining the shortest distance between the foreground pixel point and the background pixel points, and taking the shortest distance as the pixel value of the foreground pixel point in the single distance grayscale image; setting the pixel value of the background pixel points in the single distance grayscale image to a set pixel value to obtain the single distance grayscale image. According to the above embodiment, the binary image of the single ear axis is obtained based on threshold segmentation, and threshold segmentation divides the pixel points in the binary image of the single ear axis into foreground pixel points and background pixel points. The single distance grayscale image can be obtained by calculating the shortest distance between the foreground pixel points and the background pixel points. Exemplarily, assume that the shortest distance between a certain foreground pixel point and all background pixel points is 2 pixel points, then the pixel value of this foreground pixel point is set to 2 until all foreground pixel points are set, and at the same time, the pixel values of all background pixel points are set to the set pixel value to obtain the single distance grayscale image. The set pixel value of the background pixel points can be set according to actual needs, such as setting the set pixel value of the background pixel points to 0.
[0065] After obtaining the single distance grayscale image, based on the single distance grayscale image, a plurality of ear node marking points are determined. Optionally, determining a plurality of ear node marking points based on the pixel values of the grayscale pixel points in the single distance grayscale image includes: for each set pixel point among the grayscale pixel points, determining a first set neighborhood associated with the set pixel point; judging whether the set pixel point meets the marking point selection rule according to the pixel values of the pixel points in the first set neighborhood; when the set pixel point meets the marking point selection rule, taking the set pixel point as the ear node marking point.
[0066] In this embodiment, the pixel value of the pixel points in the single distance grayscale image obtained based on the foreground pixel points and the background pixel points represents the shortest distance between the foreground pixel points and the background pixel points. Based on this, the local maximum value of the pixel values of the grayscale pixel points in the single distance grayscale image can be found, and the grayscale pixel point corresponding to the local maximum value is taken as the ear node marking point. Among them, the grayscale pixel points are the pixel points of the single distance grayscale image.
[0067] Optionally, the local maximum value can be the pixel maximum value of a local area in a single distance grayscale image. In one embodiment, some or all of the grayscale pixel points can be selected as the set pixel points, the local area corresponding to each set pixel point is determined, and the ear node marker points are determined based on the pixel values of the grayscale pixel points within the local area. For example, the set pixel points that meet the marker point selection rule are used as the ear node marker points. Among them, the marker point selection rule can be that the size relationship between the pixel value of the set pixel point and the pixel values of other grayscale pixel points within the first set neighborhood meets the set requirements. The local area corresponding to the set pixel point can be the first set neighborhood centered on the set pixel point. In this embodiment, the first set neighborhood can be a four-neighborhood, a nine-neighborhood, etc., which is not limited here. Optionally, the setting of the neighborhood area can be determined based on the resolution of a single distance grayscale image. When the resolution of a single distance grayscale image is relatively high, a larger neighborhood area can be set; when the resolution of a single distance grayscale image is relatively low, a smaller neighborhood area can be set.
[0068] In one implementation, all grayscale pixel points can be used as the set pixel points. For each set pixel point, the area corresponding to the first set neighborhood centered on the set pixel point is used as the first set neighborhood associated with the set pixel point; the pixel values of all grayscale pixel points in the first set neighborhood are obtained. When the pixel value of the set pixel point is the maximum value of the pixel values of all grayscale pixel points in the first set neighborhood, the set pixel point is used as the ear node marker point; otherwise, there is no ear node marker point in the first set neighborhood. The above operations are repeatedly executed until all the set pixel points are traversed to obtain all the ear node marker points.
[0069] S130. In a single ear axis binary image, the ear node marker numbers of each ear node marker point are determined according to the marker geodesic distances of each ear node marker point, and a single ear node segmentation image is generated based on each ear node marker point and each ear node marker number according to the single distance grayscale image.
[0070] In this embodiment, after obtaining the ear node marker points, the ear node marker numbers of the ear node marker points are identified, and region growing is performed based on the ear node marker points to obtain the ear node regions associated with each ear node marker point, so that different ear node regions in the subsequent obtained single ear node segmentation image can be distinguished based on the ear node marker numbers, thereby making the ear axis features obtained based on the single ear node segmentation image more accurate.
[0071] In an embodiment of the present invention, determining the ear node marking serial numbers of each ear node marking point according to the geodesic distance of the marking points includes: taking the pixel point with the minimum vertical coordinate in the binary image of the single ear axis as the reference pixel point; for each ear node marking point, taking the geodesic distance between the ear node marking point and the reference pixel point as the geodesic distance of the marking point of the ear node; sorting each ear node marking point in the positive direction based on the geodesic distances of the marking points, and taking the sorting serial number of each ear node marking point in the positive sorting result as the ear node marking serial number of each ear node marking point. The ear node marking points can be marked according to the growth direction of the ear nodes to obtain the marking serial numbers of each ear node marking point. However, generally, the ear axis is curved. When the ear axis is curved, if the position coordinate information of the ear node marking points in the growth direction of the ear nodes is used to sort and number each ear node, it will lead to incorrect identification of the ear node connection order. Based on this, a reference pixel point can be defined in the binary image of the single ear axis first, calculate the geodesic distance between each ear node marking point and the reference pixel point as the geodesic distance of the marking point of the ear node, sort the ear node marking points in the positive direction based on the geodesic distance corresponding to the ear node marking point, and take the sorting serial number of the ear node marking point in the positive sorting result as the ear node marking serial number of the ear node marking point. Determining the ear node marking serial numbers of the ear node marking points based on the geodesic distance of the marking points can enable the ear node marking serial numbers to accurately identify the ear node connection order and ensure the accuracy of the single ear node segmentation image. Among them, the geodesic distance between the ear node marking point and the reference pixel point can be understood as the shortest distance from the ear node marking point along the ear axis to the reference pixel point.
[0072] Based on the above solution, generating a single ear node segmentation image according to each ear node marking point and each ear node marking serial number from a single distance grayscale image includes: for each ear node marking point, in the single distance grayscale image, starting from the ear node marking point, traversing the neighborhood pixel points in the second set neighborhood associated with the ear node marking point, taking the neighborhood pixel points with pixel values smaller than the pixel value of the ear node marking point as the ear node connection points associated with the ear node marking point, and taking the area formed by the ear node connection points as the ear node associated area corresponding to the ear node marking point; setting marks for the ear node associated areas corresponding to each ear node marking point based on the ear node marking serial numbers of each ear node marking point to obtain a single ear node segmentation image. Among them, the neighborhood pixel points are the pixel points in the second set neighborhood.
[0073] Optionally, region growing segmentation is performed based on a single distance grayscale image. The region growing uses the spike node marking points as the growing seed points, and grows each spike node marking point simultaneously. The growth is based on the pixel values (i.e., distance grayscale values) of the pixels within the set neighborhood. Neighborhood pixel points whose pixel values are less than the grayscale value of the current spike node marking point and have not been marked by other spike node marking points are marked and added to the spike node connected point set corresponding to this spike node marking point. Each marking point set is traversed to add new spike node connected points; until the growth stop condition is reached, the region growing ends. After the region growing ends, for each spike node marking point, the region formed by the spike node connected points in the spike node connected point set corresponding to this spike node marking point is used as the spike node associated region corresponding to this spike node marking point, and the marking value of this spike node associated region is set to the spike node marking sequence number of this spike node marking point. Finally, the spike node associated regions with different region markings are used as the single spike node segmentation result image. Among them, the growth stop condition can be that different spike node marking regions are connected or grow to the background region outside the rachis.
[0074] S140. Extract the target rachis features according to the image pixel information of each single spike node segmentation image.
[0075] Through the processing method provided by the above embodiments, after processing each single rachis binary image to obtain a single spike node segmentation image, multiple single spike node segmentation images corresponding to the complete rachis binary image are obtained. The rachis features can be calculated respectively based on the image pixel information of each single spike node segmentation image, and then the rachis features calculated for each single spike node segmentation image are statistically counted as the target rachis features. For example, the average value of the rachis features calculated for each single spike node segmentation image is used as the target rachis feature.
[0076] Optionally, the target rachis features may include features such as rachis area, rachis length, stem diameter below the spike, total number of spike nodes, spike node area, spike node length, spike node width, spikelet density, spikelet density ratio, and the average value, standard deviation, and coefficient of variation of each feature of the spike node. The above features can all be calculated through the image pixel information of the single spike node segmentation image. For example, the rachis area can be the number of foreground pixel points in all single rachis binary images, or the number of marked pixel points in all single spike node segmentation images. For example, the rachis length can be calculated by the sum of the lengths of the second spike node and all spike nodes above the second spike node. The second spike node can be understood as the spike node with the spike node marking sequence number of 2, etc.
[0077] In the technical solution of this embodiment, by obtaining the original rachis image, processing the original rachis image, and obtaining multiple binary images of single rachises; for each binary image of a single rachis, based on the distance between the foreground pixel points and the background pixel points in the binary image of the single rachis, a single distance grayscale image is obtained, and multiple rachis node marker points are determined based on the pixel values of the pixel points in the single distance grayscale image; in the binary image of the single rachis, according to the geodesic distance of each rachis node marker point, the rachis node marker serial number of each rachis node marker point is determined, and based on each rachis node marker point and each rachis node marker serial number, a single rachis node segmentation image is generated according to the single distance grayscale image; according to the image pixel information of each single rachis node segmentation image, the target rachis features are extracted. By processing the original rachis image to obtain a single rachis node segmentation image and extracting rachis features based on the single rachis node segmentation image, the automatic measurement of rachis features is realized, and the accuracy and efficiency of rachis feature measurement are improved.
[0078] Embodiment 2
[0079] On the basis of the above embodiment, this embodiment provides a preferred embodiment.
[0080] The embodiment of the present invention proposes an automatic measurement method for characteristic parameters (rachis length, number of rachis nodes, rachis thickness) in a wheat rachis image. It includes:
[0081] 1. Obtain a color image of the rachis (i.e., the original rachis image). Figure 2a It is a schematic diagram of a color image of the rachis provided by the second embodiment of the present invention. Figure 2a The color image of the rachis includes three wheat rachises.
[0082] 2. Perform grayscale processing on the color image of the rachis, convert the multi-channel color image into a single-channel image, and perform Gaussian filtering for denoising.
[0083] 3. On the denoised image, perform grayscale histogram analysis. By comparing the between-class variance between the background and the foreground at all grayscale values, using the grayscale value with the maximum between-class variance as the threshold, the image is automatically threshold-segmented to obtain a binary image (i.e., the initial binary image of the rachis).
[0084] 4. On the binary image, perform hole filling and remove small areas to obtain a complete binary image of the rachis.
[0085] 5. On the complete binary image of the rachis, perform connected region marker recognition, use the circumscribed rectangle of each connected region to locate each single rachis in the rachis image, and perform image cropping to obtain a binary image B of a single rachis.
[0086] 6. On the binary image B of a single rachis, calculate the shortest distance Di from each foreground pixel point fi to the image background. The distance value of the background pixel points is set to 0, and a single distance grayscale image D is obtained.
[0087] 7. Detect the local maxima in the single distance grayscale image D, and mark the pixel points at the positions of the local maxima as rachis node marking points.
[0088] 8. Rachis node connection order recognition strategy: The wheat rachis may be bent and not completely upright. When the rachis is bent, if the position coordinate information of the rachis node marking points is used to sort each rachis node, it will lead to incorrect recognition of the rachis node connection order. Therefore, in the binary image B of the rachis, define the foreground pixel point with the lowest position as the origin, calculate the geodesic distance from each foreground pixel point to the origin, and recognize the connection order of each rachis node according to the sorting of the geodesic distance magnitudes of the rachis node marking points obtained in step 6. The one with the shortest distance is the first rachis node, and the rachis node order is used as the marking value of the rachis node marking point.
[0089] 9. Rachis node segmentation strategy: Based on the distance grayscale image D, perform region growing segmentation: The region growing uses the rachis node marking points as the growth seed points; Each rachis node marking point grows simultaneously. The growth is based on the distance grayscale values of the pixels within the 3*3 neighborhood. The pixel points whose distance grayscale values are less than the distance grayscale value of the current marking point and have not been marked by other rachis node marking points will be marked and added to the corresponding rachis node marking point set; Traverse each marking point set to add new marking points; The growth stop condition is that the connected regions of different rachis node marking regions are connected or grow to the background region outside the rachis. After the region growing ends, the marks of different regions are the rachis node segmentation result images.
[0090] Figure 2b It is a schematic diagram of the image processing process for rachis node region extraction provided in the second embodiment of the present invention. Figure 2b successively and schematically shows a single original rachis image, a single rachis binary image, a single distance grayscale image, a rachis node marking point image, and a rachis node segmentation result image. According to Figure 2b it can be seen the processing process from the original rachis image to the rachis node segmentation result image.
[0091] 10. On the rachis node segmentation result image, calculate the rachis characteristic parameters. Include: rachis area, rachis length, rachis lower stem diameter, total rachis node number, rachis node area, rachis node length, rachis node width, spikelet density, spikelet density ratio, and the average value, standard deviation, and coefficient of variation of each rachis node characteristic.
[0092] Among them, each rachis characteristic parameter can be calculated by the following methods:
[0093] Rachis area: The number of all foreground pixel points in the rachis binary image B.
[0094] Ear length: The sum of the lengths of all ear nodes from the second ear node upwards.
[0095] Stem diameter below ear: The length of the minor axis of the ellipse of the normalized second-order central moment of the first ear node.
[0096] Total number of ear nodes: The number of ear node marking points.
[0097] Ear node area: The number of pixel points within the ear node region.
[0098] Ear node length: The length of the major axis of the ellipse of the normalized second-order central moment of the ear node.
[0099] Ear node width: The length of the minor axis of the ellipse of the normalized second-order central moment of the ear node.
[0100] Spikelet density: The ratio of the number of ear nodes to the ear length.
[0101] Spikelet density ratio: The ratio of the spikelet density in the upper half of the ear axis to the spikelet density in the lower half of the ear axis.
[0102] Average value: The mean value of the features corresponding to all ear nodes.
[0103] Standard deviation: The standard deviation of the features corresponding to all ear nodes.
[0104] Coefficient of variation: The ratio of the standard deviation to the mean value of the features corresponding to all ear nodes.
[0105] The technical solution of this embodiment realizes the automatic measurement of ear axis features and improves the accuracy and efficiency of ear axis feature measurement by processing the original ear axis image to obtain a single ear node segmentation image and calculating ear axis features based on the single ear node segmentation image.
[0106] Embodiment III
[0107] Figure 3 It is a schematic structural diagram of an ear axis feature extraction device provided in Embodiment III of the present invention. As Figure 3 shown, the device includes a binary image acquisition module 310, an ear node marking point determination module 320, an ear node segmentation image generation module 330, and an ear axis feature extraction module 340, where:
[0108] The binary image acquisition module 310 is configured to acquire the original ear axis image, process the original ear axis image, and obtain a plurality of single ear axis binary images;
[0109] The ear node marking point determination module 320 is configured to, for each single ear axis binary image, obtain a single distance grayscale image based on the distance between foreground pixel points and background pixel points in the single ear axis binary image, and determine a plurality of ear node marking points based on the pixel values of the grayscale pixel points in the single distance grayscale image;
[0110] The ear node segmentation image generation module 330 is configured to determine the ear node marker numbers of each ear node marker point according to the geodesic distance of each ear node marker point in a single ear axis binary image, and generate a single ear node segmentation image based on each ear node marker point and each ear node marker number according to a single distance grayscale image;
[0111] The ear axis feature extraction module 340 is configured to extract the target ear axis features according to the image pixel information of each single ear node segmentation image.
[0112] The technical solution of this embodiment obtains the original ear axis image, processes the original ear axis image to obtain multiple single ear axis binary images; for each single ear axis binary image, a single distance grayscale image is obtained based on the distance between the foreground pixel points and the background pixel points in the single ear axis binary image, and multiple ear node marker points are determined based on the pixel values of the grayscale pixel points in the single distance grayscale image; in the single ear axis binary image, the ear node marker numbers of each ear node marker point are determined according to the geodesic distance of each ear node marker point, and a single ear node segmentation image is generated based on each ear node marker point and each ear node marker number according to the single distance grayscale image; the target ear axis features are extracted according to the image pixel information of each single ear node segmentation image, and a single ear node segmentation image is obtained through the processing of the original ear axis image, and the ear axis features are extracted based on the single ear node segmentation image, realizing the automatic measurement of the ear axis features and improving the accuracy and efficiency of the ear axis feature measurement.
[0113] Based on the above embodiment, optionally, the binary image acquisition module 310 is specifically configured to:
[0114] Perform grayscale processing on the original ear axis image to obtain a grayscale ear axis image;
[0115] Perform binary processing on the grayscale ear axis image to obtain a complete ear axis binary image;
[0116] Segment the complete ear axis binary image based on the connected regions in the complete ear axis binary image to obtain multiple single ear axis binary images.
[0117] Based on the above embodiment, optionally, the binary image acquisition module 310 is specifically configured to:
[0118] Determine multiple connected regions in the complete ear axis binary image;
[0119] For each connected region, use the image corresponding to the circumscribed geometric shape of the connected region as a single ear axis binary image.
[0120] Based on the above embodiment, optionally, the ear node marker point determination module 320 is specifically configured to:
[0121] For each foreground pixel point in the binary image of a single ear axis, determine the shortest distance between the foreground pixel point and the background pixel point, and use the shortest distance as the pixel value of the foreground pixel point in the single-distance grayscale image;
[0122] Set the pixel value of the background pixel point in the single-distance grayscale image to the set pixel value to obtain a single-distance grayscale image.
[0123] Based on the above embodiments, optionally, the ear node marking point determination module 320 is specifically configured to:
[0124] For each set pixel point in the grayscale pixel points, determine the first set neighborhood associated with the set pixel point;
[0125] Judge whether the set pixel point meets the marking point selection rule according to the pixel values of the pixel points in the first set neighborhood;
[0126] When the set pixel point meets the marking point selection rule, use the set pixel point as the ear node marking point.
[0127] Based on the above embodiments, optionally, the ear node segmentation image generation module 330 is specifically configured to:
[0128] Use the pixel point with the smallest vertical coordinate in the binary image of a single ear axis as the reference pixel point;
[0129] For each ear node marking point, use the geodesic distance between the ear node marking point and the reference pixel point as the marking point geodesic distance of the ear node marking point;
[0130] Based on the marking point geodesic distances of each ear node marking point, perform a forward sorting on each ear node marking point, and use the sorting serial number of each ear node marking point in the forward sorting result as the ear node marking serial number of each ear node marking point.
[0131] Based on the above embodiments, optionally, the ear node segmentation image generation module 330 is specifically configured to:
[0132] For each ear node marking point, in the single-distance grayscale image, starting from the ear node marking point, traverse the neighborhood pixel points in the second set neighborhood associated with the ear node marking point, and use the neighborhood pixel points with pixel values smaller than the pixel value of the ear node marking point as the ear node connected points associated with the ear node marking point, and use the area formed by the ear node connected points as the ear node associated area corresponding to the ear node marking point;
[0133] Based on the ear node marking serial numbers of each ear node marking point, set marks for the ear node associated areas corresponding to each ear node marking point to obtain a single ear node segmentation image.
[0134] The ear axis feature extraction device provided by the embodiment of the present invention can execute the ear axis feature extraction method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0135] Embodiment 4
[0136] Figure 4 FIG. 7 is a schematic structural diagram of an electronic device provided by Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as, for example, personal digital processors, cellular telephones, smart telephones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0137] As Figure 4 shown, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. Among them, the memory stores a computer program executable by the at least one processor. The processor 11 can execute various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0138] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0139] The processor 11 may be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the ear axis feature extraction method.
[0140] In some embodiments, the ear axis feature extraction method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the ear axis feature extraction method described above may be executed. Alternatively, in other embodiments, the processor 11 may be configured to execute the ear axis feature extraction method by any other suitable means (e.g., by means of firmware).
[0141] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), systems on a chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a special-purpose or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0142] The computer program for implementing the ear axis feature extraction method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowchart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0143] Embodiment Five
[0144] Embodiment 5 of the present invention further provides a computer-readable storage medium. The computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a processor to execute a method for ear axis feature extraction. The method includes:
[0145] Obtain an original ear axis image, process the original ear axis image to obtain a plurality of binary images of single ear axes;
[0146] For each binary image of a single ear axis, obtain a single distance grayscale image based on the distances between foreground pixel points and background pixel points in the binary image of the single ear axis, and determine a plurality of node marking points based on the pixel values of the pixel points in the single distance grayscale image;
[0147] In the binary image of a single ear axis, determine the node marking serial numbers of the node marking points according to the geodesic distances of the node marking points, and generate a single node segmentation image based on the single distance grayscale image according to the node marking points and the node marking serial numbers;
[0148] Extract the target ear axis features according to the image pixel information of each single node segmentation image.
[0149] In the context of the present invention, the computer-readable storage medium may be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium may be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0150] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0151] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
[0152] A computing system can include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0153] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.
[0154] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for extracting ear axis features, characterized in that, including: obtaining an original rachis image, processing the original rachis image to obtain a plurality of single rachis binary images; for each of the single rachis binary images, obtaining a single distance grayscale image based on the distance between foreground pixel points and background pixel points in the single rachis binary image, and determining a plurality of node marking points based on the pixel values of the grayscale pixel points in the single distance grayscale image; in the single rachis binary image, determining the node marking serial numbers of the node marking points according to the geodesic distances of the node marking points, and generating a single node segmentation image according to the single distance grayscale image based on the node marking points and the node marking serial numbers; extracting target rachis features according to the image pixel information of each of the single node segmentation images.
2. The method according to claim 1, characterized in that, The processing the original rachis image to obtain a plurality of single rachis binary images includes: performing grayscale processing on the original rachis image to obtain a grayscale rachis image; performing binary processing on the grayscale rachis image to obtain a complete rachis binary image; segmenting the complete rachis binary image based on the connected regions in the complete rachis binary image to obtain a plurality of the single rachis binary images.
3. The method according to claim 2, wherein The segmenting the complete rachis binary image based on the connected regions in the complete rachis binary image to obtain a plurality of the single rachis binary images includes: determining a plurality of connected regions in the complete rachis binary image; for each of the connected regions, taking the image corresponding to the circumscribed geometric shape of the connected region as the single rachis binary image.
4. The method according to claim 1, wherein The obtaining a single distance grayscale image based on the distance between foreground pixel points and background pixel points in the single rachis binary image includes: for each foreground pixel point in the single rachis binary image, determining the shortest distance between the foreground pixel point and the background pixel point, and taking the shortest distance as the pixel value of the foreground pixel point in the single distance grayscale image; setting the pixel value of the background pixel point in the single distance grayscale image to a set pixel value to obtain the single distance grayscale image.
5. The method according to claim 1, wherein The determining a plurality of node marking points based on the pixel values of the grayscale pixel points in the single distance grayscale image includes: for each set pixel point among the grayscale pixel points, determining a first set neighborhood associated with the set pixel point; judging whether the set pixel point meets the marking point selection rule according to the pixel values of the pixel points in the first set neighborhood; when the set pixel point meets the marking point selection rule, taking the set pixel point as the node marking point.
6. The method according to claim 1, wherein The determining the node marking serial numbers of the node marking points according to the geodesic distances of the node marking points includes: taking the pixel point with the smallest vertical coordinate in the single rachis binary image as the reference pixel point; for each of the node marking points, taking the geodesic distance between the node marking point and the reference pixel point as the geodesic distance of the node marking point; Perform a forward sorting on each of the ear node marker points based on the geodesic distances of the marker points, and use the sorting sequence numbers of the ear node marker points in the forward sorting result as the ear node marker sequence numbers of the ear node marker points.
7. The method according to claim 1, characterized in that, Generating a single ear node segmentation image based on each of the ear node marker points, each of the ear node marker sequence numbers, and the single distance grayscale image, includes: For each of the ear node marker points, in the single distance grayscale image, with the ear node marker point as the starting point, traverse the neighborhood pixel points within the second preset neighborhood associated with the ear node marker point, and use the neighborhood pixel points whose pixel values are less than the pixel value of the ear node marker point as the ear node connection points associated with the ear node marker point, and use the region formed by the ear node connection points as the ear node associated region corresponding to the ear node marker point; Set marks for the ear node associated regions corresponding to the ear node marker points based on the ear node marker sequence numbers of the ear node marker points to obtain the single ear node segmentation image.
8. An ear axis feature extraction device, characterized in that, Includes: A binary image acquisition module, configured to acquire an original ear axis image, process the original ear axis image to obtain a plurality of single ear axis binary images; An ear node marker point determination module, configured to, for each of the single ear axis binary images, obtain a single distance grayscale image based on the distances between the foreground pixel points and the background pixel points in the single ear axis binary image, and determine a plurality of ear node marker points based on the pixel values of the pixel points in the single distance grayscale image; An ear node segmentation image generation module, configured to, in the single ear axis binary image, determine the ear node marker sequence numbers of the ear node marker points according to the geodesic distances of the ear node marker points, and generate a single ear node segmentation image based on each of the ear node marker points, each of the ear node marker sequence numbers, and the single distance grayscale image; An ear axis feature extraction module, configured to extract target ear axis features according to the image pixel information of each of the single ear node segmentation images.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the ear axis feature extraction method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the processor to implement the ear axis feature extraction method according to any one of claims 1-7 when executed.
Citation Information
Patent Citations
AdaBoost-based 3D (three-dimensional) model automatic classification method
CN102915448A
Contour extraction method and device based on seed point self-growth , equipment and medium
CN113989167A