CN116152220A - Seed counting and size measuring method based on machine vision - Google Patents
Seed counting and size measuring method based on machine vision Download PDFInfo
- Publication number
- CN116152220A CN116152220A CN202310219375.6A CN202310219375A CN116152220A CN 116152220 A CN116152220 A CN 116152220A CN 202310219375 A CN202310219375 A CN 202310219375A CN 116152220 A CN116152220 A CN 116152220A
- Authority
- CN
- China
- Prior art keywords
- seed
- defect
- image
- point
- seeds
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 230000007547 defect Effects 0.000 claims abstract description 75
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 17
- 238000001514 detection method Methods 0.000 claims abstract description 12
- 238000004364 calculation method Methods 0.000 claims abstract description 8
- 238000012937 correction Methods 0.000 claims abstract description 8
- 238000001914 filtration Methods 0.000 claims description 26
- 239000011159 matrix material Substances 0.000 claims description 21
- 230000011218 segmentation Effects 0.000 claims description 20
- 238000012545 processing Methods 0.000 claims description 14
- 238000004513 sizing Methods 0.000 claims description 12
- 230000000694 effects Effects 0.000 claims description 7
- 238000012216 screening Methods 0.000 claims description 3
- 238000006467 substitution reaction Methods 0.000 claims description 3
- 238000005259 measurement Methods 0.000 abstract description 16
- 238000005520 cutting process Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 241000209094 Oryza Species 0.000 description 4
- 235000007164 Oryza sativa Nutrition 0.000 description 4
- 235000009566 rice Nutrition 0.000 description 4
- 235000013339 cereals Nutrition 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 241000669298 Pseudaulacaspis pentagona Species 0.000 description 2
- 239000012535 impurity Substances 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 241000209140 Triticum Species 0.000 description 1
- 235000021307 Triticum Nutrition 0.000 description 1
- 240000008042 Zea mays Species 0.000 description 1
- 235000005824 Zea mays ssp. parviglumis Nutrition 0.000 description 1
- 235000002017 Zea mays subsp mays Nutrition 0.000 description 1
- 238000009395 breeding Methods 0.000 description 1
- 230000001488 breeding effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000008094 contradictory effect Effects 0.000 description 1
- 235000005822 corn Nutrition 0.000 description 1
- 230000007797 corrosion Effects 0.000 description 1
- 238000005260 corrosion Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/12—Edge-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30181—Earth observation
- G06T2207/30188—Vegetation; Agriculture
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Processing (AREA)
Abstract
The invention aims to provide a seed counting and size measuring method based on machine vision, which comprises the following steps: acquiring a plurality of seed images; detecting an image of stuck seeds using a defect-based stuck seed detection method; dividing the adhered seed image into single seed images by using an adhered seed dividing algorithm based on defect calculation and intersection point correction; and calculating the number of seeds and the size information of each seed according to the single seed image. The invention can accurately detect the quantity and the size of seeds in batches and solves the problem of difficult seed measurement.
Description
Technical Field
The invention relates to the technical field of computer vision, in particular to a seed counting and size measuring method based on machine vision.
Background
Along with the global economic climate and other changes, grain safety becomes an important factor of national safety, and seeds are an important foundation for guaranteeing grain safety. Measurement of phenotypic traits of seeds is a key element in breeding research, and seed size and grain type are important phenotypic traits. For seeds with smaller size (such as rice, corn, wheat and the like), the precision requirement is higher, and the measurement difficulty is higher. The current common seed identification statistical mode has manual measurement and instrument measurement, and manual measurement usually uses a caliper to measure, and is low in efficiency, time-consuming and labor-consuming, and the result is easily influenced by subjective factors, while an automatic measuring instrument is often expensive, high in maintenance cost, and difficult to realize outdoor seed test due to large volume, and the instrument also has the seed clamping problem, so that seed mixing among different strains is easy to cause during seed test. The seed size measuring method based on image recognition or machine vision is a low-cost and convenient seed checking mode, but is easily influenced by factors such as image background, seed adhesion, placement mode, light and the like.
Disclosure of Invention
The invention aims to provide a seed counting and size measuring method based on machine vision, which can accurately detect the number and size of seeds in batch and solve the problem of difficult seed measurement.
A machine vision based seed counting and sizing method comprising:
acquiring a plurality of seed images;
detecting an image of stuck seeds using a defect-based stuck seed detection method;
dividing the adhered seed image into single seed images by using an adhered seed dividing algorithm based on defect calculation and intersection point correction;
and calculating the number of seeds and the size information of each seed according to the single seed image.
After the plurality of seed images are acquired, binarization processing is carried out on the images, specifically:
the picture with small background light change is subjected to binarization by adopting a fixed threshold value, seeds and the background are distinguished, and the binarization effect is optimized by adjusting a parameter stationaryThreshold;
and (3) binarizing the picture with larger light change by adopting a local oxford algorithm with a self-adaptive threshold value, converting the gray image into binarization, adjusting the domainBlock according to the resolution, ensuring the width of the domainBlock for accommodating seeds by the pixels, and adjusting the offset value autoThreshold to optimize the binarization effect.
After binarization processing is carried out on the image, the method also comprises the step of carrying out open operation processing on the image, specifically:
calculating a scale rule: obtaining all the outer contours in the plurality of seed images subjected to binarization processing, finding a target with the maximum pixel value, and obtaining a scale rule=the input scale real length/scale pixel;
the calculation formula of the size of the convolution kernel of the open operation is as follows;
convolution kernel size = kaiKernel/rule
Wherein, the rule is a scale bar, and the kaiKernel is the open operation kernel size set by the program.
Intersection points and defects include:
two features of a plurality of stuck seeds are defined, including defect features: the uneven area exists on the outline of the seed, and the outline is covered by a line segment, so that the concave disappears, and the filled part becomes a defect;
intersection point characteristics: multiple seed adhesions necessarily form two distinct points, called intersections.
Detecting an image of stuck seeds using a defect-based stuck seed detection method includes:
defining defect = { start, end, deep, distance }, wherein start is a defect starting point, end is a defect end point, deep is a defect deepest point, and distance is the distance between deep and the connecting line of start and end, namely the defect distance;
the profile is the condition of adhering seeds: the defect_num is larger than or equal to epsilon d ,ε d Typically 2.
Segmenting the stuck seed image into individual seed images using defect-based computation includes:
calculating defects: searching the defect deepest point defect with the largest defect distance N .deep:
Find and point defect N Deep nearest defect deepest point defect M Deep, define 0ρ (P 1 ,P 2 ) For point P 1 Sum point P 2 Euclidean distance between:
if 0ρ (defect) N .deep,defect M .deep)>0.75×width∩area_avg>area 2.5area_avg is the average area and area is the area of the contour currently scanned.
Segmenting the stuck seed image into individual seed images using an intersection corrected stuck seed segmentation algorithm includes:
the program uses convolution kernel with given size to detect the intersection point, and obtains the candidate point of the intersection point through two rounds of filtering;
and filtering edge pixel values of the pixel value matrix scanned by the convolution kernel to obtain a point set points of the adhesion seed binarization outline, and then using the convolution kernel scanning of kernel Size multiplied by kernel Size to obtain a pixel value matrix A by taking each point in the point set as a center.
A first round of filtration was performed: subsequentPixel >7 ≡4× (kernelSize-1);
filtering by a centrosymmetric matrix to obtain the defect N The deep is used as a center, convolution kernel scanning of kernel Size multiplied by kernel Size is used for obtaining a pixel value matrix B, and the matrix is subjected to central symmetry processing B':
a pixel value matrix C is obtained by using a convolution kernel scan of kernelsize×kernelsize centering around the contour edge point, a number equality of values of the pixel value matrix B' and C is calculated using the following formula, and a second round of intersection filtering is performed.
Wherein the function isε d Is a threshold value related to the convolution kernel size, and the default value is
The comprehensive filtering mechanism based on Euclidean distance is adopted, and the point is obtained when the following conditions are met i Point substitution was used:
filtering to obtain intersection point candidate point set, and screening out the intersection point candidate point set N The point where deep euclidean distance is minimum:
calculating the number of seeds and the size information of each seed according to the single seed image comprises:
acquiring all contours in the processed and segmented seed image, and calculating the real area, length and width of the seed according to the contour attribute;
judging whether the image is a scale, a normal seed, an adhesion seed or an adhesion seed with failed segmentation;
removing the scale and the adhesion seed image with failed segmentation, calculating the length, width and area of normal seeds and adhesion seeds, and calculating the number and average value;
and re-segmenting and calculating the adhesion seeds with failed segmentation.
The conditions for judging the outline as the scale include:
length>0.9×ruler len where roller_len is the actual length of the scale entered.
Conditions for determining that the profile is a stuck seed that failed to cut include:
area > limit area×area_avg or length > limit length×length_avg or width > limit width×width_avg, wherein limitArea, limitLength, limitWidth is the minimum area, minimum length, and minimum width of the parameter settings, respectively.
The invention provides a simple image acquisition method, simultaneously provides application programs of a computer end and a mobile end, is simple and convenient in use method, is suitable for multi-scene and high-flux measurement application in indoor and outdoor environments, provides a simple manufacturing method for seed image acquisition, and evaluates whether a photo shot by mobile equipment is horizontal or not by placing a plurality of scales on a background plate to calculate confidence, thereby judging the reliability of an identification result. The invention also provides application programs of the computer end and the mobile end, and the application method is simple and convenient, and is suitable for multi-scene and high-flux measurement application in indoor and outdoor environments. An adhesion seed segmentation algorithm based on defect detection and intersection point correction is developed to accurately and efficiently segment adhesion seeds in an image.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a defect map of the present invention;
FIG. 3 is a graph of intersection features of the present invention;
FIG. 4 is a diagram of a stuck seed segmentation process according to the present invention;
FIG. 5 is a diagram of an alternative simplified camera model of the present invention;
FIG. 6 is a view of the background plate and scale of the present invention;
FIG. 7 is a diagram of a mobile device of the present invention capturing a seed diagram;
FIG. 8 is a diagram of a seed image processed by a computer side application of the present invention;
FIG. 9 is a diagram of a WeChat applet processing seed diagram in accordance with the present invention;
FIG. 10 is a diagram showing the steps and effects of processing a seed image according to the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that all directional indicators (such as up, down, left, right, front, and rear … …) in the embodiments of the present invention are merely used to explain the relative positional relationship, movement, etc. between the components in a particular posture (as shown in the drawings), and if the particular posture is changed, the directional indicator is changed accordingly.
Furthermore, the description of "first," "second," etc. in this disclosure is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present invention.
A machine vision based seed counting and sizing method comprising:
s100, acquiring a plurality of seed images;
s200, detecting an image of adhered seeds by using a defect-based adhered seed detection method;
s300, dividing the adhered seed image into single seed images by using an adhered seed dividing algorithm based on defect calculation and intersection point correction;
s400, calculating the number of seeds and the size information of each seed according to the single seed image.
The invention provides a simple image acquisition method, simultaneously provides application programs of a computer end and a mobile end, is simple and convenient in use method, is suitable for multi-scene and high-flux measurement application in indoor and outdoor environments, provides a simple manufacturing method for seed image acquisition, and evaluates whether a photo shot by mobile equipment is horizontal or not by placing a plurality of scales on a background plate to calculate confidence, thereby judging the reliability of an identification result. The invention also provides application programs of the computer end and the mobile end, and the application method is simple and convenient, and is suitable for multi-scene and high-flux measurement application in indoor and outdoor environments. An adhesion seed segmentation algorithm based on defect detection and intersection point correction is developed to accurately and efficiently segment adhesion seeds in an image.
The background plate and the scale paper are made according to the color of the seeds, see fig. 6, for example, the rice seeds of this embodiment are pale yellow, the black background plate and the white scale paper are made, and the length of the white scale paper is 100mm.
The seeds are evenly spread on the background plate, evenly dispersed around the central scale paper as much as possible, and impurities on the background are removed. Referring to fig. 7, a seed image is acquired by photographing vertically using a cell phone or a camera. Alternatively, a scanner may be used to take a picture, uniformly disperse the seeds on a scanning plate, place a fixed length of scale paper, and scan to obtain a seed image.
The collected pictures are measured by using the computer end measurement program GrainPheno provided by the invention, see FIG. 8, and related operation parameters are set, and the specific steps comprise:
opening a file input dialog box through a menu or a quick toolbar, and selecting pictures to be measured from a folder of a local disk;
setting a background color, black in this embodiment, in the menu bar;
setting a program running mode, wherein the program content is in various modes, namely a Rice mode aiming at Rice seeds in the embodiment;
setting the length of the scale paper to convert the calculated pixels into the actual size of the seeds in mm, wherein the length of the scale paper in the embodiment is 100mm;
and in the optional picture cutting step, a computer program provides a picture cutting function and can cut out areas except the background. Opening a cutting frame by clicking a cutting button of the quick toolbar, dragging a mouse to select an area which is desired to be reserved, if the cutting area is desired to be applied to all pictures, checking "apply the cutting area to all pictures", and finally clicking a "cutting" button to complete cutting;
by clicking the "run" button to run the program, the running process and results are displayed in the information display area of the software interface.
If the applet is used, after the WeChat search applet "GrainPheno" enters the applet interface and logs in, the settings are set in the personal settings to edit the relevant parameters, then the seed images in the handset are uploaded (9 pieces at most are run each time) and the program waits for the return of the result.
S100, after a plurality of seed images are acquired, the method further comprises S110, wherein binarization processing is carried out on the images, specifically:
the picture with small background light change is subjected to binarization by adopting a fixed threshold value, seeds and the background are distinguished, and the binarization effect is optimized by adjusting a parameter stationaryThreshold;
and (3) binarizing the picture with larger light change by adopting a local oxford algorithm with a self-adaptive threshold value, converting the gray image into binarization, adjusting the domainBlock according to the resolution, ensuring the width of the domainBlock for accommodating seeds by the pixels, and adjusting the offset value autoThreshold to optimize the binarization effect.
After the program runs, the program processes the picture, see fig. 10. In order to clearly show details of the processing, a region in the image is intercepted for display. The method comprises the following specific steps:
converting the image into a gray scale image, and converting the processed color image into the gray scale image;
median filtering treatment is carried out to remove smaller impurities in the background;
binarizing the image to increase the operation speed;
graying the image: three-channel pictures are complicated and time-consuming to process and are converted into gray pictures.
Median filtering: the median filtering can blur details and is commonly used for removing noise in pictures, but excessive blurring can influence the seed size measurement precision, and a user can control the median filtering aperture size by setting a parameter vagueAperture so as to remove noise under the condition that the precision is not influenced as much as possible. For a clean background image, the median filtering process may be selected not to be performed.
S110, after binarizing the image, S120 performs an open operation on the image, specifically:
calculating a scale rule: obtaining all the outer contours in the plurality of seed images subjected to binarization processing, finding a target with the maximum pixel value, and obtaining a scale rule=the input scale real length/scale pixel;
the calculation formula of the size of the convolution kernel of the open operation is as follows;
convolution kernel size = kaiKernel/rule
Wherein, the rule is a scale bar, and the kaiKernel is the open operation kernel size set by the program.
The image is subjected to open operation, corrosion and re-expansion are carried out firstly, and meanwhile, the length of a scale (the actual size represented by each pixel) is obtained;
the segmentation algorithm of the invention is used for detecting adhesion seeds in the image and effectively segmenting the adhesion seeds;
the length, width and area of each seed are obtained through the minimum circumscribed rectangle, and when 2 or more scales exist, the horizontal confidence of the image is calculated.
One scale is arranged in the center of the device, and the other scales are arranged on two sides of the background and used for measuring the level degree of the picture, namely the credibility of the processing result. The confidence coefficient calculating method comprises the following steps: the length of the scale is obtained through one scale, so that the measurement sizes of other scales are obtained, and the confidence coefficient can be obtained through the measurement sizes of other scales/the real sizes of other scales. Confidence is used to measure how parallel the camera is to the background when taking a picture, and the closer to 100% the more parallel the camera is, the more the confidence is recommended to be above 95%.
Intersection points and defects include:
two features of a plurality of stuck seeds are defined, including defect features: the uneven area exists on the outline of the seed, and the outline is covered by a line segment, so that the concave disappears, and the filled part becomes a defect;
intersection point characteristics: multiple seed adhesions necessarily form two distinct points, called intersections.
The invention provides an improved adhesion segmentation algorithm for identifying and respectively adhering seeds. The algorithm comprises two parts of adhesion seed identification and segmentation, namely an adhesion seed detection mechanism (defect detection) based on defects and an adhesion seed segmentation algorithm based on defect calculation and intersection point correction.
S200 detecting an image of stuck seeds using a defect-based stuck seed detection method includes:
defining defect = { start, end, deep, distance }, wherein start is a defect starting point, end is a defect end point, deep is a defect deepest point, and distance is the distance between deep and the connecting line of start and end, namely the defect distance;
the profile is the condition of adhering seeds: the defect_num is larger than or equal to epsilon d ,ε d Typically 2.
S300 using defect-based computation to segment the stuck seed image into individual seed images includes:
calculating defects: searching the defect deepest point defect with the largest defect distance N .deep:
Find and point defect N Deep nearest defect deepest point defect M Deep, define 0ρ (P 1 ,P 2 ) For point P 1 Sum point P 2 Euclidean distance between:
if 0ρ (defect) N .deep,defect M .deep)>0.75×width∩area_avg>area 2.5area_avg is the average area and area is the area of the contour currently scanned.
S300 segmenting the stuck seed image into individual seed images using an intersection corrected stuck seed segmentation algorithm includes:
the program uses convolution kernel with given size to detect the intersection point, and obtains the candidate point of the intersection point through two rounds of filtering;
and filtering edge pixel values of the pixel value matrix scanned by the convolution kernel to obtain a point set points of the adhesion seed binarization outline, and then using the convolution kernel scanning of kernel Size multiplied by kernel Size to obtain a pixel value matrix A by taking each point in the point set as a center.
A first round of filtration was performed: subsequentPixel >7 ≡4× (kernelSize-1);
filtering by a centrosymmetric matrix to obtain the defect N The deep is used as a center, convolution kernel scanning of kernel Size multiplied by kernel Size is used for obtaining a pixel value matrix B, and the matrix is subjected to central symmetry processing B':
a pixel value matrix C is obtained by using a convolution kernel scan of kernelsize×kernelsize centering around the contour edge point, a number equality of values of the pixel value matrix B' and C is calculated using the following formula, and a second round of intersection filtering is performed.
Wherein the function isε d Is a threshold value related to the convolution kernel size, and the default value is
The comprehensive filtering mechanism based on Euclidean distance is adopted, and the point is obtained when the following conditions are met i Point substitution was used:
filtering to obtain intersection point candidate point set, and screening out the intersection point candidate point set N The point where deep euclidean distance is minimum:
the S400 calculating the number of seeds and size information of each seed from the single seed image includes:
acquiring all contours in the processed and segmented seed image, and calculating the real area, length and width of the seed according to the contour attribute;
judging whether the image is a scale, a normal seed, an adhesion seed or an adhesion seed with failed segmentation;
removing the scale and the adhesion seed image with failed segmentation, calculating the length, width and area of normal seeds and adhesion seeds, and calculating the number and average value;
and re-segmenting and calculating the adhesion seeds with failed segmentation.
After the operation is finished, the program outputs an Excel result table and an image. In the table, the number, length, width and area information of each seed, and their average values are recorded. The resulting image identifies the normally identified seed (red rectangular box), the abnormally identified seed (green rectangular box), the scale (blue outline), and the horizontal confidence of the image.
The conditions for judging the outline as the scale include:
length>0.9×ruler len where roller_len is the actual length of the scale entered.
Conditions for determining that the profile is a stuck seed that failed to cut include:
area > limit area×area_avg or length > limit length×length_avg or width > limit width×width_avg, wherein limitArea, limitLength, limitWidth is the minimum area, minimum length, and minimum width of the parameter settings, respectively.
The invention provides a simple image acquisition method, simultaneously provides application programs of a computer end and a mobile end, is simple and convenient in use method, is suitable for multi-scene and high-flux measurement application in indoor and outdoor environments, provides a simple manufacturing method for seed image acquisition, and evaluates whether a photo shot by mobile equipment is horizontal or not by placing a plurality of scales on a background plate to calculate confidence, thereby judging the reliability of an identification result. The invention also provides application programs of the computer end and the mobile end, and the application method is simple and convenient, and is suitable for multi-scene and high-flux measurement application in indoor and outdoor environments. An adhesion seed segmentation algorithm based on defect detection and intersection point correction is developed to accurately and efficiently segment adhesion seeds in an image.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. A machine vision based seed counting and sizing method comprising:
acquiring a plurality of seed images;
detecting an image of stuck seeds using a defect-based stuck seed detection method;
dividing the adhered seed image into single seed images by using an adhered seed dividing algorithm based on defect calculation and intersection point correction;
and calculating the number of seeds and the size information of each seed according to the single seed image.
2. The machine vision based seed counting and sizing method of claim 1, further comprising binarizing the image after the plurality of seed images are acquired, specifically:
the picture with small background light change is subjected to binarization by adopting a fixed threshold value, seeds and the background are distinguished, and the binarization effect is optimized by adjusting a parameter stationaryThreshold;
and (3) binarizing the picture with larger light change by adopting a local oxford algorithm with a self-adaptive threshold value, converting the gray image into binarization, adjusting the domainBlock according to the resolution, ensuring the width of the domainBlock for accommodating seeds by the pixels, and adjusting the offset value autoThreshold to optimize the binarization effect.
3. The machine vision based seed counting and sizing method of claim 2, wherein after the binarizing the image, further comprising performing an open operation on the image, specifically:
calculating a scale rule: obtaining all the outer contours in the plurality of seed images subjected to binarization processing, finding a target with the maximum pixel value, and obtaining a scale rule=the input scale real length/scale pixel;
the calculation formula of the size of the convolution kernel of the open operation is as follows;
convolution kernel size = kaiKernel/rule
Wherein, the rule is a scale bar, and the kaiKernel is the open operation kernel size set by the program.
4. The machine vision based seed counting and sizing method of claim 1, wherein the intersections and defects comprise:
two features of a plurality of stuck seeds are defined, including defect features: the uneven area exists on the outline of the seed, and the outline is covered by a line segment, so that the concave disappears, and the filled part becomes a defect;
intersection point characteristics: multiple seed adhesions necessarily form two distinct points, called intersections.
5. The machine vision based seed counting and sizing method of claim 1, wherein the detecting an image of stuck seeds using a defect based stuck seed detection method comprises:
defining defect = { start, end, deep, distance }, wherein start is a defect starting point, end is a defect end point, deep is a defect deepest point, and distance is the distance between deep and the connecting line of start and end, namely the defect distance;
the profile is the condition of adhering seeds: the defect_num is larger than or equal to epsilon d ,ε d Typically 2.
6. The machine vision based seed counting and sizing method of claim 1, wherein the segmenting the stuck seed image into individual seed images using defect based computation comprises:
calculating defects: searching the defect deepest point defect with the largest defect distance N .deep:
Find and point defect N Deep nearest defect deepest point defect M Deep, define 0ρ (P 1 ,P 2 ) For point P 1 Sum point P 2 Euclidean distance between:
if 0ρ (defect) N .deep,defect M .deep)>0.75×width∩area_avg>area 2.5area_avg is the average area and area is the area of the contour currently scanned.
7. The machine vision based seed counting and sizing method of claim 1, wherein the segmenting the stuck seed image into individual seed images using an intersection corrected stuck seed segmentation algorithm comprises:
the program uses convolution kernel with given size to detect the intersection point, and obtains the candidate point of the intersection point through two rounds of filtering;
and filtering edge pixel values of the pixel value matrix scanned by the convolution kernel to obtain a point set points of the adhesion seed binarization outline, and then using the convolution kernel scanning of kernel Size multiplied by kernel Size to obtain a pixel value matrix A by taking each point in the point set as a center.
A first round of filtration was performed: subsequentPixel >7 ≡4× (kernelSize-1);
filtering by a centrosymmetric matrix to obtain the defect N The deep is used as a center, convolution kernel scanning of kernel Size multiplied by kernel Size is used for obtaining a pixel value matrix B, and the matrix is subjected to central symmetry processing B':
a pixel value matrix C is obtained by using a convolution kernel scan of kernel size×kernel size centering on a contour edge point, and a pixel value matrix B is calculated using the following formula ′ Equal to CIs equal to Kernel and a second round of intersection filtering is performed.
Wherein the function isε d Is a threshold value related to the convolution kernel size, and the default value is
The comprehensive filtering mechanism based on Euclidean distance is adopted, and the point is obtained when the following conditions are met i Point substitution was used:
filtering to obtain intersection point candidate point set, and screening out the intersection point candidate point set N The point where deep euclidean distance is minimum:
8. the machine vision based seed counting and sizing method of claim 1, wherein calculating the number of seeds and the size information of each seed from a single seed image comprises:
acquiring all contours in the processed and segmented seed image, and calculating the real area, length and width of the seed according to the contour attribute;
judging whether the image is a scale, a normal seed, an adhesion seed or an adhesion seed with failed segmentation;
removing the scale and the adhesion seed image with failed segmentation, calculating the length, width and area of normal seeds and adhesion seeds, and calculating the number and average value;
and re-segmenting and calculating the adhesion seeds with failed segmentation.
9. The machine vision based seed counting and sizing method of claim 1, wherein the condition of determining the profile as a scale comprises:
length>0.9×ruler len where roller_len is the actual length of the scale entered.
10. The machine vision based seed counting and sizing method of claim 1, wherein the condition for determining that the profile is a stuck seed that fails to cut comprises:
area > limit area×area_avg or length > limit length×length_avg or width > limit width×width_avg, wherein limitArea, limitLength, limitWidth is the minimum area, minimum length, and minimum width of the parameter settings, respectively.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310219375.6A CN116152220A (en) | 2023-03-09 | 2023-03-09 | Seed counting and size measuring method based on machine vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310219375.6A CN116152220A (en) | 2023-03-09 | 2023-03-09 | Seed counting and size measuring method based on machine vision |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116152220A true CN116152220A (en) | 2023-05-23 |
Family
ID=86356307
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310219375.6A Pending CN116152220A (en) | 2023-03-09 | 2023-03-09 | Seed counting and size measuring method based on machine vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116152220A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116451734A (en) * | 2023-06-19 | 2023-07-18 | 浙江托普云农科技股份有限公司 | Auxiliary high-precision seed counting method, system, device and readable storage medium |
-
2023
- 2023-03-09 CN CN202310219375.6A patent/CN116152220A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116451734A (en) * | 2023-06-19 | 2023-07-18 | 浙江托普云农科技股份有限公司 | Auxiliary high-precision seed counting method, system, device and readable storage medium |
CN116451734B (en) * | 2023-06-19 | 2023-09-29 | 浙江托普云农科技股份有限公司 | Auxiliary high-precision seed counting method, system, device and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022042579A1 (en) | Lcd screen defect detection method and apparatus | |
JP4351911B2 (en) | Method and apparatus for evaluating photographic quality of captured images in a digital still camera | |
CN110517265B (en) | Method and device for detecting surface defects of product and storage medium | |
CN116559183B (en) | Method and system for improving defect judging efficiency | |
US8368803B2 (en) | Setting exposure attributes for capturing calibration images | |
JP2000004393A (en) | Back light scene determining method, computer-readable storage medium with back light scene determining method program stored therein and image processor having back light scene determining function | |
CN111369523B (en) | Method, system, equipment and medium for detecting cell stack in microscopic image | |
TWI669519B (en) | Board defect filtering method and device thereof and computer-readabel recording medium | |
CN113109240B (en) | Method and system for determining imperfect grains of grains implemented by computer | |
CN113777033B (en) | Raw strip defect detection method and device based on machine vision | |
CN111879735A (en) | Rice appearance quality detection method based on image | |
CN116152220A (en) | Seed counting and size measuring method based on machine vision | |
US20170048518A1 (en) | Method and apparatus for adjusting installation flatness of lens in real time | |
WO2021248599A1 (en) | Method and system for automatically identifying spot of which category is abnormal | |
CN116468687A (en) | Scratch defect detection method and device, storage medium and electronic equipment | |
CN114627089A (en) | Defect identification method, defect identification device, computer equipment and computer readable storage medium | |
CN114972230A (en) | Method and system for detecting defects of circuit board on production line | |
CN115063342A (en) | Lens dead pixel detection method and device, electronic equipment and storage medium | |
CN113518182A (en) | Cucumber phenotype characteristic measuring method based on raspberry pie | |
CN117351472A (en) | Tobacco leaf information detection method and device and electronic equipment | |
CN116797824A (en) | Automatic egg activity detection method and system based on vision system | |
CN115861259A (en) | Lead frame surface defect detection method and device based on template matching | |
JP5644655B2 (en) | Edible fruit inspection method, inspection apparatus and program | |
CN110874837B (en) | Defect automatic detection method based on local feature distribution | |
CN108734703B (en) | Polished tile printing pattern detection method, system and device based on machine vision |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |