A pomelo image recognition method for picking robots

By combining the color histogram, threshold segmentation method and morphological operation, combined with the seed filling and edge point extraction algorithm, the problem of Shatian pomelo recognition is solved, and efficient recognition in natural scenes is achieved, with strong adaptability and high recognition accuracy. .

CN114187254BActive Publication Date: 2024-09-27SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111483581.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-07
Publication Date
2024-09-27
Estimated Expiration
2041-12-07

AI Technical Summary

Technical Problem

It is difficult to identify Shatian pomelo in natural scenes. Due to the obstruction of branches and leaves, color interference and irregular fruit shape, it is difficult for existing technology to accurately identify the location and status of Shatian pomelo.

Method used

The color histogram is used to grayscale the image. The threshold segmentation method and morphological operation are combined. The seed filling method and the scan line filling method are used to process the image. The contour information of Shatian Pomelo is extracted based on edge points, and the edge point estimation optimization algorithm is used. Identify.

Benefits of technology

It improves the recognition accuracy and speed of pomelo, has strong adaptability, is sensitive to obstructions and color features, enhances the recognition success rate of occluded pomelo, and achieves efficient recognition in wild environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114187254B
    Figure CN114187254B
Patent Text Reader

Abstract

The invention discloses a pomelo image recognition method for a picking robot, comprising the following steps: graying the pomelo image with color difference components R / 4+3G / 4‑B for immature pomelo and 2R‑G‑B for mature pomelo; binarizing the grayscale image with a threshold segmentation method; performing morphological operations on the binary image to process image noise; marking connected regions, marking the region with a seed filling method, removing the region with a number of pixels less than #imgabs0#, and then dividing the region for the second time with a seed filling method; filling the region with a scan line filling method; obtaining discrete edge points, and then integrating the discrete points into a point chain in order to extract edges; obtaining the pomelo body circle and head circle shapes respectively according to an edge point estimation optimization algorithm, obtaining the overall contour information of the pomelo, performing image fitting, and obtaining the final pomelo recognition mark. The pomelo image recognition method of the invention has higher detection accuracy and can efficiently identify the position and state of the pomelo.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a pomelo image recognition method for a picking robot. Background Art

[0002] As a fruit harvesting tool, the fruit picking robot can effectively solve the problems of insufficient labor and high labor costs. Through automated picking, not only can the sanitary conditions of fruit picking be improved, but also the labor intensity of workers can be reduced and labor efficiency can be improved. The automated fruit picking robot uses mechanical automation to solve the problems of time-consuming, labor-intensive and expensive traditional fruit picking. The robot arm is used to replace manual operation. Among them, whether the information of fruit location and fruit shape can be successfully obtained is the key to fruit picking.

[0003] In agricultural machine vision systems, the recognition and positioning of pomelo is a key factor in determining the reliability and accuracy of pomelo picking robots, and is an important guarantee for the picking rate. In natural scenes, mature and unripe pomelo is not only affected by the occlusion of branches and leaves and the mutual occlusion of fruits, but its own color is also easily disturbed by the blue sky and green or yellow branches and leaves. How to identify pomelo in the wild environment has become a key problem that must be solved in the development of pomelo picking robots. Therefore, it is necessary to provide a method that is more accurate in detection and more efficient in identifying irregular fruits. Summary of the invention

[0004] The object of the present invention is to overcome the deficiencies of the prior art and to provide a pomelo image recognition method for a picking robot. The pomelo image recognition method has higher detection accuracy and can efficiently identify the position and state of the pomelo.

[0005] The technical solution of the present invention to solve the above technical problems is:

[0006] A pomelo image recognition method for a picking robot comprises the following steps:

[0007] (1) After obtaining the original image of the pomelo, the color histogram is used to grayscale the image of the mature and unripe pomelo using different color difference formulas to obtain a grayscale image;

[0008] (2) Use the threshold segmentation method to convert the grayscale Figure 2 Value to obtain a binary image;

[0009] (3) Perform morphological operations on binary images to process image noise;

[0010] (4) Mark the connected regions of the image after image noise processing, use the seed filling method to mark the region, and then remove the regions with less than 1 pixel point. The area is divided into two parts, and finally the seed filling method is used to divide the area for the second time;

