Plant nodule detection method, system and device based on machine vision
Through machine vision technology, the plant root system is corrected and binarized, combined with the fill circle binary image and distance position relationship, the problem of subjectivity and low efficiency of nodule tumor detection in the existing technology is solved, and the rapid and accurate nodule tumor is achieved Testing and statistics meet research needs.
Patent Information
- Application Number
- CN202411144252.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-20
AI Technical Summary
The existing nodule tumor detection methods have problems such as strong subjectivity, low efficiency and low accuracy, and cannot meet the actual production needs.
Using machine vision-based detection methods, the original image of the plant root system is obtained for correction, binarization processing, and nodule tumor detection, and the pseudo-nodule area is judged using the fill circle binary image and distance position relationship, the pseudo-nodule tumor is eliminated, and the number of nodule tumors is counted.
Fast and accurate nodule tumor regional detection and quantitative statistics are achieved, meeting the needs of nodule-related research, and providing an accurate data reference for root nodule phenotype analysis.
Smart Images

Figure CN118657825B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a plant nodule detection method, system and device based on machine vision. Background Art
[0002] Nodules are special tumors that grow on plant roots, formed by symbiotic nitrogen-fixing bacteria in parasitic tissues. The formation process is as follows: Rhizobia rapidly divide and multiply in cortical cells. At the same time, due to the stimulation of nodule invasion, cortical cells also rapidly divide and grow, causing the local volume of the root to swell, forming tumor-like protrusions, which are nodules. Rhizobia absorb the water and nutrients they need for life from nodule cells. They can fix free nitrogen and synthesize nitrogen-containing compounds, which are used by legumes. The symbiosis between legumes and rhizobia results in high yields due to nitrogen. At the same time, due to the shedding of nodules, roots or stumps with nodules are left in the soil, which can increase soil fertility. The function of nodules is to fix free nitrogen and synthesize nitrogen-containing compounds, thereby increasing the yield and quality of legume crops and increasing soil fertility.
[0003] Therefore, the statistics of nodules has become a hot topic in related fields. The existing nodule counting is basically a manual operation, which is not only time-consuming, but also highly subjective and cannot guarantee accuracy. Of course, machine vision methods are also used at present. So far, the statistical results obtained by machine vision methods still have the disadvantages of low accuracy and low degree of automation, and cannot serve actual production at all.
[0004] In short, current research is either not accurate enough or cannot be precisely combined with actual production. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention provides a plant nodule detection method, system and device based on machine vision.
[0006] In order to solve the above technical problems, the present invention is solved by the following technical solutions:
[0007] A plant nodule detection method based on machine vision comprises the following steps:
[0008] Acquire an original image of a plant root system, and correct the original image of the plant root system to obtain a corrected image of the plant root system;
[0009] Binarizing the plant root correction image to obtain a plant root binary image;
[0010] Perform nodule detection on the plant root correction image to obtain an initial nodule region set;
[0011] A filled circle binary image of the initial nodule region is obtained based on the initial nodule region, and then an intersection area of the plant root binary image and the filled circle binary image is obtained, and a circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image;
[0012] Based on the center coordinates of the initial nodule region and the intersection area, the distance position relationship is obtained;
[0013] Based on the circular area ratio and the distance position relationship, it is determined whether each initial nodule area is a pseudo-nodule area. If so, the pseudo-nodule area in the initial nodule area set is removed to obtain the plant nodule set and count the number of nodules.
[0014] As an implementable method, the correcting the original plant root system image to obtain the corrected plant root system image includes the following steps:
[0015] A lookup table is constructed according to the image grayscale space of the original image of the plant root system to obtain the maximum image grayscale value and the minimum image grayscale value in the original image of the plant root system;
[0016] Resetting the lookup table based on the maximum grayscale value and the minimum grayscale value of the image to obtain a reset lookup table;
[0017] Perform pixel traversal on the plant root system image, look up the reset lookup table based on the image pixel value at the corresponding pixel point position, and update the plant root system image according to the lookup result to obtain a plant root system correction image;
[0018] The reset lookup table is represented as follows:
[0019]
[0020] in, Reset the lookup table. represents the image grayscale space, Represents the minimum grayscale value of the image. Indicates the maximum value of the image grayscale space.
[0021] As an implementable method, the binarization processing of the plant root correction image to obtain the plant root binarization image includes the following steps:
[0022] Performing grayscale processing on the plant root correction image to obtain a plant root grayscale image;
[0023] Denoising the plant root grayscale image to obtain a plant root filter image, performing local threshold segmentation and edge extraction on the plant root filter image to obtain a first binary image of the plant root and a plant root edge image;
[0024] The first binary image of the plant root system and the edge image of the plant root system are fused to obtain a fused image of the plant root system, and then feature analysis and impurity removal are performed to obtain a feature selection image of the plant root system;
[0025] The plant root feature selection image is subjected to morphological transformation to obtain a plant root binary image.
[0026] As an implementable method, the method of obtaining a filled circle binary image of the initial nodule area based on the initial nodule area, and then obtaining an intersection area of the plant root system binary image and the filled circle binary image, and obtaining a circular area area ratio based on the area of the intersection area and the area of the filled circle binary image, comprises the following steps:
[0027] Establish a single-channel background image based on the binary image of plant roots;
[0028] Based on the initial nodule region, the center coordinates of the initial nodule region and the diagonal length of the initial nodule region are obtained, and the single-channel background image is filled with the center coordinates of the initial nodule region as the center of the circle and the diagonal length of the initial nodule region as the diameter to obtain a filled circle binary image;
[0029] Based on the plant root binary image and the filled circle binary image, the intersection area of the initial nodule area and the plant root binary image is obtained;
[0030] The circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image.
[0031] As an implementable method, the diagonal length of the initial nodule region is expressed as follows:
[0032]
[0033] The initial nodule region center coordinates are expressed as follows:
[0034]
[0035] The area of the filled circle binary image is expressed as follows:
[0036]
[0037] The circular area ratio is expressed as follows:
[0038]
[0039] in, The upper left corner abscissa represents the initial nodule area, The upper left ordinate represents the initial nodule area, The lower right corner abscissa represents the initial nodule area, The lower right ordinate represents the initial nodule area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents the diagonal length of the initial nodule area, represents the area of the filled circle binary image, represents the circular area ratio, Represents the area of the intersection region.
[0040] As an implementable method, obtaining the distance position relationship based on the center coordinates of the initial nodule area and the intersection area includes the following steps:
[0041] Based on the coordinates of the contour points in the intersection area and the coordinates of the center of the initial nodule area, the distance of the intersection area is calculated by a preset distance formula;
[0042] If the center-edge distance is less than the intersection area distance, the center-edge distance remains unchanged; if the center-edge distance is not less than the intersection area distance, the center-edge distance is updated to the intersection area distance;
[0043] Through the center-edge distance and the intersection area distance, the distance position relationship between the center-edge distance and the center area position is obtained;
[0044] The preset distance formula is expressed as follows:
[0045]
[0046] in, Represents the contour points of the intersection area, represents the number of contour points in the intersection area, The horizontal coordinates of the contour points representing the intersection area, The ordinate of the contour point representing the intersection area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents a function that computes square roots, Represents a function that computes powers.
[0047] As an implementation method, the method further includes the following steps: constructing a plant nodule detection network, training the plant nodule detection network based on a plant root system image set to obtain a plant nodule detection model, and performing nodule detection using the plant nodule detection model, wherein the plant root system image set is obtained by the following steps:
[0048] Based on the size of the plant nodule detection network and the maximum edge length of the original plant root image, the image change rate is obtained;
[0049] Perform image transformation on the original plant root image based on the image change rate to obtain a plant root image set;
[0050] The image change rate is expressed as follows:
[0051]
[0052]
[0053] in, represents the image change rate, represents the maximum edge length of the original image of the plant root system, Represents the width of the original image of the plant root system, Indicates the height of the original image of the plant root system.
[0054] As an implementable method, performing image transformation on the original plant root image based on the image change rate to obtain a plant root image set includes the following steps:
[0055] When the image change rate is less than a preset scale threshold, performing image transformation on the original image of the plant root system to obtain a first transformed image;
[0056] When the image change rate is greater than a preset scale threshold, a mask image is established according to the original image size of the plant root system and the image change rate, and the original image of the plant root system is filled into the central area of the mask image to obtain a second transformed image;
[0057] Based on the first transformed image and the second transformed image, a plant root system image set is formed;
[0058] The first transformed image is expressed as follows:
[0059]
[0060]
[0061] in, Indicates the width of the plant root image, Indicates the height of the plant root image, represents the image change rate, Represents the width of the original image of the plant root system, Indicates the height of the original image of the plant root system.
[0062] A plant nodule detection system based on machine vision, comprising a correction module, a binary processing module, an image detection module and a data elimination module;
[0063] The correction module is used to obtain the original image of the plant root system, correct the original image of the plant root system, and obtain the corrected image of the plant root system;
[0064] The binary processing module is used to perform binary processing on the plant root correction image to obtain a plant root binary image;
[0065] The image detection module is used to perform nodule detection on the plant root correction image to obtain an initial nodule region set;
[0066] The data elimination module obtains a filled circle binary image of the initial nodule area based on the initial nodule area, and then obtains the intersection area of the plant root system binary image and the filled circle binary image, and obtains the circular area area ratio based on the area of the intersection area and the area of the filled circle binary image; obtains the distance position relationship based on the central coordinates of the initial nodule area and the intersection area; and determines whether each initial nodule area is a pseudo-nodule area based on the circular area area ratio and the distance position relationship. If so, the pseudo-nodule area in the initial nodule area set is eliminated to obtain a plant nodule set and count the number of nodules.
[0067] As an implementable method, the data elimination module is configured to:
[0068] Establish a single-channel background image based on the binary image of plant roots;
[0069] Based on the initial nodule region, the center coordinates of the initial nodule region and the diagonal length of the initial nodule region are obtained, and the single-channel background image is filled with the center coordinates of the initial nodule region as the center of the circle and the diagonal length of the initial nodule region as the diameter to obtain a filled circle binary image;
[0070] Based on the plant root binary image and the filled circle binary image, the intersection area of the initial nodule area and the plant root binary image is obtained, and the circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image;
[0071] Based on the initial nodule region center coordinates and the intersection area, the distance position relationship between the center edge distance and the center region position is obtained;
[0072] The diagonal length of the initial nodule region is expressed as follows:
[0073]
[0074] The initial nodule region center coordinates are expressed as follows:
[0075]
[0076] The area of the filled circle binary image is expressed as follows:
[0077]
[0078] The circular area ratio is expressed as follows:
[0079]
[0080] in, The upper left corner abscissa represents the initial nodule area, The upper left ordinate represents the initial nodule area, The lower right corner abscissa represents the initial nodule area, The lower right ordinate represents the initial nodule area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents the diagonal length of the initial nodule area, represents the area of the filled circle binary image, represents the circular area ratio, Represents the area of the intersection region.
[0081] As an implementable method, the data elimination module is configured to:
[0082] Based on the coordinates of the contour points in the intersection area and the coordinates of the center of the initial nodule area, the distance of the intersection area is calculated by a preset distance formula;
[0083] If the center-edge distance is less than the intersection area distance, the center-edge distance remains unchanged; if the center-edge distance is not less than the intersection area distance, the center-edge distance is updated to the intersection area distance;
[0084] Through the center-edge distance and the intersection area distance, the distance position relationship between the center-edge distance and the center area position is obtained;
[0085] The preset distance formula is expressed as follows:
[0086]
[0087] in, Represents the contour points of the intersection area, represents the number of contour points in the intersection area, The horizontal coordinates of the contour points representing the intersection area, The ordinate of the contour point representing the intersection area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents a function that computes square roots, Represents a function that computes powers.
[0088] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the following method:
[0089] Acquire an original image of a plant root system, and correct the original image of the plant root system to obtain a corrected image of the plant root system;
[0090] Binarizing the plant root correction image to obtain a plant root binary image;
[0091] Perform nodule detection on the plant root correction image to obtain an initial nodule region set;
[0092] A filled circle binary image of the initial nodule region is obtained based on the initial nodule region, and then an intersection area of the plant root binary image and the filled circle binary image is obtained, and a circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image;
[0093] Based on the center coordinates of the initial nodule region and the intersection area, the distance position relationship is obtained;
[0094] Based on the circular area ratio and the distance position relationship, it is determined whether each initial nodule area is a pseudo-nodule area. If so, the pseudo-nodule area in the initial nodule area set is removed to obtain the plant nodule set and count the number of nodules.
[0095] A plant nodule detection device based on machine vision comprises a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following method when executing the computer program:
[0096] Acquire an original image of a plant root system, and correct the original image of the plant root system to obtain a corrected image of the plant root system;
[0097] Binarizing the plant root correction image to obtain a plant root binary image;
[0098] Perform nodule detection on the plant root correction image to obtain an initial nodule region set;
[0099] A filled circle binary image of the initial nodule region is obtained based on the initial nodule region, and then an intersection area of the plant root binary image and the filled circle binary image is obtained, and a circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image;
[0100] Based on the center coordinates of the initial nodule region and the intersection area, the distance position relationship is obtained;
[0101] Based on the circular area ratio and the distance position relationship, it is determined whether each initial nodule area is a pseudo-nodule area. If so, the pseudo-nodule area in the initial nodule area set is removed to obtain the plant nodule set and count the number of nodules.
[0102] The present invention has significant technical effects due to the adoption of the above technical solution:
[0103] The present invention solves the technical defects of the prior art, such as strong subjectivity, low efficiency and low readiness, and can quickly and accurately analyze the root nodule phenotypic parameters, which can not only meet the research subjects' analysis needs for root phenotypic parameters including nodules, but also provide accurate data reference for nodule-related research. BRIEF DESCRIPTION OF THE DRAWINGS
[0104] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0105] Figure 1 It is a schematic diagram of the overall process of the method of the present invention;
[0106] Figure 2 It is a schematic diagram of the overall structure of the system of the present invention;
[0107] Figure 3 is a schematic diagram of an image acquisition device of the present invention;
[0108] Figure 4 is a schematic diagram of color correction results in an embodiment of the present invention;
[0109] Figure 5 This is a schematic diagram of segmenting a binary image according to an embodiment of the present invention;
[0110] Figure 6 is a schematic diagram of the nodule detection algorithm of the present invention;
[0111] Figure 7 This is a schematic diagram of the nodule initial detection marker of the present invention;
[0112] Figure 8 It is a schematic diagram of marking the nodule detection results of the present invention. DETAILED DESCRIPTION
[0113] The present invention is further described in detail below in conjunction with embodiments. The following embodiments are for explanation of the present invention but the present invention is not limited to the following embodiments.
[0114] Embodiment 1:
[0115] A plant nodule detection method based on machine vision, such as Figure 1 As shown, the following steps are included:
[0116] S100, obtaining an original image of a plant root system, and correcting the original image of the plant root system to obtain a corrected image of the plant root system;
[0117] S200, performing binarization processing on the plant root correction image to obtain a plant root binarization image;
[0118] S300, performing nodule detection on the plant root correction image to obtain an initial nodule region set;
[0119] S400, obtaining a filled circle binary image of the initial nodule region based on the initial nodule region, and then obtaining an intersection area of the plant root system binary image and the filled circle binary image, and obtaining a circular area ratio based on an area of the intersection area and an area of the filled circle binary image;
[0120] S500, obtaining a distance position relationship based on the central coordinates of the initial nodule region and the intersection region;
[0121] S600: Based on the circular area ratio and the distance position relationship, determine whether each initial nodule region is a pseudo-nodule region. If so, remove the pseudo-nodule region from the initial nodule region set to obtain a plant nodule set and count the number of nodules.
[0122] The present invention overcomes the defects of strong subjectivity and low efficiency in the traditional root nodule statistics and measurement process, can quickly and accurately detect the nodule area, and is used for nodule number statistics and nodule phenotypic parameter analysis, meeting the research needs of the research subjects on plant root nodule parameters, and can provide data reference for root nodule phenotypic research.
[0123] In one embodiment, Figure 3 As shown, there are a scanner device 310, a plant root system 311, and a root nodule analysis unit 312; the original plant root image image1 is obtained by the scanner device 310, and the root nodule analysis unit 312 performs subsequent image processing and analysis related work.
[0124] In one embodiment, the correcting the original plant root image to obtain the corrected plant root image includes the following steps:
[0125] A lookup table is constructed according to the image grayscale space of the original image of the plant root system to obtain the maximum image grayscale value and the minimum image grayscale value in the original image of the plant root system;
[0126] Resetting the lookup table based on the maximum grayscale value and the minimum grayscale value of the image to obtain a reset lookup table;
[0127] Perform pixel traversal on the plant root system image, look up the reset lookup table based on the image pixel value at the corresponding pixel point position, and update the plant root system image according to the lookup result to obtain a plant root system correction image;
[0128] The reset lookup table is represented as follows:
[0129]
[0130] in, Reset the lookup table. represents the image grayscale space, Represents the minimum grayscale value of the image. Indicates the maximum value of the image grayscale space.
[0131] Here, the correction in this embodiment is color correction, and the specific process is as follows:
[0132] S110, define an empty look-up table LUT (Look-Up Table). Since the image grayscale space is 0-255, the size of the look-up table is 256;
[0133] S120, constructing a LUT table, and resetting the values of each gray level according to the minimum and maximum gray values of the image, as follows:
[0134] LUT={0}
[0135] minMaxLoc(image1,minPixel,maxPixel)
[0136] for i=0 to 255
[0137] if i <minPixel:
[0138] LUT[i]=0
[0139] else if i>maxPixel:
[0140] LUT[i]=255
[0141] else:
[0142] LUT[i]=(255.0*(i-minPixel) / (maxPixel-minPixel))
[0143] S130, perform color mapping, traverse each position of the image, perform LUT table lookup according to the corresponding pixel value of each position, update the image gray value, and obtain the plant root correction image image2. The specific algorithm is as follows:
[0144] Let image2=image1
[0145] for i=0 to imageWidth
[0146] for j=0 to imageHeight
[0147] pixel=image1(i,j)
[0148] newPixel=LUT[pixel]
[0149] image2(i,j)=newPixel
[0150] The plant root correction image image2 is as follows Figure 4 shown.
[0151] In one embodiment, the binarization processing of the plant root correction image to obtain the plant root binarization image includes the following steps:
[0152] Performing grayscale processing on the plant root correction image to obtain a plant root grayscale image;
[0153] Denoising the plant root grayscale image to obtain a plant root filter image, performing local threshold segmentation and edge extraction on the plant root filter image to obtain a first binary image of the plant root and a plant root edge image;
[0154] The first binary image of the plant root system and the edge image of the plant root system are fused to obtain a fused image of the plant root system, and then feature analysis and impurity removal are performed to obtain a feature selection image of the plant root system;
[0155] The plant root feature selection image is subjected to morphological transformation to obtain a plant root binary image.
[0156] In actual operation, the following processing steps are provided in combination with the attached drawings:
[0157] The plant root grayscale image imageGray of the plant root correction image image2 is obtained; the plant root grayscale image imageGray is subjected to bilateral filtering to remove noise interference to obtain the plant root filter image imageBilateral; the plant root filter image imageBilateral is subjected to local threshold segmentation to obtain the first plant root binary image imageThre, and the plant root filter image imageBilateral is subjected to edge extraction to obtain the plant root edge image edgeImage; the plant root first binary image imageThre and the plant root edge image edgeImage are fused to obtain the plant root fusion image fusionImage; the plant root fusion image fusionImage is subjected to feature analysis to remove impurities to obtain the plant root feature selection image filterImage; the plant root feature selection image filterImage is subjected to morphological transformation to obtain the plant root binary image image3, as shown in FIG. Figure 5 shown.
[0158] Since the plant root system is thin and the distance between roots is small, conventional segmentation is easily affected by surrounding information. Therefore, bilateral filtering considers the spatial information and grayscale similarity of the image at the same time to achieve the purpose of edge preservation and denoising. Since the image may have uneven illumination, local binary segmentation is used to segment the target area. However, due to the thin root system, the segmentation process is prone to breakage. The canny edge extraction algorithm has anisotropic characteristics and can better obtain the root edge. Therefore, the edge image is merged with the local threshold segmentation image, which can solve the breakage problem well. Since dust and root soil are shaken off on the backlight board and segmented as the foreground, interference is filtered out through morphological transformation, width feature, length feature, and area feature analysis. Since the time performance of root phenotyping analysis is related to the amount of image information, and the above binary image contains a lot of redundant information except the root system, only the root area is retained through image cropping to reduce the amount of calculation and improve the operation efficiency, and finally the root segmentation binary image is obtained.
[0159] In one embodiment, the following steps are also included: constructing a plant nodule detection network, training the plant nodule detection network based on a plant root system image set to obtain a plant nodule detection model, performing nodule detection through the plant nodule detection model, and obtaining an initial nodule region set. The nodule detection algorithm of this embodiment adopts a deep neural convolutional network detection model to detect the information of the nodule circumscribed rectangular marking area. Since the target detection neural network is relatively mature, this embodiment does not elaborate on the network in detail. The selection of the corresponding neural network architecture needs to be based on the actual application scenario. A specific network model is selected. For nodule detection applications, since nodules are small targets and weak textures, it is necessary to select an application scenario that is suitable for small targets and has simple features. In addition, since the nodules are small, the actual collected image resolution is high, resulting in a large image scale. Therefore, it is usually necessary to preprocess the original image, including cropping and fusion, padding, etc. to adapt to the neural network input size.
[0160] In addition, the plant root image set is obtained through the following steps:
[0161] Based on the size of the plant nodule detection network and the maximum edge length of the original plant root image, the image change rate is obtained;
[0162] Perform image transformation on the original plant root image based on the image change rate to obtain a plant root image set;
[0163] The image change rate is expressed as follows:
[0164]
[0165]
[0166] in, represents the image change rate, represents the maximum edge length of the original image of the plant root system, Represents the width of the original image of the plant root system, Indicates the height of the original image of the plant root system.
[0167] In addition, the image transformation of the original plant root image based on the image change rate to obtain the plant root image set includes the following steps:
[0168] When the image change rate is less than a preset scale threshold, performing image transformation on the original image of the plant root system to obtain a first transformed image;
[0169] When the image change rate is greater than a preset scale threshold, a mask image is established according to the original image size of the plant root system and the image change rate, and the original image of the plant root system is filled into the central area of the mask image to obtain a second transformed image;
[0170] Based on the first transformed image and the second transformed image, a plant root system image set is formed;
[0171] The first transformed image is expressed as follows:
[0172]
[0173]
[0174] in, Indicates the width of the plant root image, Indicates the height of the plant root image, represents the image change rate, Represents the width of the original image of the plant root system, Indicates the height of the original image of the plant root system.
[0175] In actual operation, please refer to the following steps:
[0176] Step 1: Determine the network input size W*W
[0177] Step 2: Input image inputImage, image width and height are width and height, calculate the longest side maxLength=max(width,height)
[0178] Step 3: Calculate the image transformation ratio ratio = W / maxLength
[0179] Step 4: The process of image transformation is as follows:
[0180] if ratio=1:
[0181] outputImage=inputImage
[0182] else if ratio<1:
[0183] resize(inputImage,outputImage,Size(width / ratio,height / ratio)
[0184] else:
[0185] padding(inputImage,outputImage)
[0186] The padding is used to fill the small image, so as to enlarge the original image while ensuring that the resolution of the original image remains unchanged. The padding algorithm is as follows:
[0187] enter:
[0188] inputImage,ratio
[0189] Algorithm flow:
[0190] Create an image maskImage with a size of W*W and pixel values of all channels are 0;
[0191] Traverse inputImage and fill inputImage into the center area of maskImage
[0192] for i=0 to width
[0193] for j=0 to height
[0194] maskImage(i+(W-width) / 2,j+(W-height) / 2)=inputImage(i,j)
[0195] Output: maskImage
[0196] outputImage is the maskImage that forms the plant root image set.
[0197] The transformed image is used in the training process or detection process to ensure that the input image scale is consistent with the network input scale and improve the detection accuracy.
[0198] The nodule detection process is shown in the figure below: Figure 6 As shown in the figure, the image adaptive transformation process proposed above occurs at the input image stage. For the detection process, the final output initial nodule region set is noduleRects={rect1,rect2,...,rectn}. The marking result is as follows Figure 7 shown.
[0199] In one embodiment, the method of obtaining a filled circle binary image of the initial nodule region based on the initial nodule region, and then obtaining an intersection area of the plant root system binary image and the filled circle binary image, and obtaining a circular area ratio based on the area of the intersection area and the area of the filled circle binary image, comprises the following steps:
[0200] Establish a single-channel background image based on the binary image of plant roots;
[0201] Based on the initial nodule region, the center coordinates of the initial nodule region and the diagonal length of the initial nodule region are obtained, and the single-channel background image is filled with the center coordinates of the initial nodule region as the center of the circle and the diagonal length of the initial nodule region as the diameter to obtain a filled circle binary image;
[0202] Based on the plant root binary image and the filled circle binary image, the intersection area of the initial nodule area and the plant root binary image is obtained;
[0203] The circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image.
[0204] Specifically, the diagonal length of the initial nodule region is expressed as follows:
[0205]
[0206] The initial nodule region center coordinates are expressed as follows:
[0207]
[0208] The area of the filled circle binary image is expressed as follows:
[0209]
[0210] The circular area ratio is expressed as follows:
[0211]
[0212] in, The upper left corner abscissa represents the initial nodule area, The upper left ordinate represents the initial nodule area, The lower right corner abscissa represents the initial nodule area, The lower right ordinate represents the initial nodule area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents the diagonal length of the initial nodule area, represents the area of the filled circle binary image, represents the circular area ratio, Represents the area of the intersection region.
[0213] Specifically, the distance position relationship is obtained based on the central coordinates of the initial nodule area and the intersection area, including the following steps:
[0214] Based on the coordinates of the contour points in the intersection area and the coordinates of the center of the initial nodule area, the distance of the intersection area is calculated by a preset distance formula;
[0215] If the center-edge distance is less than the intersection area distance, the center-edge distance remains unchanged; if the center-edge distance is not less than the intersection area distance, the center-edge distance is updated to the intersection area distance;
[0216] Through the center-edge distance and the intersection area distance, the distance position relationship between the center-edge distance and the center area position is obtained;
[0217] The preset distance formula is expressed as follows:
[0218]
[0219] in, Represents the contour points of the intersection area, represents the number of contour points in the intersection area, The horizontal coordinates of the contour points representing the intersection area, The ordinate of the contour point representing the intersection area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents a function that computes square roots, Represents a function that computes powers.
[0220] In actual operation, according to the plant root binary image image3 and the initial nodule area noduleRects, the pseudo nodules are eliminated based on the image processing and target detection fusion technology, and the actual nodule area information is calculated, as follows:
[0221] Take one of the initial detection areas rect1 as an example:
[0222] S410, creating a single-channel black background binary image maskImage2 of the same size as the plant root binary image image3;
[0223] S420, according to the coordinates of the upper left vertex vertexPoint1(x1,y1) and the lower right vertex vertexPoint2(x2,y2) of the detection area information rect1, the center coordinates of the rectangle are calculated to be centerPoint((x1+x2) / 2,(y1+y2) / 2), the length of the diagonal of the rectangle is diagonal=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)), the image maskImage2 is filled with centerPoint as the center and diagonal / 2 as the radius to obtain a filled circle binary image circleImage, and the area of the circular region circleArea=π*(diagonal / 2)*(diagonal / 2);
[0224] S430, obtaining the intersection area interImage of the initially detected nodule area and the root system binary image according to the calculation method interImage=image3&circleImage, wherein the contour point set of the area is contourPoint={point1,point2,...,point3}, and the contour area is contourArea;
[0225] S440, calculating the area ratio of interImage to the circular area areaRatio=contourArea / circleArea, the shortest distance between the center of the circle centerPoint and the edge of interImage minEdgeDistance, and the relationship between the center of the circle and interImage centerPos, that is, whether it is within the intersection area, if it is within the area, it is 0, and if it is outside the area, it is 1;
[0226] Among them, the minEdgeDistance calculation process is as follows:
[0227] Initialize minEdgeDistance=1e+9
[0228] for i=0 to contourPoint
[0229] dis=sqrt(pow(contourPoint[i].x-centerPoint.x,2)+pow(contourPoint[i].y-centerPoint.y,2))
[0230] minEdgeDistance=minEdgeDistance <dis?minEdgeDistance:dis
[0231] Among them, the method to determine whether the center of the circle is within the region is:
[0232] pixel=interImage(centerPoint.x,centerPoint.y)
[0233] centerPos=pixel>0?0:1
[0234] S450, according to the discrimination scheme proposed in this embodiment, if and only if (areaRatio>0.5)&&(minEdgeDistance<0.1*diagonal)&&(centerPos==0), when the discrimination condition is met, the contourPoint is recorded as the corresponding nodule area information;
[0235] S460, traverse noduleRects={rect1,rect2,...,rectn}, and obtain the plant nodule set noduleRegions={contourPoint1,contourPoint2,...,contourPointm} according to the above discrimination rules;
[0236] According to the plant nodule set noduleRegions information, the actual nodule region marking result is obtained as shown in the figure Figure 8 As shown, it can not only filter out pseudo-nodules, but also accurately detect nodule area information, which can lay a solid foundation for subsequent nodule calculation and nodule phenotype analysis.
[0237] Embodiment 2:
[0238] A plant nodule detection system based on machine vision, such as Figure 2 As shown, it includes a correction module 100, a binary processing module 200, an image detection module 300 and a data elimination module 400;
[0239] The correction module 100 is used to obtain the original image of the plant root system, and correct the original image of the plant root system to obtain a corrected image of the plant root system;
[0240] The binary processing module 200 is used to perform binary processing on the plant root correction image to obtain a plant root binary image;
[0241] The image detection module 300 is used to perform nodule detection on the plant root correction image to obtain an initial nodule region set;
[0242] The data elimination module 400 obtains a filled circle binary image of the initial nodule area based on the initial nodule area, and then obtains the intersection area of the plant root system binary image and the filled circle binary image, and obtains the circular area area ratio based on the area of the intersection area and the area of the filled circle binary image; obtains the distance position relationship based on the central coordinates of the initial nodule area and the intersection area; and determines whether each initial nodule area is a pseudo-nodule area based on the circular area area ratio and the distance position relationship. If so, the pseudo-nodule area in the initial nodule area set is eliminated to obtain a plant nodule set and count the number of nodules.
[0243] In one embodiment, the data elimination module 400 is configured to:
[0244] Establish a single-channel background image based on the binary image of plant roots;
[0245] Based on the initial nodule region, the center coordinates of the initial nodule region and the diagonal length of the initial nodule region are obtained, and the single-channel background image is filled with the center coordinates of the initial nodule region as the center of the circle and the diagonal length of the initial nodule region as the diameter to obtain a filled circle binary image;
[0246] Based on the plant root binary image and the filled circle binary image, the intersection area of the initial nodule area and the plant root binary image is obtained, and the circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image;
[0247] Based on the initial nodule region center coordinates and the intersection area, the distance position relationship between the center edge distance and the center region position is obtained;
[0248] The diagonal length of the initial nodule region is expressed as follows:
[0249]
[0250] The initial nodule region center coordinates are expressed as follows:
[0251]
[0252] The area of the filled circle binary image is expressed as follows:
[0253]
[0254] The circular area ratio is expressed as follows:
[0255]
[0256] in, The upper left corner abscissa represents the initial nodule area, The upper left ordinate represents the initial nodule area, The lower right corner abscissa represents the initial nodule area, The lower right ordinate represents the initial nodule area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents the diagonal length of the initial nodule area, represents the area of the filled circle binary image, represents the circular area ratio, Represents the area of the intersection region.
[0257] Specifically, the data elimination module is configured to:
[0258] Based on the coordinates of the contour points in the intersection area and the coordinates of the center of the initial nodule area, the distance of the intersection area is calculated by a preset distance formula;
[0259] If the center-edge distance is less than the intersection area distance, the center-edge distance remains unchanged; if the center-edge distance is not less than the intersection area distance, the center-edge distance is updated to the intersection area distance;
[0260] Through the center-edge distance and the intersection area distance, the distance position relationship between the center-edge distance and the center area position is obtained;
[0261] The preset distance formula is expressed as follows:
[0262]
[0263] in, Represents the contour points of the intersection area, represents the number of contour points in the intersection area, The horizontal coordinates of the contour points representing the intersection area, The ordinate of the contour point representing the intersection area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents a function that computes square roots, Represents a function that computes powers.
[0264] Various changes and modifications can be made without departing from the spirit and scope of the present invention, and all equivalent technical solutions also belong to the scope of the present invention.
[0265] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0266] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0267] The present invention is described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0268] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0269] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0270] It should be noted that:
[0271] The "one embodiment" or "embodiment" mentioned in the specification means that the specific features, structures or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present invention. Therefore, the phrases "one embodiment" or "embodiment" appearing in various places throughout the specification do not necessarily refer to the same embodiment.
[0272] In addition, it should be noted that the shapes and names of the parts and components of the specific embodiments described in this specification may be different. Any equivalent or simple changes made based on the structure, features and principles described in the patent concept of the present invention are included in the protection scope of the patent of the present invention. The technicians in the technical field of the present invention can make various modifications or supplements to the specific embodiments described or replace them in a similar manner, as long as they do not deviate from the structure of the present invention or exceed the scope defined by the claims, they should all fall within the protection scope of the present invention.
Claims
1. A plant nodule detection method based on machine vision, It is characterized in that The following steps are involved: Acquire an original image of a plant root system, and correct the original image of the plant root system to obtain a corrected image of the plant root system; Binarizing the plant root correction image to obtain a plant root binary image; Perform nodule detection on the plant root correction image to obtain an initial nodule region set; A filled circle binary image of the initial nodule region is obtained based on the initial nodule region, and then an intersection area of the plant root binary image and the filled circle binary image is obtained, and a circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image; Based on the center coordinates of the initial nodule region and the intersection area, the distance position relationship is obtained; Based on the circular area ratio and the distance position relationship, it is determined whether each initial nodule area is a pseudo-nodule area. If so, the pseudo-nodule area in the initial nodule area set is removed to obtain the plant nodule set and count the number of nodules.
2. The plant nodule detection method based on machine vision according to claim 1, It is characterized in that The method of correcting the original plant root system image to obtain the corrected plant root system image comprises the following steps: A lookup table is constructed according to the image grayscale space of the original image of the plant root system to obtain the maximum image grayscale value and the minimum image grayscale value in the original image of the plant root system; Resetting the lookup table based on the maximum grayscale value and the minimum grayscale value of the image to obtain a reset lookup table; Perform pixel traversal on the plant root system image, look up the reset lookup table based on the image pixel value at the corresponding pixel point position, and update the plant root system image according to the lookup result to obtain a plant root system correction image; The reset lookup table is represented as follows: in, Reset the lookup table. represents the image grayscale space, Represents the minimum grayscale value of the image. Indicates the maximum value of the image grayscale space.
3. The plant nodule detection method based on machine vision according to claim 1, It is characterized in that The process of binarizing the plant root correction image to obtain a plant root binarization image comprises the following steps: Performing grayscale processing on the plant root correction image to obtain a plant root grayscale image; Denoising the plant root grayscale image to obtain a plant root filter image, performing local threshold segmentation and edge extraction on the plant root filter image to obtain a first binary image of the plant root and a plant root edge image; The first binary image of the plant root system and the edge image of the plant root system are fused to obtain a fused image of the plant root system, and then feature analysis and impurity removal are performed to obtain a feature selection image of the plant root system; The plant root feature selection image is subjected to morphological transformation to obtain a plant root binary image.
4. The plant nodule detection method based on machine vision according to claim 1, It is characterized in that The method of obtaining a filled circle binary image of the initial nodule region based on the initial nodule region, and then obtaining an intersection area of the plant root system binary image and the filled circle binary image, and obtaining a circular area area ratio based on the area of the intersection area and the area of the filled circle binary image, comprises the following steps: Establish a single-channel background image based on the binary image of plant roots; Based on the initial nodule region, the center coordinates of the initial nodule region and the diagonal length of the initial nodule region are obtained, and the single-channel background image is filled with the center coordinates of the initial nodule region as the center of the circle and the diagonal length of the initial nodule region as the diameter to obtain a filled circle binary image; Based on the plant root binary image and the filled circle binary image, the intersection area of the initial nodule area and the plant root binary image is obtained; The circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image.
5. The plant nodule detection method based on machine vision according to claim 4, It is characterized in that The diagonal length of the initial nodule region is expressed as follows: The initial nodule region center coordinates are expressed as follows: The area of the filled circle binary image is expressed as follows: The circular area ratio is expressed as follows: in, The upper left corner abscissa represents the initial nodule area, The upper left ordinate represents the initial nodule area, The lower right corner abscissa represents the initial nodule area, The lower right ordinate represents the initial nodule area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents the diagonal length of the initial nodule area, represents the area of the filled circle binary image, represents the circular area ratio, Represents the area of the intersection region.
6. The plant nodule detection method based on machine vision according to claim 1 or 4, It is characterized in that The method of obtaining the distance position relationship based on the central coordinates of the initial nodule region and the intersection region comprises the following steps: Based on the coordinates of the contour points in the intersection area and the coordinates of the center of the initial nodule area, the distance of the intersection area is calculated by a preset distance formula; If the center-edge distance is less than the intersection area distance, the center-edge distance remains unchanged; if the center-edge distance is not less than the intersection area distance, the center-edge distance is updated to the intersection area distance; Through the center-edge distance and the intersection area distance, the distance position relationship between the center-edge distance and the center area position is obtained; The preset distance formula is expressed as follows: in, Represents the contour points of the intersection area, represents the number of contour points in the intersection area, The horizontal coordinates of the contour points representing the intersection area, The ordinate of the contour point representing the intersection area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents a function that computes square roots, Represents a function that computes powers.
7. The plant nodule detection method based on machine vision according to claim 1, It is characterized in that The following steps are also included: A plant nodule detection network is constructed, and the plant nodule detection network is trained based on a plant root system image set to obtain a plant nodule detection model, and nodule detection is performed using the plant nodule detection model, wherein the plant root system image set is obtained by the following steps: Based on the size of the plant nodule detection network and the maximum edge length of the original plant root image, the image change rate is obtained; Perform image transformation on the original plant root image based on the image change rate to obtain a plant root image set; The image change rate is expressed as follows: in, represents the image change rate, represents the maximum edge length of the original image of the plant root system, Indicates the width of the original image of the plant root system, Indicates the height of the original image of the plant root system. Represents the size of the plant nodule detection network.
8. The plant nodule detection method based on machine vision according to claim 7, It is characterized in that The method of performing image transformation on the original plant root system image based on the image change rate to obtain a plant root system image set includes the following steps: When the image change rate is less than a preset scale threshold, performing image transformation on the original image of the plant root system to obtain a first transformed image; When the image change rate is greater than a preset scale threshold, a mask image is established according to the original image size of the plant root system and the image change rate, and the original image of the plant root system is filled into the central area of the mask image to obtain a second transformed image; Based on the first transformed image and the second transformed image, a plant root system image set is formed; The first transformed image is expressed as follows: in, Indicates the width of the plant root image, Indicates the height of the plant root image, represents the image change rate, Indicates the width of the original image of the plant root system, Indicates the height of the original image of the plant root system.
9. A plant nodule detection system based on machine vision, It is characterized in that It includes a correction module, a binary processing module, an image detection module and a data elimination module; The correction module is used to obtain the original image of the plant root system, correct the original image of the plant root system, and obtain the corrected image of the plant root system; The binary processing module is used to perform binary processing on the plant root correction image to obtain a plant root binary image; The image detection module is used to perform nodule detection on the plant root correction image to obtain an initial nodule region set; The data elimination module obtains a filled circle binary image of the initial nodule area based on the initial nodule area, and then obtains the intersection area of the plant root system binary image and the filled circle binary image, and obtains the circular area area ratio based on the area of the intersection area and the area of the filled circle binary image; obtains the distance position relationship based on the central coordinates of the initial nodule area and the intersection area; and determines whether each initial nodule area is a pseudo-nodule area based on the circular area area ratio and the distance position relationship. If so, the pseudo-nodule area in the initial nodule area set is eliminated to obtain a plant nodule set and count the number of nodules.
10. The plant nodule detection system based on machine vision according to claim 9, It is characterized in that The data elimination module is configured as follows: Establish a single-channel background image based on the binary image of plant roots; Based on the initial nodule region, the center coordinates of the initial nodule region and the diagonal length of the initial nodule region are obtained, and the single-channel background image is filled with the center coordinates of the initial nodule region as the center of the circle and the diagonal length of the initial nodule region as the diameter to obtain a filled circle binary image; Based on the plant root binary image and the filled circle binary image, the intersection area of the initial nodule area and the plant root binary image is obtained, and the circular area ratio is obtained based on the area of the intersection area and the area of the filled circle binary image; Based on the initial nodule region center coordinates and the intersection area, the distance position relationship between the center edge distance and the center region position is obtained; The diagonal length of the initial nodule region is expressed as follows: The initial nodule region center coordinates are expressed as follows: The area of the filled circle binary image is expressed as follows: The circular area ratio is expressed as follows: in, The upper left corner abscissa represents the initial nodule area, The upper left ordinate represents the initial nodule area, The lower right corner abscissa represents the initial nodule area, The lower right ordinate represents the initial nodule area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents the diagonal length of the initial nodule area, represents the area of the filled circle binary image, represents the circular area ratio, Represents the area of the intersection region.
11. The plant nodule detection system based on machine vision according to claim 10, It is characterized in that The data elimination module is configured as follows: Based on the coordinates of the contour points in the intersection area and the coordinates of the center of the initial nodule area, the distance of the intersection area is calculated by a preset distance formula; If the center-edge distance is less than the intersection area distance, the center-edge distance remains unchanged; if the center-edge distance is not less than the intersection area distance, the center-edge distance is updated to the intersection area distance; Through the center-edge distance and the intersection area distance, the distance position relationship between the center-edge distance and the center area position is obtained; The preset distance formula is expressed as follows: in, Represents the contour points of the intersection area, represents the number of contour points in the intersection area, The horizontal coordinates of the contour points representing the intersection area, The ordinate of the contour point representing the intersection area, The horizontal coordinate represents the coordinate of the center of the initial nodule region, The ordinate represents the coordinate of the center of the initial nodule region, represents a function that computes square roots, Represents a function that computes powers.
12. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
13. A plant nodule detection device based on machine vision, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Image processing method, image processing apparatus, and non-transitory storage medium
CA3204361A1
Cigarette filter online counting and quality detecting method based on machine vision
CN104537671A
Method for machine vision detection in allusion to self-focusing lens surface defect
CN107255641A
Machine vision identification method for pointer type instrument
CN114898347A
Pod phenotype analysis method, system and device based on computer vision
CN115620279A
