CN110060239B - Defect detection method for bottle opening of bottle - Google Patents
Defect detection method for bottle opening of bottle Download PDFInfo
- Publication number
- CN110060239B CN110060239B CN201910265598.XA CN201910265598A CN110060239B CN 110060239 B CN110060239 B CN 110060239B CN 201910265598 A CN201910265598 A CN 201910265598A CN 110060239 B CN110060239 B CN 110060239B
- Authority
- CN
- China
- Prior art keywords
- image
- area
- bottleneck
- region
- bottle
- 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.)
- Active
Links
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
- G06T7/0004—Industrial image inspection
- G06T7/0006—Industrial image inspection using a design-rule based approach
-
- 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/11—Region-based segmentation
-
- 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/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- 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/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20132—Image cropping
Abstract
The embodiment of the invention discloses a defect detection method for a bottle mouth of a bottle, which comprises the steps of carrying out threshold segmentation and feature extraction on a bottle mouth image, and extracting a template area to be established; generating a region to be cut according to the center coordinate of the region of the template to be established and the vertical coordinate of the highest point of the outline; cutting the region to be cut out from the bottleneck image, and performing threshold segmentation on the region to be cut out to obtain the region area; when the bottleneck image is a complete image of the bottleneck, the area of the obtained area is used as an area standard; and subtracting the area standard from the area obtained by the bottleneck image, comparing the absolute value of the difference obtained by subtracting with a preset value, and if the absolute value of the difference is greater than the preset value, determining that the bottleneck is unqualified. By adopting the invention, the bottle mouth defect can be rapidly detected, and the detection accuracy is high.
Description
Technical Field
The invention relates to the field of image processing, in particular to a defect detection method for a bottle opening of a bottle.
Background
At present, manufacturers of beer, beverage and the like mostly use recyclable glass bottles for environmental protection and cost saving. In the recycling of beer bottles, the detection of the mouth of a beer bottle by a visual inspection method is a work which consumes manpower and time and can not ensure the reliability of detection. In order to reduce the labor time cost and realize industrial automation, the robot vision-based automatic detection of the machine is suitable for transportation, but most of the detection machines adopted in China at present are imported and expensive, and can not be purchased by common medium and small enterprises, and in addition, foreign detection equipment is not completely suitable for China due to the factors such as the size, the color and the national conditions of bottles. Therefore, it is necessary to develop a rapid and effective method for detecting the bottle opening.
Disclosure of Invention
In order to solve the problems, the invention provides a defect detection method for a bottle mouth of a bottle, which has the advantages of high speed and high accuracy for detecting the defects of the bottle mouth and can meet the requirements on a production line.
Based on this, the invention provides a defect detection method for a bottle opening, which comprises the following steps:
performing threshold segmentation and feature extraction on the bottleneck image, and extracting a template area to be established;
generating a region to be cut according to the center coordinate of the region of the template to be established and the vertical coordinate of the highest point of the outline;
cutting the region to be cut out from the bottleneck image, and performing threshold segmentation on the region to be cut out to obtain the region area;
when the bottleneck image is a complete image of the bottleneck, the area of the obtained area is used as an area standard;
and subtracting the area standard from the area obtained by the bottleneck image, comparing the absolute value of the difference obtained by subtracting with a preset value, and if the absolute value of the difference is greater than the preset value, determining that the bottleneck is unqualified.
And denoising the complete image of the bottle opening before reading the image to be detected.
The threshold segmentation and feature extraction of the bottle opening image and the extraction of the template area to be established comprise the following steps:
performing global threshold segmentation on the bottleneck image, and extracting pixel points with gray values within a preset gray range;
performing connected region combination on the pixels, and extracting a maximum area region as an image to be processed according to the shape area characteristics of the connected regions;
and performing gray level closed operation on the image to be processed to be used as a template area to be established.
The method for global threshold segmentation comprises the following steps: histogram bimodal method.
And averaging the row coordinates and the vertical coordinates of the pixel points to obtain the area center coordinates.
And the point with the minimum vertical coordinate of the pixel point is the highest point of the contour.
The generating of the area to be cut according to the center coordinate of the area to be built and the vertical coordinate of the highest point of the outline comprises the following steps:
and generating a rectangular region to be cut by taking the central coordinate as a center, wherein the region to be cut is symmetrical by taking the bottle mouth as the center.
The threshold segmentation is used for segmenting the bottleneck image into a target area and a background area with different gray levels according to the gray level difference between the bottleneck image and the background image, selecting a threshold and determining that each pixel point in the bottleneck image belongs to the target area or the background area to generate a corresponding binary image.
And the global threshold is realized by calculating the gray value of the peak in the region to be cut minus a preset gray value.
If the absolute value of the difference is smaller than a preset value, the bottleneck is qualified, if the absolute value of the difference is smaller than one tenth of the preset value, the bottleneck is a first-class bottleneck, and if the absolute value of the difference is larger than one tenth of the preset value and smaller than the preset value, the bottleneck is a second-class bottleneck.
The bottle mouth defect detection method has the advantages of high speed and high accuracy, and can meet the requirements on production lines.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of a method for defect detection of a bottle mouth provided by an embodiment of the present invention;
FIG. 2 is a schematic view of a completed bottle mouth provided by an embodiment of the present invention;
fig. 3 is a schematic view of a sample vial finish to be tested according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
S101, performing threshold segmentation and feature extraction on the bottleneck image, and extracting a template area to be established;
the method comprises the steps of carrying out threshold segmentation and feature extraction on a bottle opening image, and carrying out denoising processing on the bottle opening image before extracting a template region to be established.
Image noise is a luminance distribution that interferes with the reception of a planar two-dimensional luminance distribution if the luminance distribution is visually received when information is transmitted from a subject or an information source to a viewer by some method. Image noise is typically quantified or described in terms of a signal-to-noise ratio.
The bottle opening image is subjected to denoising processing, so that the bottle opening image is improved, and the problem that the image quality is reduced due to noise interference of the bottle opening image is solved. The image quality can be effectively improved through denoising processing, the signal to noise ratio is increased, and information carried by the bottleneck image is better embodied.
And denoising the bottleneck image by adopting methods such as Gaussian filtering, median filtering and the like.
The threshold segmentation and feature extraction of the bottleneck image and the extraction of the template area to be established comprise the following steps:
performing global threshold segmentation on the bottleneck image, and extracting pixel points with gray values within a preset gray range;
performing connected region combination on the pixels, and extracting a maximum area region as an image to be processed according to the shape area characteristics of the connected regions;
and performing gray level closed operation on the image to be processed to be used as a template area to be established.
Image segmentation is an image segmentation algorithm that divides a digital image into non-overlapping regions and extracts an object of interest, and is generally based on one of two properties of gray scale: discontinuities and similarities. A first application of the property is to segment images based on discrete changes in gray scale. The main application of the second property is to segment images into similar regions according to a predetermined criterion.
Image segmentation is one of the most basic and important fields in image processing and low-level vision in the field of computer vision, and is a basic premise for performing visual analysis and pattern recognition on images. Image threshold segmentation is one of the methods, and image segmentation can also be understood as extracting meaningful feature regions or feature regions to be applied in an image, where the feature regions may be gray values of pixels, object contour curves, texture features, and the like, or may be a threshold segmentation technique such as spatial spectrum or histogram features. The basic principle of thresholding an image is described as follows: the difference of the gray characteristics of the target object to be extracted and the background thereof in the image is utilized, the image is regarded as the combination of two types of areas (target and background) with different gray levels, and a proper threshold value is selected to determine whether each pixel point in the image belongs to the target area or the background area, so that a corresponding binary image is generated.
The threshold segmentation is a simple and effective image segmentation method, and is particularly effective for image segmentation with strong contrast between an object and a background, all pixels with gray levels larger than or equal to a predetermined value are judged to belong to the object, the gray level value is 255 to represent the foreground, otherwise, the pixel points are excluded from the object area, and the gray level value is 0 to represent the background.
Wherein, the threshold segmentation of the bottleneck image includes but is not limited to: and carrying out global threshold segmentation on the bottleneck image, wherein the global threshold is realized by calculating the gray value of the wave crest in the bottleneck image and subtracting a preset gray value.
The method for carrying out threshold segmentation on the bottleneck image comprises a global threshold segmentation method and a threshold segmentation method such as self-adaptive threshold segmentation.
The global threshold segmentation method comprises a histogram bimodal method, and a maximum inter-class variance method and the like.
The communication area is an area G on the complex plane, and if a simple closed curve is made in any area G, the interior of the closed curve always belongs to G, and the G is called as a single communication area. A region is referred to as a multiply connected region if it is not a singly connected region.
Connectivity is an important concept describing areas and boundaries, including: requirements for 4-pass, 8-pass, m-pass, and two-pixel pass: 1. whether the two pixel positions are adjacent; 2. whether the two pixel gray values satisfy a certain similarity criterion.
(1)4, communication: two pixels p and q, if p is in the 4 neighborhood of q, the two pixels are said to be 4 connected;
(2)8, communication: two pixels p and q, if p is in the 8 neighborhood of q, the two pixels are said to be 8 connected;
(3) m is connected with: 1. two pixels p and q, p being in the 4 neighborhood of q, or p being in the D neighborhood of q, 2, and the intersection of the 4 neighborhoods of p and q being empty, i.e. m connectivity is a mixed (mixture) connectivity of 4 connectivity and D connectivity.
Each connected set in the bottleneck image forms a region of the bottleneck image, and a maximum area region is extracted as an image to be processed according to the shape area characteristics of the connected region;
and performing gray level closed operation on the image to be processed to be used as a template area to be established.
The process of expansion followed by erosion is called closed-loop operation, and is used to fill small voids in objects, connect neighboring objects, smooth their boundaries, and not significantly change their areas.
Erosion is a process by which boundary points are eliminated and the boundaries are shrunk inward. Can be used to eliminate small and meaningless objects. The algorithm of corrosion: with a 3 × 3 structure element, each pixel of the scanned image is anded with the structure element and its overlaid binary image if both are 1, resulting in that pixel of the image being 1. Otherwise it is 0. As a result: the binary image is reduced by one turn.
Dilation is the process of merging all background points in contact with an object into the object, expanding the boundary outward. Can be used to fill in voids in objects. The algorithm of inflation: with a 3 × 3 structuring element, each pixel of the scanned image is anded with the structuring element and the binary image it overlays if both are 0, resulting in that pixel of the image being 0. Otherwise it is 1. As a result: the binary image is enlarged by one turn.
And performing gray level closed operation on the image to be processed to be used as a template area to be established.
S102, generating a region to be cut according to the center coordinate of the region of the template to be established and the vertical coordinate of the highest point of the outline;
and averaging the row coordinates and the vertical coordinates of the pixel points to obtain the area center coordinates. And the point with the minimum vertical coordinate of the pixel point, namely the highest point of the outline, takes the central coordinate as the center to generate a rectangular area which is symmetrical by taking the bottle mouth as the center, namely the area to be cut.
S103, cutting the region to be cut out from the bottleneck image, and performing threshold segmentation on the region to be cut out to obtain a region area;
cutting the region to be cut out from the bottleneck image, namely separating the region to be cut out from the bottleneck image, so that the proportion of the part of the bottleneck in the image, which accounts for the image, becomes larger, and performing threshold segmentation on the region to be cut out to obtain the region area.
S104, when the bottle mouth image is a complete bottle mouth image, the area of the obtained area is used as an area standard;
fig. 2 is an image of a complete bottle mouth, and the area of the region obtained after the operations from S101 to S103 are performed on the image of the complete bottle mouth is used as an area standard, and the area standard is a constant for judging whether the bottle mouth is qualified.
S105, subtracting the area standard from the area of the area obtained by the bottleneck image, and comparing the absolute value of the difference obtained by subtracting with a preset value;
the bottleneck image comprises a complete bottleneck image and a damaged bottleneck image, the damaged bottleneck image is subjected to operations from S101 to S103 to obtain an area, the area of the area is subtracted from an area standard to obtain a difference value, and the difference value may be a negative number, so that an absolute value of the difference value is compared with a preset value.
S106, judging whether the absolute value of the difference value is larger than a preset value or not;
s107, if the absolute value of the difference is larger than a preset value, the bottle mouth is unqualified;
and S108, if the absolute value of the difference is not greater than a preset value, the bottle mouth is qualified.
The difference is not greater than a preset value, namely, under the condition that the bottleneck is qualified, the bottleneck can be divided into a plurality of grades, if the absolute value of the difference is smaller than the preset value, the bottleneck is qualified, if the absolute value of the difference is smaller than one tenth of the preset value, the bottleneck is a first-class bottleneck, and if the absolute value of the difference is larger than one tenth of the preset value and smaller than the preset value, the bottleneck is a second-class bottleneck.
The invention has the advantages of high speed and high accuracy for detecting the defects of the bottle mouth and can meet the requirements on the production line.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and substitutions can be made without departing from the technical principle of the present invention, and these modifications and substitutions should also be regarded as the protection scope of the present invention.
Claims (7)
1. A method for detecting defects of a bottle opening is characterized by comprising the following steps:
performing threshold segmentation and feature extraction on the bottleneck image, and extracting a template area to be established;
generating a region to be cut according to the center coordinate of the region of the template to be established and the vertical coordinate of the highest point of the outline;
cutting the region to be cut out from the bottleneck image, and performing threshold segmentation on the region to be cut out to obtain the region area;
when the bottleneck image is a complete image of the bottleneck, the area of the obtained area is used as an area standard;
subtracting the area standard from the area obtained by the bottleneck image, comparing the absolute value of the difference obtained by subtracting with a preset value, and if the absolute value of the difference is greater than the preset value, determining that the bottleneck is unqualified;
the threshold segmentation and feature extraction of the bottleneck image and the extraction of the template area to be established comprise the following steps:
performing global threshold segmentation on the bottleneck image, and extracting pixel points with gray values within a preset gray range;
performing connected region combination on pixels, and extracting a maximum area region as an image to be processed according to the shape area characteristics of the connected regions;
performing gray level closed operation on the image to be processed to be used as a template area to be established;
averaging the row coordinates and the vertical coordinates of the pixel points to obtain area center coordinates; and the point with the minimum vertical coordinate of the pixel point is the highest point of the contour.
2. The method for detecting defects of a bottle mouth as claimed in claim 1, wherein before the threshold segmentation, feature extraction and extraction of the template region to be established for the bottle mouth image, further comprising: and denoising the bottle opening image.
3. The method for defect detection of a bottle mouth as claimed in claim 1, wherein said global threshold segmentation method comprises: histogram bimodal method.
4. The method for detecting defects of bottle openings as claimed in claim 1, wherein the generating the region to be trimmed according to the center coordinates of the region to be built and the ordinate of the highest point of the contour comprises:
and generating a rectangular region to be cut by taking the central coordinate as a center, wherein the region to be cut is symmetrical by taking the bottle mouth as the center.
5. The method for detecting defects of a bottle mouth according to claim 1, wherein the threshold segmentation divides the bottle mouth image into a target area and a background area with different gray levels according to the difference of the gray levels of the bottle mouth image and the background image, selects a threshold and determines whether each pixel point in the bottle mouth image belongs to the target area or the background area to generate a corresponding binary image.
6. The method for detecting defects on a bottle mouth of a bottle according to claim 1, wherein the global threshold is implemented by calculating a gray value of a peak minus a preset gray value in the region to be cut.
7. The method of claim 1, wherein the bottleneck is qualified if the absolute value of the difference is less than a predetermined value, the bottleneck is an equal-class bottleneck if the absolute value of the difference is less than one tenth of the predetermined value, and the bottleneck is an equal-class bottleneck if the absolute value of the difference is greater than one tenth of the predetermined value and less than the predetermined value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910265598.XA CN110060239B (en) | 2019-04-02 | 2019-04-02 | Defect detection method for bottle opening of bottle |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910265598.XA CN110060239B (en) | 2019-04-02 | 2019-04-02 | Defect detection method for bottle opening of bottle |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110060239A CN110060239A (en) | 2019-07-26 |
CN110060239B true CN110060239B (en) | 2021-05-07 |
Family
ID=67318340
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910265598.XA Active CN110060239B (en) | 2019-04-02 | 2019-04-02 | Defect detection method for bottle opening of bottle |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110060239B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113998344B (en) * | 2020-07-28 | 2023-06-27 | 北京四维图新科技股份有限公司 | Express box recycling method, system, server, terminal and storage medium |
CN112561896B (en) * | 2020-12-22 | 2023-08-15 | 广州大学 | Method, system and device for detecting defects of glass bottle mouth and storage medium |
CN113610772B (en) * | 2021-07-16 | 2023-07-04 | 广州大学 | Method, system, device and storage medium for detecting spraying code defect at bottom of pop can bottle |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4929828A (en) * | 1988-02-29 | 1990-05-29 | Emhart Industries, Inc. | Inspecting glass containers for line-over finish defects with bifurcated fiber optic bundle |
CN1475795A (en) * | 2002-08-12 | 2004-02-18 | 广西师范大学 | Glass Bottle and can detecting method and detecting device |
CN101710080A (en) * | 2009-12-01 | 2010-05-19 | 湖南大学 | Stacking glass bottle detection method based on machine vision and transporter |
CN106546605A (en) * | 2016-10-26 | 2017-03-29 | 湖南大学 | A kind of medicated beer bottle mouth defect detection method for utilizing 4 circumferential registrations and hysteresis threshold |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102162797B (en) * | 2010-11-24 | 2012-07-04 | 哈尔滨工业大学(威海) | Algorithm for detecting glass bottle neck damage and bottle bottom dirt |
CN105954301B (en) * | 2016-06-22 | 2019-08-06 | 广东省智能制造研究所 | A kind of bottleneck quality detection method based on machine vision |
-
2019
- 2019-04-02 CN CN201910265598.XA patent/CN110060239B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4929828A (en) * | 1988-02-29 | 1990-05-29 | Emhart Industries, Inc. | Inspecting glass containers for line-over finish defects with bifurcated fiber optic bundle |
CN1475795A (en) * | 2002-08-12 | 2004-02-18 | 广西师范大学 | Glass Bottle and can detecting method and detecting device |
CN101710080A (en) * | 2009-12-01 | 2010-05-19 | 湖南大学 | Stacking glass bottle detection method based on machine vision and transporter |
CN106546605A (en) * | 2016-10-26 | 2017-03-29 | 湖南大学 | A kind of medicated beer bottle mouth defect detection method for utilizing 4 circumferential registrations and hysteresis threshold |
Non-Patent Citations (3)
Title |
---|
一种圆形瓶口缺陷定位检测方法;韦哲等;《测控技术》;20171118;第36卷(第11期);第27-31页 * |
基于OpenCV的啤酒瓶口缺陷检测系统研究;郭克友等;《制造业自动化》;20140810;第36卷(第8期);第61-71页 * |
郭克友等.基于OpenCV的啤酒瓶口缺陷检测系统研究.《制造业自动化》.2014,第36卷(第8期),第61-71页. * |
Also Published As
Publication number | Publication date |
---|---|
CN110060239A (en) | 2019-07-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110070523B (en) | Foreign matter detection method for bottle bottom | |
CN109377485B (en) | Machine vision detection method for instant noodle packaging defects | |
CN115082683A (en) | Injection molding defect detection method based on image processing | |
CN109242853B (en) | PCB defect intelligent detection method based on image processing | |
CN110060239B (en) | Defect detection method for bottle opening of bottle | |
CN109685760B (en) | MATLAB-based SLM powder bed powder laying image convex hull depression defect detection method | |
CN111179243A (en) | Small-size chip crack detection method and system based on computer vision | |
CN115345885A (en) | Method for detecting appearance quality of metal fitness equipment | |
CN115908269B (en) | Visual defect detection method, visual defect detection device, storage medium and computer equipment | |
CN111127402A (en) | Visual detection method for welding quality of robot | |
CN114140679A (en) | Defect fusion method, device, recognition system and storage medium | |
CN109540925B (en) | Complex ceramic tile surface defect detection method based on difference method and local variance measurement operator | |
CN106780526A (en) | A kind of ferrite wafer alligatoring recognition methods | |
CN109378279B (en) | Wafer detection method and wafer detection system | |
CN113077437B (en) | Workpiece quality detection method and system | |
CN110738106A (en) | optical remote sensing image ship detection method based on FPGA | |
CN113256624A (en) | Continuous casting round billet defect detection method and device, electronic equipment and readable storage medium | |
CN115760820A (en) | Plastic part defect image identification method and application | |
CN115471476A (en) | Method, device, equipment and medium for detecting component defects | |
CN114897881A (en) | Crystal grain defect detection method based on edge characteristics | |
CN112102278A (en) | Metal workpiece machining surface defect detection method based on computer vision | |
CN113971681A (en) | Edge detection method for belt conveyor in complex environment | |
CN113916893A (en) | Method for detecting die-cutting product defects | |
CN113129265A (en) | Method and device for detecting surface defects of ceramic tiles and storage medium | |
CN102313740A (en) | Solar panel crack detection method |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |