A method for obtaining location information of famous and high-quality tea picking points based on machine vision
Through machine vision technology, Gaussian filtering, ROI settings, HSV color space conversion and feature extraction algorithms are used to solve the problem of low positioning accuracy and efficiency of famous tea picking points, achieve more efficient tea bud picking, and improve picking efficiency and Tea integrity.
Patent Information
- Application Number
- CN202110077443.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-20
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-01-20
AI Technical Summary
In the automatic picking of famous tea, the accuracy and efficiency of identification and positioning of tea bud picking points are low. Affected by factors such as the complex tea garden environment, unstable lighting, tea leaves swinging and tea leaves blocking each other, the picking is difficult and limits the development of automated picking. .
Using methods based on machine vision, through Gaussian filtering, ROI settings, HSV color space conversion, Otsu algorithm, binary segmentation, Zhang thinning algorithm and Shi-Tomasi algorithm, the characteristics of tea buds and their growing points are extracted to determine picking The coordinates of the point to improve the positioning accuracy and efficiency of the picking point.
It improves the positioning accuracy and efficiency of the tea bud picking point, ensuring that the coordinates of the picking point accurately fall on the petiole, improving the integrity of the tea, reducing environmental impact, and improving picking efficiency.
Smart Images

Figure CN112861654B
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence, machine vision and image processing algorithms, and in particular provides a method for acquiring location information of famous and high-quality tea picking points based on machine vision. Background Art
[0002] In recent years, vision-based automatic picking robots have been used to pick premium teas, and the automatic identification and positioning of picking points has become a key point and difficulty that restricts its development. Premium teas are light in weight, and wind or movement of the picking machine will cause the tea leaves to sway; the tea garden environment is complex, and the tea leaves block each other; the light is too strong or too dark, and the resolution of tender buds and old leaves is low. These factors make it very difficult to identify and locate tender bud picking points, which seriously limits the automated picking of premium teas. The current positioning method for picking tea buds has low positioning accuracy and low efficiency. In order to achieve rapid identification and positioning of picking points and ensure the efficiency and high quality requirements of premium tea machine picking, it is necessary to develop a method for obtaining the location information of the picking points of premium teas. Summary of the invention
[0003] The purpose of the present invention is to overcome the deficiencies in the above-mentioned background technology and provide a method for obtaining the location information of the picking points of famous and high-quality tea based on machine vision, which should be able to greatly improve the accuracy and efficiency of locating the picking points of tea buds.
[0004] The technical solution of the present invention is:
[0005] A method for obtaining location information of famous and high-quality tea picking points based on machine vision comprises the following steps in sequence:
[0006] Step 1: Get tea leaves from the tea garden and use a 3╳3 convolution kernel to perform Gaussian filtering to remove noise:
[0007] Step 2: In order to reduce the influence of factors unrelated to the picking point and the number of pixels in image processing and improve the real-time performance of image processing, a separate ROI is set for each sprout acquired in the image. When identifying the picking point, only this area is used as the target object;
[0008] Step 3: Convert the ROI in RGB color space to HSV color space to extract the features of the buds and their growth point branches;
[0009] Step 4: Use Otsu algorithm to perform secondary binary segmentation on the extracted buds and branches;
[0010] Step 5: Use the improved Zhang thinning algorithm to thin the binary image in the previous step and extract its skeleton to retain the original features and generate a single-pixel skeleton;
[0011] Step 6: Use Shi-Tomasi algorithm to search for the bifurcation points of buds and branches as feature corner points for the refined skeleton detection;
[0012] Step 7: Fit the lowest point and corner points of the contour into straight line segments, and take the center point as the picking point, whose coordinates are:
[0013]
[0014] In the formula, u and v represent the horizontal and vertical coordinates of the picking point;
[0015] x0, y0 represent the horizontal and vertical coordinates of the lowest point of the contour;
[0016] x′, y′ represent the horizontal and vertical coordinates of the feature corner points detected by the Shi-Tomasi algorithm.
[0017] In the first step, the GB component map of the image is first obtained under the RGB model, and then the Otsu algorithm is used to perform the initial segmentation on the tea buds, and then the corrosion morphological operation is performed on the buds to filter out the fine contours generated again due to noise and other reasons.
[0018] In the second step, the search algorithm for setting the ROI with the lowest point of the tea bud outline as the center is:
[0019] 1) Traverse the edge points of each contour in the graph and find the lowest point (x0, y0) and the highest point (x1, y1);
[0020] 2) Set the contour height screening parameter D to filter out some sprouts with too small visible areas due to occlusion and other reasons. When the straight line length between the highest point and the lowest point is greater than or equal to the preset value D, the contour number i is entered into the list to be processed list[]. Otherwise, it is discarded and recorded blank. The mathematical expression is:
[0021]
[0022] 3) Set a rectangular ROI with a length of Roi_L and a height of Roi_H, with the lowest point (x0, y0) of each contour in list[] as the center, where
[0023]
[0024] Where x min ,y max Respectively represent the horizontal and vertical coordinates of the upper left corner of the rectangular ROI, x max ,y min Indicates the horizontal and vertical coordinates of the lower right corner of the rectangular ROI.
[0025] The step 3 includes:
[0026] 1) Separate the H, S, and V channels from the ROI in the HSV space, set the upper and lower limits of the pixel values of the H, S, and V channels, select the areas where the buds and branches are located, and set a mask of the same size as the original image:
[0027]
[0028] Where src represents the pixel value of each pixel point in the H, S, and V channels of the HSV color space, min represents the lower limit of the pixel value, and max represents the upper limit of the pixel value;
[0029] 2) Perform bitwise AND operation on the ROI and mask in RGB space to extract the bud and branch areas.
[0030] The refinement of step 5 includes:
[0031] 1) A pixel located at the boundary of the binary image is denoted as P1, and the eight adjacent pixels around it are denoted as P2, P3, P4, P5, P6, P7, P8, and P9 in clockwise order, with P2 being located directly above P1;
[0032] 2) Mark the boundary points that meet the following conditions at the same time:
[0033] ①2≤N(P1)≤6
[0034] ②S(P1)=1 or B(P1)∈{5,13,20,22,52,54,65,80,133,141}
[0035] ③P2×P4×P6=0
[0036] ④P4×P6×P8=0
[0037] 3) Delete the boundary points that meet the following conditions at the same time:
[0038] ①2≤N(P1)≤6
[0039] ②S(P1)=1 or B(P1)∈{5,13,20,22,52,54,65,80,133,141}
[0040] ③P2×P4×P8=0
[0041] ④P2×P6×P8=0
[0042] 4) Repeat the above refinement steps and stop when no point meets the above conditions;
[0043] Among them, N(P1) is the number of non-zero neighbors of P1, S(P1) is the number of times its value changes from 0 to 1 in the order of P2, P3, P4, P5, P6, P7, P8, and P9, and B(P1) is the binary code value of the eight neighborhood points of P1.
[0044] The step 6 includes:
[0045] Suppose the pixel coordinates of a point in the window are (x, y), the movement amount is (Δx, Δy), and the grayscale is I, then the grayscale change is:
[0046]
[0047] Where the window function ω(x,y) is represented by a Gaussian function:
[0048]
[0049] Taylor expansion of the grayscale change function and ignoring the high-order terms yields:
[0050]
[0051] In the formula
[0052]
[0053] I x , I y Respectively represent the gradient values of the image grayscale in the x and y directions:
[0054]
[0055] Define the corner response function:
[0056] R=min(λ1,λ2)
[0057] Where λ1 and λ2 are the two eigenvalues of the matrix M.
[0058] When R is greater than the threshold T0 and is a local maximum in its neighborhood, the point is a Shi-Tomasi feature corner point, and its coordinates (x′, y′) are output.
[0059] The beneficial effects of the present invention are:
[0060] The method for acquiring the coordinates of the tea bud picking points adopted by the present invention can determine the picking points according to the growth posture of the tea buds, ensure that the located picking point coordinates all fall on the petioles of the tea buds, improve the integrity of the picked tea buds, while reducing the influence of the surrounding environment on its positioning, and improve the accuracy and efficiency of the tea bud picking point positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a schematic diagram of the present invention.
[0062] Figure 2 This is a photo of tea leaves taken by an embodiment of the present invention.
[0063] Figure 3 Yes Figure 2 The effect diagram after executing step 1 of the present invention.
[0064] Figure 4 Yes Figure 3 The effect diagram after executing step 2 of the present invention.
[0065] Figure 5 Yes Figure 4 The effect diagram after executing step 3 of the present invention.
[0066] Figure 6 Yes Figure 5 The effect diagram after executing step 4 of the present invention.
[0067] Figure 7 express Figure 6 A box diagram of tea buds in one of the ROI areas.
[0068] Figure 8 Yes Figure 7 The effect diagram of the tea buds in one of the ROI areas after executing step 5 of the present invention.
[0069] Fig. 9 Yes Figure 8 The effect diagram after executing step 6 of the present invention; that is: outputting the intersection coordinates (x′, y′) and marking them in the figure (white dots in the figure).
[0070] Fig.10 Figure A in Figure 2 ( Figure 2 (The original photo is an enlarged picture of a tea bud.)
[0071] Fig.10 Figure B is Fig. 9 The effect diagram after executing step 7 of the present invention is shown, and the obtained picking points are marked on the original image (i.e. Fig.10 The circular black dots in the figure represent the picking points marked by the present invention; the rectangular black dots represent the lowest points of the initial segmentation contour; the triangular black dots represent the detected corner points DETAILED DESCRIPTION
[0072] The present invention will be further described below in conjunction with the embodiments shown in the accompanying drawings of the specification, but the present invention is not limited to the following embodiments.
[0073] A method for obtaining location information of famous and high-quality tea picking points based on machine vision comprises the following steps in sequence:
[0074] Step 1: Take the tea pictures obtained from the tea garden ( Figure 2 ), the collected tea sample images were subjected to Gaussian filtering and noise removal using a 3╳3 convolution kernel (see the processed images for details). Figure 3 ).
[0075] Firstly, the GB component map of the image is obtained under the RGB model, and then the Otsu algorithm is used to perform the initial segmentation of the tea buds, and then the corrosion morphological operation is performed on them to filter out the fine contours generated again due to noise and other reasons;
[0076] Step 2: In order to reduce the influence of factors unrelated to the picking point and the number of pixels in image processing and improve the real-time performance of image processing, a separate ROI is set for each sprout in the image. When identifying the picking point, only this area is used as the target object.
[0077] The search algorithm for setting ROI with the lowest point of the tea bud outline as the center is:
[0078] 1) Traverse the edge points of each contour in the graph and find the lowest point (x0, y0) and the highest point (x1, y1);
[0079] 2) Set the contour height screening parameter D to filter out some sprouts with too small visible areas due to occlusion and other reasons. When the straight line length between the highest point and the lowest point is greater than or equal to the preset value D, the contour number i is entered into the list to be processed list[]. Otherwise, it is discarded and recorded blank. The mathematical expression is:
[0080]
[0081] (3) With the lowest point (x0, y0) of each contour in list[] as the center, set a rectangular ROI with a length of Roi_L and a height of Roi_H, where
[0082]
[0083] Where x min ,y max Respectively represent the horizontal and vertical coordinates of the upper left corner of the rectangular ROI, x max ,y min Indicates the horizontal and vertical coordinates of the vertex of the lower right corner of the rectangular ROI;
[0084] Combined with the example of tea buds in tea garden, take x min =x0-30pixels; x max =x0+30pixels;y min=y0-30pixels; y max =y0+25pixels, a more ideal effect can be obtained;
[0085] See the processed pictures Figure 4 .
[0086] Step 3: Convert the ROI in RGB color space to HSV color space to extract the features of the buds and their growth point branches:
[0087] 1) Separate the H, S, and V channels from the ROI in the HSV space, set the upper and lower limits of the pixel values of the H, S, and V channels, select the areas where the buds and branches are located, and set a mask of the same size as the original image:
[0088]
[0089] In the formula, src represents the pixel value of each pixel point in the H, S, and V channels of the HSV color space; min represents the lower limit of the pixel value, and max represents the upper limit of the pixel value;
[0090] Combining the example of young tea buds in a tea garden, setting the value range of each channel to: H = [80, 150], S = [35, 250], V = [35, 250], a more ideal effect can be obtained.
[0091] 2) The ROI and mask in RGB space are bitwise ANDed to extract the bud and branch areas (see the processed image for details). Figure 5 );
[0092] Step 4: Use Otsu algorithm to perform secondary binary segmentation on the extracted buds and branches (see the processed image). Figure 6 );
[0093] Step 5: Use the improved Zhang thinning algorithm to thin each ROI region in the previous step binary image in turn, extract its skeleton, so as to retain the original features and generate a single pixel skeleton (extract Figure 7 For each ROI region, the fifth step of the present invention is performed in sequence; see Figure 7 , Figure 8 ); the result is as follows Figure 8 As shown;
[0094] The detailed steps are:
[0095] 1) A pixel located at the boundary of the binary image is recorded as P1, and the eight adjacent pixels around it are recorded as P2, P3, P4, P5, P6, P7, P8, and P9 in clockwise order, with P2 located directly above P1;
[0096] 2) Mark the boundary points that meet the following conditions at the same time:
[0097] ①2≤N(P1)≤6
[0098] ②S(P1)=1orB(P1)∈{5,13,20,22,52,54,65,80,133,141}
[0099] ③P2×P4×P6=0
[0100] ④P4×P6×P8=0
[0101] 3) Delete the boundary points that meet the following conditions at the same time:
[0102] ①2≤N(P1)≤6
[0103] ②S(P1)=1orB(P1)∈{5,13,20,22,52,54,65,80,133,141}
[0104] ③P2×P4×P8=0
[0105] ④P2×P6×P8=0
[0106] Where N(P1) is the number of non-zero neighbors of P1, S(P1) is the number of times its value changes from 0 to 1 in the order of P2, P3, P4, P5, P6, P7, P8, and P9, and B(P1) is the binary coded value of the eight neighbors of P1.
[0107] 4) Repeat the above refinement steps and stop when no point meets the above conditions;
[0108] Step 6: Use Shi-Tomasi algorithm to search for the bifurcation points of buds and branches as feature corner points for the refined skeleton detection (for Figure 8 Execute step 6, output the coordinates of the intersection (x′, y′) and mark them in the figure (the white dots in the figure). The result is as follows Fig. 9 The specific steps are as follows:
[0109] Suppose the pixel coordinates of a point in the window are (x, y), the movement amount is (Δx, Δy), and the grayscale is I, then the grayscale change is:
[0110]
[0111] Where the window function ω(x,y) is represented by a Gaussian function:
[0112]
[0113] Taylor expansion of the grayscale change function and ignoring the high-order terms yields:
[0114]
[0115] In the formula
[0116]
[0117] I x , I y Respectively represent the gradient values of the image grayscale in the x and y directions:
[0118]
[0119] Define the corner response function:
[0120] R=min(λ1,λ2)
[0121] Where λ1 and λ2 are the two eigenvalues of the matrix M;
[0122] When R is greater than the threshold T0 and is a local maximum in its neighborhood, the point is a Shi-Tomasi feature corner point, and its coordinates (x′, y′) are output;
[0123] Step 7: Mark the obtained picking points in the original image. The result is as follows: Fig.10 As shown (the circular black dots in the figure represent the picking points marked by the present invention; the rectangular black dots represent the lowest points of the initial segmentation contour; the triangular black dots represent the detected corner points).
[0124] The specific steps are: fit the lowest point and corner points of the contour into a straight line segment, take the center point as the picking point, and its coordinates are:
[0125]
[0126] Where u and v represent the horizontal and vertical coordinates of the picking point.
Claims
1. A method for obtaining location information of famous and high-quality tea picking points based on machine vision, comprising the following steps in sequence: Step 1: Get tea leaves from the tea garden and use a 3╳3 convolution kernel to perform Gaussian filtering to remove noise: Step 2: In order to reduce the influence of factors unrelated to the picking point and the number of pixels in image processing and improve the real-time performance of image processing, a separate ROI is set for each sprout acquired in the image. When identifying the picking point, only this area is used as the target object; Step 3: Convert the region of interest in the RGB color space to the HSV color space to extract the features of the buds and their growth point branches; Step 4: Use Otsu algorithm to perform secondary binary segmentation on the extracted buds and branches; Step 5: Use the improved Zhang thinning algorithm to thin the binary image in the previous step and extract its skeleton to retain the original features and generate a single-pixel skeleton; Step 6: Use Shi-Tomasi algorithm to search for the bifurcation points of buds and branches as feature corner points for the refined skeleton detection; Step 7: Fit the lowest point and corner points of the contour into straight line segments, and take the center point as the picking point, whose coordinates are: In the formula: u, v represent the horizontal and vertical coordinates of the picking point; x0, y0 represent the horizontal and vertical coordinates of the lowest point of the contour; x′, y′ represent the horizontal and vertical coordinates of the feature corner points detected by the Shi-Tomasi algorithm; In the first step, the GB component map of the image is first obtained under the RGB model, and then the Otsu algorithm is used to perform the initial segmentation of the tea buds, and then the corrosion morphological operation is performed on the buds to filter out the fine contours generated again due to noise; In the second step, the search algorithm for setting the ROI with the lowest point of the tea bud outline as the center is: 1) Traverse the edge points of each contour in the graph and find the lowest point (x0, y0) and the highest point (x1, y1); 2) Set the contour height screening parameter D to filter out some sprouts with too small visible areas due to occlusion. When the straight line length between the highest point and the lowest point is greater than or equal to the preset value D, the contour number i is entered into the list to be processed list[]. Otherwise, it is discarded and recorded blank. The mathematical expression is: 3) Set a rectangular ROI with a length of Roi_L and a height of Roi_H, with the lowest point (x0, y0) of each contour in list[] as the center, where Where x min ,y max Respectively represent the horizontal and vertical coordinates of the upper left corner of the rectangular ROI, x max ,y min Indicates the horizontal and vertical coordinates of the lower right corner of the rectangular ROI.
2. The method for obtaining location information of famous and high-quality tea picking points based on machine vision according to claim 1, characterized in that: The step 3 includes: 1) Separate the H, S, and V channels from the ROI in the HSV space, set the upper and lower limits of the pixel values of the H, S, and V channels, select the areas where the buds and branches are located, and set a mask of the same size as the original image: Where src represents the pixel value of each pixel point in the H, S, and V channels of the HSV color space, min represents the lower limit of the pixel value, and max represents the upper limit of the pixel value; 2) Perform bitwise AND operation on the ROI and mask in RGB space to extract the bud and branch areas.
3. The method for obtaining location information of famous and high-quality tea picking points based on machine vision according to claim 2 is characterized in that: The refinement of step 5 includes: 1) A pixel located at the boundary of the binary image is denoted as P1, and the eight adjacent pixels around it are denoted as P2, P3, P4, P5, P6, P7, P8, and P9 in clockwise order, with P2 being located directly above P1; 2) Mark the boundary points that meet the following conditions at the same time: ①2≤N(P1)≤6 ②S(P1)=1 or B(P1)∈{5,13,20,22,52,54,65,80,133,141} ③P2×P4×P6=0 ④P4×P6×P8=0 3) Delete the boundary points that meet the following conditions at the same time: ①2≤N(P1)≤6 ②S(P1)=1 or B(P1)∈{5,13,20,22,52,54,65,80,133,141} ③P2×P4×P8=0 ④P2×P6×P8=0 4) Repeat the above refinement steps and stop when no point meets the above conditions; Among them, N(P1) is the number of non-zero neighbors of P1, S(P1) is the number of times its value changes from 0 to 1 in the order of P2, P3, P4, P5, P6, P7, P8, and P9, and B(P1) is the binary code value of the eight neighborhood points of P1.
4. The method for obtaining location information of famous and high-quality tea picking points based on machine vision according to claim 3 is characterized in that: The step 6 includes: Suppose the pixel coordinates of a point in the window are (x, y), the movement amount is (Δx, Δy), and the grayscale is I, then the grayscale change is: Where the window function ω(x,y) is represented by a Gaussian function: Taylor expansion of the grayscale change function and ignoring the high-order terms yields: In the formula I x , I y Respectively represent the gradient values of the image grayscale in the x and y directions: Define the corner response function: R=min(λ1,λ2) Where λ1 and λ2 are the two eigenvalues of the matrix M; When R is greater than the threshold T0 and is a local maximum in its neighborhood, the point is a Shi-Tomasi feature corner point, and its coordinates (x′, y′) are output.