[0011] (5) Use the seed filling method to fill the divided image, and then use the scan line filling method to fill the area;

[0012] (6) Perform edge extraction on the image after region filling to obtain discrete edge points, then integrate the discrete edge points into point chains in order and perform edge extraction again;

[0013] (7) According to the edge point estimation optimization algorithm, the body circular shape contour information and the head circular shape contour information of the pomelo are obtained respectively, and then the whole contour information of the pomelo is obtained by integration, and then the image fitting is performed to obtain the final pomelo identification mark.

[0014] Preferably, in step (1), the grayscale conversion of the image of the mature pomelo and the immature pomelo using different color difference formulas comprises the following steps:

[0015] (1-1) Use a color histogram for the original image to show the proportion of different colors in the entire image;

[0016] (1-2) Analyze the color histogram and find the grayscale image with obvious double peaks. Use the formula gray = 2R-GB, where gray refers to the grayscale value and R, G, and B refer to the three primary colors of red, green, and blue, respectively; to distinguish the ripe pomelo with a large red component from the background; use the formula gray = 0.25R + 0.75GB to distinguish the unripe pomelo with a small red component and mixed with a large amount of green component from the background.

[0017] Preferably, in step (2), the threshold segmentation method comprises the following steps:

[0018] (2-1) Establish a grayscale histogram of the grayscale image and count the frequency of occurrence of each grayscale;

[0019] (2-2) Calculate the probability of background A and target B appearing; Calculate the inter-class variance of the background A and target B regions;

[0020] (2-3) Compare the inter-class variances corresponding to each threshold, and select the threshold t corresponding to the maximum inter-class variance as the optimal threshold;

[0021] (2-4) Set the points greater than the threshold t to 255 and the points less than the threshold t to 0 to achieve edge segmentation.

[0022] Preferably, in step (2-4), the edge segmentation adopts the Sobel operator detection method, comprising the following steps:

[0023] (2-41) Use the 3×3 template as the kernel to perform convolution and operation with each pixel in the image;

[0024] (2-42), select the threshold t to extract the edge and separate the adhesion boundaries;

[0025] (2-43) Set the grayscale values ​​of all pixels belonging to the boundary to 0 to obtain the background.

[0026] Preferably, in step (3), the strategy of the morphological operation is: first perform 3 corrosions and then perform 3 dilations to absorb and eliminate smaller particle-type image noise, reduce the image noise left over from the threshold segmentation, and increase the accuracy of subsequent operations.

[0027] Preferably, in step (4), the connected region labeling comprises the following steps:

[0028] (4-1) Scan the image line by line, select an unmarked pixel in the foreground as a seed point, mark the seed point, and add it to the queue;

[0029] (4-2) Remove the seed point from the queue, check the eight neighbors of the seed point, mark the neighboring points that are also foreground points, and add them to the queue as new seed points;

[0030] (4-3) If the queue is not empty, repeat step (4-2); if the queue is empty, continue to scan the image to find the next unmarked foreground as the seed point of the next connected area; if found, continue with steps (4-2) and (4-3); if not found, end the algorithm;

[0031] (4-4) Eliminate the interference of irrelevant small blocks, perform a connected area statistics, calculate the number of regions n whose pixel values ​​are greater than or equal to the total number of pixels in the image / 8, and the total number of pixels N in the target area counted initially;

[0032] (4-5) Set the threshold The grayscale values ​​of all pixels in the area smaller than the threshold T are set to 0 and classified as background;

[0033] (4-6) Then use the seed filling method to mark the area for the second time.

[0034] Preferably, in step (5), the steps of using the seed filling method to fill the area are: selecting a background point as a seed; then using the seed filling method to fill the background as the foreground color; then inverting the image; and finally adding the inverted image to the original binary image to achieve hole filling.

[0035] Preferably, in step (5), the step of refilling the area using the scan line filling method is:

[0036] (5-1) Use horizontal scan lines and vertical scan lines to perform seed filling, wherein the horizontal scan line filling step is: scan each row of the image to obtain the leftmost point and the rightmost point of the region in the row; mark all points between the leftmost point and the rightmost point as the region; the vertical scan line filling step is: scan each column of the image to obtain the highest point and the lowest point; mark all points between the highest point and the lowest point as the region;

