Broad bean pod parameter analysis method, system and device based on machine vision
Through machine vision-based methods, various parameters of broad bean pods are automatically measured, solving the problems of low efficiency and poor accuracy of traditional manual measurement, and achieving efficient and automated parameter analysis.
Patent Information
- Application Number
- CN202411626659.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, the measurement of broad bean pod parameters mainly relies on manual measurement, and there are problems such as high time, labor and economic costs, low accuracy, large errors in repeated measurements, high difficulty and low efficiency.
Using a machine vision-based method, the original image of the broad bean pod is obtained and pre-processed, RGB images and binary images of the broad bean pod are extracted. Combined with image processing technology, various parameters of the broad bean pods are extracted, including the number of grains, gap distance, phenotype, shape and morphological parameters.
The automated and efficient measurement of broad bean pod parameters is realized, which avoids problems such as low efficiency and poor accuracy of manual measurement, and significantly improves the efficiency of parameter analysis.
Smart Images

Figure CN119540270A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine vision, and in particular to a method, system and device for analyzing broad bean pod parameters based on machine vision. Background Art
[0002] Broad bean pod parameters mainly include the length, width, area, convex arc length, concave arc length, chord length, bending angle, number of seeds, seed spacing, seed gap, uniformity of broad bean pod shape and length of the central axis. Analyzing various parameters of broad bean pods can optimize broad bean breeding programs and guide the development of new varieties. In the prior art, the measurement of broad bean pod parameters is mainly achieved through manual measurement. However, the traditional manual measurement method consumes a lot of time, manpower and economic costs, which can no longer meet the needs of the rapid development of today's construction industry. In addition, the traditional manual measurement method has the defects of low precision, large repeated measurement errors, high difficulty and low efficiency.
[0003] With the development of machine vision technology, it can quickly obtain a large amount of information and is easy to process automatically. It is also easy to integrate with design information and processing control information, improve the flexibility and automation of production, and is widely used in quality inspection, working condition monitoring and finished product inspection. However, there are many problems in measuring the parameters of broad bean pods through machine vision technology: the design and installation based on machine vision technology requires a high level of technology and high maintenance costs; because machine vision technology involves complex computer technologies such as image processing, there are certain difficulties in data analysis, and in some cases it cannot even provide enough information to determine the root cause of the problem. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a method, system and device for analyzing broad bean pod parameters based on machine vision.
[0005] In order to solve the above technical problems, the present invention is solved by the following technical solutions:
[0006] A method for analyzing broad bean pod parameters based on machine vision, wherein the broad bean pod parameters at least include broad bean seed parameters, broad bean pod phenotypic parameters, broad bean pod shape parameters and broad bean pod morphological parameters, comprising the following steps:
[0007] Obtaining an original image of a broad bean pod and preprocessing it to obtain an RGB image of the broad bean pod and a binary image of the broad bean pod, wherein the original image of the broad bean pod is an original image of the broad bean pod obtained when light penetrates the broad bean pod;
[0008] Processing the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtaining the number of seeds and the distance between the seeds based on the gap area;
[0009] Extract the broad bean pod outline based on the broad bean pod binary image, perform minimum bounding rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtain the seed spacing based on the minimum bounding rectangle, and obtain the broad bean pod phenotypic parameters based on the minimum bounding rectangle and polygonal outline fitting;
[0010] The endpoints of the broad bean pod are determined based on the minimum circumscribed rectangle, and the convex arc and concave arc of the broad bean pod are determined according to the endpoints of the broad bean pod, thereby obtaining the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length;
[0011] The broad bean pod width histogram was obtained based on the convex arc length and the concave arc length, and the broad bean pod morphological parameters were obtained through the broad bean pod width histogram, including the degree of broad bean pod curvature, the mean value of broad bean pod width, the uniformity of broad bean pod and the length of the central axis of broad bean pod.
[0012] As an implementable method, the method of obtaining the original image of broad bean pods and preprocessing it to obtain the broad bean pods RGB image and the broad bean pods binary image includes the following steps:
[0013] Obtaining the original image of broad bean pods and extracting the regional image containing the broad bean pods to obtain the broad bean pod regional image;
[0014] Performing image enhancement processing on the broad bean pod region image to obtain an enhanced broad bean pod image;
[0015] Performing filtering on the enhanced broad bean pod image to obtain a filtered broad bean pod image;
[0016] Performing image edge detection on the filtered broad bean pod image to obtain edge information of the broad bean pod and then segmenting the broad bean pod RGB image;
[0017] The broad bean pod RGB image is gray-scaled and binarized to obtain the broad bean pod binary image.
[0018] As an implementable method, the processing of the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod includes the following steps:
[0019] Separating the green channel of the broad bean pod RGB image and drawing it into a preset blank image with 0 pixels to obtain a first image;
[0020] The first image is subjected to noise reduction processing to obtain the gap area between each seed in the broad bean pod.
[0021] As an implementable method, obtaining the number of grains and the distance between grains based on the gap area includes the following steps:
[0022] Counting the number of gap areas to obtain the number of gap areas in broad bean pods, and calculating based on the number of gap areas in broad bean pods to obtain the number of grains, where the number of grains is the number of gap areas in broad bean pods + 1;
[0023] Based on the first image, extract the gap area contour and obtain a contour point set;
[0024] Perform least square straight line fitting on the contour point set to obtain a fitting straight line, calculate two intersection points of the fitting straight line and the contour of the gap area, namely the first intersection point and the second intersection point, and calculate the perpendicular midline of the line segment formed by the first intersection point and the second intersection point;
[0025] The two intersection points of the perpendicular median line and the contour of the gap area are calculated, namely the third intersection point and the fourth intersection point, and the distance between the third intersection point and the fourth intersection point is the grain gap distance.
[0026] As an implementable method, the broad bean pod grain parameters include at least the number of grains, the distance between the grains and the distance between the grains, and the broad bean pod phenotypic parameters include the circumference, area, pod length, pod width and bending angle.
[0027] As an implementable method, obtaining the seed spacing based on the minimum circumscribed rectangle includes the following steps:
[0028] Determine the first straight line and the second straight line where the two long sides of the minimum circumscribed rectangle are located based on the minimum circumscribed rectangle;
[0029] Segmenting the broad bean pod outline based on the fitting straight line to obtain a first outline, a second outline, a third outline and a fourth outline;
[0030] Draw perpendicular line segments to the first straight line based on the first contour and the second contour, draw perpendicular line segments to the second straight line based on the third contour and the fourth contour, calculate the distances of all perpendicular line segments and construct a perpendicular line segment height histogram, and then calculate the minimum value of the perpendicular line segment height histogram;
[0031] Determine the first convex point coordinate, the second convex point coordinate, the third convex point coordinate and the fourth convex point coordinate of the broad bean pod contour based on the minimum value;
[0032] The first midpoint coordinates of the first convex point coordinates and the second convex point coordinates are calculated, and the second midpoint coordinates of the third convex point coordinates and the fourth convex point coordinates are calculated. The distance between the first midpoint coordinates and the second midpoint coordinates is the grain spacing.
[0033] As an implementable method, the method of obtaining broad bean pod phenotypic parameters based on minimum circumscribed rectangle and polygonal contour fitting includes the following steps:
[0034] The contour length of the polygonal contour fitting is the circumference of the broad bean pod;
[0035] Calculate the contour area of the broad bean pod contour. Based on the contour area and perimeter, the area of the broad bean pod is obtained, which is expressed as follows:
[0036] The area of a broad bean pod = outline area + perimeter / 2;
[0037] The two long sides of the minimum circumscribed rectangle are the length of the broad bean pod;
[0038] Draw a perpendicular bisector for the long side of the minimum circumscribed rectangle, determine a first interactive intersection point and a second interactive intersection point of the perpendicular bisector and the outline of the broad bean pod, and the distance between the first interactive intersection point and the second interactive intersection point is the pod width of the broad bean pod;
[0039] Determine the midpoint of the first interactive intersection and the second interactive intersection, and use the midpoint as the vertex to construct an angle between the broad bean pod endpoint and the midpoint coordinates, wherein the angle is the broad bean pod bending angle.
[0040] As an implementable method, the method of determining the endpoints of the broad bean pod based on the minimum circumscribed rectangle, determining the convex arc and the concave arc of the broad bean pod according to the endpoints of the broad bean pod, and then obtaining the shape parameters of the broad bean pod includes the following steps:
[0041] Determine the third straight line and the fourth straight line where the two short sides of the minimum circumscribed rectangle are located, and respectively determine the closest points between the third straight line and the fourth straight line and the outline of the broad bean pod, wherein the closest points are the endpoints of the broad bean pod, and the distance between the endpoints of the broad bean pod is the chord length of the broad bean pod;
[0042] Determine the straight line where the broad bean pod endpoints are located based on the broad bean pod endpoints and determine the perpendicular bisector of the straight line;
[0043] Determine two intersection points of the perpendicular median line and the outline of the broad bean pod, and respectively calculate the distances between the two intersection points and the perpendicular median line, i.e., a first distance and a second distance;
[0044] Determine the midpoint of the two intersections, and use the midpoint as a vertex to construct an angle between the broad bean pod endpoint and the midpoint coordinates, wherein the angle is the broad bean pod bending angle;
[0045] Determine the length of the first distance and the second distance. The semi-arc where the short distance is located is the concave arc of the broad bean pod, and the semi-arc where the long distance is located is the convex arc of the broad bean pod;
[0046] Polygonal contour fitting is performed on the concave arc and convex arc of the broad bean pod respectively, and the contour length of the corresponding polygonal contour fitting is the concave arc length and convex arc length of the broad bean pod.
[0047] As an implementable method, the method of obtaining a broad bean pod width histogram based on the convex arc length and the concave arc length, and obtaining broad bean pod morphological parameters through the broad bean pod width histogram comprises the following steps:
[0048] Extract all points of the concave arc to form a concave arc point set and all points of the convex arc to form a convex arc point set;
[0049] Traverse each concave arc point in the concave arc point set in turn and calculate the tangent slope of each concave arc point, calculate the perpendicular line corresponding to the concave arc point according to each concave arc point and the corresponding tangent slope, and determine the third interactive intersection point of the perpendicular line and the convex arc point set;
[0050] Calculate the distance between the convex arc point set and the third interactive intersection point, construct a circle with the convex arc point as the center and the distance as the radius, and calculate the fourth interactive intersection point between the circle and the convex arc point set;
[0051] Calculate the shortest distance between all coordinate points and the concave arc point between the third interactive intersection point and the fourth interactive intersection point, the shortest distance is the broad bean pod width, and form a broad bean pod width set;
[0052] Constructing a broad bean pod width histogram based on the broad bean pod width, calculating the mean of the broad bean pod width histogram based on the broad bean pod width histogram, which is the broad bean pod width mean, and calculating the variance of the broad bean pod width histogram, which is the broad bean pod uniformity;
[0053] The central axis point set is established with the midpoint of the line segment where the width of the broad bean pod lies, and then the length of the central axis of the broad bean pod is obtained.
[0054] A machine vision-based broad bean pod parameter analysis system, comprising an acquisition preprocessing module, a first analysis module, a second analysis module, a third analysis module and a fourth analysis module;
[0055] The acquisition preprocessing module is used to acquire and preprocess the original image of the broad bean pod to obtain the broad bean pod RGB image and the broad bean pod binary image, wherein the original image of the broad bean pod is the original image of the broad bean pod obtained when light penetrates the broad bean pod;
[0056] The first analysis module is used to process the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtain the number of seeds and the distance between the seeds based on the gap area;
[0057] The second analysis module extracts the broad bean pod outline based on the broad bean pod binary image, performs minimum circumscribed rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtains the seed spacing based on the minimum circumscribed rectangle, and obtains the broad bean pod phenotypic parameters based on the minimum circumscribed rectangle and polygonal outline fitting;
[0058] The third analysis module determines the endpoints of the broad bean pod based on the minimum circumscribed rectangle, determines the convex arc and the concave arc of the broad bean pod according to the endpoints of the broad bean pod, and then obtains the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length;
[0059] The fourth analysis module obtains a broad bean pod width histogram based on the convex arc length and the concave arc length, and obtains broad bean pod morphological parameters through the broad bean pod width histogram, including the degree of broad bean pod curvature, the mean value of broad bean pod width, the uniformity of broad bean pods and the length of the central axis of the broad bean pods.
[0060] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following method is implemented:
[0061] Obtaining an original image of a broad bean pod and preprocessing it to obtain an RGB image of the broad bean pod and a binary image of the broad bean pod, wherein the original image of the broad bean pod is an original image of the broad bean pod obtained when light penetrates the broad bean pod;
[0062] Processing the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtaining the number of seeds and the distance between the seeds based on the gap area;
[0063] Extract the broad bean pod outline based on the broad bean pod binary image, perform minimum bounding rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtain the seed spacing based on the minimum bounding rectangle, and obtain the broad bean pod phenotypic parameters based on the minimum bounding rectangle and polygonal outline fitting;
[0064] The endpoints of the broad bean pod are determined based on the minimum circumscribed rectangle, and the convex arc and concave arc of the broad bean pod are determined according to the endpoints of the broad bean pod, thereby obtaining the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length;
[0065] The broad bean pod width histogram was obtained based on the convex arc length and the concave arc length, and the broad bean pod morphological parameters were obtained through the broad bean pod width histogram, including the degree of broad bean pod curvature, the mean value of broad bean pod width, the uniformity of broad bean pod and the length of the central axis of broad bean pod.
[0066] A machine vision-based broad bean pod parameter analysis device 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:
[0067] Obtaining an original image of a broad bean pod and preprocessing it to obtain an RGB image of the broad bean pod and a binary image of the broad bean pod, wherein the original image of the broad bean pod is an original image of the broad bean pod obtained when light penetrates the broad bean pod;
[0068] Processing the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtaining the number of seeds and the distance between the seeds based on the gap area;
[0069] Extract the broad bean pod outline based on the broad bean pod binary image, perform minimum bounding rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtain the seed spacing based on the minimum bounding rectangle, and obtain the broad bean pod phenotypic parameters based on the minimum bounding rectangle and polygonal outline fitting;
[0070] The endpoints of the broad bean pod are determined based on the minimum circumscribed rectangle, and the convex arc and concave arc of the broad bean pod are determined according to the endpoints of the broad bean pod, thereby obtaining the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length;
[0071] The broad bean pod width histogram was obtained based on the convex arc length and the concave arc length, and the broad bean pod morphological parameters were obtained through the broad bean pod width histogram, including the degree of broad bean pod curvature, the mean value of broad bean pod width, the uniformity of broad bean pod and the length of the central axis of broad bean pod.
[0072] The present invention has significant technical effects due to the adoption of the above technical solution:
[0073] The invention obtains an original image of a broad bean pod when light penetrates the broad bean pod and performs preprocessing to obtain an RGB image and a binary image of the broad bean pod, obtains broad bean pod seed parameters based on the RGB image, and obtains broad bean pod phenotypic parameters, broad bean pod shape parameters and broad bean pod morphological parameters based on the binary image of the broad bean pod; through machine vision technology, the problems of low efficiency, poor accuracy, high difficulty and the like existing in manual measurement are avoided; the parameter measurement and analysis process is automated and efficient, and the parameter analysis efficiency is greatly improved in combination with specific steps and methods corresponding to measuring various parameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] 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.
[0075] Figure 1 It is a schematic diagram of the overall process of the broad bean pod parameter analysis method of the present invention;
[0076] Figure 2 It is a structural schematic diagram of the pod parameter collection device of the present invention;
[0077] Figure 3 is a schematic diagram of a broad bean pod image according to an embodiment of the present invention;
[0078] Figure 4 is a schematic diagram of an RGB image of a broad bean pod according to an embodiment of the present invention;
[0079] Figure 5is a schematic diagram of a binary image of a broad bean pod according to an embodiment of the present invention;
[0080] Figure 6 Schematic diagram of the gap distance between broad bean pods and seeds according to an embodiment of the present invention;
[0081] Figure 7 is a schematic diagram of a vertical line segment height histogram of a broad bean pod according to an embodiment of the present invention;
[0082] Figure 8 is a schematic diagram of the distance between broad bean pods and seeds in an embodiment of the present invention;
[0083] Fig. 9 is a schematic diagram of the bending angle of a broad bean pod according to an embodiment of the present invention;
[0084] Fig.10 is a schematic diagram of a broad bean pod width histogram according to an embodiment of the present invention;
[0085] Fig.11 Schematic diagram of a central axis point set of a broad bean pod according to an embodiment of the present invention;
[0086] Fig.12 It is a schematic diagram of the overall structure of the broad bean pod parameter analysis system of the present invention. DETAILED DESCRIPTION
[0087] 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.
[0088] Embodiment 1:
[0089] A method for analyzing broad bean pod parameters based on machine vision, wherein the broad bean pod parameters at least include broad bean seed parameters, broad bean pod phenotypic parameters, broad bean pod shape parameters and broad bean pod morphological parameters, such as Figure 1 As shown, the following steps are included:
[0090] S100, obtaining an original image of a broad bean pod and performing preprocessing to obtain an RGB image of the broad bean pod and a binary image of the broad bean pod, wherein the original image of the broad bean pod is an original image of the broad bean pod obtained when light penetrates the broad bean pod;
[0091] S200, processing the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtaining the number of seeds and the distance between the seeds based on the gap area;
[0092] S300, extracting the broad bean pod outline based on the broad bean pod binary image, performing minimum circumscribed rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtaining the seed spacing based on the minimum circumscribed rectangle, and obtaining the broad bean pod phenotypic parameters based on the minimum circumscribed rectangle and polygonal outline fitting;
[0093] S400, determining the endpoints of the broad bean pod based on the minimum circumscribed rectangle, determining the convex arc and the concave arc of the broad bean pod according to the endpoints of the broad bean pod, and then obtaining the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length;
[0094] S500, obtaining a broad bean pod width histogram based on the convex arc length and the concave arc length, and obtaining broad bean pod morphological parameters through the broad bean pod width histogram, including broad bean pod curvature, broad bean pod width mean, broad bean pod uniformity and broad bean pod central axis length.
[0095] In step S100, the original image of the broad bean pod is the original image of the broad bean pod obtained when the light penetrates the broad bean pod, wherein the original image of the broad bean pod is obtained by a broad bean pod parameter acquisition device, and the broad bean pod parameter acquisition device is as follows: Figure 2 As shown, it includes a backlight plate 1, a light-transmitting plate 2, a camera bracket 3 and a camera 4. The backlight plate 1 can emit strong light of white or other colors. The bottom of the camera bracket 3 is connected and fixed to the backlight plate 1. The camera 4 is placed on the top and the field of view of the camera 4 can cover the entire backlight plate 1. The light-transmitting plate 2 is placed on the backlight plate 1. The light-transmitting plate 2 is black or other non-green non-light-transmitting material. The light-transmitting plate 2 is provided with light-transmitting holes 5 and a plurality of light-transmitting holes 6 of different sizes, lengths and curvatures. The light-transmitting holes 6 are fixed distances used to calibrate the size of the broad bean pods. The broad bean pods are placed on the light-transmitting holes 5 of the light-transmitting plate 2 according to the size and curvature of the broad bean pods, and during the acquisition process, the light emitted by the backlight plate 1 can penetrate the gap between the broad bean pods and the grains. Then, the exposure of the camera is adjusted until the acquisition conditions are met and the camera 4 acquires the original image src of the broad bean pods. After extracting the original image src of the broad bean pod, directly extract the coordinates of several light-transmitting holes, correct the captured image according to the extracted light-transmitting hole coordinates, determine the proportional relationship between the physical distance and the pixel according to the spacing of the light-transmitting holes, and obtain the actual length of the broad bean pod according to the proportional relationship. Of course, in other embodiments, the original image src of the broad bean pod can be obtained by other image acquisition devices.
[0096] In step S100, the original image of broad bean pods is obtained and preprocessed to obtain a broad bean pod RGB image and a broad bean pod binary image, including the following steps:
[0097] Separate the image of the region containing the broad bean pods in the broad bean pod original image src to obtain the region image containing the broad bean pods, such as Figure 3 As shown; performing contrast enhancement processing on the regional image image to obtain an enhanced broad bean pod image image_f;
[0098] Performing median filtering on the enhanced broad bean pod image image_f to obtain a filtered broad bean pod image image_m;
[0099] Using the Sobel operator, the image edge detection is performed on the filtered broad bean pod image image_m to obtain the edge information of the broad bean pod, and then the broad bean pod RGB image img_rgb containing the broad bean pod is segmented, as shown in FIG. Figure 4 As shown;
[0100] The bean pod RGB image img_rgb is grayed and binarized to obtain a broad bean pod binary image img_binary, such as Figure 5 shown.
[0101] In step S200, the processing of the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod includes the following steps:
[0102] Separating the green channel of the broad bean pod RGB image and drawing it into a preset blank image with 0 pixels to obtain a first image;
[0103] The first image is subjected to noise reduction processing to obtain the gap area between each seed in the broad bean pod.
[0104] Combined with a specific image, i.e., the broad bean pod RGB image img_rgb, the gap area between each seed in the broad bean pod is obtained as follows:
[0105] Create a blank image img_green with 0 pixels; separate the green channel of the broad bean pod RGB image img_rgb, and draw the separated green channel image on the blank image img_green to form a first image;
[0106] The first image is subjected to noise reduction processing, and only the gap area between broad bean pods and grains is retained.
[0107] In one embodiment, after obtaining the gap area, the number of grains and the gap distance between grains can be obtained through the gap area, including the following steps:
[0108] Counting the number of gap areas to obtain the number of gap areas in broad bean pods, and calculating based on the number of gap areas in broad bean pods to obtain the number of grains, where the number of grains is the number of gap areas in broad bean pods + 1;
[0109] Based on the first image, extract the gap area contour and obtain a contour point set;
[0110] Perform least square straight line fitting on the contour point set to obtain a fitting straight line, calculate two intersection points of the fitting straight line and the contour of the gap area, namely the first intersection point and the second intersection point, and calculate the perpendicular midline of the line segment formed by the first intersection point and the second intersection point;
[0111] The two intersection points of the perpendicular median line and the contour of the gap area are calculated, namely the third intersection point and the fourth intersection point, and the distance between the third intersection point and the fourth intersection point is the grain gap distance.
[0112] That is to say, in the actual counting process, the number of gap areas in broad bean pods is 1 less than the number of grains. If the number of gap areas is n, the number of grains is n+1, and the number of grains = the number of gap areas in broad bean pods + 1;
[0113] Based on the first image, the contour contours_j of the gap area of the broad bean pods are extracted and the contour point set is counted, and the least squares straight line fitting is performed on the contour point set. Here, the least squares straight line fitting process is as follows:
[0114] Step 1: Assume the fitting line l c , y = bx + a;
[0115] Step 2: Calculate the coordinates of each point on the contour contours_j of the broad bean pod gap area to the fitting line l c The sum of squared distances SUM,
[0116] Step 3: According to the distance square sum SUM, calculate the partial derivative of parameters a and b respectively: calculate the partial derivative of parameter a and set the partial derivative to 0. Find the partial derivative of parameter b and set it to 0.
[0117] Step 4: Solve the partial derivative equations for the parameters a and b to obtain the values of the parameters a and b. The values of the parameters a and b are as follows:
[0118]
[0119] The above is the fitting process. After the fitting is completed, the fitting straight line l is determined. c The intersection points M and N of the contours_j of the gap area of the broad bean pods, and the perpendicular bisector l of the line segment MN formed by the intersection points M and N are calculated v ;
[0120] Determine the perpendicular bisector l v The intersection points with the gap area contours_j are the coordinates of the intersection point P and the coordinates of the intersection point Q. The distance d from the intersection point P to the intersection point Q is the gap distance of the broad bean pods and grains. Each gap area is traversed in turn to obtain the gap distance data of each grain in the broad bean pod, such as Figure 6 shown.
[0121] In one embodiment, the broad bean pod seed parameters include at least the number of grains, the distance between the grains and the distance between the grains, and the broad bean pod phenotypic parameters include the circumference, area, pod length, pod width and bending angle.
[0122] In step S200, obtaining the seed spacing based on the minimum circumscribed rectangle includes the following steps:
[0123] Determine the first straight line and the second straight line where the two long sides of the minimum circumscribed rectangle are located based on the minimum circumscribed rectangle;
[0124] Segmenting the broad bean pod outline based on the fitting straight line to obtain a first outline, a second outline, a third outline and a fourth outline;
[0125] Draw perpendicular line segments to the first straight line based on the first contour and the second contour, draw perpendicular line segments to the second straight line based on the third contour and the fourth contour, calculate the distances of all perpendicular line segments and construct a perpendicular line segment height histogram, and then calculate the minimum value of the perpendicular line segment height histogram;
[0126] Determine the first convex point coordinate, the second convex point coordinate, the third convex point coordinate and the fourth convex point coordinate of the broad bean pod contour based on the minimum value;
[0127] The first midpoint coordinates of the first convex point coordinates and the second convex point coordinates are calculated, and the second midpoint coordinates of the third convex point coordinates and the fourth convex point coordinates are calculated. The distance between the first midpoint coordinates and the second midpoint coordinates is the grain spacing.
[0128] The above process combined with the attached Fig. 9 , based on the broad bean pod binary image img_binary, the convex point midpoint method is used to calculate the grain spacing. The specific steps are:
[0129] Extract the contours_c of the broad bean pod binary image img_binary based on the broad bean pod binary image img_binary, calculate the minimum bounding rectangle of the contours_c, and calculate the straight lines l where the two long sides of the minimum bounding rectangle are located respectively u , straight line l d ;
[0130] Based on the fitted straight line l c Segment the contour contours_c to obtain contour contours_c1, contour contours_c2, contour contours_c3 and contour contours_c4;
[0131] Based on the contour contours_c1, from the left side of each point of the contour contours_c1 to the straight line l u Draw a vertical line and calculate the distance between each vertical line segment, and establish a vertical line segment height histogram, such as Figure 8 As shown, the minimum value of the vertical line segment height histogram is calculated;
[0132] Calculate contours_c1, contours_c2 and line l in sequence u and contours_c3, contours_c4 and line l d The vertical line segment height histogram is calculated, the minimum value of each vertical line segment height histogram is calculated, the convex point coordinates A, B, C, D of the contour contours_c are determined, the midpoint E of points A and B and the midpoint F of points C and D are calculated; the distance d between point E and point F is calculated seed , which is the distance between the grains in the broad bean pod. Figure 8 shown.
[0133] In step S300, the method of obtaining broad bean pod phenotypic parameters based on the minimum circumscribed rectangle and polygonal contour fitting includes the following steps:
[0134] The contour length of the polygonal contour fitting is the circumference of the broad bean pod;
[0135] Calculate the contour area of the broad bean pod contour. Based on the contour area and perimeter, the area of the broad bean pod is obtained, which is expressed as follows:
[0136] The area of a broad bean pod = outline area + perimeter / 2;
[0137] The two long sides of the minimum circumscribed rectangle are the length of the broad bean pod;
[0138] Draw a perpendicular bisector for the long side of the minimum circumscribed rectangle, determine a first interactive intersection point and a second interactive intersection point of the perpendicular bisector and the outline of the broad bean pod, and the distance between the first interactive intersection point and the second interactive intersection point is the pod width of the broad bean pod;
[0139] Determine the midpoint of the first interactive intersection and the second interactive intersection, and use the midpoint as the vertex to construct an angle between the broad bean pod endpoint and the midpoint coordinates, wherein the angle is the broad bean pod bending angle.
[0140] That is to say, after extracting the broad bean pod contours_c from the broad bean pod binary image img_binary, the minimum bounding rectangle of the contour data contours_c of the binary image is obtained, and the length of the minimum bounding rectangle is the length of the broad bean pod L pod ;
[0141] The polygonal contour of the broad bean pod contour contours_c is fitted by the OpenCV library function approxPolyDP() to obtain the fitted polygonal contour contours_p;
[0142] The OpenCV library function arcLength() is used to calculate the contour length of the polygon contour contours_p. The contour length is the perimeter L of the broad bean pod. bean ;
[0143] Based on the broad bean pod contour contours_c, the OpenCV library function contoursArea() is used to calculate the area S of the broad bean pod contour contours_c. The area S plus L bean / 2, we get the bean pod area S bean , which is expressed as follows:
[0144] S bean =S+L bean / 2;
[0145] Based on the minimum circumscribed rectangle, the longest side of the minimum circumscribed rectangle is obtained, and the perpendicular bisector of the longest side of the minimum circumscribed rectangle is drawn to obtain the perpendicular bisector l f ;
[0146] Based on the perpendicular bisector l f Calculate the intersection point with contours_c and get the intersection point C b and intersection point D b , based on the intersection point C b and intersection point D b The distance between the two points is the width of the broad bean pod W. pod ;
[0147] Determine the perpendicular bisector l f The intersection point C with the contour contours_c b , D b The midpoint E b , calculate from point E b The vertex is the angle formed by the endpoints of the broad bean pod extreme_Point_A and extreme_Point_B. This angle is the bending angle of the broad bean pod. The degree of bending of the broad bean pod A can be calculated. curve .
[0148] In addition, it should be noted that the polygon contour fitting is performed on the contour contours_c through the OpenCV library function approxPolyDP(). Since the contour perimeter directly calculated by the OpenCV library function arcLength() is longer than the actual perimeter of the contour, the OpenCV library function approxPolyDP() is used for calculation; the area S plus L bean / 2, we can get the precise value of the area of the broad bean pod. Because the area calculated by the OpenCV library function contoursArea() based on the center point of the contour pixels is smaller than the recognition area, the area S of the broad bean pod contour contours_c is added with the value of half the circumference of the broad bean pod.
[0149] In one embodiment, determining the endpoints of the broad bean pod based on the minimum circumscribed rectangle, determining the convex arc and the concave arc of the broad bean pod according to the endpoints of the broad bean pod, and then obtaining the shape parameters of the broad bean pod includes the following steps:
[0150] Determine the third straight line and the fourth straight line where the two short sides of the minimum circumscribed rectangle are located, and respectively determine the closest points between the third straight line and the fourth straight line and the outline of the broad bean pod, wherein the closest points are the endpoints of the broad bean pod, and the distance between the endpoints of the broad bean pod is the chord length of the broad bean pod;
[0151] Determine the straight line where the broad bean pod endpoints are located based on the broad bean pod endpoints and determine the perpendicular bisector of the straight line;
[0152] Determine two intersection points of the perpendicular median line and the outline of the broad bean pod, and respectively calculate the distances between the two intersection points and the perpendicular median line, i.e., a first distance and a second distance;
[0153] Determine the length of the first distance and the second distance. The semi-arc where the short distance is located is the concave arc of the broad bean pod, and the semi-arc where the long distance is located is the convex arc of the broad bean pod;
[0154] Polygonal contour fitting is performed on the concave arc and convex arc of the broad bean pod respectively, and the contour length of the corresponding polygonal contour fitting is the concave arc length and convex arc length of the broad bean pod.
[0155] That is to say, determine the third straight line l where the two short sides of the minimum circumscribed rectangle of the binary image img_binary are located r and the fourth straight line l l ;
[0156] Calculate the contour of the broad bean pod contours_c and the third straight line l r The coordinates of the nearest point and the bean pod contour contours_c and the fourth straight line l l The coordinates of the nearest point are obtained to obtain the first endpoint extreme_Point_A and the second endpoint extreme_Point_B of the broad bean pod, that is, the endpoint positions of the broad bean pod;
[0157] Based on the first endpoint extreme_Point_A and the second endpoint extreme_Point_B, the straight line l where the broad bean pod endpoint is located is obtained x , according to the straight line l x Calculate the perpendicular bisector l m , calculate the perpendicular bisector l m The intersection points with the broad bean pod contour contours_c are obtained as intersection points R and S;
[0158] According to the intersection points R and S, calculate the distance between the intersection points R and S and the perpendicular bisector l m The first distance d is obtained P and the second distance d QThe half arc where the distance is larger is the convex arc of the broad bean pod arc_convex, and the other half arc is the concave arc of the broad bean pod arc_concave.
[0159] The polygonal contour fitting data of the convex arc of the broad bean pod arc_convex and the concave arc of the broad bean pod arc_concave are obtained by using the OpenCV library function approxPolyDP(). The polygonal contour fitting data is calculated by using the OpenCV library function arcLength() to obtain the convex arc length L of the broad bean pod. convex and concave arc length L concave .
[0160] In step S500, a broad bean pod width histogram is obtained based on the convex arc length and the concave arc length, and broad bean pod morphological parameters are obtained through the broad bean pod width histogram, including the following steps:
[0161] Extract all points of the concave arc to form a concave arc point set and all points of the convex arc to form a convex arc point set;
[0162] Traverse each concave arc point in the concave arc point set in turn and calculate the tangent slope of each concave arc point, calculate the perpendicular line corresponding to the concave arc point according to each concave arc point and the corresponding tangent slope, and determine the third interactive intersection point of the perpendicular line and the convex arc point set;
[0163] Calculate the distance between the convex arc point set and the third interactive intersection point, construct a circle with the convex arc point as the center and the distance as the radius, and calculate the fourth interactive intersection point between the circle and the convex arc point set;
[0164] Calculate the shortest distance between all coordinate points and the concave arc point between the third interactive intersection point and the fourth interactive intersection point, the shortest distance is the broad bean pod width, and form a broad bean pod width set;
[0165] Constructing a broad bean pod width histogram based on the broad bean pod width, calculating the mean of the broad bean pod width histogram based on the broad bean pod width histogram, which is the broad bean pod width mean, and calculating the variance of the broad bean pod width histogram, which is the broad bean pod uniformity;
[0166] The central axis point set is established with the midpoint of the line segment where the width of the broad bean pod lies, and then the length of the central axis of the broad bean pod is obtained.
[0167] Combined with actual operation, the specific process is as follows:
[0168] Add the convex arc of the broad bean pod arc_convex point set to set X, and add the concave arc of the broad bean pod arc_concave point set to set E;
[0169] Based on the set X and the set E, firstly, an empty set, namely the set M, is initialized to place the broad bean pod width data, and an empty set Z, namely the set Z, is initialized to place the broad bean pod central axis point set;
[0170] Based on the set E, traverse each point in the set E in turn and calculate the tangent slope k of each point, and calculate the perpendicular line y of the corresponding point according to the tangent slope k and the tangent point coordinates E[i];
[0171] Determine the intersection point S of the vertical line y and the set X, calculate the distance d between the tangent point coordinate E[i] and the intersection point S, construct a circle O with the tangent point coordinate E[i] as the center of circle O and d as the radius of circle O, and calculate the intersection point T between circle O and set X;
[0172] Calculate the shortest distance between the coordinates of the intersection point S and the intersection point T and the tangent point coordinate E[i], add the shortest distance to the set M, and the set M is the bean pod width; establish a bean pod width histogram based on the set M, such as Fig.10 As shown;
[0173] Based on the broad bean pod width histogram, the mean of the broad bean pod width histogram is obtained, that is, the broad bean pod width mean W avg ;
[0174] Based on the broad bean pod width histogram, the variance of the broad bean pod width histogram, i.e. the broad bean pod uniformity U, is calculated;
[0175] The midpoint of the line segment where the bean pod width lies is used to establish the central axis point set Z of the bean pod, as follows: Fig.11 As shown, the length of the central axis of the broad bean pod is obtained based on the central axis point set Z of the broad bean pod.
[0176] Specifically, based on the sets X and E, the vertical line range search method is used to calculate the broad bean pod width histogram. The source code is as follows:
[0177]
[0178] Example 2
[0179] A machine vision-based broad bean pod parameter analysis system, such as Fig.12 As shown, it includes an acquisition preprocessing module 100, a first analysis module 200, a second analysis module 300, a third analysis module 400 and a fourth analysis module 500;
[0180] The acquisition preprocessing module 100 is used to acquire and preprocess the original image of the broad bean pod to obtain the broad bean pod RGB image and the broad bean pod binary image, wherein the original image of the broad bean pod is the original image of the broad bean pod obtained when light penetrates the broad bean pod;
[0181] The first analysis module 200 is used to process the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtain the number of seeds and the distance between the seeds based on the gap area;
[0182] The second analysis module 300 extracts the broad bean pod outline based on the broad bean pod binary image, performs minimum circumscribed rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtains the seed spacing based on the minimum circumscribed rectangle, and obtains the broad bean pod phenotypic parameters based on the minimum circumscribed rectangle and polygonal outline fitting;
[0183] The third analysis module 400 determines the endpoints of the broad bean pod based on the minimum circumscribed rectangle, determines the convex arc and the concave arc of the broad bean pod according to the endpoints of the broad bean pod, and then obtains the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length;
[0184] The fourth analysis module 500 obtains a broad bean pod width histogram based on the convex arc length and the concave arc length, and obtains broad bean pod morphological parameters through the broad bean pod width histogram, including the broad bean pod curvature, the mean broad bean pod width, the broad bean pod uniformity and the length of the broad bean pod central axis.
[0185] 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.
[0186] 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.
[0187] 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.
[0188] 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.
[0189] 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 implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0190] It should be noted that:
[0191] 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.
[0192] In addition, it should be noted that the shapes and names of the parts 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 method for analyzing broad bean pod parameters based on machine vision, wherein the broad bean pod parameters at least include broad bean seed parameters, broad bean pod phenotypic parameters, broad bean pod shape parameters and broad bean pod morphological parameters, characterized in that: The following steps are involved: Obtaining an original image of a broad bean pod and preprocessing it to obtain an RGB image of the broad bean pod and a binary image of the broad bean pod, wherein the original image of the broad bean pod is an original image of the broad bean pod obtained when light penetrates the broad bean pod; Processing the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtaining the number of seeds and the distance between the seeds based on the gap area; Extract the broad bean pod outline based on the broad bean pod binary image, perform minimum bounding rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtain the seed spacing based on the minimum bounding rectangle, and obtain the broad bean pod phenotypic parameters based on the minimum bounding rectangle and polygonal outline fitting; The endpoints of the broad bean pod are determined based on the minimum circumscribed rectangle, and the convex arc and concave arc of the broad bean pod are determined according to the endpoints of the broad bean pod, thereby obtaining the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length; The broad bean pod width histogram was obtained based on the convex arc length and the concave arc length, and the broad bean pod morphological parameters were obtained through the broad bean pod width histogram, including the degree of broad bean pod curvature, the mean value of broad bean pod width, the uniformity of broad bean pod and the length of the central axis of broad bean pod.
2. The method for analyzing broad bean pod parameters based on machine vision according to claim 1, characterized in that: The method of obtaining the original image of broad bean pods and preprocessing it to obtain the broad bean pods RGB image and the broad bean pods binary image comprises the following steps: Obtaining the original image of broad bean pods and extracting the regional image containing the broad bean pods to obtain the broad bean pod regional image; Performing image enhancement processing on the broad bean pod region image to obtain an enhanced broad bean pod image; Performing filtering on the enhanced broad bean pod image to obtain a filtered broad bean pod image; Performing image edge detection on the filtered broad bean pod image to obtain edge information of the broad bean pod and then segmenting the broad bean pod RGB image; The broad bean pod RGB image is gray-scaled and binarized to obtain the broad bean pod binary image.
3. The method for analyzing broad bean pod parameters based on machine vision according to claim 1, characterized in that: The method of processing the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod comprises the following steps: Separating the green channel of the broad bean pod RGB image and drawing it into a preset blank image with 0 pixels to obtain a first image; The first image is subjected to noise reduction processing to obtain the gap area between each seed in the broad bean pod.
4. The method for analyzing broad bean pod parameters based on machine vision according to claim 3, characterized in that: The method of obtaining the number of seeds and the distance between seeds and the gaps between seeds based on the gap area comprises the following steps: Counting the number of gap areas to obtain the number of gap areas in broad bean pods, and calculating based on the number of gap areas in broad bean pods to obtain the number of grains, where the number of grains is the number of gap areas in broad bean pods + 1; Based on the first image, extract the gap area contour and obtain a contour point set; Perform least square straight line fitting on the contour point set to obtain a fitting straight line, calculate two intersection points of the fitting straight line and the contour of the gap area, namely the first intersection point and the second intersection point, and calculate the perpendicular midline of the line segment formed by the first intersection point and the second intersection point; The two intersection points of the perpendicular median line and the contour of the gap area are calculated, namely the third intersection point and the fourth intersection point, and the distance between the third intersection point and the fourth intersection point is the grain gap distance.
5. The method for analyzing broad bean pod parameters based on machine vision according to claim 1, characterized in that: The broad bean seed clamp parameters include at least the number of grains, the distance between grains and the distance between grains. The broad bean pod phenotypic parameters include the circumference, area, pod length, pod width and bending angle.
6. The method for analyzing broad bean pod parameters based on machine vision according to claim 1, characterized in that: The method of obtaining the seed spacing based on the minimum circumscribed rectangle comprises the following steps: Determine the first straight line and the second straight line where the two long sides of the minimum circumscribed rectangle are located based on the minimum circumscribed rectangle; Segmenting the broad bean pod outline based on the fitting straight line to obtain a first outline, a second outline, a third outline and a fourth outline; Draw perpendicular line segments to the first straight line based on the first contour and the second contour, draw perpendicular line segments to the second straight line based on the third contour and the fourth contour, calculate the distances of all perpendicular line segments and construct a perpendicular line segment height histogram, and then calculate the minimum value of the perpendicular line segment height histogram; Determine the first convex point coordinate, the second convex point coordinate, the third convex point coordinate and the fourth convex point coordinate of the broad bean pod contour based on the minimum value; The first midpoint coordinates of the first convex point coordinates and the second convex point coordinates are calculated, and the second midpoint coordinates of the third convex point coordinates and the fourth convex point coordinates are calculated. The distance between the first midpoint coordinates and the second midpoint coordinates is the grain spacing.
7. The method for analyzing broad bean pod parameters based on machine vision according to claim 1, characterized in that: The method of obtaining broad bean pod phenotypic parameters based on minimum circumscribed rectangle and polygonal contour fitting comprises the following steps: The contour length of the polygonal contour fitting is the circumference of the broad bean pod; Calculate the contour area of the broad bean pod contour. Based on the contour area and perimeter, the area of the broad bean pod is obtained, which is expressed as follows: The area of a broad bean pod = outline area + perimeter / 2; The two long sides of the minimum circumscribed rectangle are the length of the broad bean pod; Draw a perpendicular bisector for the long side of the minimum circumscribed rectangle, determine a first interactive intersection point and a second interactive intersection point of the perpendicular bisector and the outline of the broad bean pod, and the distance between the first interactive intersection point and the second interactive intersection point is the pod width of the broad bean pod; Determine the midpoint of the first interactive intersection and the second interactive intersection, and use the midpoint as the vertex to construct an angle between the broad bean pod endpoint and the midpoint coordinates, wherein the angle is the broad bean pod bending angle.
8. The method for analyzing broad bean pod parameters based on machine vision according to claim 1, characterized in that: The method of determining the endpoints of the broad bean pod based on the minimum circumscribed rectangle, determining the convex arc and the concave arc of the broad bean pod according to the endpoints of the broad bean pod, and then obtaining the shape parameters of the broad bean pod comprises the following steps: Determine the third straight line and the fourth straight line where the two short sides of the minimum circumscribed rectangle are located, and respectively determine the closest points between the third straight line and the fourth straight line and the outline of the broad bean pod, wherein the closest points are the endpoints of the broad bean pod, and the distance between the endpoints of the broad bean pod is the chord length of the broad bean pod; Determine the straight line where the broad bean pod endpoints are located based on the broad bean pod endpoints and determine the perpendicular bisector of the straight line; Determine two intersection points of the perpendicular median line and the outline of the broad bean pod, and respectively calculate the distances between the two intersection points and the perpendicular median line, i.e., a first distance and a second distance; Determine the length of the first distance and the second distance. The semi-arc where the short distance is located is the concave arc of the broad bean pod, and the semi-arc where the long distance is located is the convex arc of the broad bean pod; Polygonal contour fitting is performed on the concave arc and convex arc of the broad bean pod respectively, and the contour length of the corresponding polygonal contour fitting is the concave arc length and convex arc length of the broad bean pod.
9. The method for analyzing broad bean pod parameters based on machine vision according to claim 1, characterized in that: The method of obtaining a broad bean pod width histogram based on the convex arc length and the concave arc length, and obtaining broad bean pod morphological parameters through the broad bean pod width histogram, comprises the following steps: Extract all points of the concave arc to form a concave arc point set and all points of the convex arc to form a convex arc point set; Traverse each concave arc point in the concave arc point set in turn and calculate the tangent slope of each concave arc point, calculate the perpendicular line corresponding to the concave arc point according to each concave arc point and the corresponding tangent slope, and determine the third interactive intersection point of the perpendicular line and the convex arc point set; Calculate the distance between the convex arc point set and the third interactive intersection point, construct a circle with the convex arc point as the center and the distance as the radius, and calculate the fourth interactive intersection point between the circle and the convex arc point set; Calculate the shortest distance between all coordinate points and the concave arc point between the third interactive intersection point and the fourth interactive intersection point, the shortest distance is the broad bean pod width, and form a broad bean pod width set; Constructing a broad bean pod width histogram based on the broad bean pod width, calculating the mean of the broad bean pod width histogram based on the broad bean pod width histogram, which is the broad bean pod width mean, and calculating the variance of the broad bean pod width histogram, which is the broad bean pod uniformity; The central axis point set is established with the midpoint of the line segment where the width of the broad bean pod lies, and then the length of the central axis of the broad bean pod is obtained.
10. A machine vision-based broad bean pod parameter analysis system, characterized in that: It includes an acquisition preprocessing module, a first analysis module, a second analysis module, a third analysis module and a fourth analysis module; The acquisition preprocessing module is used to acquire and preprocess the original image of the broad bean pod to obtain the broad bean pod RGB image and the broad bean pod binary image, wherein the original image of the broad bean pod is the original image of the broad bean pod obtained when light penetrates the broad bean pod; The first analysis module is used to process the broad bean pod RGB image to obtain the gap area between each seed in the broad bean pod, and obtain the number of seeds and the distance between the seeds based on the gap area; The second analysis module extracts the broad bean pod outline based on the broad bean pod binary image, performs minimum circumscribed rectangle fitting and polygonal outline fitting based on the broad bean pod outline, obtains the seed spacing based on the minimum circumscribed rectangle, and obtains the broad bean pod phenotypic parameters based on the minimum circumscribed rectangle and polygonal outline fitting; The third analysis module determines the endpoints of the broad bean pod based on the minimum circumscribed rectangle, determines the convex arc and the concave arc of the broad bean pod according to the endpoints of the broad bean pod, and then obtains the shape parameters of the broad bean pod, including the chord length, the convex arc length and the concave arc length; The fourth analysis module obtains a broad bean pod width histogram based on the convex arc length and the concave arc length, and obtains broad bean pod morphological parameters through the broad bean pod width histogram, including the degree of broad bean pod curvature, the mean value of broad bean pod width, the uniformity of broad bean pods and the length of the central axis of the broad bean pods.
11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
12. A machine vision-based broad bean pod parameter analysis device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Fruit dimension detection method based on Kinect camera
CN107358627A
Corn ear character estimation method and device based on corn ear unilateral scanning image
CN115345880A
Pod phenotype analysis method, system and device based on computer vision
CN115620279A
Cited By
Soybean germplasm resource tissue organ characteristic intelligent identification and management method
CN120495905A