CN111652221B - ROI extraction method and system for USB plug surface defect detection - Google Patents

ROI extraction method and system for USB plug surface defect detection Download PDF

Info

Publication number
CN111652221B
CN111652221B CN202010522325.1A CN202010522325A CN111652221B CN 111652221 B CN111652221 B CN 111652221B CN 202010522325 A CN202010522325 A CN 202010522325A CN 111652221 B CN111652221 B CN 111652221B
Authority
CN
China
Prior art keywords
image
usb plug
roi
carrying
adjustment
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
Application number
CN202010522325.1A
Other languages
Chinese (zh)
Other versions
CN111652221A (en
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.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
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 Zhejiang University ZJU filed Critical Zhejiang University ZJU
Publication of CN111652221A publication Critical patent/CN111652221A/en
Application granted granted Critical
Publication of CN111652221B publication Critical patent/CN111652221B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • 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
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • 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/20048Transform domain processing
    • G06T2207/20061Hough transform
    • 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

Abstract

The invention discloses a ROI extraction method for detecting surface defects of a USB plug, which comprises the following steps: (1) collecting an image of the surface of a USB plug to be detected; (2) Carrying out first angle adjustment on the image according to the partial contour features of the USB plug including the window boundary; (3) Carrying out secondary angle adjustment on the image according to the edge characteristics of two sides of the USB plug; the ROI is extracted from the image according to the fixed size of the USB plug.

Description

ROI extraction method and system for USB plug surface defect detection
Technical Field
The invention relates to machine vision detection, in particular to USB plug surface defect detection.
Background
For high-end handset manufacturers, perfection is required not only in terms of product quality but also in terms of appearance. In the production and processing process of the USB data line, the product needs to be subjected to a plurality of working procedures such as processing, transportation, assembly, detection and the like, and damages such as scratches, damages and the like to the USB plug in the process are inevitable.
Naturally, these problems are brought about, and from the perspective of companies, increasing labor cost and objective requirements for industrial structure adjustment under international situation, and the low efficiency of manual detection prompts companies to want to reduce heavy manual activities; from an individual perspective, working under light for a long time is prone to cause eye diseases.
The surface detection technology based on machine vision is developed from the late 20 th century and is used in various fields of people production and life, such as surface defect detection of strip steel, woven fabric, rails and the like. The detection precision of the machine vision method can reach micron level, the accuracy can reach more than 90%, the method is efficient and highly automatic, and the requirement of detecting the surface defects of the USB plug can be completely met.
However, the detection of USB surface defects by using the machine vision method must involve image acquisition and image processing, so it is necessary to design a robust image processing algorithm to process the USB raw image acquired by the camera to extract the ROI region in the USB plug in the acquired image.
Disclosure of Invention
In view of the above-mentioned drawbacks of the prior art, the technical problem to be solved by the present invention is how to extract the ROI region in the USB plug in the captured picture.
In order to achieve the above object, the present invention provides a ROI extraction method for USB plug surface defect detection, comprising the steps of: collecting an image of the surface of a USB plug to be detected; (2) Carrying out first angle adjustment on the image according to the partial contour features of the USB plug including the window boundary; (3) Performing a second angle adjustment on the image according to the edge characteristics of the two sides of the USB plug; the ROI is extracted from the image according to the fixed size of the USB plug.
Further, the step (2) comprises the steps of: extracting a contour and performing rectangular fitting; intercepting a window area; obtaining partial contour features including window boundaries through Hough line detection; the rotation angle is calculated.
Further, the step (3) comprises the steps of: constructing a mask; carrying out masking operation; carrying out Hough line detection to obtain the characteristics of two side edges; the rotation angle is calculated.
Further, when the rotation angle is calculated, traversing all straight lines obtained through Hough straight line detection to calculate an average value.
Further, the step (4) comprises the steps of: extracting a contour and performing rectangular fitting; and comparing the rectangular information with the fixed size of the USB plug, and adjusting the extracted contour features to obtain the ROI area.
The invention provides a ROI extraction system for detecting the surface defects of the USB plug in another aspect, which is characterized by comprising an image acquisition module, a detection module and a control module, wherein the image acquisition module is used for acquiring an image of the surface of the USB plug to be detected; the angle initial adjustment module is used for carrying out first-time angle adjustment on the image according to the partial contour characteristics of the USB plug including the window boundary; the angle fine adjustment module is used for carrying out secondary angle adjustment on the image according to the edge characteristics of two sides of the USB plug; and the ROI extraction module is used for extracting the ROI from the image according to the fixed size of the USB plug.
Further, the angle initial adjustment module comprises a contour extraction and rectangle fitting unit; intercepting a window area unit; the straight line detection unit is used for obtaining window boundary and partial contour characteristics through Hough straight line detection; a rotation angle calculation unit.
Further, the angle fine-tuning module includes: a mask construction unit; a mask operation unit; the straight line detection unit is used for carrying out Hough straight line detection to obtain the characteristics of two side edges; a rotation angle calculation unit.
Further, when the rotation angle calculation unit calculates the rotation angle, the rotation angle calculation unit performs traversal averaging on the straight lines obtained by all the straight line detection units.
Further, the ROI extracting unit includes: extracting a contour and rectangular fitting unit; and the comparison and adjustment unit compares the rectangular information with the fixed size of the USB plug and adjusts the extracted contour characteristics to obtain the ROI area.
According to the invention, aiming at the USB with different rotation angles in the acquired image, the USB is subjected to angle adjustment and ROI extraction processing by detecting the contour and the straight line in the image, and the USB ROI area in the acquired image can be extracted very effectively. And has strong robustness.
The conception, the specific structure and the technical effects of the present invention will be further described with reference to the accompanying drawings to fully understand the objects, the features and the effects of the present invention.
Drawings
FIG. 1 is a USB plug ROI that needs to be extracted by the present invention;
FIG. 2 is a general flow chart of a preferred embodiment of the present invention;
FIG. 3 is a flow chart of a first angular adjustment in a preferred embodiment of the present invention;
FIG. 4 is a flow chart of a second angular adjustment in a preferred embodiment of the present invention;
FIG. 5 is a flowchart of ROI extraction in a preferred embodiment of the present invention;
FIG. 6 is a flow chart of angle calculation in a preferred embodiment of the present invention;
FIG. 7 is a diagram of the extraction results in a preferred embodiment of the present invention.
Detailed Description
The technical contents of the preferred embodiments of the present invention will be more clearly and easily understood by referring to the drawings attached to the specification. The present invention may be embodied in many different forms of embodiments and the scope of the invention is not limited to the embodiments set forth herein.
As shown in FIG. 1, the ROI to be extracted by the invention is the front and back surfaces of the USB plug, the height is 13.40mm, and the width is 11.50mm.
A general flowchart of an embodiment of the ROI extraction method for USB plug surface defect detection according to the present invention is shown in fig. 2, and first, an image of a USB plug to be detected is collected by an industrial camera, where the size of the collected image is 2448 × 2048 pixels and the bit depth is 8. Then, angle adjustment is carried out on the USB plug in the image twice, and ROI extraction is carried out on the adjusted image.
The specific flow of the first angle adjustment is shown in fig. 3, and an acquired original image 101 is subjected to gray level transformation and gaussian filtering to increase the image quality and remove noise to obtain an image 102; performing OSTU thresholding to distinguish the USB plug in the image 103 as foreground from the background; then, performing open operation on the image 103 by using rectangular convolution to check so that the edge of the USB plug in the image 104 is smoother, and the extraction of the outline of the USB plug in the next step is facilitated; extracting the outline of the USB plug by adopting a Douglas-Puck algorithm and performing rectangle fitting to obtain an image 105; recording rectangular information and intercepting corresponding areas to obtain an image 106; carrying out OSTU inverse thresholding processing and closing operation on the image 106 to obtain an image 107; performing expansion operation on the image 107 by using a cross convolution kernel to obtain an image 108, performing corrosion operation by using a diamond convolution kernel to obtain an image 109, and synthesizing the images 108 and 109 to further obtain an image 110; carrying out Hough line detection on the image 110, and extracting line features to obtain an image 111; and calculating the rotation angle, and rotating the rectangular fitting area to obtain an output result image 112 of the first angle adjustment.
The first angular adjustment is based on window boundary and little profile, belongs to preliminary adjustment, and is all effective to most rotatory USB gathers, but has deformation or window boundary line to some window regions and has impaired unobvious USB to gather the image and have certain error, consequently this embodiment has carried out the second angular adjustment, has carried out the straight line to more general USB surface specific area characteristic promptly both sides edge and has detected, and this time adjustment has realized the accurate adjustment of USB rotation angle.
The second angle adjustment process is shown in fig. 4, and the output image 112 of the first angle adjustment is used as the input image 201 of the second angle adjustment; carrying out gray level transformation, gaussian filtering and OSTU thresholding to obtain an image 202; performing expansion operation on the image 202 by using a cross convolution kernel to obtain an image 203, performing corrosion operation by using a diamond convolution kernel to obtain an image 204, and synthesizing the images 203 and 204 to further obtain an image 205; constructing a mask 206, and performing a masking operation on the image 205 to obtain an image 207; and carrying out Hough line detection on the image 207 to obtain two side edges, calculating a rotation angle, and rotating the rectangular fitting area to obtain an output result image 209 of the second angle adjustment.
The specific flow of calculating the rotation angle is shown in FIG. 6, so as to
Figure 991233DEST_PATH_IMAGE001
As the coordinates of the lower left corner of the straight line,
Figure 239812DEST_PATH_IMAGE002
as the coordinates of the upper right corner of the straight line, more than one straight line detected by hough line detection is detected, so that the process of calculating the angle is a process of traversing and averaging, and the accuracy of calculating the angle and the robustness of rotation are improved to a certain extent.
ROI extraction is based on two principles, namely ROI contour detection and USB based, which are both characteristics that an industrial product has a fixed size and that the ROI region we want to extract is also of a fixed size, which is also of a fixed pixel size in a CCD camera with a certain pixel size. Therefore, after the ROI contour features are extracted, the extracted contour features are subjected to fine adjustment to a certain degree according to the characteristic that the ROI pixel size is fixed, and finally the ROI area required by the user is extracted.
The specific ROI extraction procedure is shown in fig. 5, and the output image 209 of the second angle adjustment is the input image 301 of the ROI extraction procedure; obtaining an image 302 after gray level transformation, gaussian filtering and OSTU thresholding; performing closed operation on the image 302 by using a rectangular convolution kernel to obtain an image 303; carrying out contour extraction and rectangle fitting on the image 303 to obtain an image 304; recording rectangle information, including coordinates (x, y) at the upper left corner of a rectangular frame and width and height (w, h) of the rectangular frame, and calculating to obtain a parameter ROI _ h according to the pixel size, magnification and ROI actual size of a camera, wherein ROI _ h =1050 in the embodiment; when h is larger than ROI _ h, the corresponding region of the fitting rectangular frame is cut out as the ROI by taking ROI _ h as the height value, and an output image 305 is obtained; and when h is smaller than or equal to ROI _ h, the corresponding region of the fitted rectangular frame is cut out as the ROI by taking the height value when h is larger than ROI _ h, and the output image 305 is obtained.
As shown in fig. 7, the results of ROI extraction experiments performed on the last thousand collected images with different types of defects prove that the present invention has a good effect on ROI extraction of images collected by USB plugs with different rotation angles, and has strong robustness.
The foregoing detailed description of the preferred embodiments of the invention has been presented. It should be understood that numerous modifications and variations could be devised by those skilled in the art in light of the present teachings without departing from the inventive concepts. Therefore, the technical solutions available to those skilled in the art through logic analysis, reasoning and limited experiments based on the prior art according to the concept of the present invention should be within the scope of protection defined by the claims.

Claims (6)

1. A ROI extraction method for detecting surface defects of a USB plug is characterized by comprising the following steps:
collecting an image of the surface of a USB plug to be detected;
carrying out first angle adjustment on the image according to the partial contour features of the USB plug including the window boundary;
carrying out secondary angle adjustment on the image according to the edge characteristics of the two sides of the USB plug;
extracting an ROI from the image according to the fixed size of the USB plug;
the first angle adjustment comprises the steps of increasing the image quality and removing noise of an acquired original image 101 through gray level transformation and Gaussian filtering to obtain an image 102; performing OSTU thresholding; then, opening operation is carried out on the image 103 by using a rectangular convolution kernel; extracting the outline of the USB plug by adopting a Douglas-Puck algorithm and performing rectangle fitting to obtain an image 105; recording rectangular information and intercepting a corresponding area to obtain an image 106; carrying out OSTU inverse thresholding processing and closing operation on the image 106 to obtain an image 107; performing expansion operation on the image 107 by using a cross convolution kernel to obtain an image 108, performing corrosion operation by using a diamond convolution kernel to obtain an image 109, and synthesizing the images 108 and 109 to further obtain an image 110; carrying out Hough line detection on the image 110, and extracting line features to obtain an image 111; calculating a rotation angle, and rotating the rectangular fitting area to obtain an output result image 112 of the first angle adjustment;
the second angular adjustment comprises taking the first angular adjusted output image 112 as a second angular adjusted input image 201; carrying out gray level transformation, gaussian filtering and OSTU thresholding to obtain an image 202; performing expansion operation on the image 202 by using a cross convolution kernel to obtain an image 203, performing corrosion operation by using a diamond convolution kernel to obtain an image 204, and synthesizing the images 203 and 204 to further obtain an image 205; constructing a mask 206, and performing a masking operation on the image 205 to obtain an image 207; and carrying out Hough line detection on the image 207 to obtain two side edges, calculating a rotation angle, and rotating the rectangular fitting area to obtain an output result image 209 of the second angle adjustment.
2. A ROI extraction system for detecting surface defects of a USB plug is characterized by comprising
The device comprises an image acquisition module, a data acquisition module and a data processing module, wherein the image acquisition module is used for acquiring an image of the surface of a USB plug to be detected;
the angle initial adjustment module is used for carrying out first-time angle adjustment on the image according to the partial contour features of the USB plug, including the window boundary;
the angle fine adjustment module is used for carrying out secondary angle adjustment on the image according to the edge characteristics of the two sides of the USB plug;
an ROI extraction module for extracting an ROI from the image according to a fixed size of the USB plug;
the first angle adjustment comprises the steps of increasing the image quality and removing noise of an acquired original image 101 through gray level transformation and Gaussian filtering to obtain an image 102; performing OSTU thresholding; then, opening operation is carried out on the image 103 by using a rectangular convolution kernel; extracting the outline of the USB plug by adopting a Douglas-Puck algorithm and performing rectangle fitting to obtain an image 105; recording rectangular information and intercepting corresponding areas to obtain an image 106; carrying out OSTU inverse thresholding processing and closing operation on the image 106 to obtain an image 107; performing expansion operation on the image 107 by using a cross convolution kernel to obtain an image 108, performing corrosion operation by using a diamond convolution kernel to obtain an image 109, and synthesizing the images 108 and 109 to further obtain an image 110; performing Hough line detection on the image 110, and extracting line features to obtain an image 111; calculating a rotation angle, and rotating the rectangular fitting area to obtain an output result image 112 of the first angle adjustment;
the second angular adjustment comprises taking the first angular adjusted output image 112 as a second angular adjusted input image 201; carrying out gray level transformation, gaussian filtering and OSTU thresholding to obtain an image 202; performing expansion operation on the image 202 by using a cross convolution kernel to obtain an image 203, performing corrosion operation by using a diamond convolution kernel to obtain an image 204, and synthesizing the images 203 and 204 to further obtain an image 205; constructing a mask 206, and performing a masking operation on the image 205 to obtain an image 207; and performing Hough line detection on the image 207 to obtain two side edges, calculating a rotation angle, and rotating the rectangular fitting area to obtain an output result image 209 of the second angle adjustment.
3. The ROI extraction system for USB plug surface defect detection according to claim 2, wherein the angle initial adjustment module includes an outline extraction and rectangle fitting unit; intercepting a window area unit; the straight line detection unit is used for obtaining the window boundary and partial contour characteristics through Hough straight line detection; a rotation angle calculation unit.
4. The ROI extraction system for USB plug surface defect detection of claim 2, wherein the angle fine adjustment module comprises: a mask construction unit; a mask operation unit; the straight line detection unit is used for carrying out Hough straight line detection to obtain the two side edge characteristics; a rotation angle calculation unit.
5. The ROI extraction system for USB plug surface defect detection according to claim 3 or 4, wherein the rotation angle calculation unit performs traversal averaging on the straight lines obtained by all the straight line detection units when calculating the rotation angle.
6. The ROI extraction system for USB plug surface defect detection as claimed in claim 2, wherein the ROI extraction module comprises: extracting a contour and rectangular fitting unit; and the comparison and adjustment unit compares the rectangular information with the fixed size of the USB plug and adjusts the extracted contour characteristics to obtain the ROI area.
CN202010522325.1A 2019-06-29 2020-06-10 ROI extraction method and system for USB plug surface defect detection Active CN111652221B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2019105814329 2019-06-29
CN201910581432 2019-06-29

Publications (2)

Publication Number Publication Date
CN111652221A CN111652221A (en) 2020-09-11
CN111652221B true CN111652221B (en) 2022-11-01

Family

ID=72347534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010522325.1A Active CN111652221B (en) 2019-06-29 2020-06-10 ROI extraction method and system for USB plug surface defect detection

Country Status (1)

Country Link
CN (1) CN111652221B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113096102A (en) * 2021-04-15 2021-07-09 深圳市玻尔智造科技有限公司 Charger surface defect detection method based on multi-scale transfer

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109215026A (en) * 2018-09-29 2019-01-15 广东工业大学 A kind of accurate LED defect inspection method of high speed based on machine vision

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7027666B2 (en) * 2002-10-01 2006-04-11 Eastman Kodak Company Method for determining skew angle and location of a document in an over-scanned image
US9972093B2 (en) * 2015-03-30 2018-05-15 Siemens Healthcare Gmbh Automated region of interest detection using machine learning and extended Hough transform

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109215026A (en) * 2018-09-29 2019-01-15 广东工业大学 A kind of accurate LED defect inspection method of high speed based on machine vision

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于机器视觉的轻触开关引脚缺陷检测算法研究;蒋建东等;《浙江工业大学学报》;20150225(第01期);全文 *

Also Published As

Publication number Publication date
CN111652221A (en) 2020-09-11

Similar Documents

Publication Publication Date Title
CN106780486B (en) Steel plate surface defect image extraction method
CN106934803B (en) method and device for detecting surface defects of electronic device
CN109816652B (en) Complex casting defect identification method based on gray level significance
US8009928B1 (en) Method and system for detecting and recognizing text in images
US20210049744A1 (en) Method for image dehazing based on adaptively improved linear global atmospheric light of dark channel
WO2021109697A1 (en) Character segmentation method and apparatus, and computer-readable storage medium
CN105913396A (en) Noise estimation-based image edge preservation mixed de-noising method
CN115063421B (en) Pole piece region detection method, system and device, medium and defect detection method
CN106780526A (en) A kind of ferrite wafer alligatoring recognition methods
CN110866903A (en) Ping-pong ball identification method based on Hough circle transformation technology
CN108830857B (en) Self-adaptive Chinese character copy label image binarization segmentation method
US10497107B1 (en) Method, computer program product and computer readable medium for generating a mask for a camera stream
CN105447489B (en) A kind of character of picture OCR identifying system and background adhesion noise cancellation method
CN111652221B (en) ROI extraction method and system for USB plug surface defect detection
CN110648330A (en) Defect detection method for camera glass
CN112669265A (en) Method for realizing surface defect detection based on Fourier transform and image gradient characteristics
CN110047041B (en) Space-frequency domain combined traffic monitoring video rain removing method
CN115661110B (en) Transparent workpiece identification and positioning method
CN112184619A (en) Metal part surface defect detection method based on deep learning
CN114529715B (en) Image identification method and system based on edge extraction
CN110930358A (en) Solar panel image processing method based on self-adaptive algorithm
CN116309780A (en) Water gauge water level identification method based on target detection
CN109426770B (en) Iris identification method
CN116030430A (en) Rail identification method, device, equipment and storage medium
CN106780529B (en) Conference video mosaic detection method based on external rectangle

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