[0037] (5-2) When the angle between the side of the head of the pomelo and the horizontal line is greater than 63°, fill in with oblique scan lines, including the following steps: detect from the top of the image whether the oblique lines with slope angles of 63° and 117° intersect with the image and whether there are two intersection points; if so, find the two intersection points and mark all points between the two intersection points as area points.

[0038] Preferably, in step (6), the edge extraction comprises the following steps:

[0039] (6-1) The first stage is to obtain discrete edge points, including the following steps:

[0040] (6-11) When performing contour extraction, a one-dimensional array is used to record the information of the eight neighborhoods around the processed pixel point;

[0041] (6-12) If the gray value of a pixel is 0 and the gray values ​​of the pixels in the eight neighborhoods are the same as the gray value of the central pixel, the pixel is considered to be inside the image and should be deleted; otherwise, the pixel is considered to be at the edge of the image and needs to be retained;

[0042] (6-13), process each pixel in the image in sequence according to step (6-12), and the remaining part is the outline of the image;

[0043] (6-2) The second stage integrates the discrete edge points into point chains in sequence, including the following steps:

[0044] (6-21) Find the pixel point P whose number of points in the eight-neighborhood region is equal to 2, and add point P to the queue as a seed;

[0045] (6-22) Set a father node attribute and a step attribute dist for each pixel. The step of the first pixel is 1, the step interval is d, and the step of its father node is dist=d+1;

[0046] (6-23) The pixel in the queue is dequeued, denoted as Q, and the eight-neighborhood of the dequeued point is searched. If there is a pixel R that belongs to the edge point of the region, Q is set as the father node of R, R.dist = Q.dist + 1, and the pixel R is enqueued;

[0047] (6-24) Repeat the dequeue step (6-23) until the queue is empty.

[0048] Preferably, in step (7), the edge point estimation optimization algorithm includes the following steps:

[0049] (7-1) According to the regional information of the pomelo, the top, bottom, leftmost and rightmost points of the pomelo region are scanned, wherein the topmost point is top(x1, y1), the bottommost point is bottom(x2, y2), the leftmost point is left(x3, y3), and the rightmost point is right(x4, y4);

[0050] (7-2) Calculate the distance d between the left and right positions, where:

[0051]

[0052] According to the ratio of the head circle radius to the body circle radius of 0.44, the body circle radius R = d / 2, and the head circle radius r = 0.44 × R;

[0053] (7-3) Calculate the center of the body circle (Rx, Ry), where Ry = y2 + R, Rx = (x3 + x4) / 2;

[0054] (7-4) Calculate the center of the head circle (rx, ry), and adjust the position of the head circle based on the fact that the head of the pomelo is above its body; β = Rx-R, then the straight line y = β is a tangent line above the body circle; calculate the average value xa of the horizontal coordinates of all pixel points above the straight line y = β in the pomelo area, and use it as the horizontal coordinate rx = xa of the center of the head circle. Substitute rx = xa into the circle equation to obtain the vertical coordinate ry:

[0055]

[0056] (7-5) Draw the outline of the pomelo;

[0057] (7-6) Establish a mathematical model of the pomelo morphology, find the common tangent line between the head circle and the body circle of the pomelo, and adjust to obtain the final pomelo recognition effect diagram.

[0058] Compared with the prior art, the present invention has the following beneficial effects:

[0059] 1. The pomelo image recognition method for a picking robot of the present invention adopts an adaptive threshold segmentation method based on color difference features and an edge point estimation optimization algorithm for target recognition, and has the characteristics of fast recognition speed, strong adaptability to occlusions, and sensitivity to color features.

[0060] 2. The area filling method of the pomelo image recognition method for a picking robot of the present invention is based on the shape of most pomelo, adjusts the filling angle of the scanning line, and then fills the blocked part of the pomelo, which greatly improves the recognition success rate of the blocked pomelo.

[0061] 3. The pomelo image recognition method for a picking robot of the present invention applies the maze path finding algorithm to extract the pomelo contour point chain. This method can quickly traverse and obtain the connection between the pomelo contour points, laying a good foundation for the feature extraction, subsequent processing, and morphological fitting of the pomelo.

