CN115619793B - Power adapter appearance quality detection method based on computer vision - Google Patents
Power adapter appearance quality detection method based on computer vision Download PDFInfo
- Publication number
- CN115619793B CN115619793B CN202211644898.7A CN202211644898A CN115619793B CN 115619793 B CN115619793 B CN 115619793B CN 202211644898 A CN202211644898 A CN 202211644898A CN 115619793 B CN115619793 B CN 115619793B
- Authority
- CN
- China
- Prior art keywords
- frequency
- power adapter
- detected
- gray
- difference
- 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
- 238000001514 detection method Methods 0.000 title claims abstract description 26
- 238000000034 method Methods 0.000 claims abstract description 35
- 238000001228 spectrum Methods 0.000 claims abstract description 20
- 230000007547 defect Effects 0.000 claims description 59
- 239000011159 matrix material Substances 0.000 claims description 56
- 230000002950 deficient Effects 0.000 claims description 14
- 239000013598 vector Substances 0.000 claims description 12
- 238000010586 diagram Methods 0.000 abstract description 6
- 238000012545 processing Methods 0.000 abstract description 4
- 238000004458 analytical method Methods 0.000 description 7
- 238000000605 extraction Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 6
- 238000004519 manufacturing process Methods 0.000 description 5
- 238000001914 filtration Methods 0.000 description 4
- 238000005299 abrasion Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000003044 adaptive effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000003384 imaging method Methods 0.000 description 2
- 239000000126 substance Substances 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 206010034960 Photophobia Diseases 0.000 description 1
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000002537 cosmetic Substances 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 208000013469 light sensitivity Diseases 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
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
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration by the use of histogram techniques
-
- G06T5/90—
Abstract
The invention relates to the technical field of image processing, in particular to a power adapter appearance quality detection method based on computer vision. The method comprises the following steps: obtaining a frequency spectrum diagram of the power adapter to be detected based on a gray level image of the power adapter to be detected, constructing a frequency histogram based on frequencies corresponding to all pixel points in the frequency spectrum diagram so as to obtain an initial cut-off frequency, obtaining a target cut-off frequency according to gradient values of pixel points in a circle corresponding to the initial cut-off frequency in the frequency spectrum diagram and pixel points in the gray level image of the power adapter to be detected, further obtaining high-frequency information and low-frequency information corresponding to all pixel points in the gray level image of the power adapter to be detected, and calculating a frequency domain difference coefficient; and obtaining a spatial domain difference coefficient based on the texture corresponding to the gray level image of the power adapter to be detected, and further judging the appearance quality grade of the power adapter to be detected. The invention improves the detection precision of the appearance quality of the power adapter.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a power adapter appearance quality detection method based on computer vision.
Background
With the continuous deepening of scientific research problems and the further improvement of the manufacturing level of industrial processes, the appearance of ultra-large scale integrated circuits leads related intelligent devices such as current mobile phones, computers, projectors and the like to be increased increasingly and simultaneously, a plurality of intelligent functions are correspondingly increased, and great convenience is brought to daily life. However, the rated operating voltages of the intelligent devices are not different, the intelligent devices need to work normally under the corresponding voltages, and in order to convert the daily 220V alternating current voltage for household use into the corresponding rated operating voltage of the intelligent devices, the intelligent devices are usually provided with power adapters. The power adapter volume is less usually, and some quality problems that exist on its surface are difficult to discover, but power adapter surface has quality problems and probably influences power adapter inner structure occasionally to make power adapter cause relevant trouble, cause great property economic loss to daily production life, cause the incident even, consequently, need carry out surface quality to it after power adapter production is accomplished and detect. In the existing method, the cut-off frequency of a filter is manually set at first, then a high-frequency region and a low-frequency region in a surface image of a power adapter are obtained based on the filter, the high-frequency region is analyzed, and the appearance quality detection of the power adapter is completed, but the extraction of high-frequency information is directly influenced when the manually set cut-off frequency is too high or too low, so that the accuracy of an extraction result is not high, and the detection precision of the appearance quality of the power adapter is reduced.
Disclosure of Invention
In order to solve the problems that the existing method has low extraction precision and affects the detection result of the appearance quality of the power adapter when the high-frequency region of the spectrogram of the power adapter is extracted based on the manually set cut-off frequency, the invention aims to provide a power adapter appearance quality detection method based on computer vision, and the adopted technical scheme is as follows:
the invention provides a power adapter appearance quality detection method based on computer vision, which comprises the following steps:
acquiring a gray level image of a power adapter to be detected and a gray level image of a standard power adapter;
obtaining a spectrogram of the power adapter to be detected based on the gray level image of the power adapter to be detected; acquiring the frequency corresponding to each pixel point in the spectrogram, constructing a frequency histogram corresponding to the power adapter to be detected based on the frequency, acquiring an initial cut-off frequency according to the frequency histogram, and acquiring a target cut-off frequency according to the gradient values of pixel points in a circle corresponding to the initial cut-off frequency in the spectrogram and pixel points in a gray level image of the power adapter to be detected; obtaining high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected according to the target cut-off frequency;
obtaining a frequency domain difference coefficient corresponding to the power adapter to be detected based on high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected and high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the standard power adapter; obtaining a space domain difference coefficient corresponding to the power adapter to be detected based on the texture corresponding to the gray level image of the power adapter to be detected and the texture corresponding to the gray level image of the standard power adapter;
and judging the appearance quality grade of the power adapter to be detected based on the frequency domain difference coefficient and the space domain difference coefficient.
Preferably, the obtaining of the target cutoff frequency according to the gradient values of the pixel points in the circle corresponding to the initial cutoff frequency in the spectrogram and the pixel points in the gray scale image of the power adapter to be detected includes:
marking the pixel points with gradient values larger than a gradient threshold value in the gray level image of the power adapter to be detected as target pixel points, and counting the number of the target pixel points; calculating the ratio of the number of target pixel points to the total number of pixel points in the gray image of the power adapter to be detected as a defective pixel point ratio coefficient;
recording a circle corresponding to the initial cut-off frequency in the spectrogram as a first target circle, and obtaining a high-frequency ratio corresponding to the initial cut-off frequency according to a gray value of each pixel point in the first target circle and a gray value of each pixel point in a gray image of the power adapter to be detected;
calculating the absolute value of the difference value between the high-frequency ratio corresponding to the initial cut-off frequency and the defective pixel point ratio coefficient, recording the absolute value as a first absolute value, judging whether the first absolute value is smaller than a difference threshold value, and if so, taking the initial cut-off frequency as a target cut-off frequency; if the difference value is larger than or equal to the target cut-off frequency, taking the difference value obtained by subtracting the preset frequency from the initial cut-off frequency as the first cut-off frequency, calculating a high-frequency ratio corresponding to the first cut-off frequency, judging whether the absolute value of the difference value between the high-frequency ratio corresponding to the first cut-off frequency and the ratio coefficient of the defective pixel point is smaller than a difference threshold value, and if the absolute value is smaller than the difference threshold value, taking the first cut-off frequency as the target cut-off frequency; and if the absolute value is larger than or equal to the difference threshold, reducing the first cut-off frequency by a preset frequency, and repeating the steps until the obtained absolute value is smaller than the difference threshold, and recording the finally obtained frequency as the target cut-off frequency.
Preferably, obtaining a high frequency ratio corresponding to the initial cut-off frequency according to the gray value of each pixel point in the first target circle and the gray value of each pixel point in the gray image of the power adapter to be detected includes:
calculating the sum of gray values corresponding to all pixel points in the first target circle, recording the sum as a first characteristic index, calculating the sum of gray values of all pixel points in a gray image of the power adapter to be detected, recording the sum as a second characteristic index, calculating the ratio of the first characteristic index to the second characteristic index, recording the ratio as a first ratio, and taking the difference value of a constant 1 and the first ratio as a high-frequency ratio corresponding to the initial cut-off frequency.
Preferably, the obtaining of the frequency domain difference coefficient corresponding to the power adapter to be detected based on the high frequency information and the low frequency information corresponding to each pixel point in the grayscale image of the power adapter to be detected and the high frequency information and the low frequency information corresponding to each pixel point in the grayscale image of the standard power adapter includes:
calculating difference indexes and cosine distances corresponding to all pixel points in the gray-scale image of the power adapter to be detected based on high-frequency information and low-frequency information corresponding to all pixel points in the gray-scale image of the power adapter to be detected and high-frequency information and low-frequency information corresponding to all pixel points in the gray-scale image of the standard power adapter;
taking the product of the difference index corresponding to each pixel point in the gray-scale image of the power adapter to be detected and the corresponding cosine distance as the frequency spectrum difference corresponding to each pixel point;
and calculating the sum of the frequency spectrum differences corresponding to all the pixel points in the gray level image of the power adapter to be detected, and taking the sum as the frequency domain difference coefficient corresponding to the power adapter to be detected.
Preferably, calculating a difference index corresponding to each pixel point in the grayscale image of the power adapter to be detected includes:
calculating the high-frequency information corresponding to the pixel point to adapt to the standard power supplyIn the gray scale image of the deviceThe absolute value of the difference value of the high-frequency information corresponding to each pixel point is used as a first difference; calculating the low frequency information corresponding to the pixel point and the gray scale image of the standard power adapterThe absolute value of the difference value of the low-frequency information corresponding to each pixel point is used as a second difference; taking the product of the first difference and the high-frequency weight as a high-frequency difference, and taking the product of the second difference and the low-frequency weight as a low-frequency difference; and taking the sum of the high-frequency difference and the low-frequency difference as a difference index corresponding to the pixel point.
Preferably, calculating the cosine distance corresponding to each pixel point in the gray scale image of the power adapter to be detected includes:
constructing a frequency domain vector corresponding to the pixel point according to the high-frequency information and the low-frequency information corresponding to the pixel point; in grayscale images from standard power adaptersConstructing high-frequency information and low-frequency information corresponding to each pixel point in gray scale image of standard power adapterFrequency domain vectors corresponding to the pixel points; calculating the frequency domain vector corresponding to the pixel point and the gray level image of the standard power adapterAnd the cosine distance of the frequency domain vector corresponding to each pixel point is used as the cosine distance corresponding to the pixel point.
Preferably, the obtaining an initial cut-off frequency according to the frequency histogram includes: and taking the frequency corresponding to the first trough position in the frequency histogram as an initial cut-off frequency.
Preferably, the obtaining of the airspace difference coefficient corresponding to the power adapter to be detected based on the texture corresponding to the grayscale image of the power adapter to be detected and the texture corresponding to the grayscale image of the standard power adapter includes:
recording a gray level co-occurrence matrix corresponding to a gray level image of a power adapter to be detected as a gray level co-occurrence matrix to be analyzed, and recording a gray level co-occurrence matrix corresponding to a gray level image of a standard power adapter as a standard gray level co-occurrence matrix; according to the gray level co-occurrence matrix to be analyzed and the standard gray level co-occurrence matrix, calculating a spatial domain difference coefficient corresponding to the power adapter to be detected by adopting the following formula:
wherein, the first and the second end of the pipe are connected with each other,the spatial domain difference coefficient corresponding to the power adapter to be detected,for the number of rows of the gray level co-occurrence matrix to be analyzed,for the number of columns of the gray level co-occurrence matrix to be analyzed,for the first in the gray level co-occurrence matrix to be analyzedGo to the firstThe values of the columns are such that,is the mean value of the elements in the gray level co-occurrence matrix to be analyzed,is the first in the standard gray level co-occurrence matrixGo to the firstThe values of the columns are such that,is the mean of the elements in the standard gray level co-occurrence matrix,for the gray level co-occurrence matrix to be analyzed,is a standard gray-level co-occurrence matrix,in the form of a function of the variance,for the variance of the elements in the gray level co-occurrence matrix to be analyzed,is the variance of the elements in the normal gray level co-occurrence matrix.
Preferably, the determining the appearance quality grade of the power adapter to be detected based on the frequency domain difference coefficient and the space domain difference coefficient includes:
calculating the sum of the frequency domain difference coefficient and the space domain difference coefficient as an overall difference coefficient; taking the sum of the constant 1 and the overall difference coefficient as a third characteristic index; taking the ratio of the overall difference coefficient to the third characteristic index as a defect index of the power adapter to be detected;
judging whether the defect index is less than or equal to a first defect threshold value, and if the defect index is less than or equal to the first defect threshold value, judging that the appearance quality grade of the power adapter to be detected is three grades; if the defect index is greater than the second defect threshold value, judging whether the defect index is less than or equal to the second defect threshold value, if the defect index is less than or equal to the second defect threshold value, judging that the appearance quality grade of the power adapter to be detected is two-grade, and if the defect index is greater than the second defect threshold value, judging that the appearance quality grade of the power adapter to be detected is one-grade; the first defect threshold is less than the second defect threshold.
The invention has at least the following beneficial effects:
the method analyzes the power adapter to be detected from two angles of a frequency domain and an airspace, and when analyzing the frequency domain information of the power adapter to be detected, the method considers that under the normal condition, a high-frequency region in a gray scale image of the power adapter to be detected is a region with unevenly transformed surface of the power adapter, and the regions have higher possibility of defects, so that the method distinguishes the high-frequency information and the low-frequency information based on cut-off frequency, and considers that the extraction accuracy of the high-frequency information and the low-frequency information can be directly influenced by the over-high or over-low set cut-off frequency, so the method firstly converts the gray scale image of the power adapter to be detected in the airspace into the frequency domain to obtain a corresponding frequency spectrogram; the method comprises the steps of obtaining the frequency of each pixel point based on a frequency spectrogram, constructing a corresponding frequency histogram, and enabling the frequency histogram to reflect the frequency distribution condition of the surface of the power adapter to be detected more intuitively, analyzing the frequency histogram to obtain an initial cut-off frequency, obtaining high-frequency information and low-frequency information corresponding to each pixel point in a gray image of the power adapter to be detected based on the optimal cut-off frequency according to the pixel points in a circle corresponding to the initial cut-off frequency in the frequency spectrogram and the gradient value of the pixel points in the gray image of the power adapter to be detected, wherein the high-frequency information and the low-frequency information are higher in extraction precision, and further the detection accuracy of the appearance quality of the subsequent power adapter to be detected can be effectively guaranteed; according to the method, the frequency domain difference coefficient corresponding to the power adapter to be detected is calculated according to the high-frequency information and the low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected, the frequency domain difference coefficient reflects the difference condition of the frequency domain information of the power adapter to be detected and the standard power adapter, and the larger the frequency domain difference coefficient is, the higher the possibility that the surface of the power adapter to be detected has defects is; when the airspace information of the power adapter to be detected is analyzed, the airspace difference coefficient corresponding to the power adapter to be detected is obtained based on the texture corresponding to the grayscale image of the power adapter to be detected and the texture corresponding to the grayscale image of the standard power adapter, the airspace difference coefficient reflects the difference condition of the airspace information of the power adapter to be detected and the standard power adapter, and the larger the airspace difference coefficient is, the higher the possibility that the surface of the power adapter to be detected has defects is; according to the method, the appearance quality of the power adapter to be detected is comprehensively evaluated by combining the frequency domain information and the spatial domain information of the power adapter to be detected, and the appearance quality of the power adapter to be detected is judged based on the frequency domain difference coefficient and the spatial domain difference coefficient.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of 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 other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a method for detecting appearance quality of a power adapter based on computer vision according to the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention for achieving the predetermined objects, the following detailed description will be made on the method for detecting the appearance quality of a power adapter based on computer vision according to the present invention with reference to the accompanying drawings and preferred embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following describes a specific scheme of the power adapter appearance quality detection method based on computer vision in detail with reference to the accompanying drawings.
The embodiment of the power adapter appearance quality detection method based on computer vision comprises the following steps:
the embodiment proposes a power adapter appearance quality detection method based on computer vision, and as shown in fig. 1, the power adapter appearance quality detection method based on computer vision of the embodiment includes the following steps:
s1, acquiring a gray level image of a power adapter to be detected and a gray level image of a standard power adapter.
The specific scenario addressed by the present embodiment is as follows: the method comprises the steps of collecting a surface image of a to-be-detected power adapter after production is finished by a camera, then obtaining cut-off frequency in a self-adaptive mode, extracting high-frequency information and low-frequency information in the surface image of the to-be-detected power adapter by a filter, analyzing frequency domain information of the to-be-detected power adapter according to the high-frequency information and the low-frequency information in the surface image of the to-be-detected power adapter, analyzing airspace information of the to-be-detected power adapter based on a gray image of the to-be-detected power adapter and a gray image of a standard power adapter, and further evaluating the quality of the to-be-detected power adapter.
Compared with a camera formed by other CMOS electronic elements, the CCD camera has the characteristics of high light sensitivity, clear and non-smear imaging content and high imaging quality, so that the CCD camera is used for shooting the surface of the power adapter to be detected to obtain a surface image of the power adapter to be detected, and corresponding data support is provided for subsequent analysis of the surface quality of the power adapter to be detected. Meanwhile, in order to facilitate detection and analysis of the surface quality of the power adapter to be detected, the standard power adapter with a defect-free surface is selected, and the surface image of the standard power adapter is acquired by using the CCD camera.
According to the process, the surface image of the power adapter to be detected and the surface image of the standard power adapter in the RGB color space are obtained, in order to improve the detection precision of the surface quality of the power adapter to be detected, the collected surface image of the power adapter to be detected and the collected surface image of the standard power adapter in the RGB color space are converted through a weighted average method, meanwhile, in order to reduce the influence of random natural noise in the image collection process on the appearance quality detection of the subsequent power adapter, the Gaussian filter function is used for carrying out filtering processing on the obtained surface images of the two power adapters, the interference and the influence of the random natural noise on the appearance quality detection of the subsequent power adapter are weakened or even eliminated as much as possible, and the two images obtained after the filtering processing are respectively recorded as the gray level image of the power adapter to be detected and the gray level image of the standard power adapter.
Therefore, the gray level image of the power adapter to be detected and the gray level image of the standard power adapter are obtained and used for detecting the surface quality of the subsequent power adapter.
S2, acquiring a spectrogram of the power adapter to be detected based on the gray image of the power adapter to be detected; acquiring the frequency corresponding to each pixel point in the spectrogram, constructing a frequency histogram corresponding to the power adapter to be detected based on the frequency, acquiring an initial cut-off frequency according to the frequency histogram, and acquiring a target cut-off frequency according to the gradient values of pixel points in a circle corresponding to the initial cut-off frequency in the spectrogram and pixel points in a gray level image of the power adapter to be detected; and obtaining high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected according to the target cut-off frequency.
When the surface of the power adapter to be detected has no quality problem, the arrangement of pixel points in the gray image and corresponding gray values all present a certain rule, when a scratch or abrasion defect occurs in a certain area on the power adapter to be detected, the gray values of the pixel points in the corresponding area can be changed correspondingly, but if the scratch or abrasion is slight, the change on the gray image of the power adapter to be detected is not easy to perceive, in addition, part of noise points in the gray image of the power adapter to be detected are difficult to remove by adopting a conventional filtering algorithm, and the existence of the noise points can also have a certain influence on the detection precision of the surface quality of the power adapter to be detected. In order to eliminate the above effects, in this embodiment, discrete fourier transform is performed on the grayscale image of the to-be-detected power adapter and the grayscale image of the standard power adapter, respectively, and the grayscale image of the to-be-detected power adapter and the grayscale image of the standard power adapter in the space domain are converted into the spectrogram of the corresponding power adapter surface in the frequency domain. The two-dimensional discrete fourier transform of an image is a well-known technique, and is often used for converting a spatial domain image into a frequency domain for corresponding analysis and calculation, and will not be described in detail herein. By adopting the method, the frequency spectrum diagram of the power adapter to be detected and the frequency spectrum diagram of the standard power adapter are obtained.
The low frequency region of the spectrogram of the power adapter typically represents a region of uniform transformation of the surface of the power adapter, located in the center of the spectrogram, while the high frequency region typically represents a region of non-uniform transformation of the surface of the power adapter, located in four different quadrant regions of the spectrogram, which typically contain cosmetic defects of the power adapter. Based on this, it is necessary to design a corresponding filter to respectively extract the high frequency region and the low frequency region in the spectrogram of the power adapter to be detected, and to perform calculation analysis respectively.
Cut-off frequency needs the manual setting in traditional butterworth wave filter, and too high or too low setting of cut-off frequency can direct influence subsequent analysis result, and this embodiment combines power adapter surface defect characteristic and the distribution characteristic self-adaptation of power adapter spectrogram to obtain optimal cut-off frequency to the effectual dependence relevant technical staff of avoiding excessively setting up cut-off frequency improves holistic intelligent effect. In general, in an airspace, the proportion of defective pixel points in a gray image of a power adapter to be detected is small, the proportion of normal pixel points is large, and the normal pixel points in the gray image of the power adapter to be detected belong to low-frequency information after being transformed, so that the normal pixel points are mostly concentrated in the central area of a spectrogram after being subjected to Fourier transform, namely the low-frequency area; the defect pixel points in the gray level image of the power adapter to be detected belong to high-frequency information after being transformed, and are relatively far away from the center position of the spectrogram, and the embodiment obtains the high-frequency and low-frequency partition boundary based on the characteristic, namely, obtains the cut-off frequency.
Firstly, obtaining the gradient value of each pixel point in the gray level image of the power adapter to be detected, wherein the method for obtaining the gradient value of the pixel point is a known technology and is not described in too much detail here; when some pixel points are located in the defect area, the gray values of the pixel points will fluctuate, and the gradient values of the pixel points will be large, so this embodiment sets a gradient threshold, marks the pixel points with the gradient value larger than the gradient threshold in the gray image of the power adapter to be detected as target pixel points, counts the number of the target pixel points, and calculates the ratio of the number of the target pixel points to the total number of the pixel points in the gray image of the power adapter to be detectedAnd as the defective pixel point proportion coefficient, the more serious the surface defect of the power adapter to be detected is, the larger the defective pixel point proportion coefficient is. The gradient threshold is set to 0.65 in this embodiment, and in a specific application, the implementer can set the threshold according to specific situations. Then, counting the frequency of each pixel point in the frequency spectrogram of the power adapter to be detected, and constructing a corresponding frequency histogram based on the frequency of each pixel point in the frequency spectrogram of the power adapter to be detected, wherein the abscissa of the frequency histogram is the frequency, and the ordinate is the probability of the occurrence of the corresponding frequency; taking the frequency corresponding to the first trough position in the frequency histogram as the initial cut-off frequency, then performing adaptive adjustment on the initial cut-off frequency to obtain the optimal cut-off frequency, which is recorded as the target cut-off frequency, and then obtaining the high-frequency information and the low-frequency information in the grayscale image of the power adapter to be detected based on the target cut-off frequency. In particular, the initial cut-off frequency is determined for the testThe method comprises the following steps of representing a circle with a radius of R in a gray level image of a source adapter, recording the circle as a first target circle, calculating the sum of gray levels corresponding to all pixel points in the first target circle, recording the sum as a first characteristic index, calculating the sum of gray levels of all pixel points in the gray level image of the power adapter to be detected, recording the sum as a second characteristic index, calculating the ratio of the first characteristic index to the second characteristic index, recording the ratio as a first ratio, taking the difference value of a constant 1 and the first ratio as a high-frequency ratio corresponding to an initial cut-off frequency, wherein the specific expression of the high-frequency ratio corresponding to the initial cut-off frequency is as follows:
wherein the content of the first and second substances,is the high frequency ratio corresponding to the initial cut-off frequency,is the first target circleThe gray value corresponding to each pixel point,is the number of pixel points in the first target circle,is the frequency spectrum diagram of the power adapter to be detectedThe gray value corresponding to each pixel point,the number of pixel points in the frequency spectrogram of the power adapter to be detected,is a first characteristicThe sign of the index is carried out,as the second characteristic index, the index of the first characteristic,is a first ratio.
When the sum of the gray values of the pixels in the first target circle is smaller, it is indicated that the ratio of the low-frequency components in the spectrogram of the power adapter to be detected is smaller, and the ratio of the high-frequency components in the spectrogram of the power adapter to be detected is larger, namely the ratio of the high frequency corresponding to the initial cut-off frequency is larger; when the sum of the gray values of the pixels in the first target circle is larger, it is described that the ratio of the low-frequency components in the spectrogram of the power adapter to be detected is larger, and the ratio of the high-frequency components in the spectrogram of the power adapter to be detected is smaller, that is, the ratio of the high frequency corresponding to the initial cut-off frequency is smaller. Setting a difference threshold value, and calculating high-frequency ratio corresponding to the initial cut-off frequency and ratio coefficient of defective pixel pointsRecording the absolute value of the difference as a first absolute value, judging whether the first absolute value is smaller than a difference threshold, if so, indicating that the initial cut-off frequency can better divide a high-frequency region and a low-frequency region in a spectrogram of the power adapter to be detected, and taking the initial cut-off frequency as a target cut-off frequency; if the absolute value of the difference between the high-frequency ratio corresponding to the first cut-off frequency and the defect pixel point ratio coefficient is smaller than the difference threshold, the first cut-off frequency is taken as the target cut-off frequency; if the first cut-off frequency is larger than or equal to the difference threshold, reducing the first cut-off frequency to a preset frequency, and repeating the steps until the obtained absolute value is smaller than the difference threshold, and recording the finally obtained frequency as a target cut-off frequency; the true bookThe embodiment sets the difference threshold to be 0.1 and the preset frequency to be 0.2, and in a specific application, an implementer can set the difference threshold according to specific situations.
In order to ensure that the cut-off frequency can better divide the high-frequency information component and the low-frequency information component of the power adapter to be detected, the embodiment adopts the above steps to perform small adaptive adjustment on the initial cut-off frequency, and sequentially shrinks inwards based on the adjustment step length, so as to ensure that the high-frequency information in the spectrogram of the power adapter to be detected is retained to the greatest extent. In the embodiment, a butterworth high-pass filter is used for filtering out low-frequency parts in a spectrogram of a power adapter to be detected, so as to obtain a high-frequency area in the spectrogram of the power adapter to be detected; subtracting a high-frequency region in the spectrogram of the power adapter to be detected from the spectrogram of the power adapter to be detected to obtain a low-frequency region in the spectrogram of the power adapter to be detected; as other embodiments, other types of high pass filters may be used; based on the frequency corresponding to each pixel point in the spectrogram of the power adapter to be detected, obtaining high-frequency information corresponding to each pixel point, wherein the calculation formula of the high-frequency information is as follows:
wherein, the first and the second end of the pipe are connected with each other,in order to target the cut-off frequency,for the frequency at which the pixel points correspond,is a frequency ofThe high frequency information corresponding to the pixel point of (2). The above calculation formula is an existing formula, and is not described herein in detail.
According to the above formula, high-frequency information corresponding to each pixel point in the spectrogram of the power adapter to be detected can be obtained, and then, in this embodiment, low-frequency information corresponding to each pixel point in the spectrogram of the power adapter to be detected is obtained, where the method for obtaining low-frequency information corresponding to any pixel point in the spectrogram of the power adapter to be detected is as follows: subtracting the high-frequency information corresponding to the pixel point from the frequency information of the pixel point to obtain a difference value, and taking the difference value as the low-frequency information corresponding to the pixel point; by adopting the method, the high-frequency information and the low-frequency information corresponding to each pixel point in the spectrogram of the power adapter to be detected can be obtained, namely the high-frequency information and the low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected are obtained. Similarly, based on the spectrogram of the standard power adapter, the high-frequency information and the low-frequency information corresponding to each pixel point in the grayscale image of the standard power adapter are obtained.
S3, obtaining a frequency domain difference coefficient corresponding to the power adapter to be detected based on high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected and high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the standard power adapter; and obtaining the airspace difference coefficient corresponding to the power adapter to be detected based on the texture corresponding to the gray-scale image of the power adapter to be detected and the texture corresponding to the gray-scale image of the standard power adapter.
If the difference between the high-frequency information of a certain pixel point in the gray-scale image of the power adapter to be detected and the high-frequency information of the corresponding position in the gray-scale image of the standard power adapter is not large, and the difference between the low-frequency information of a certain pixel point in the gray-scale image of the power adapter to be detected and the low-frequency information of the corresponding position in the gray-scale image of the standard power adapter is also not large, it is indicated that the probability that the pixel point in the gray-scale image of the power adapter to be detected is a defective pixel point is low. Based on this, in this embodiment, the difference index corresponding to each pixel point in the grayscale image of the power adapter to be detected is calculated according to the low-frequency information and the high-frequency information corresponding to each pixel point in the grayscale image of the power adapter to be detected and the low-frequency information and the high-frequency information corresponding to each pixel point in the grayscale image of the standard power adapter to be detected, specifically, for the second pixel point in the grayscale image of the power adapter to be detectedEach pixel point is used for calculating the high-frequency information corresponding to the pixel point and the gray level image of the standard power adapterThe absolute value of the difference value of the high-frequency information corresponding to each pixel point is used as a first difference; calculating the low frequency information corresponding to the pixel point and the gray scale image of the standard power adapterThe absolute value of the difference value of the low-frequency information corresponding to each pixel point is used as a second difference; taking the product of the first difference and the high-frequency weight as a high-frequency difference, and taking the product of the second difference and the low-frequency weight as a low-frequency difference; taking the sum of the high-frequency difference and the low-frequency difference as a difference index corresponding to the pixel point; the specific expression of the difference index corresponding to the pixel point is as follows:
wherein, the first and the second end of the pipe are connected with each other,in the gray scale image of the power adapter to be testedThe difference index corresponding to each pixel point,in order to be a high-frequency weight,in order to be a low-frequency weight,in the gray scale image of the power adapter to be testedHigh-frequency information corresponding to each pixel point,in grayscale images for standard power adaptersHigh-frequency information corresponding to each pixel point,in the gray scale image of the power adapter to be testedLow-frequency information corresponding to each pixel point,in grayscale images for standard power adaptersThe low frequency information corresponding to each pixel point,in order to take the absolute value of the value,in order to be the first difference,in order to be the second difference, the first difference,in order to be a high-frequency difference,is a low frequency difference. Since the defect generally has a high-frequency region, high-frequency information is taken as the right when the gray image of the power adapter to be detected is analyzedThe weight should be greater than the weight of the vehicle,the present embodiment is arranged,In a specific application, the implementer can set the setting according to specific situations.
In the gray scale image for representing the power adapter to be detectedThe high-frequency information corresponding to each pixel point is compared with the gray scale image of the standard power adapterThe difference in high frequency information corresponding to an individual pixel point,in gray scale image for representing power adapter to be detectedDifference indexes of high-frequency information of the pixel points;in the gray scale image for representing the power adapter to be detectedThe low-frequency information corresponding to each pixel point is compared with the gray level image of the standard power adapterDifference of low frequency information corresponding to each pixel pointIn the case of an abnormal situation,in gray scale image for representing power adapter to be detectedDifference indexes of low-frequency information of the pixel points; when the power adapter to be detected is in the gray scale imageThe high and low frequency information corresponding to each pixel point is equal to the gray level image of the standard power adapterWhen the difference of each pixel point is larger and the difference of the high-frequency information is larger, the gray image of the power adapter to be detected is shown as the second imageThe more likely each pixel is to be a defective pixel; when the gray image of the power adapter to be detected is the firstThe high and low frequency information corresponding to each pixel point is equal to the gray level image of the standard power adapterWhen the difference of each pixel point does not exist or is smaller, the gray level image of the power adapter to be detected is describedThe more likely it is that a pixel is a normal pixel.
By adopting the method, the difference index corresponding to each pixel point in the gray-scale image of the power adapter to be detected can be obtained.
Considering the high and low frequency information of each pixel point in the gray scale image of the power adapter to be detected and each gray scale image of the standard power adapterThe cosine distance of the high-frequency and low-frequency information of the pixel points can also represent the difference degree of the frequency spectrum characteristics of the power adapter to be detected and the standard power adapter, and if the cosine distance is larger, the larger the frequency spectrum characteristic difference of the power adapter to be detected and the standard power adapter is, the larger the possibility that the appearance of the power adapter to be detected is defective is. Therefore, in the following embodiment, based on the low frequency information and the high frequency information corresponding to each pixel point in the grayscale image of the power adapter to be detected and the low frequency information and the high frequency information corresponding to each pixel point in the grayscale image of the standard power adapter, the cosine distance corresponding to each pixel point in the grayscale image of the power adapter to be detected is calculated, specifically, for the cosine distance corresponding to the first pixel point in the grayscale image of the power adapter to be detectedEach pixel point, according to the high-frequency information and the low-frequency information corresponding to the pixel point, constructing a frequency domain vector corresponding to the pixel point, namely(ii) a In grayscale images from standard power adaptersConstructing high-frequency information and low-frequency information corresponding to each pixel point in gray scale image of standard power adapterFrequency-domain vectors corresponding to individual pixel points, i.e.(ii) a Calculating the frequency domain vector corresponding to the pixel point and the first in the gray level image of the standard power adapterAnd the cosine distance of the frequency domain vector corresponding to each pixel point is used as the cosine distance corresponding to the pixel point. The specific expression of the cosine distance corresponding to the pixel point is as follows:
wherein, the first and the second end of the pipe are connected with each other,in the gray scale image of the power adapter to be testedThe cosine distance of the point corresponding to each pixel.
The cosine distance calculated by the formula represents the difference degree of the frequency spectrum characteristics of the power adapter to be detected and the standard power adapter, if the difference degree is the first in the gray level image of the power adapter to be detectedThe larger the cosine distance corresponding to each pixel point is, the larger the cosine distance is, the power adapter to be detectedPixel point and standard power supply adaptingThe larger the difference of the frequency spectrum characteristics of each pixel point is, the larger the gray level image of the power adapter to be detected isThe more likely an individual pixel is a defective pixel; if the gray scale image of the power adapter to be detected is the firstThe smaller the cosine distance corresponding to each pixel point is, the smaller the cosine distance is, the power adapter to be detectedPixel point and standard power supply adaptingThe more similar the frequency spectrum characteristics of each pixel point, the first in the gray level image of the power adapter to be detectedThe more likely an individual pixel is a normal pixel.
By adopting the method, the cosine distance corresponding to each pixel point in the gray image of the power adapter to be detected can be obtained. The difference index and the cosine distance corresponding to each pixel point in the gray-scale image of the power adapter to be detected can reflect the frequency spectrum difference condition of the power adapter to be detected and the standard power adapter, so that for any pixel point in the gray-scale image of the power adapter to be detected: taking the product of the difference index corresponding to the pixel point and the cosine distance corresponding to the pixel point as the frequency spectrum difference corresponding to the pixel point; by adopting the method, the frequency spectrum difference corresponding to each pixel point in the gray-scale image of the power adapter to be detected can be obtained, the sum of the frequency spectrum differences corresponding to all the pixel points in the gray-scale image of the power adapter to be detected is calculated and is used as the frequency domain difference coefficient corresponding to the power adapter to be detected, and the larger the frequency spectrum difference corresponding to the gray-scale image of the power adapter to be detected is, the more serious the defect of the power adapter to be detected is.
In order to further improve the analysis accuracy of the appearance quality of the power adapter to be detected, the grayscale image of the power adapter in the null domain is further analyzed. When the surface of the power adapter to be detected has defects such as scratches and abrasion, the inherent texture characteristics of the surface of the power adapter to be detected can be changed, so that the embodiment analyzes the surface by extracting corresponding texture characteristics, that is, a gray level co-occurrence matrix corresponding to a gray level image of the power adapter to be detected is obtained and recorded as a gray level co-occurrence matrix to be analyzed, and simultaneously, a gray level co-occurrence matrix corresponding to a gray level image of a standard power adapter is obtained and recorded as a standard gray level co-occurrence matrix, which is used for representing the texture distribution condition of the corresponding image, the gray level co-occurrence matrix is a common texture extraction algorithm, the calculation process of the gray level co-occurrence matrix is a known technology, and redundant description is not repeated here. The larger the difference between the gray level co-occurrence matrix to be analyzed and the standard gray level co-occurrence matrix is, the larger the difference between the airspace information of the power adapter to be detected and the airspace information of the standard power adapter is. Therefore, in this embodiment, based on the gray level co-occurrence matrix to be analyzed and the standard gray level co-occurrence matrix, the airspace difference coefficient corresponding to the power adapter to be detected is calculated, that is:
wherein the content of the first and second substances,the spatial domain difference coefficient corresponding to the power adapter to be detected,for the number of rows of the gray level co-occurrence matrix to be analyzed,for the number of columns of the gray level co-occurrence matrix to be analyzed,for the first in the gray level co-occurrence matrix to be analyzedGo to the firstThe values of the columns are such that,is the mean value of the elements in the gray level co-occurrence matrix to be analyzed,is the first in the standard gray level co-occurrence matrixGo to the firstThe values of the columns are such that,is the mean value of the elements in the normal gray level co-occurrence matrix,for the gray level co-occurrence matrix to be analyzed,is a standard gray-level co-occurrence matrix,in the form of a function of the variance,for the variance of the elements in the gray level co-occurrence matrix to be analyzed,is the variance of the elements in the normal gray level co-occurrence matrix.
When the difference between the gray level co-occurrence matrix to be analyzed and the standard gray level co-occurrence matrix is larger, the larger the difference between the appearance of the power adapter to be detected and the appearance of the standard power adapter is, the higher the possibility that the surface of the power adapter to be detected has defects is, namely, the larger the airspace difference coefficient corresponding to the power adapter to be detected is; when the difference between the gray level co-occurrence matrix to be analyzed and the standard gray level co-occurrence matrix is smaller, it is indicated that the difference between the appearance of the power adapter to be detected and the appearance of the standard power adapter is smaller, the possibility that the surface of the power adapter to be detected has defects is smaller, and namely the airspace difference coefficient corresponding to the power adapter to be detected is smaller.
By analyzing the frequency domain information and the spatial domain information of the power adapter to be detected, the frequency domain difference coefficient and the spatial domain difference coefficient corresponding to the power adapter to be detected are obtained.
And S4, judging the appearance quality grade of the power adapter to be detected based on the frequency domain difference coefficient and the space domain difference coefficient.
In the embodiment, the frequency domain information and the spatial domain information of the power adapter to be detected are analyzed to obtain a frequency domain difference coefficient and a spatial domain difference coefficient corresponding to the power adapter to be detected, the frequency domain difference coefficient reflects the difference condition of the frequency domain information of the power adapter to be detected and a standard power adapter, and the spatial domain difference coefficient reflects the difference condition of the spatial domain information of the power adapter to be detected and the standard power adapter; taking the sum of the constant 1 and the overall difference coefficient as a third characteristic index; taking the ratio of the overall difference coefficient to the third characteristic index as a defect index of the power adapter to be detected; the specific calculation formula of the defect index of the power adapter to be detected is as follows:
wherein, the first and the second end of the pipe are connected with each other,is a defect index of the power adapter to be detected,is the airspace difference coefficient corresponding to the power adapter to be detected,the frequency domain difference coefficient corresponding to the power adapter to be detected,as a result of the overall difference coefficient,is the third characteristic index.
Calculating to obtain the defect index of the power adapter to be detected through the formula, wherein the value of the defect index of the power adapter to be detected is in the interval [0,1 ]]If the frequency domain difference coefficient and the airspace difference coefficient corresponding to the power adapter to be detected are both large, the value of the defect index of the power adapter to be detected approaches to 1, and the surface defect degree of the power adapter to be detected is more serious at the moment; setting a first defect thresholdAnd a second defect threshold,When the defect index of the power adapter to be detectedWhen the detection result is positive, the surface of the power adapter to be detected has slight defects, and the appearance quality grade of the power adapter to be detected is three grades; when the defect index of the power adapter to be detectedWhen the detection result is positive, the surface of the power adapter to be detected has a medium defect, and the appearance quality grade of the power adapter to be detected is two-grade; when the defect index of the power adapter to be detectedAnd then, the surface of the power adapter to be detected has serious defects, and the appearance quality grade of the power adapter to be detected is first grade. In this embodimentThe value of (a) is 0.2,the value of (b) is 0.5, which can be set by the practitioner as the case may be in a particular application. Therefore, the method provided by the embodiment is adopted to complete the detection of the appearance quality of the power adapter to be detected.
The embodiment analyzes the power adapter to be detected from two angles of a frequency domain and an airspace, and when analyzing the frequency domain information of the power adapter to be detected, in consideration of the common condition, a high-frequency region in a gray scale image of the power adapter to be detected is a region with unevenly transformed surface of the power adapter, and the possibility of defects existing in the regions is higher, so that the embodiment distinguishes the high-frequency information and the low-frequency information based on cut-off frequency, and in consideration of the fact that the high or low set cut-off frequency directly affects the extraction precision of the high-frequency information and the low-frequency information, the embodiment firstly converts the gray scale image of the power adapter to be detected in the airspace into the frequency domain to obtain a corresponding spectrogram; the method comprises the steps of obtaining the frequency of each pixel point based on a frequency spectrogram, constructing a corresponding frequency histogram, wherein the frequency histogram can visually reflect the frequency distribution condition of the surface of the power adapter to be detected, analyzing the frequency histogram to obtain an initial cut-off frequency, obtaining high-frequency information and low-frequency information corresponding to each pixel point in a gray image of the power adapter to be detected based on the optimal cut-off frequency according to the pixel points in a circle corresponding to the initial cut-off frequency in the frequency spectrogram and the gradient values of the pixel points in the gray image of the power adapter to be detected to obtain a target cut-off frequency, namely the optimal cut-off frequency, obtaining the high-frequency information and the low-frequency information corresponding to each pixel point in the gray image of the power adapter to be detected based on the optimal cut-off frequency, and further effectively ensuring the detection accuracy of the appearance quality of the subsequent power adapter to be detected; in the embodiment, a frequency domain difference coefficient corresponding to the power adapter to be detected is calculated according to high-frequency information and low-frequency information corresponding to each pixel point in a gray-scale image of the power adapter to be detected, the frequency domain difference coefficient reflects the difference condition of the frequency domain information of the power adapter to be detected and a standard power adapter, and the larger the frequency domain difference coefficient is, the higher the possibility that the surface of the power adapter to be detected has defects is; when the airspace information of the power adapter to be detected is analyzed, the airspace difference coefficient corresponding to the power adapter to be detected is obtained based on the texture corresponding to the grayscale image of the power adapter to be detected and the texture corresponding to the grayscale image of the standard power adapter, the airspace difference coefficient reflects the difference condition of the airspace information of the power adapter to be detected and the standard power adapter, and the larger the airspace difference coefficient is, the higher the possibility that the surface of the power adapter to be detected has defects is; the method provided by the embodiment can accurately extract the high-frequency information and the low-frequency information of the power adapter to be detected, so that the analysis result is more accurate, and the detection precision of the appearance quality of the power adapter to be detected is improved.
Claims (6)
1. A power adapter appearance quality detection method based on computer vision is characterized by comprising the following steps:
acquiring a gray level image of a power adapter to be detected and a gray level image of a standard power adapter;
obtaining a spectrogram of the power adapter to be detected based on the gray level image of the power adapter to be detected; acquiring frequencies corresponding to all pixel points in the spectrogram, constructing a frequency histogram corresponding to the power adapter to be detected based on the frequencies, acquiring an initial cut-off frequency according to the frequency histogram, and acquiring a target cut-off frequency according to gradient values of pixel points in a circle corresponding to the initial cut-off frequency in the spectrogram and pixel points in a gray image of the power adapter to be detected; obtaining high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected according to the target cut-off frequency;
obtaining a frequency domain difference coefficient corresponding to the power adapter to be detected based on high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the power adapter to be detected and high-frequency information and low-frequency information corresponding to each pixel point in the gray-scale image of the standard power adapter; obtaining a space domain difference coefficient corresponding to the power adapter to be detected based on the texture corresponding to the gray level image of the power adapter to be detected and the texture corresponding to the gray level image of the standard power adapter;
judging the appearance quality grade of the power adapter to be detected based on the frequency domain difference coefficient and the space domain difference coefficient;
the obtaining of the initial cut-off frequency according to the frequency histogram includes: taking the frequency corresponding to the first trough position in the frequency histogram as an initial cut-off frequency;
the obtaining of the target cut-off frequency according to the gradient values of the pixel points in the circle corresponding to the initial cut-off frequency in the spectrogram and the pixel points in the gray scale image of the power adapter to be detected comprises:
recording pixel points with gradient values larger than a gradient threshold value in a gray level image of the power adapter to be detected as target pixel points, and counting the number of the target pixel points; calculating the ratio of the number of target pixel points to the total number of pixel points in the gray image of the power adapter to be detected, and taking the ratio as a defective pixel point ratio coefficient;
recording a circle corresponding to the initial cut-off frequency in the spectrogram as a first target circle, and obtaining a high-frequency ratio corresponding to the initial cut-off frequency according to a gray value of each pixel point in the first target circle and a gray value of each pixel point in a gray image of the power adapter to be detected;
calculating the absolute value of the difference value between the high-frequency ratio corresponding to the initial cut-off frequency and the defective pixel point ratio coefficient, recording the absolute value as a first absolute value, judging whether the first absolute value is smaller than a difference threshold value, and if so, taking the initial cut-off frequency as a target cut-off frequency; if the difference value is larger than or equal to the target cut-off frequency, taking a difference value obtained by subtracting the preset frequency from the initial cut-off frequency as the first cut-off frequency, calculating a high-frequency ratio corresponding to the first cut-off frequency, judging whether the absolute value of the difference value between the high-frequency ratio corresponding to the first cut-off frequency and the ratio coefficient of the defective pixel points is smaller than a difference threshold value, and if the absolute value of the difference value is smaller than the difference threshold value, taking the first cut-off frequency as the target cut-off frequency; if the absolute value is larger than or equal to the difference threshold, reducing the first cut-off frequency by a preset frequency, and repeating the steps until the obtained absolute value is smaller than the difference threshold, and recording the finally obtained frequency as a target cut-off frequency;
obtaining a high-frequency ratio corresponding to the initial cut-off frequency according to the gray value of each pixel point in the first target circle and the gray value of each pixel point in the gray image of the power adapter to be detected, and the method comprises the following steps:
calculating the sum of gray values corresponding to all pixel points in the first target circle, recording the sum as a first characteristic index, calculating the sum of gray values of all pixel points in a gray image of the power adapter to be detected, recording the sum as a second characteristic index, calculating the ratio of the first characteristic index to the second characteristic index, recording the ratio as a first ratio, and taking the difference value of a constant 1 and the first ratio as a high-frequency ratio corresponding to the initial cut-off frequency.
2. The method for detecting the appearance quality of the power adapter based on the computer vision of claim 1, wherein the obtaining of the frequency domain difference coefficient corresponding to the power adapter to be detected based on the high frequency information and the low frequency information corresponding to each pixel point in the grayscale image of the power adapter to be detected and the high frequency information and the low frequency information corresponding to each pixel point in the grayscale image of the standard power adapter comprises:
calculating difference indexes and cosine distances corresponding to all pixel points in the gray-scale image of the power adapter to be detected based on high-frequency information and low-frequency information corresponding to all pixel points in the gray-scale image of the power adapter to be detected and high-frequency information and low-frequency information corresponding to all pixel points in the gray-scale image of the standard power adapter;
taking the product of the difference index corresponding to each pixel point in the gray level image of the power adapter to be detected and the corresponding cosine distance as the frequency spectrum difference corresponding to each pixel point;
and calculating the sum of the frequency spectrum differences corresponding to all the pixel points in the gray level image of the power adapter to be detected, and taking the sum as the frequency domain difference coefficient corresponding to the power adapter to be detected.
3. The method for detecting the appearance quality of the power adapter based on the computer vision according to claim 2, wherein calculating the difference index corresponding to each pixel point in the gray image of the power adapter to be detected comprises:
calculating the high frequency information corresponding to the pixel point and the gray scale image of the standard power adapterThe absolute value of the difference value of the high-frequency information corresponding to each pixel point is used as a first difference; calculating the low frequency information corresponding to the pixel point and the gray scale image of the standard power adapterThe absolute value of the difference value of the low-frequency information corresponding to each pixel point is used as a second difference; taking the product of the first difference and the high-frequency weight as a high-frequency difference, and taking the product of the second difference and the low-frequency weight as a low-frequency difference; and taking the sum of the high-frequency difference and the low-frequency difference as a difference index corresponding to the pixel point.
4. The method for detecting the appearance quality of the power adapter based on the computer vision according to claim 2, wherein the step of calculating the cosine distance corresponding to each pixel point in the gray-scale image of the power adapter to be detected comprises the following steps:
constructing a frequency domain vector corresponding to the pixel point according to the high-frequency information and the low-frequency information corresponding to the pixel point; in grayscale images according to standard power adapterConstructing high-frequency information and low-frequency information corresponding to each pixel point in gray scale image of standard power adapterFrequency domain vectors corresponding to the pixel points; calculating gray scale image of power adapter to be detectedFrequency domain vector corresponding to each pixel point and the first in gray level image of standard power adapterAnd the cosine distance of the frequency domain vector corresponding to each pixel point is used as the cosine distance corresponding to the pixel point.
5. The method for detecting the appearance quality of the power adapter based on the computer vision according to claim 1, wherein obtaining the spatial domain difference coefficient corresponding to the power adapter to be detected based on the texture corresponding to the gray-scale image of the power adapter to be detected and the texture corresponding to the gray-scale image of the standard power adapter comprises:
recording a gray level co-occurrence matrix corresponding to a gray level image of a power adapter to be detected as a gray level co-occurrence matrix to be analyzed, and recording a gray level co-occurrence matrix corresponding to a gray level image of a standard power adapter as a standard gray level co-occurrence matrix; according to the gray level co-occurrence matrix to be analyzed and the standard gray level co-occurrence matrix, calculating a spatial domain difference coefficient corresponding to the power adapter to be detected by adopting the following formula:
wherein, the first and the second end of the pipe are connected with each other,the spatial domain difference coefficient corresponding to the power adapter to be detected,for the number of rows of the gray level co-occurrence matrix to be analyzed,for the number of columns of the gray level co-occurrence matrix to be analyzed,for the first in the gray level co-occurrence matrix to be analyzedGo to the firstThe values of the columns are such that,is the mean value of the elements in the gray level co-occurrence matrix to be analyzed,is the first in the standard gray level co-occurrence matrixGo to the firstThe values of the columns are such that,is the mean of the elements in the standard gray level co-occurrence matrix,for the gray level co-occurrence matrix to be analyzed,is a standard gray level co-occurrence matrix,in the form of a function of the variance,for the variance of the elements in the gray level co-occurrence matrix to be analyzed,is the variance of the elements in the normal gray level co-occurrence matrix.
6. The method for detecting the appearance quality of the power adapter based on the computer vision according to claim 1, wherein the step of judging the appearance quality grade of the power adapter to be detected based on the frequency domain difference coefficient and the spatial domain difference coefficient comprises the steps of:
calculating the sum of the frequency domain difference coefficient and the space domain difference coefficient to be used as an integral difference coefficient; taking the sum of the constant 1 and the overall difference coefficient as a third characteristic index; taking the ratio of the overall difference coefficient to the third characteristic index as a defect index of the power adapter to be detected;
judging whether the defect index is less than or equal to a first defect threshold value, and if the defect index is less than or equal to the first defect threshold value, judging that the appearance quality grade of the power adapter to be detected is three grades; if the defect index is larger than the second defect threshold value, judging whether the defect index is smaller than or equal to the second defect threshold value, if so, judging that the appearance quality grade of the power adapter to be detected is of a second grade, and if so, judging that the appearance quality grade of the power adapter to be detected is of a first grade; the first defect threshold is less than the second defect threshold.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211644898.7A CN115619793B (en) | 2022-12-21 | 2022-12-21 | Power adapter appearance quality detection method based on computer vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211644898.7A CN115619793B (en) | 2022-12-21 | 2022-12-21 | Power adapter appearance quality detection method based on computer vision |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115619793A CN115619793A (en) | 2023-01-17 |
CN115619793B true CN115619793B (en) | 2023-03-10 |
Family
ID=84880161
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211644898.7A Active CN115619793B (en) | 2022-12-21 | 2022-12-21 | Power adapter appearance quality detection method based on computer vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115619793B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116237205B (en) * | 2023-01-30 | 2023-11-24 | 南通市金月亮新材料科技发展有限公司 | Door and window spraying adjustment method and system |
CN116228764B (en) * | 2023-05-08 | 2023-07-18 | 聊城市东昌府区妇幼保健院 | Neonate disease screening blood sheet acquisition quality detection method and system |
CN117152143B (en) * | 2023-10-30 | 2023-12-26 | 南通睿智超临界科技发展有限公司 | Reverse osmosis membrane surface quality detection method and system |
CN117169639B (en) * | 2023-11-02 | 2023-12-29 | 启东市航新实用技术研究所 | Product detection method and system for power adapter production |
CN117173186B (en) * | 2023-11-03 | 2024-03-05 | 南通苏禾车灯配件有限公司 | Train door gap parameter detection method and system |
CN117408995A (en) * | 2023-12-11 | 2024-01-16 | 东莞市时实电子有限公司 | Power adapter appearance quality detection method based on multi-feature fusion |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114842027A (en) * | 2022-04-24 | 2022-08-02 | 南通真馨家纺有限公司 | Fabric defect segmentation method and system based on gray level co-occurrence matrix |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101299268B (en) * | 2008-07-01 | 2010-08-11 | 上海大学 | Semantic object dividing method suitable for low depth image |
CN103729368B (en) * | 2012-10-13 | 2016-12-21 | 复旦大学 | A kind of robust audio recognition methods based on local spectrum iamge description |
-
2022
- 2022-12-21 CN CN202211644898.7A patent/CN115619793B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114842027A (en) * | 2022-04-24 | 2022-08-02 | 南通真馨家纺有限公司 | Fabric defect segmentation method and system based on gray level co-occurrence matrix |
Also Published As
Publication number | Publication date |
---|---|
CN115619793A (en) | 2023-01-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115619793B (en) | Power adapter appearance quality detection method based on computer vision | |
CN108921176B (en) | Pointer instrument positioning and identifying method based on machine vision | |
CN116168026B (en) | Water quality detection method and system based on computer vision | |
CN116309537B (en) | Defect detection method for oil stain on surface of tab die | |
CN113808138B (en) | Artificial intelligence-based wire and cable surface defect detection method | |
CN115018844B (en) | Plastic film quality evaluation method based on artificial intelligence | |
CN115082451B (en) | Stainless steel soup ladle defect detection method based on image processing | |
CN115063430B (en) | Electric pipeline crack detection method based on image processing | |
CN114782329A (en) | Bearing defect damage degree evaluation method and system based on image processing | |
CN116542982B (en) | Departure judgment device defect detection method and device based on machine vision | |
CN115511907B (en) | Scratch detection method for LED screen | |
CN117557820B (en) | Quantum dot optical film damage detection method and system based on machine vision | |
CN115272303B (en) | Textile fabric defect degree evaluation method, device and system based on Gaussian blur | |
CN115082477B (en) | Semiconductor wafer processing quality detection method based on light reflection removing effect | |
CN115018835B (en) | Automobile starter gear detection method | |
CN111738931B (en) | Shadow removal algorithm for aerial image of photovoltaic array unmanned aerial vehicle | |
CN115290663A (en) | Mini LED wafer appearance defect detection method based on optical detection | |
CN114881960A (en) | Feature enhancement-based cloth linear defect detection method and system | |
CN114998311A (en) | Part precision detection method based on homomorphic filtering | |
CN115601379A (en) | Surface crack accurate detection technology based on digital image processing | |
CN116883408B (en) | Integrating instrument shell defect detection method based on artificial intelligence | |
CN114066862A (en) | Indicator identification method and system based on color gamut and contour characteristics | |
CN116958127B (en) | Silicon wafer quality assessment method based on image features | |
CN117011291A (en) | Watch shell quality visual detection method | |
CN114565563B (en) | Color steel plate surface abnormity detection method based on artificial intelligence |
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 |