CN114187247A - Ampoule bottle printing character defect detection method based on image registration - Google Patents

Ampoule bottle printing character defect detection method based on image registration Download PDF

Info

Publication number
CN114187247A
CN114187247A CN202111432045.2A CN202111432045A CN114187247A CN 114187247 A CN114187247 A CN 114187247A CN 202111432045 A CN202111432045 A CN 202111432045A CN 114187247 A CN114187247 A CN 114187247A
Authority
CN
China
Prior art keywords
image
registered
ampoule bottle
difference
template
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
CN202111432045.2A
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.)
Henan University
Original Assignee
Henan University
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 Henan University filed Critical Henan University
Priority to CN202111432045.2A priority Critical patent/CN114187247A/en
Publication of CN114187247A publication Critical patent/CN114187247A/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
    • G06T7/001Industrial image inspection using an image reference approach
    • G06T5/80
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
    • 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/20081Training; Learning
    • 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
    • G06T2207/30144Printing quality

Abstract

The invention discloses an ampoule bottle printed word defect detection method based on image registration, which comprises the following steps of 1: acquiring an ampoule bottle printing digital image by using a linear array industrial camera to obtain a template image and an image to be registered; step 2: extracting and describing feature points of the template image by using an SURF algorithm, and extracting and describing the feature points of the image to be registered; and step 3: matching the feature points by using a FLANN matching algorithm; and 4, step 4: calculating a transformation matrix of the image to be registered mapped to the template image according to the matched feature point pairs; and 5: the image to be registered is subjected to matrix transformation, calibration is carried out, and image distortion is eliminated; step 6: and carrying out image difference on the template image and the calibrated image to be registered to obtain a difference image, and judging whether the printed word has defects according to the difference image. The invention can quickly and effectively realize the characteristic extraction, matching, correction and detection of the ampoule bottle printing digital image, and the detection process uses less time.

Description

Ampoule bottle printing character defect detection method based on image registration
Technical Field
The invention belongs to the field of industrial printed word defect detection, and particularly relates to an ampoule bottle printed word defect detection method based on image registration.
Background
In recent years, the quality safety problem of medicines is concerned by more and more people, and the quality detection of medicines is also enhanced in China. Aiming at the field of ampoule bottle printing, the quality requirement for printing characters is stricter, and the problem of medicine safety caused by incomplete printing characters or incomplete information of the ampoule bottle is avoided.
The printing equipment rear end that present medicine bottle manufacturing enterprise adopted does not have supporting printing check out test set, can only hire the manual work and detect ampoule printing quality, and the manual detection has the defect that can't avoid:
1. the condition of missing detection is easily caused, the eyes can be tired due to long-time work of workers, some defect information is easily missed, and the local judgment of some defects is wrong.
2. The qualified standards of the quality cannot be completely unified, and different people detecting the same product may make different judgments on the product due to subjective consciousness.
3. Slow, costly, inefficient, and require a large amount of labor and capital.
Therefore, based on the above problems, a novel ampoule bottle printed word defect detection method is urgently needed to replace the manual work and improve the production efficiency.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide an ampoule bottle printed word defect detection method based on image registration, and solves the problems in the background art.
The invention provides the following technical scheme:
an ampoule bottle printing word defect detection method based on image registration comprises the following steps:
step 1: acquiring an ampoule bottle printing digital image by using a linear array industrial camera to obtain a template image and an image to be registered;
step 2: extracting and describing feature points of the template image by using an SURF algorithm, and extracting and describing the feature points of the image to be registered;
and step 3: matching the feature points by using a FLANN matching algorithm;
and 4, step 4: calculating a transformation matrix of the image to be registered mapped to the template image according to the matched feature point pairs;
and 5: the image to be registered is subjected to matrix transformation, calibration is carried out, and image distortion is eliminated;
step 6: and carrying out image difference on the template image and the calibrated image to be registered to obtain a difference image, and judging whether the printed word has defects according to the difference image.
Preferably, in step 1, a CMOS line industrial camera is used to capture an image, the image sensor of which has two rows of photosensitive elements.
Preferably, in step 2, the input picture is adjusted to a uniform size before the feature point extraction.
Preferably, in step 3, after feature point matching is performed by using a FLANN matching algorithm, the euclidean distance of each feature point pair is calculated, and feature point pairs with the euclidean distance greater than a set threshold are removed.
Preferably, in step 4, the RANSAC operator is used to eliminate the mismatching point pairs when calculating the transformation matrix.
Preferably, in step 6, the template image and the calibrated image to be registered are grayed, and then image difference is performed.
Preferably, after the differential image is obtained, binarization processing and filtering processing are sequentially performed on the differential image, the number of pixels with a pixel value of 255 in the differential image is counted, and if the counted number is greater than a set threshold value, a missing printing condition is considered to exist.
Compared with the prior art, the invention has the following beneficial effects:
(1) the ampoule bottle printing character defect detection method based on image registration can quickly and effectively realize the extraction, matching, correction and detection of the features of the ampoule bottle printing character image, the image features have the characteristics of scale invariance, light non-deformability and rotation invariance, and the detection process is less in time consumption.
(2) According to the ampoule bottle printed word defect detection method based on image registration, the FLANN matching algorithm is used for matching the feature points, so that the feature point matching precision is improved, and the feature matching error is reduced.
(3) According to the ampoule bottle printing character defect detection method based on image registration, images to be registered are calibrated through the transformation matrix, image distortion is eliminated, adverse effects on detection work due to image distortion are avoided, the detection result is improved, and the detection efficiency is improved.
(4) According to the ampoule bottle printing word defect detection method based on image registration, when a transformation matrix is calculated, RANSAC operators are used, mismatching point pairs are eliminated, the influence of the mismatching point pairs on the detection process is reduced, and the detection precision is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flow chart of the present invention.
Fig. 2 shows a template image and an image to be registered.
Fig. 3 is a schematic diagram of feature point pair matching after removing mismatching.
Fig. 4 is an image of an image to be registered after being subjected to transformation matrix calibration and restoration.
Fig. 5 is an effect diagram of image difference between the template image and the calibrated image to be registered.
Fig. 6 is an effect diagram of the difference image after binarization processing.
Fig. 7 is a diagram of the effect of the difference image after being filtered.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be described in detail and completely with reference to the accompanying drawings. It is to be understood that the described embodiments are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
The first embodiment is as follows:
as shown in fig. 1, an ampoule bottle printed word defect detection method based on image registration includes the following steps:
step 1: acquiring an ampoule bottle printing digital image by using a linear array industrial camera to obtain a template image and an image to be registered; step 2: extracting and describing feature points of the template image by using an SURF algorithm, and extracting and describing the feature points of the image to be registered; and step 3: matching the feature points by using a FLANN matching algorithm; and 4, step 4: calculating a transformation matrix of the image to be registered mapped to the template image according to the matched feature point pairs; and 5: the image to be registered is subjected to matrix transformation, calibration is carried out, and image distortion is eliminated; step 6: and carrying out image difference on the template image and the calibrated image to be registered to obtain a difference image, and judging whether the printed word has defects according to the difference image. In step 1, a CMOS line industrial camera is used to capture an image, the image sensor of which has two rows of photosensitive elements. In step 2, the input picture is adjusted to a uniform size before feature point extraction. In step 3, after feature point matching is performed by using a FLANN matching algorithm, the Euclidean distance of each feature point pair is calculated, and the feature point pairs with the Euclidean distances larger than a set threshold value are removed. In step 4, when calculating the transformation matrix, using RANSAC operator to eliminate the mismatching point pairs. In step 6, firstly, graying the template image and the calibrated image to be registered, then, carrying out image difference to obtain a difference image, and then, sequentially carrying out binarization processing and filtering processing on the difference image, counting the number of pixels with a pixel value of 255 in the difference image, and if the counted number is greater than a set threshold value, determining that a missing printing condition exists.
Example two
An ampoule bottle printing word defect detection method based on image registration comprises the following steps: step 1: acquiring an ampoule bottle printing digital image by using a linear array industrial camera to obtain a template image and an image to be registered, wherein the template image and the image to be registered are shown in figure 2; step 2: extracting and describing feature points of the template image by using an SURF algorithm, extracting and describing the feature points of the image to be registered, and reducing the size of the input image to 250 x 200 before extracting the feature points; and step 3: using a FLANN matching algorithm to match the feature points, as shown in FIG. 3, after the feature points are matched, calculating the Euclidean distance of each feature point pair, setting the value of 2 times of the minimum Euclidean distance as a threshold value, and removing the feature point pairs with the Euclidean distance larger than the set threshold value; and 4, step 4: calculating a transformation matrix of the image to be registered mapped to the template image according to the matched characteristic point pairs, and simultaneously, removing mismatching point pairs again by using an RANSAC operator, removing interference generated by the mismatching point pairs and improving the matching precision; and 5: the image to be registered is subjected to matrix transformation, calibration is carried out, and image distortion is eliminated, as shown in FIG. 4; step 6: firstly, graying the template image and the calibrated image to be registered, then carrying out image difference to obtain a difference image as shown in fig. 5, then carrying out binarization processing and filtering processing on the difference image in sequence as shown in fig. 6 and 7, then counting the number of pixel points with the pixel value of 255 in the difference image, if the counted number is greater than a set threshold value, determining that a missing printing condition exists, and if the counted number is less than the set threshold value, determining that printing is complete.
EXAMPLE III
As shown in fig. 1, an ampoule bottle printed word defect detection method based on image registration includes the following steps:
step 1: acquiring an ampoule bottle printing digital image by using a linear array industrial camera to obtain a template image and an image to be registered;
step 2: utilizing an SURF algorithm to extract and describe feature points of the template image, and extracting and describing the feature points of the image to be registered, wherein the description of the feature points comprises two steps of feature point direction distribution and 128-dimensional vector description, and the direction distribution of the feature points comprises the following steps: the gradient directions of all pixels in the neighborhood around the feature point are calculated by the Sift, a gradient direction histogram is generated and is normalized to be the gradient direction histogram of 0-360 degrees to 36 directions, and the direction represented by the main component of the gradient histogram is taken as the direction of the feature point; the 128-dimensional vector describes: based on the gradient direction histogram expansion, 4 × 4 blocks around the feature point are taken, 8 gradient directions are extracted from each block, and 128 directions are taken as descriptors of the features.
And step 3: matching the feature points by using a FLANN matching algorithm; the result of the feature point matching will obtain a corresponding relationship list of the two feature sets. The first set of feature sets is referred to as the training set and the second set is referred to as the query set. FLANN trains a matcher to increase the speed of matching before invoking the matching function. The training phase was to optimize the performance of cv:FlanBasedMatcher. the train class builds an index tree of feature sets. Matching each characteristic point of the query image with a train matcher to find out the best match; the method comprises the steps of matching features of query images with a trainer one by one, enabling each query image feature point to have a best match, then verifying the correctness of the match, and eliminating the match with large error by setting a truncation value.
And 4, step 4: calculating a transformation matrix of the image to be registered mapped to the template image according to the matched feature point pairs; and when the transformation matrix is calculated, using an RANSAC operator to remove the mismatching point pairs. RANSAC estimates the model by repeatedly selecting a data set, and continuously iterates until a better model is estimated.
The specific implementation steps are as follows:
(1) selecting a minimum data set which can be used for estimating a model;
(2) using this data set to compute a data model;
(3) all data are brought into the model, the number of 'inner points' is calculated, and the data which are suitable for the current iteration and are in a certain error range are accumulated;
(4) comparing the number of the 'interior points' of the current model and the best model deduced before, and recording the model parameters of the maximum 'interior points' number and the 'interior points' number;
and repeating the steps 1-4 until the iteration is finished or the current model is a better model.
And 5: the image to be registered is subjected to matrix transformation, calibration is carried out, and image distortion is eliminated;
step 6: the method comprises the steps of carrying out image difference on a template image and a calibrated image to be registered to obtain a difference image, judging whether a printed word has defects according to the difference image, carrying out graying processing on the template image and the calibrated image to be registered first, then carrying out image difference to obtain the difference image, then carrying out binarization processing and filtering processing on the difference image in sequence, counting the number of pixels with the pixel value of 255 in the difference image, and if the counted number is larger than a set threshold value, determining that a missing printing condition exists.
The device obtained by the technical scheme is an ampoule bottle printing character defect detection method based on image registration, can quickly and effectively realize the processes of feature extraction, matching, correction and detection of ampoule bottle printing digital images, and has the advantages of scale invariance, light non-deformability, rotation invariance and less time consumption.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and it will be apparent to those skilled in the art that various modifications and variations can be made in the present invention; any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (7)

1. An ampoule bottle printing word defect detection method based on image registration is characterized by comprising the following steps:
step 1: acquiring an ampoule bottle printing digital image by using a linear array industrial camera to obtain a template image and an image to be registered;
step 2: extracting and describing feature points of the template image by using an SURF algorithm, and extracting and describing the feature points of the image to be registered;
and step 3: matching the feature points by using a FLANN matching algorithm;
and 4, step 4: calculating a transformation matrix of the image to be registered mapped to the template image according to the matched feature point pairs;
and 5: the image to be registered is subjected to matrix transformation, calibration is carried out, and image distortion is eliminated;
step 6: and carrying out image difference on the template image and the calibrated image to be registered to obtain a difference image, and judging whether the printed word has defects according to the difference image.
2. The ampoule bottle printed word defect detection method based on image registration as claimed in claim 1, characterized in that in step 1, a CMOS line industrial camera is used to capture images, and an image sensor thereof has two lines of photosensitive elements.
3. The ampoule bottle printed word defect detection method based on image registration according to claim 1, characterized in that in step 2, the input picture is adjusted to a uniform size before feature point extraction.
4. The method for detecting defects of printed words on ampoule bottles based on image registration as claimed in claim 1, wherein in step 3, after feature point matching is performed by using a FLANN matching algorithm, the euclidean distance of each feature point pair is calculated, and feature point pairs with euclidean distances greater than a set threshold are removed.
5. The method for detecting defects of ampoule bottle printing words based on image registration as claimed in claim 1, wherein in step 4, a RANSAC operator is used to eliminate the mismatching point pairs when calculating the transformation matrix.
6. The method for detecting the defect of the printed word on the ampoule bottle based on the image registration as claimed in claim 1, wherein in step 6, the template image and the calibrated image to be registered are grayed first, and then image difference is performed.
7. The method for detecting the ampoule bottle printed word defect based on the image registration as claimed in claim 6, wherein after the difference image is obtained, the difference image is subjected to binarization processing and filtering processing in sequence, the number of pixels with a pixel value of 255 in the difference image is counted, and if the counted number is greater than a set threshold value, a missing printing condition is considered to exist.
CN202111432045.2A 2021-11-29 2021-11-29 Ampoule bottle printing character defect detection method based on image registration Pending CN114187247A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111432045.2A CN114187247A (en) 2021-11-29 2021-11-29 Ampoule bottle printing character defect detection method based on image registration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111432045.2A CN114187247A (en) 2021-11-29 2021-11-29 Ampoule bottle printing character defect detection method based on image registration