[0062] 4. The pomelo image recognition method for a picking robot of the present invention takes the two axes of the pomelo as the basis of the pomelo shape, and then uses experiments to obtain the shape proportion of the pomelo, finds the position of the head and body of the pomelo, and then uses two circles and their common tangents to fit the shape of the pomelo. This restoration method based on the edge point estimation optimization algorithm proves to be a restoration degree of the original posture of the pomelo that does not depend on the sample points, showing good results.

[0063] 5. The pomelo image recognition method for a picking robot of the present invention has higher detection accuracy and can efficiently identify the position and state of the pomelo, so that the picking robot can accurately pick mature pomelo. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 It is a flow chart of the pomelo image recognition method for a picking robot of the present invention.

[0065] Figure 2 It is a schematic diagram of the hardware equipment used in the pomelo image recognition method for picking robots of the present invention.

[0066] Figure 3 It is a flowchart of the edge point estimation optimization algorithm.

[0067] Among them: 1—images of pomelo in the wild; 2—computer; 3—digital camera. DETAILED DESCRIPTION

[0068] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.

[0069] See also Figure 1-Figure 3The pomelo image recognition method for a picking robot of the present invention comprises the following steps:

[0070] (1) After obtaining the original image of the pomelo, the color histogram is used to grayscale the image of the mature and unripe pomelo using different color difference formulas to obtain a grayscale image;

[0071] (2) Use the threshold segmentation method to convert the grayscale Figure 2 Value to obtain a binary image;

[0072] (3) Perform morphological operations on binary images to process image noise;

[0073] (4) Mark the connected regions of the image after image noise processing, use the seed filling method to mark the region, and then remove the regions with less than 1 pixel point. The area is divided into two parts, and finally the seed filling method is used to divide the area for the second time;

[0074] (5) Use the seed filling method to fill the divided image, and then use the scan line filling method to fill the area;

[0075] (6) Perform edge extraction on the image after region filling to obtain discrete edge points, then integrate the discrete edge points into point chains in order and perform edge extraction again;

[0076] (7) According to the edge point estimation optimization algorithm, the body circular shape contour information and the head circular shape contour information of the pomelo are obtained respectively, and then the whole contour information of the pomelo is obtained by integration, and then the image fitting is performed to obtain the final pomelo identification mark.

[0077] See also Figure 1-Figure 3 In step (1), the grayscale conversion of the image of the mature pomelo and the immature pomelo using different color difference formulas includes the following steps:

[0078] (1-1) Use a color histogram for the original image to show the proportion of different colors in the entire image;

[0079] (1-2) Analyze the color histogram and find the grayscale image with obvious double peaks. Use the formula gray = 2R-GB, where gray refers to the grayscale value and R, G, and B refer to the three primary colors of red, green, and blue, respectively; to distinguish the ripe pomelo with a large red component from the background; use the formula gray = 0.25R + 0.75GB to distinguish the unripe pomelo with a small red component and mixed with a large amount of green component from the background.

[0080] See also Figure 1-Figure 3 In step (2), the threshold segmentation method includes the following steps:

[0081] (2-1) Establish a grayscale histogram of the grayscale image and count the frequency of occurrence of each grayscale;

[0082] (2-2) Calculate the probability of background A and target B appearing; Calculate the inter-class variance of the background A and target B regions;

[0083] (2-3) Compare the inter-class variances corresponding to each threshold, and select the threshold t corresponding to the maximum inter-class variance as the optimal threshold;

[0084] (2-4) Set the points greater than the threshold t to 255 and the points less than the threshold t to 0 to achieve edge segmentation.

[0085] See also Figure 1-Figure 3 In step (2-4), the edge segmentation adopts the Sobel operator detection method, including the following steps:

[0086] (2-41) Use the 3×3 template as the kernel to perform convolution and operation with each pixel in the image;

[0087] (2-42), select the threshold t to extract the edge and separate the adhesion boundaries;

[0088] (2-43) Set the grayscale values ​​of all pixels belonging to the boundary to 0 to obtain the background.

[0089] See also Figure 1-Figure 3 In step (3), the strategy of the morphological operation is: first perform 3 corrosions and then perform 3 dilations to absorb and eliminate the image noise of smaller particles, reduce the image noise left over from the threshold segmentation, and increase the accuracy of subsequent operations.

