CN113538345A - Industrial bottle and can device counting method based on image processing - Google Patents

Industrial bottle and can device counting method based on image processing Download PDF

Info

Publication number
CN113538345A
CN113538345A CN202110726962.5A CN202110726962A CN113538345A CN 113538345 A CN113538345 A CN 113538345A CN 202110726962 A CN202110726962 A CN 202110726962A CN 113538345 A CN113538345 A CN 113538345A
Authority
CN
China
Prior art keywords
image
bottle
industrial
counting method
devices
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
Application number
CN202110726962.5A
Other languages
Chinese (zh)
Inventor
王涌
潘宏
周王益
赵远方
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shengzhou Zhejiang University of Technology Innovation Research Institute
Original Assignee
Shengzhou Zhejiang University of Technology Innovation Research Institute
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shengzhou Zhejiang University of Technology Innovation Research Institute filed Critical Shengzhou Zhejiang University of Technology Innovation Research Institute
Priority to CN202110726962.5A priority Critical patent/CN113538345A/en
Publication of CN113538345A publication Critical patent/CN113538345A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration by the use of local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration by the use of histogram techniques
    • G06T5/70
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20036Morphological image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20152Watershed segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30242Counting objects in image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Quality & Reliability (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

An industrial bottle and can device counting method based on image processing is characterized in that an industrial camera takes a snapshot of an industrial bottle and can device picture as a data source and transmits the snapshot to a computer image preprocessing part; carrying out image enhancement on the original industrial bottle device image by a histogram equalization enhancement technology; then, a wiener filtering algorithm is adopted to reduce noise of the image, and meanwhile, the edge profile of the bottle device is kept well; after image preprocessing is carried out, the bottle device and the background are segmented by adopting an OTSU maximum between-class variance algorithm to obtain an ideal bottle device binary image; removing false from the binary image of the bottle device by morphological expansion and corrosion operation; separating the adhered bottle and can devices by using a watershed segmentation algorithm; finally, the number of devices is counted based on the size area threshold. The device and the method are suitable for counting the number of the industrial bottle and can devices, replace the traditional manual counting mode, save the labor cost and improve the working efficiency of industrial production.

Description

Industrial bottle and can device counting method based on image processing
Technical Field
The invention relates to the field of image processing, in particular to an industrial bottle and can device counting method based on image processing.
Background
The production of bottle-can type devices is huge in industry, and the bottle-can type devices are widely used, such as beverage bottles, dairy product packages, liquid medical medicine containers and the like. The traditional counting method for devices by manufacturers is usually a manual counting method, the counting method consumes a large amount of manpower time and is low in efficiency, and eye fatigue is easily caused due to long-time checking and counting by naked eyes, so that result errors are large.
Disclosure of Invention
In order to solve the problems in the background art, the invention provides the image processing-based industrial bottle and can device counting method which is simple and easy to operate, has accurate and efficient calculation, can effectively count industrial bottle and can devices, replaces a manual counting mode, saves the labor cost and greatly improves the industrial work efficiency.
The technical scheme adopted by the invention for solving the technical problems is as follows:
an industrial bottle and can device counting method based on image processing comprises the following steps:
step S1: overlooking and shooting images of the bottle and can devices, and transmitting the images to a computer system as a data source;
step S2: carrying out image enhancement on the original industrial bottle device image by a histogram equalization enhancement technology;
step S3: carrying out noise reduction processing on the original image by adopting a wiener filtering algorithm;
step S4: segmenting the bottle device and the background by adopting an OTSU maximum between-class variance algorithm to obtain an ideal bottle device binary image;
step S5: removing false operation of the binary image of the bottle device by adopting morphological expansion and corrosion operation;
step S6: separating the adhered bottle and can devices by using a watershed segmentation algorithm;
step S7: finally, the number of devices is counted based on the size area threshold.
Further, in step S2, the histogram is a visual statistic of the gray level distribution range of the image, and the gray level histogram function represents the gray level range of [0, L-1 ].
h(rp)=np
Where np is the number of pixels whose image gray scale is rp, and rp is the p-th gray scale in the image.
Still further, in step S3, the wiener filter is an optimal linear filtering method proposed according to the minimum mean square error criterion, and the application range is wide. When the image is subjected to wiener filtering, the mean and variance of the local matrix of the target pixel a (n1, n2) are estimated, and the calculation formula is as follows:
Figure BDA0003137876080000021
Figure BDA0003137876080000022
wherein η is a neighborhood of M × N of a certain pixel;
then estimating the transformed pixel value b (n1, n2) by using a wiener filter;
Figure BDA0003137876080000023
wherein v is2Is the image variance.
In step S4, the image is binarized by using the maximum inter-class variance algorithm of the OSTU, and a threshold T is obtained.
In step S5, morphological operations such as erosion and dilation are performed on the extracted binary image, so that noise can be effectively eliminated, and a complete device region and clear edge information can be obtained.
In step S6, a distance-based watershed segmentation method is used, and after distance change is performed on the binary image, a distance set from each pixel in the binary image to a pixel closest to a zero value is obtained, and watershed transformation is performed according to the set;
complementing the target binary image to obtain a distance transformation function:
D(p)=min{dist(p,q),q∈m}
the region of interest is m, D represents a set after distance transformation, p and q are pixel points, and dist is a distance function.
After the processing of steps S2, S3, S4, S5, and S6, the target regions are basically binary images of the bottle-can devices in a plan view state separated from each other, and a counting method based on a size area is adopted for the statistical number.
According to the method, firstly, the image of the device is enhanced through a histogram equalization enhancement technology, then the original image is subjected to primary noise reduction processing through wiener filtering, after a binary image of a more ideal original image is extracted through a maximum between-class variance algorithm, false removing processing is performed through morphological corrosion and expansion operation, the secondary noise reduction effect is achieved, bottle and can devices in the binary image are mutually independent through a better segmentation effect of a watershed algorithm, and therefore counting is achieved through a counting method based on the size area.
The invention has the following beneficial effects: the counting machine is simple and easy to operate, is accurate and efficient in calculation, can effectively count industrial bottle devices, replaces a manual counting mode, saves labor cost and greatly improves industrial work efficiency.
Drawings
FIG. 1 is a system flow diagram of an industrial can device counting method based on image processing.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Referring to fig. 1, an image processing-based industrial bottle and can device counting method includes the following steps:
step S1: image acquisition
The high-definition images of the bottle and can devices can be obtained by a high-definition camera in a way of overhead shooting, the images are clear, have no shielding and are not obvious, the shot images are used as data sources of the method, the number of the bottle and can devices is counted, the arrangement modes of the same kind of bottle and can devices in the images are random, and then the images are transmitted to a computer for processing and counting.
Step 2: histogram equalization enhancement
Preprocessing a target image, performing image enhancement on the image of the bottle device by utilizing a gray level histogram, enhancing the contrast ratio of a device region and a background, and providing a more real digital image for noise reduction, false removal and counting of a subsequent image;
the histogram is a visual statistic of the gray level distribution range of the image, with the gray level histogram function representing the gray level range of [0, L-1 ].
h(rp)=np
Np is the number of pixels with the image gray level rp, and rp is the p-th gray level in the image;
and step 3: wiener filtering noise reduction
Carrying out first noise reduction on the original picture subjected to histogram equalization enhancement through wiener filtering, wherein the noise reduction is carried out aiming at eliminating noise caused by factors such as shooting angle, light intensity and vibration and simultaneously keeping the edge outline of a bottle device in the image;
wiener filtering is an optimal linear filtering method provided according to the minimum mean square error criterion, and has a wide application range. When the image is subjected to wiener filtering, the mean and variance of the local matrix of the target pixel a (n1, n2) are estimated, and the calculation formula is as follows:
Figure BDA0003137876080000051
Figure BDA0003137876080000052
wherein η is a neighborhood of M × N of a certain pixel;
then estimating the transformed pixel value b (n1, n2) by using a wiener filter;
Figure BDA0003137876080000053
wherein v is2Is the image variance.
And 4, step 4: OTSU binary image extraction
After image processing, what is needed for counting is a binary image of the can device. The OTSU maximum between-class variance algorithm is based on a clustering idea, data is divided into two categories by using a threshold T, when the variance between the thresholds is maximum, the probability of wrong division is minimum, so that the gray value of a pixel point with the gray value larger than the threshold T is adjusted to be 255 again, and the gray value of a pixel point with the gray value smaller than the threshold T is adjusted to be 0. The device and the background are segmented by the algorithm, and an ideal device binary image is obtained.
And 5: morphological operations to remove artifacts
Erosion and dilation are basic operations of mathematical morphology, where erosion reduces the area of a white region, while dilation is the expansion of a white region in an image, and the pixel area is changed by erosion and erosion to obtain an ideal output image.
Step 6: watershed segmentation based on distance
The watershed algorithm based on distance can effectively separate the adhered objects. For the condition that a plurality of bottle devices are adhered and abutted in the image, the device is relatively independent by complementing the target image to obtain distance conversion and then segmenting, so that a subsequent counting method is conveniently utilized;
adopting a distance-based watershed segmentation method, obtaining a distance set from each pixel in the binary image to a pixel closest to a zero value after distance change is carried out on the binary image, and carrying out watershed transformation according to the set;
complementing the target binary image to obtain a distance transformation function:
D(p)=min{dist(p,q),q∈m}
the region of interest is m, D represents a set after distance transformation, p and q are pixel points, and dist is a distance function.
And 7: counting method based on size area
After the processing of steps S2, S3, S4, S5 and S6, the target regions are basically binary images of the bottle-can devices in a mutually separated, overlooked state, and a counting method based on size and area is adopted for counting the number;
after the images are processed for a plurality of times in the previous period, the target areas are basically separated from each other, 2/3 sizes of corresponding actual bottle size areas are selected as judgment threshold values S in the algorithm process, when the areas are larger than the threshold values S, the devices are determined, the number is increased by 1, otherwise, no operation is performed, and finally the number of the devices in the input bottle device images can be obtained.
The embodiments described in this specification are merely illustrative of implementations of the inventive concepts, which are intended for purposes of illustration only. The scope of the present invention should not be construed as being limited to the particular forms set forth in the examples, but rather as being defined by the claims and the equivalents thereof which can occur to those skilled in the art upon consideration of the present inventive concept.

Claims (7)

1. An industrial bottle and can device counting method based on image processing is characterized by comprising the following steps:
step S1: overlooking and shooting images of the bottle and can devices, and transmitting the images to a computer system as a data source;
step S2: carrying out image enhancement on the original industrial bottle device image by a histogram equalization enhancement technology;
step S3: carrying out noise reduction processing on the original image by adopting a wiener filtering algorithm;
step S4: segmenting the bottle device and the background by adopting an OTSU maximum between-class variance algorithm to obtain an ideal bottle device binary image;
step S5: removing false operation of the binary image of the bottle device by adopting morphological expansion and corrosion operation;
step S6: separating the adhered bottle and can devices by using a watershed segmentation algorithm;
step S7: finally, the number of devices is counted based on the size area threshold.
2. The image processing based industrial canister device counting method according to claim 1, characterized in that: in step S2, the histogram is a visual statistic of the gray-level distribution range of the image, and the gray-level histogram function represents the gray-level range of [0, L-1 ].
h(rp)=np
Where np is the number of pixels whose image gray scale is rp, and rp is the p-th gray scale in the image.
3. Image processing based industrial bottle and can device counting method according to claim 1 or 2, characterized in that: in step S3, the wiener filter is an optimal linear filtering method proposed according to the minimum mean square error criterion, and the application range is wide. When the image is subjected to wiener filtering, the mean and variance of the local matrix of the target pixel a (n1, n2) are estimated, and the calculation formula is as follows:
μ=1/MN∑n1,n2∈ηa(n1,n2)
σ2=1/MN∑n1,n2∈ηa2(n1,n2)-μ2
wherein η is a neighborhood of M × N of a certain pixel;
then estimating the transformed pixel value b (n1, n2) by using a wiener filter;
Figure FDA0003137876070000021
wherein v is2Is the image variance.
4. Image processing based industrial bottle and can device counting method according to claim 1 or 2, characterized in that: in step S4, the image is binarized by using the maximum inter-class variance algorithm of the OSTU, and a threshold T is obtained.
5. Image processing based industrial bottle and can device counting method according to claim 1 or 2, characterized in that: in step S5, morphological operations such as erosion and dilation are performed on the extracted binary image, so that noise can be effectively eliminated, and a complete device region and clear edge information can be obtained.
6. Image processing based industrial bottle and can device counting method according to claim 1 or 2, characterized in that: in step S6, a distance-based watershed segmentation method is used to obtain a distance set from each pixel in the binary image to a pixel closest to a zero value after distance change is performed on the binary image, and watershed transformation is performed according to the set;
complementing the target binary image to obtain a distance transformation function:
D(p)=min{dist(p,q),q∈m}
the region of interest is m, D represents a set after distance transformation, p and q are pixel points, and dist is a distance function.
7. The image processing based industrial canister device counting method according to claim 1, characterized in that: after the processing of steps S2, S3, S4, S5, and S6, the target regions are basically binary images of the bottle-can devices in a plan view state separated from each other, and a counting method based on a size area is adopted for the statistical number.
CN202110726962.5A 2021-06-29 2021-06-29 Industrial bottle and can device counting method based on image processing Pending CN113538345A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110726962.5A CN113538345A (en) 2021-06-29 2021-06-29 Industrial bottle and can device counting method based on image processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110726962.5A CN113538345A (en) 2021-06-29 2021-06-29 Industrial bottle and can device counting method based on image processing

Publications (1)

Publication Number Publication Date
CN113538345A true CN113538345A (en) 2021-10-22

Family

ID=78126186

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110726962.5A Pending CN113538345A (en) 2021-06-29 2021-06-29 Industrial bottle and can device counting method based on image processing

Country Status (1)

Country Link
CN (1) CN113538345A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914843A (en) * 2014-04-04 2014-07-09 上海交通大学 Image segmentation method based on watershed algorithm and morphological marker
WO2016091016A1 (en) * 2014-12-12 2016-06-16 山东大学 Nucleus marker watershed transformation-based method for splitting adhered white blood cells

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914843A (en) * 2014-04-04 2014-07-09 上海交通大学 Image segmentation method based on watershed algorithm and morphological marker
WO2016091016A1 (en) * 2014-12-12 2016-06-16 山东大学 Nucleus marker watershed transformation-based method for splitting adhered white blood cells

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
王念富: "基于机器视觉的羊群图像分割及计数算法研究", 《中国优秀硕士学位论文全文数据库 农业科技辑》, no. 2 *
谢勤岚;于小卉;: "一种基于Matlab的血红细胞计数的工程方法", 中南民族大学学报(自然科学版), no. 04 *

Similar Documents

Publication Publication Date Title
CN108898610B (en) Object contour extraction method based on mask-RCNN
CN108376403B (en) Grid colony image segmentation method based on Hough circle transformation
CN110287963B (en) OCR recognition method for comprehensive performance test
CN114972326A (en) Defective product identification method for heat-shrinkable tube expanding process
CN110210477B (en) Digital instrument reading identification method
CN110674812B (en) Civil license plate positioning and character segmentation method facing complex background
CN105447489B (en) A kind of character of picture OCR identifying system and background adhesion noise cancellation method
CN110648330B (en) Defect detection method for camera glass
CN115063430B (en) Electric pipeline crack detection method based on image processing
CN110415208A (en) A kind of adaptive targets detection method and its device, equipment, storage medium
CN111754538B (en) Threshold segmentation method for USB surface defect detection
CN113252695B (en) Plastic packaging film defect detection method and detection device based on image processing
CN111476804A (en) Method, device and equipment for efficiently segmenting carrier roller image and storage medium
CN116188468A (en) HDMI cable transmission letter sorting intelligent control system
CN108038482A (en) A kind of automobile engine cylinder-body sequence number Visual intelligent identifying system
CN113487538A (en) Multi-target segmentation defect detection method and device and computer storage medium thereof
Al-Mahadeen et al. Signature region of interest using auto cropping
CN111242051B (en) Vehicle identification optimization method, device and storage medium
Wang et al. Adaptive binarization: A new approach to license plate characters segmentation
CN113538345A (en) Industrial bottle and can device counting method based on image processing
CN108009459B (en) Character two-dimensional bar code rapid positioning method based on triangular locator
CN113643290B (en) Straw counting method and device based on image processing and storage medium
CN115587966A (en) Method and system for detecting whether parts are missing or not under condition of uneven illumination
CN115631128A (en) Circular medicine quantity detection method based on circular power theorem
CN114758125A (en) Gear surface defect detection method and system based on deep learning

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