CN110047067B - Bottle shoulder detection method for bottle classification - Google Patents
Bottle shoulder detection method for bottle classification Download PDFInfo
- Publication number
- CN110047067B CN110047067B CN201910269488.0A CN201910269488A CN110047067B CN 110047067 B CN110047067 B CN 110047067B CN 201910269488 A CN201910269488 A CN 201910269488A CN 110047067 B CN110047067 B CN 110047067B
- Authority
- CN
- China
- Prior art keywords
- region
- image
- roi
- bottle
- value
- 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
-
- 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
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20092—Interactive image processing based on input by user
- G06T2207/20104—Interactive definition of region of interest [ROI]
Abstract
The embodiment of the invention discloses a bottle shoulder detection method for bottle classification, which comprises the following steps: reading an image to be detected, and extracting an ROI (region of interest); performing threshold segmentation on the ROI, and performing gray value closed operation after extracting pixel points with gray values within a preset range; performing gray value closed operation on the ROI, then performing connected region combination, and extracting a maximum area region as an image to be processed; performing tangent operation on the upper left corner coordinate and the lower right corner coordinate of the maximum area region to obtain a tan value; and judging the bottle type according to the tan value. By adopting the invention, the labor time cost can be reduced, and the category of the bottle can be accurately judged.
Description
Technical Field
The invention relates to the field of image processing, in particular to a bottle shoulder detection method for bottle classification.
Background
At present, manufacturers of beer, beverage and the like mostly use recyclable bottles for environmental protection and cost saving. In recycling of bottles, sorting bottles by visual inspection is a very labor-and time-consuming task and does not guarantee the reliability of sorting. 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 classification machines adopted in China at present are imported and expensive, and can not be purchased by common medium and small enterprises. Therefore, there is a need to develop a rapid and efficient method of sorting bottles.
Disclosure of Invention
In order to solve the problems, the invention provides a bottle shoulder detection method for bottle classification, which can realize quick classification of bottles, has high accuracy and can meet the requirements on production lines.
Based on this, the invention provides a bottle shoulder detection method for bottle classification, which comprises the following steps:
reading an image to be detected, and extracting an ROI (region of interest); the ROI region comprises a bottle shoulder image;
performing threshold segmentation on the ROI, and performing gray value closed operation after extracting pixel points with gray values within a preset range;
performing gray value closed operation on the ROI, then performing connected region combination, and extracting a maximum area region as an image to be processed;
performing tangent operation on the upper left corner coordinate and the lower right corner coordinate of the maximum area region to obtain a tan value;
and judging the bottle type according to the tan value.
And denoising the image to be detected before reading the image to be detected.
Wherein the ROI region, i.e., the region of interest, is used to determine a region for performing threshold segmentation.
The RIO area extraction method comprises the steps of generating a rectangular area in an image to be detected, wherein the rectangular area is the bottle shoulder image, and intercepting the rectangular area in the image to be detected.
The threshold segmentation is used for segmenting an ROI (region of interest) into a target region and a background region with different gray levels according to the gray difference between the shoulder image and the background image of the ROI, selecting a threshold and determining that each pixel point in the ROI belongs to the target region or the background region to generate a corresponding binary image.
Wherein the thresholding of the ROI area comprises: and carrying out global threshold segmentation on the ROI, wherein the global threshold is realized by calculating the peak gray value in the ROI and subtracting a preset gray value.
The method for global threshold segmentation comprises the following steps: histogram bimodal method.
Wherein the gray value closing operation is used to fill the ROI area and smooth boundary.
Wherein the extracting the maximum area region as the image to be processed includes:
and extracting a maximum area region according to the shape area characteristics of the ROI after the union of the connected regions is carried out.
And if the tan value is greater than the first preset value and less than the second preset value, the bottle is judged to be the second-class bottle, and if the tan value is greater than the second preset value, the bottle is judged to be the third-class bottle.
The invention can reduce the time for classifying the bottles through human visual inspection, and has simple detection method, high speed for classifying the bottles and high accuracy.
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 schematic diagram of a method for detecting a shoulder of a bottle for sorting according to an embodiment of the present invention;
FIG. 2 is a schematic illustration of a bottle of the type provided by embodiments of the present invention;
FIG. 3 is a schematic diagram of a class II bottle provided by an embodiment of the present invention;
fig. 4 is a schematic diagram of three types of bottles provided by the embodiment of the 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.
Fig. 1 is a schematic diagram of a bottle shoulder detection method for bottle classification provided by an embodiment of the present invention, the method including:
s101, reading an image to be detected, and extracting an ROI (region of interest);
and denoising the image to be detected before reading the image to be detected.
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 image to be detected is subjected to denoising treatment, so that the image to be detected is improved, and the problem of image quality reduction caused by noise interference of the image to be detected is solved. The image quality can be effectively improved through denoising treatment, the signal to noise ratio is increased, and the information carried by the image to be detected is better embodied.
The image to be detected can be denoised by adopting methods such as Gaussian filtering, median filtering and the like.
And extracting an ROI (region of interest) region from the image to be detected, wherein the ROI region is an ROI (region of interest). In machine vision, image processing, a region to be processed, called a region of interest, is delineated from a processed image in the form of a box, a circle, an ellipse, an irregular polygon, or the like.
And extracting the RIO area comprises generating a rectangular area in the image to be detected, wherein the rectangular area is a bottle shoulder image, and intercepting the rectangular area in the image to be detected. That is, the region containing the shoulder image is extracted from the image to be detected, i.e., the image range is further reduced. For example, the whole image is a beer bottle on a table, and the ROI region is extracted, that is, the image is cut into a region containing the shoulder image, and the bottle mouth, the bottle bottom, the table and other parts are all removed.
S102, performing threshold segmentation on the ROI, extracting pixel points with gray values within a preset range, and performing gray value closed operation;
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.
The threshold segmentation is used for segmenting an ROI (region of interest) into a target region and a background region with different gray levels according to the gray difference between a bottle shoulder image and the background image of the ROI, selecting a threshold and determining that each pixel point in the ROI belongs to the target region or the background region, so as to generate a corresponding binary image.
Wherein the threshold segmentation of the ROI area includes but is not limited to: and carrying out global threshold segmentation on the ROI, wherein the global threshold is realized by calculating the peak gray value in the ROI and subtracting a preset gray value.
The method for performing threshold segmentation on the ROI region includes a threshold segmentation method such as adaptive threshold segmentation, in addition to global threshold segmentation.
The global threshold segmentation method comprises a histogram bimodal method, and a maximum inter-class variance method and the like.
After threshold segmentation is carried out on the ROI, pixel points with gray values within a preset range are taken, and then gray value closing operation is carried out. The gray value closing operation is used for filling the ROI area and the smooth boundary.
S103, performing connected region combination after performing gray value closed operation on the ROI, and extracting a maximum area region as an image to be processed;
the connected regions are image regions formed by foreground pixel points which have the same pixel value and are adjacent in position in the image, the areas of the connected regions are calculated, the areas of all the connected regions are compared, and the largest area region is selected as the image to be processed.
S104, performing tangent operation on the upper left corner coordinate and the lower right corner coordinate of the maximum area region to obtain a tan value;
the upper left corner coordinate (x) of the maximum area region1,y1) And the coordinate (x) of the lower right corner2,y2);
For the coordinate (x) of the upper left corner1,y1) And the coordinates of the lower right corner (x)2,y2) Performing tangent operation to obtain tan value
tan=(|y1-y2|)/(|x1-x2|)
And S105, judging the bottle type according to the tan value.
And if the tan value is greater than the first preset value and less than the second preset value, the bottle is judged to be the second-class bottle, and if the tan value is greater than the second preset value, the bottle is judged to be the third-class bottle.
For example: the first preset value is 1.31, and the second preset value is 3, then
the beer bottle image with tan value less than 1.31 is judged as a type 1 bottle, please refer to fig. 2;
judging the beer bottle image with tan value between 1.31 and 3 as a type 2 bottle, please refer to FIG. 3;
the beer bottle image with tan value greater than 3 is judged as a type 3 bottle, please refer to fig. 4.
The invention can reduce the time for classifying the bottles through human visual inspection, and has simple detection method, high speed for classifying the bottles and high accuracy.
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 (10)
1. A shoulder detection method for bottle classification, comprising:
reading an image to be detected, and extracting an ROI (region of interest); the ROI region comprises a bottle shoulder image;
performing threshold segmentation on the ROI, and performing gray value closed operation after extracting pixel points with gray values within a preset range;
performing gray value closed operation on the ROI, then performing connected region combination, and extracting a maximum area region as an image to be processed;
performing tangent operation on the upper left corner coordinate and the lower right corner coordinate of the maximum area region to obtain a tan value;
and judging the bottle type according to the tan value.
2. The method as claimed in claim 1, wherein the image to be detected is denoised before the image to be detected is read.
3. The shoulder detection method for bottle classification as claimed in claim 1, wherein the ROI region, i.e. the region of interest, is used to determine the region where the threshold segmentation is performed.
4. The shoulder detection method for bottle classification as claimed in claim 1, wherein the extracting the ROI region includes generating a rectangular region in the image to be detected, the rectangular region being the shoulder image, and intercepting the rectangular region in the image to be detected.
5. The shoulder detection method of claim 1, wherein the threshold segmentation segments the ROI into a target region and a background region with different gray levels according to the gray level difference between the shoulder image and the background image of the ROI, selects a threshold and determines whether each pixel in the ROI belongs to the target region or the background region, and generates a corresponding binary image.
6. The shoulder detection method for bottle classification as claimed in claim 1, wherein the threshold segmentation of the ROI region comprises: and carrying out global threshold segmentation on the ROI, wherein the global threshold is realized by calculating the peak gray value in the ROI and subtracting a preset gray value.
7. The shoulder detection method for bottle classification as claimed in claim 6, wherein the global threshold segmentation method comprises: histogram bimodal method.
8. The shoulder detection method for bottle classification as claimed in claim 1, wherein the gray value closure operation is used to fill the ROI region and smooth boundary.
9. The shoulder detecting method for bottle classification as claimed in claim 1, wherein the extracting the maximum area region as the image to be processed includes:
and extracting a maximum area region according to the shape area characteristics of the ROI after the union of the connected regions is carried out.
10. The shoulder detecting method for bottle classification as claimed in claim 1, wherein the tan value is less than a first preset value, the bottle is judged as first class, the tan value is greater than the first preset value and less than a second preset value, the bottle is judged as second class, and the tan value is greater than the second preset value, the bottle is judged as third class.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910269488.0A CN110047067B (en) | 2019-04-02 | 2019-04-02 | Bottle shoulder detection method for bottle classification |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910269488.0A CN110047067B (en) | 2019-04-02 | 2019-04-02 | Bottle shoulder detection method for bottle classification |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110047067A CN110047067A (en) | 2019-07-23 |
CN110047067B true CN110047067B (en) | 2021-06-22 |
Family
ID=67276191
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910269488.0A Active CN110047067B (en) | 2019-04-02 | 2019-04-02 | Bottle shoulder detection method for bottle classification |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110047067B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102393908A (en) * | 2011-06-29 | 2012-03-28 | 湖南大学 | Method for identifying three bottles on mixed production line based on machine vision detection |
CN102708368A (en) * | 2012-05-04 | 2012-10-03 | 湖南大学 | Method for positioning bottle bodies on production line based on machine vision |
CN104990942A (en) * | 2015-07-20 | 2015-10-21 | 清华大学 | Detection system and method of defected vision caused by transparent glass containers |
CN109165568A (en) * | 2018-08-02 | 2019-01-08 | 小黄狗环保科技有限公司 | A kind of recognition methods general based on deformable plastic bottle shape feature |
CN109190691A (en) * | 2018-08-20 | 2019-01-11 | 小黄狗环保科技有限公司 | The method of waste drinking bottles and pop can Classification and Identification based on deep neural network |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2004065903A1 (en) * | 2003-01-24 | 2004-08-05 | Nihon Yamamura Glass Co., Ltd. | Inspection device for mouth of container |
CN101858734B (en) * | 2010-05-19 | 2011-06-29 | 山东明佳包装检测科技有限公司 | Method for detecting PET bottleneck quality |
DE102010037448A1 (en) * | 2010-09-10 | 2012-03-15 | Wincor Nixdorf International Gmbh | Method and device for detecting empties containers |
FR3000193B1 (en) * | 2012-12-20 | 2015-01-16 | Msc & Sgcc | METHOD AND DEVICE FOR MEASURING VERTICALITY ON A CONTAINER |
CN108171691B (en) * | 2017-12-26 | 2021-05-04 | 成都睿视智能设备有限责任公司 | Detection method of plastic container |
-
2019
- 2019-04-02 CN CN201910269488.0A patent/CN110047067B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102393908A (en) * | 2011-06-29 | 2012-03-28 | 湖南大学 | Method for identifying three bottles on mixed production line based on machine vision detection |
CN102708368A (en) * | 2012-05-04 | 2012-10-03 | 湖南大学 | Method for positioning bottle bodies on production line based on machine vision |
CN104990942A (en) * | 2015-07-20 | 2015-10-21 | 清华大学 | Detection system and method of defected vision caused by transparent glass containers |
CN109165568A (en) * | 2018-08-02 | 2019-01-08 | 小黄狗环保科技有限公司 | A kind of recognition methods general based on deformable plastic bottle shape feature |
CN109190691A (en) * | 2018-08-20 | 2019-01-11 | 小黄狗环保科技有限公司 | The method of waste drinking bottles and pop can Classification and Identification based on deep neural network |
Non-Patent Citations (1)
Title |
---|
基于机器视觉的啤酒瓶检测系统研究;顾勇 等;《计算机工程与设计》;20120116;第33卷(第1期);第248-253页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110047067A (en) | 2019-07-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110070523B (en) | Foreign matter detection method for bottle bottom | |
CN113781402B (en) | Method and device for detecting scratch defects on chip surface and computer equipment | |
CN109377485B (en) | Machine vision detection method for instant noodle packaging defects | |
CN111179243A (en) | Small-size chip crack detection method and system based on computer vision | |
CN110717489B (en) | Method, device and storage medium for identifying text region of OSD (on Screen display) | |
CN106780486B (en) | Steel plate surface defect image extraction method | |
CN115082683A (en) | Injection molding defect detection method based on image processing | |
CN115082419A (en) | Blow-molded luggage production defect detection method | |
CN108830832A (en) | A kind of plastic barrel surface defects detection algorithm based on machine vision | |
WO2021109697A1 (en) | Character segmentation method and apparatus, and computer-readable storage medium | |
CN115908269B (en) | Visual defect detection method, visual defect detection device, storage medium and computer equipment | |
CN110060239B (en) | Defect detection method for bottle opening of bottle | |
CN109886935A (en) | A kind of road face foreign matter detecting method based on deep learning | |
CN110570442A (en) | Contour detection method under complex background, terminal device and storage medium | |
CN114782475A (en) | Corrugated carton line pressing defect detection optimization method based on artificial intelligence system | |
CN115760820A (en) | Plastic part defect image identification method and application | |
CN115471476A (en) | Method, device, equipment and medium for detecting component defects | |
Al-Mahadeen et al. | Signature region of interest using auto cropping | |
CN112288780B (en) | Multi-feature dynamically weighted target tracking algorithm | |
CN110047067B (en) | Bottle shoulder detection method for bottle classification | |
CN108205678A (en) | A kind of nameplate Text region processing method containing speck interference | |
CN109934817A (en) | The external contouring deformity detection method of one seed pod | |
CN105354823A (en) | Tree-ring image edge extraction and segmentation system | |
CN115239595A (en) | Method for detecting qualification of two-dimensional code of packaging printed matter | |
CN110298799B (en) | PCB image positioning correction 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 |