[0090] See also Figure 1-Figure 3 In step (4), the connected area marking includes the following steps:

[0091] (4-1) Scan the image line by line, select an unmarked pixel in the foreground as a seed point, mark the seed point, and add it to the queue;

[0092] (4-2) Remove the seed point from the queue, check the eight neighbors of the seed point, mark the neighboring points that are also foreground points, and add them to the queue as new seed points;

[0093] (4-3) If the queue is not empty, repeat step (4-2); if the queue is empty, continue to scan the image to find the next unmarked foreground as the seed point of the next connected area; if found, continue with steps (4-2) and (4-3); if not found, end the algorithm;

[0094] (4-4) Eliminate the interference of irrelevant small blocks, perform a connected area statistics, calculate the number of regions n whose pixel values ​​are greater than or equal to the total number of pixels in the image / 8, and the total number of pixels N in the target area counted initially;

[0095] (4-5) Set the threshold The grayscale values ​​of all pixels in the area smaller than the threshold T are set to 0 and classified as background;

[0096] (4-6) Then use the seed filling method to mark the area for the second time.

[0097] See also Figure 1-Figure 3 In step (5), the steps of using the seed filling method to fill the area are: select a background point as a seed; then use the seed filling method to fill the background as the foreground color; then invert the image; finally, add the inverted image to the original binary image to achieve hole filling.

[0098] See also Figure 1-Figure 3 In step (5), the steps of refilling the area using the scan line filling method are:

[0099] (5-1) Use horizontal scan lines and vertical scan lines to perform seed filling, wherein the horizontal scan line filling step is: scan each row of the image to obtain the leftmost point and the rightmost point of the region in the row; mark all points between the leftmost point and the rightmost point as the region; the vertical scan line filling step is: scan each column of the image to obtain the highest point and the lowest point; mark all points between the highest point and the lowest point as the region;

[0100] (5-2) When the angle between the side of the head of the pomelo and the horizontal line is greater than 63°, fill in with oblique scan lines, including the following steps: detect from the top of the image whether the oblique lines with slope angles of 63° and 117° intersect with the image and whether there are two intersection points; if so, find the two intersection points and mark all points between the two intersection points as area points.

[0101] See also Figure 1-Figure 3 In step (6), the edge extraction includes the following steps:

[0102] (6-1) The first stage is to obtain discrete edge points, including the following steps:

[0103] (6-11) When performing contour extraction, a one-dimensional array is used to record the information of the eight neighborhoods around the processed pixel point;

[0104] (6-12) If the gray value of a pixel is 0 and the gray values ​​of the pixels in the eight neighborhoods are the same as the gray value of the central pixel, the pixel is considered to be inside the image and should be deleted; otherwise, the pixel is considered to be at the edge of the image and needs to be retained;

[0105] (6-13), process each pixel in the image in sequence according to step (6-12), and the remaining part is the outline of the image;

[0106] (6-2) The second stage integrates the discrete edge points into point chains in sequence, including the following steps:

[0107] (6-21) Find the pixel point P whose number of points in the eight-neighborhood region is equal to 2, and add point P to the queue as a seed;

[0108] (6-22) Set a father node attribute and a step attribute dist for each pixel. The step of the first pixel is 1, the step interval is d, and the step of its father node is dist=d+1;

[0109] (6-23) The pixel in the queue is dequeued, denoted as Q, and the eight-neighborhood of the dequeued point is searched. If there is a pixel R that belongs to the edge point of the region, Q is set as the father node of R, R.dist = Q.dist + 1, and the pixel R is enqueued;

[0110] (6-24) Repeat the dequeue step (6-23) until the queue is empty.

[0111] See also Figure 1 In step (7), the edge point estimation optimization algorithm includes the following steps:

[0112] (7-1) According to the regional information of the pomelo, the top, bottom, leftmost and rightmost points of the pomelo region are scanned, wherein the topmost point is top(x1, y1), the bottommost point is bottom(x2, y2), the leftmost point is left(x3, y3), and the rightmost point is right(x4, y4);

[0113] (7-2) Calculate the distance d between the left and right positions, where:

[0114]