Publications (1)

Publication Number Publication Date
CN114187247A true CN114187247A (en) 2022-03-15

Family

ID=80541697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111432045.2A Pending CN114187247A (en) 2021-11-29 2021-11-29 Ampoule bottle printing character defect detection method based on image registration

Country Status (1)

Country Link
CN (1) CN114187247A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114757913A (en) * 2022-04-15 2022-07-15 电子科技大学 Display screen defect detection method
WO2024087640A1 (en) * 2022-10-26 2024-05-02 上海第二工业大学 Printed circuit board welding spot defect detection method based on digital image processing

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114757913A (en) * 2022-04-15 2022-07-15 电子科技大学 Display screen defect detection method
WO2024087640A1 (en) * 2022-10-26 2024-05-02 上海第二工业大学 Printed circuit board welding spot defect detection method based on digital image processing

Similar Documents

Publication Publication Date Title
CN108562589B (en) Method for detecting surface defects of magnetic circuit material
CN111709909B (en) General printing defect detection method based on deep learning and model thereof
CN114240939B (en) Method, system, equipment and medium for detecting appearance defects of mainboard components
CN114187247A (en) Ampoule bottle printing character defect detection method based on image registration
CN109190625B (en) Large-angle perspective deformation container number identification method
Xia et al. SSIM-NET: Real-time PCB defect detection based on SSIM and MobileNet-V3
CN109886978B (en) End-to-end alarm information identification method based on deep learning
CN111445459A (en) Image defect detection method and system based on depth twin network
CN111126446B (en) Method for amplifying defect image data of robot vision industrial product
CN111738367B (en) Part classification method based on image recognition
CN110738216A (en) Medicine identification method based on improved SURF algorithm
CN116152261B (en) Visual inspection system for quality of printed product
CN111415339A (en) Image defect detection method for complex texture industrial product
CN111340041B (en) License plate recognition method and device based on deep learning
CN111563896A (en) Image processing method for catenary anomaly detection
CN111882547A (en) PCB missing part detection method based on neural network
CN113780484B (en) Industrial product defect detection method and device
CN113487538B (en) Multi-target segmentation defect detection method and device and computer storage medium thereof
CN112926563B (en) Fault diagnosis system for steel coil spray printing mark
CN113516619B (en) Product surface flaw identification method based on image processing technology
CN111738310B (en) Material classification method, device, electronic equipment and storage medium
CN112396582A (en) Mask RCNN-based equalizing ring skew detection method
CN110969163A (en) Method for detecting text information in image
CN113516193B (en) Image processing-based red date defect identification and classification method and device
CN112037193A (en) Power line feature marking method and device

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