[0115] According to the ratio of the head circle radius to the body circle radius of 0.44, the body circle radius R = d / 2, and the head circle radius r = 0.44 × R;

[0116] (7-3) Calculate the center of the body circle (Rx, Ry), where Ry = y2 + R, + Rx = (x3 + x4) / 2;

[0117] (7-4) Calculate the center of the head circle (rx, ry), and adjust the position of the head circle based on the fact that the head of the pomelo is above its body; β = Rx-R, then the straight line y = β is a tangent line above the body circle; calculate the average value xa of the horizontal coordinates of all pixel points above the straight line y = β in the pomelo area, and use it as the horizontal coordinate rx = xa of the center of the head circle. Substitute rx = xa into the circle equation to obtain the vertical coordinate ry:

[0118]

[0119] (7-5) Draw the outline of the pomelo;

[0120] (7-6) Establish a mathematical model of the pomelo morphology, find the common tangent line between the head circle and the body circle of the pomelo, and adjust to obtain the final pomelo recognition effect diagram.

[0121] Specific implementation cases

[0122] See also Figure 1-Figure 3 The present invention provides a method for recognizing the pomelo image for a picking robot, which includes the following six aspects: 1. Using a threshold to convert the grayscale Figure 2 1. Value conversion; 2. Morphological operation processing; 3. Marking connected areas; 4. Region filling; 5. Edge extraction; 6. Image fitting.

[0123] 1. Use the threshold to convert grayscale Figure 2 Value

[0124] In this experiment, a color digital camera 3 is used to collect images 1 of pomelo grown in different field environments and obtain digital images, wherein the types of pomelo include mature pomelo and immature pomelo.

[0125] In this process, since there is a lot of redundant information in the collected RGB images, the original true color images need to be converted into grayscale images. And after analyzing the color histogram, the red, green, and blue components of mature and unripe pomelo have different contributions to color information; therefore, this experiment uses the formula gray=R / 4+3G / 4-B for unripe pomelo and the formula gray=2R-GB for ripe pomelo to complete the grayscale conversion of the image and distinguish the pomelo from the background.

[0126] After graying, the image threshold segmentation method is particularly effective in images with strong contrast between the object and the background. This experiment uses the adaptive threshold method to select an appropriate threshold t, set points greater than the threshold t as the foreground, and points less than the threshold t as the background to achieve segmentation. And according to the specific situation, when calculating the threshold of mature pomelo, this experiment increases the threshold by 5 gray levels to achieve a better segmentation effect.

[0127] Because the edge is an important basis for image analysis such as image segmentation, texture features and shape features, this experiment uses the Sobel operator to obtain some edges. In the process of algorithm implementation, the 3×3 template is used as the kernel to perform convolution and operation with each pixel in the image, and then a suitable threshold is selected to extract the edge. Due to the interference of lighting and other similar colors, the edge is not a continuous curve and has a lot of noise when the target boundary is directly obtained by using the edge. Therefore, the edge obtained by the Sobel operator is also set as the background to separate the background that is glued to the target image.

[0128] 2. Morphological operation processing

[0129] For the binary image, morphological operations are used for auxiliary processing. First, 3 corrosions are performed, and then 3 dilations are performed; this can absorb and eliminate the noise of smaller particles, reduce the noise left by threshold segmentation, and increase the accuracy of subsequent operations.

[0130] 3. Marking connected areas

[0131] In order to detect connected areas in a binary image, it is necessary to mark the grapefruit (Shatian pomelo) area. In order to avoid multiple Shatian pomeloes in the image, that is, multiple connected areas, the scanning of seed points is added to the original region growth, that is, the seed filling method is used to mark the connected areas. In order to detect connected areas in a binary image, the number of pixels in each connected area is calculated, and the number of pixels is less than The area (N is the total number of pixels in the entire image, and n is the number of connected areas counted for the first time) is classified as the background to eliminate the influence of small noises, and then the connected areas are marked again.

[0132] 4. Area filling

[0133] After segmentation, some holes will appear in the image, or the target will be blocked internally and have gaps. In order to avoid these holes and gaps from having a negative impact on subsequent processing, this experiment performs area filling. First, the seed filling method is used, then the vertical scan line and horizontal scan line are used for seed filling, and finally the oblique scan line filling is performed. This can greatly increase the accuracy of subsequent edge extraction and grapefruit fitting.

[0134] 5. Edge extraction

[0135] In order to extract the contour of the pomelo image, this experiment extracts the edge, that is, first extract the edge points, and then use the breadth-first algorithm and the idea of ​​searching the feasible path of the maze to find the edge loop and form an ordered edge point chain.

[0136] 6. Image fitting

[0137] In the case where it is difficult to fit without obtaining a point chain, this experiment found that the body of the pomelo occupies most of the area of ​​the pomelo and contains a large amount of information. In addition, in most pomelo images, the head is at the top and the body is at the bottom, and the ratio of the head circle radius to the body circle radius is about 0.44. If it is assumed that the head is always at the top, the overall information of the pomelo can be inferred from the body information. Based on this feature, this experiment proposes to restore the posture of the pomelo based on the edge point estimation optimization algorithm.

[0138] The hardware equipment for this experiment is InterCorei5-4200M@2.50GHzx8 CPU and 4GB memory. Due to the powerful matrix computing ability of Matlab, it is the first choice for digital image processing recorded with pixel matrix. The main interface written by Matlab includes histogram display and the acquisition of various operator boundaries. Since this experiment requires structured algorithms (such as edge point chain algorithms) and Java can process threshold segmentation algorithms step by step, different color difference components can also be selected to segment images. Therefore, this experiment uses Matlab and Java as development languages. Therefore, the development platform selected for this experiment is EclipseLunaServiceRelease2(4.4.2), JDK1.8.0_51, and MatlabR2015a.

[0139] The idea flow of Shatian pomelo recognition based on the threshold segmentation algorithm and edge point estimation optimization algorithm based on color difference features was summarized and sorted out. This experiment identified 110 pictures containing only one Shatian pomelo and 24 pictures containing multiple Shatian pomeloes, a total of 59 Shatian pomelo areas. The experiment showed that 80 of the 110 selected samples could accurately find the correct picking position, and the experimental effect was relatively ideal. The following table lists some statistical data:

[0140]

[0141] Furthermore, the statistical results of the identification of mature and unripe grapefruits are shown in the following table:

[0142]

[0143] The experiment found that the recognition rate of a single image of a ripe grapefruit was 9.27% ​​lower than that of a single image of an unripe grapefruit. After analyzing the grayscale image segmentation of the two, it was found that this difference came from the influence of the light intensity and angle when the image was collected. The recognition rate of multiple images of ripe grapefruits was much higher than that of multiple images of unripe grapefruits. The reason was simply that among the multiple grapefruit images collected, most of the ripe ones were scattered, while the unripe grapefruit images were mostly stuck together.

[0144] In order to analyze the time efficiency of the algorithm, this experiment extracts 50 grapefruit images (pixels are 600*400 and 600*900) for recognition each time, and calculates the average time of each step, and conducts 20 experiments. The running time of each part is shown in the following table:

[0145]

[0146] The above is a preferred embodiment of the present invention, but the embodiment of the present invention is not limited to the above content. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A pomelo image recognition method for a picking robot, characterized in that: The following steps are involved: (1) After obtaining the original image of the pomelo, using the color histogram, graying the image of the mature and immature pomelo using different color difference formulas to obtain a grayscale image; wherein the graying of the image of the mature and immature pomelo using different color difference formulas comprises the following steps: (1-1) Use a color histogram for the original image to show the proportion of different colors in the entire image; (1-2) Analyze the color histogram and find the grayscale image with obvious double peaks. Use the formula gray = 2R-GB, where gray refers to the grayscale value and R, G, and B refer to the three primary colors of red, green, and blue respectively; to distinguish the ripe pomelo with more red components from the background; use the formula gray = 0.25R + 0.75GB to distinguish the unripe pomelo with less red components and mixed with a large amount of green components from the background; (2) Use the threshold segmentation method to binarize the grayscale image to obtain a binary image; (3) Perform morphological operations on binary images to process image noise; (4) Mark the connected regions of the image after image noise processing, calculate the number of regions n whose pixel values ​​are greater than or equal to the total number of pixels in the image divided by 8, and the total number of pixels N in the target region counted initially; mark the regions using the seed filling method, and then remove the regions with pixel points less than Finally, the seed filling method is used to divide the area for the second time; (5) Using the seed filling method to fill the divided image, and then using the scan line filling method to fill the area; wherein the steps of filling the area again using the scan line filling method are: (5-1) Use horizontal scan lines and vertical scan lines to perform seed filling, wherein the horizontal scan line filling step is: scan each row of the image to obtain the leftmost point and the rightmost point of the region in the row; mark all points between the leftmost point and the rightmost point as the region; the vertical scan line filling step is: scan each column of the image to obtain the highest point and the lowest point; mark all points between the highest point and the lowest point as the region; (5-2) When the angle between the side of the head of the pomelo and the horizontal line is greater than 63°, fill with oblique scanning lines, including the following steps: detect from the top of the image whether oblique lines with slope angles of 63° and 117° intersect with the image and whether there are two intersection points; if so, find the two intersection points, and mark all points between the two intersection points as region points; (6) Perform edge extraction on the image after region filling to obtain discrete edge points, then integrate the discrete edge points into point chains in order and perform edge extraction again; (7) According to the edge point estimation optimization algorithm, the body circular shape contour information and the head circular shape contour information of the pomelo are obtained respectively, and then the whole contour information of the pomelo is obtained by integration, and then the image fitting is performed to obtain the final pomelo identification mark.

2. The pomelo image recognition method for a picking robot according to claim 1, characterized in that: In step (2), the threshold segmentation method includes the following steps: (2-1) Establish a grayscale histogram of the grayscale image and count the frequency of occurrence of each grayscale; (2-2) Calculate the probability of background A and target B appearing; Calculate the inter-class variance of the background A and target B regions; (2-3) Compare the inter-class variances corresponding to each threshold, and select the threshold t corresponding to the maximum inter-class variance as the optimal threshold; (2-4) Set the points greater than the threshold t to 255 and the points less than the threshold t to 0 to achieve edge segmentation.

3. The pomelo image recognition method for a picking robot according to claim 2, characterized in that: In step (2-4), the edge segmentation adopts the Sobel operator detection method, including the following steps: (2-41) Use the 3×3 template as the kernel to perform convolution and operation with each pixel in the image; (2-42), select the threshold t to extract the edge and separate the adhesion boundaries; (2-43) Set the grayscale values ​​of all pixels belonging to the boundary to 0 to obtain the background.

4. The pomelo image recognition method for a picking robot according to claim 1, characterized in that: In step (3), the strategy of the morphological operation is: first perform 3 times of corrosion, then perform 3 times of expansion, absorb and eliminate the image noise of smaller particles, reduce the image noise left in the threshold segmentation, and increase the accuracy of subsequent operations.

5. The pomelo image recognition method for a picking robot according to claim 1, characterized in that: In step (4), the connected area labeling includes the following steps: (4-1) Scan the image line by line, select an unmarked pixel in the foreground as a seed point, mark the seed point, and add it to the queue; (4-2) Remove the seed point from the queue, check the eight neighbors of the seed point, mark the neighboring points that are also foreground points, and add them to the queue as new seed points; (4-3) If the queue is not empty, repeat step (4-2); if the queue is empty, continue to scan the image to find the next unmarked foreground as the seed point of the next connected area; if found, continue with steps (4-2) and (4-3); if not found, end the algorithm; (4-4) Eliminate the interference of irrelevant small blocks, perform a connected area statistics, calculate the number of areas n whose pixel values ​​are greater than or equal to the total number of pixels in the image divided by 8, and the total number of pixels N in the target area counted initially; (4-5) Set the threshold , set the grayscale value of all pixels in the area smaller than the threshold T to 0 and classify them as background; (4-6) Then use the seed filling method to mark the area for the second time.

6. The pomelo image recognition method for a picking robot according to claim 1, characterized in that: In step (5), the steps of using the seed filling method to fill the area are: select a background point as a seed; then use the seed filling method to fill the background as the foreground color; then invert the image; finally, add the inverted image to the original binary image to achieve hole filling.

Citation Information

Patent Citations

  • Method for automatic contour extraction of a cardiac image

    US5457754A

  • Ultrasound image lesion describing method and apparatus, computer device, and storage medium

    WO2021129323A1