A method for quality inspection of the appearance of a laptop power adapter

Through a multi-step image processing method, the problem of low detection accuracy of scratches on the matte granular surface of the notebook power adapter is solved, and higher detection accuracy and efficiency are achieved.

CN119359701BActive Publication Date: 2025-03-14DONG GUAN SIMER ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411896483.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-03-14
Estimated Expiration
2044-12-23

AI Technical Summary

Technical Problem

The existing laptop power adapter appearance quality inspection methods are not accurate when detecting scratches on frosted granular surfaces, making it difficult to distinguish between scratched areas and non-scratch areas, resulting in a high misjudgment rate.

Method used

A multi-step image processing method is adopted, including acquiring surface images, preprocessing images, calculating the defect degree and expansion degree of each pixel point, iteratively expanding the acquisition of scratched pixel points, and connecting scratched pixel points to detect scratched edges and areas.

Benefits of technology

By refining the accuracy of defect detection and reducing the misjudgment rate, the accuracy and efficiency of the appearance quality inspection of the notebook power adapter is significantly improved, and the interference of matte particles on shallow scratch detection is effectively reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119359701B_ABST
    Figure CN119359701B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to a method for inspecting the appearance of a laptop power adapter, comprising: obtaining a surface image of the laptop power adapter; obtaining the defect degree of each pixel; obtaining an extended window and an extended window group of each pixel; obtaining the similarity between the window of each pixel and each extended window; obtaining the extended defect degree of each pixel; obtaining the possibility that each pixel belongs to a defective pixel; obtaining the defect similarity between each scratch pixel after preliminary screening and the central pixel of each extended window; obtaining several scratch pixels, obtaining several scratch edges and several endpoints to be processed; obtaining several initial scratch areas and effective closed line segments; obtaining several extended scratch areas; and obtaining the probability of scratches. The present invention effectively reduces the influence of frosted particles on shallow scratch detection by analyzing the scratch area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to an appearance quality inspection method for a notebook power adapter. Background Art

[0002] When inspecting the appearance of a laptop power adapter, since the laptop power adapter needs to meet the requirements of long-term operation and anti-slip, its outer shell surface is generally designed to be frosted and granular to ensure that the heat dissipation efficiency can be effectively improved while also taking into account the appearance. Generally, it is necessary to conduct multiple inspections on the appearance of the laptop power adapter, including whether there are scratches and bumps on the surface, whether the edges are neat, etc., in order to cope with the high-intensity work of the assembly line, so an automated and high-accuracy quality inspection method is needed.

[0003] Traditional defect detection uses color features to extract features from images. However, due to the influence of the small-grain frosted texture and heat dissipation pores on the surface of the laptop power adapter, there will be more bright spots and dark spots in the image. The grayscale values ​​of the dark spots overlap with the grayscale values ​​of shallow scratches, making it difficult to accurately distinguish between scratched areas and non-scratched areas, resulting in low quality inspection accuracy for scratch defects. Summary of the invention

[0004] The invention provides an appearance quality inspection method for a notebook power adapter to solve the existing problems.

[0005] The appearance quality inspection method of a laptop power adapter of the present invention adopts the following technical scheme:

[0006] The present invention provides a method for inspecting the appearance of a laptop power adapter, the method comprising the following steps:

[0007] Acquire a surface image of a laptop power adapter, and preprocess to obtain an image to be detected on the surface of the laptop power adapter;

[0008] Obtain a window for each pixel in the image to be detected; obtain the degree of defect of each pixel according to the gray value of the pixel in the window of each pixel and the gray value of all pixels in the image to be detected; obtain an extended window and an extended window group for each pixel; obtain the similarity between the window of each pixel and each extended window according to the gray fluctuation difference and gradient amplitude difference of the pixels in different windows;

[0009] According to the similarity between the window of each pixel and the two extended windows in the same extended window group, the similarity difference within each extended window group of each pixel is obtained, and then the extended defect degree of each pixel is obtained; according to the defect degree of each pixel and the extended defect degree, the possibility of each pixel being a defective pixel is obtained;

[0010] Obtain scratch pixel points after preliminary screening, and obtain defect similarity between each scratch pixel point after preliminary screening and the central pixel point of each extended window according to the window of each scratch pixel point after preliminary screening and its extended window; obtain several scratch pixel points through iterative expansion based on the defect similarity between the scratch pixel point after preliminary screening and the central pixel point of its extended window;

[0011] Connect the scratch pixel points to obtain several scratch edges and several endpoints to be processed; according to the distribution of the endpoints to be processed, connect to obtain several initial scratch areas and effective closed line segments; according to the endpoints to be processed and the scratch edges, extend to obtain several extended scratch areas; according to the number of pixels in the initial scratch area and the extended scratch area in the image to be detected, obtain the probability of the scratch.

[0012] Furthermore, the defect degree of each pixel is obtained according to the gray value of the pixel in the window of each pixel and the gray values ​​of all pixels in the image to be detected, and the specific steps include the following:

[0013]

[0014] in, Indicates The degree of defect of each pixel; Indicates The number of pixels in a window of pixels; Represents the mean gray value of all pixels in the image to be detected; Indicates The pixel window The gray value of each pixel; Expressed as an exponential function with a natural constant as base.

[0015] Furthermore, the obtaining of the extended window and extended window group for each pixel point includes the following specific steps:

[0016] Several windows of the same size that are extended from the window of any pixel point in the direction of the eight-neighborhood are recorded as the extended windows of the pixel point, and the extended windows are divided with the window of the pixel point as the symmetric point to obtain four groups of symmetrical extended windows of the pixel point.

[0017] Furthermore, the similarity between the window of each pixel point and each extended window is obtained according to the grayscale fluctuation difference and gradient amplitude difference of the pixel points in different windows, and the specific steps include the following:

[0018]

[0019] in, Indicates The pixel window and its Similarity of the extended window; Indicates The variance of the grayscale values ​​of pixels within a window of pixels; Indicates The pixel The variance of the grayscale values ​​of the pixels within the expanded window; Indicates The mean of the gradient amplitudes of pixels within a window of pixels; Indicates The pixel The mean of the gradient amplitudes of the pixels within the expanded window; represents the absolute value function.

[0020] Furthermore, the similarity difference within each extended window group of each pixel is obtained according to the similarity between the window of each pixel and two extended windows in the same extended window group, and the specific steps include the following:

[0021]

[0022] in, Indicates The pixel The similarity difference within the expanded window group; Indicates The pixel window and its The first Similarity of the extended window; Indicates The pixel window and its The first Similarity of the extended window; represents the absolute value function.

[0023] Furthermore, the step of obtaining the extended defect degree of each pixel point includes the following specific steps:

[0024]

[0025] in, Indicates The degree of expansion defect of each pixel; Indicates the number of extended window groups for each pixel; Indicates The pixel window and its The mean similarity between two extended windows in an extended window group; Indicates The mean similarity between a window with pixels and all its extended windows; represents the absolute value function.

[0026] Furthermore, the possibility of each pixel being a defective pixel is obtained according to the defect degree and the extended defect degree of each pixel, and the specific steps include the following:

[0027]

[0028] in, Indicates The probability that a pixel is a defective pixel; Indicates The degree of defect of each pixel; Indicates The degree of expansion defect of each pixel; Represents the normalization function.

[0029] Furthermore, the defect similarity between each scratch pixel point after preliminary screening and the central pixel point of each extended window thereof is obtained according to the window of each scratch pixel point after preliminary screening and its extended window, and the specific steps include the following:

[0030]

[0031] in, Indicates The pixel and its The defect similarity of the central pixel of the expanded window; Indicates The probability that a pixel is a defective pixel; Indicates The pixel The possibility that the central pixel of the expanded window is a defective pixel; represents the absolute value function.

[0032] Furthermore, the defect similarity between the scratch pixel point after preliminary screening and the central pixel point of its expansion window is obtained by iterative expansion, and the specific steps include the following:

[0033] Take each scratch pixel point after preliminary screening as the initial expansion point. When the defect similarity between any initial expansion point and the central pixel point of any expansion window is greater than the similarity threshold, the expansion window is used as the next central window. The defect similarity between the central pixel point of the central window and the central pixel point of its expansion window is analyzed. This process is repeated until the defect similarities between the central pixel point of the central window and the central pixel points of all expansion windows are less than the similarity threshold. Then the expansion is stopped and the scratch pixel point after preliminary screening and all the central pixel points passed during the expansion process are recorded as scratch pixels.

[0034] Further, the scratch pixel points are connected to obtain a plurality of scratch edges and a plurality of endpoints to be processed; according to the distribution of the endpoints to be processed, a plurality of initial scratch areas and valid closed line segments are connected; according to the endpoints to be processed and the scratch edges, a plurality of extended scratch areas are extended, including the following specific steps:

[0035] Connect adjacent scratch pixel points to obtain several scratch edges, and record the unclosed endpoints of each scratch edge as endpoints to be processed;

[0036] Connect each endpoint to be processed with its nearest unconnected endpoint to be processed to obtain several connected line segments, and combine several scratch edges to obtain several closed areas, which are recorded as initial scratch areas; record several connected line segments that participate in forming the initial scratch area as valid closed line segments, and discard the line segments that do not form the initial scratch area;

[0037] A straight line is fitted between the endpoint to be processed and several pixel points closest to the scratch edge where it is located, and the line is extended in the direction pointing to the endpoint to be processed and stops after intersection. The closed area formed by the extended part and the effective closed line segment is recorded as the extended scratch area.

[0038] The beneficial effects of the technical solution of the present invention are:

[0039] By analyzing the scratch area, the efficiency and accuracy of the appearance quality inspection of the laptop power adapter are improved, and the impact of frosted particles on the detection of shallow scratches is effectively reduced. Specifically, by obtaining the surface image of the laptop power adapter and performing preprocessing, the processed image to be detected is obtained, which improves the contrast and clarity of the image and lays the foundation for subsequent defect detection; by obtaining the window of each pixel in the image to be detected and calculating the defect degree of each pixel based on the grayscale value, the accuracy of defect detection is refined and the misjudgment rate is reduced; by obtaining the extended window and extended window group of each pixel and calculating the mean of the grayscale value variance and gradient amplitude, the similarity between the extended window of each pixel and the window in which it is located is obtained, and the similarity difference between the extended groups of each pixel is further calculated to obtain the extended defect degree. This step enhances the recognition ability of defective pixels. ; Combining the defect degree and extended defect degree of each pixel, the possibility of each pixel being a defective pixel is calculated, and the accuracy of defect detection is ensured through multiple standard evaluations; by obtaining the scratch pixels after preliminary screening, and performing similarity calculations on the window and the extended window, all the scratch pixels are obtained by iterative expansion, and then the scratch area is accurately detected by connecting and extending the scratch edge and the extended area, effectively reducing the interference of frosted particles on the detection of shallow scratches; through statistics on the initial scratch area and the extended scratch area, the probability of scratches in the image is obtained, and the scratch area is further accurately located. Combined with preliminary screening and subsequent expansion, the accuracy of scratch detection is significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 A flowchart of the steps of a method for inspecting the appearance of a laptop power adapter according to the present invention;

[0042] Figure 2 Schematic diagram of the original scratch;

[0043] Figure 3 This is a schematic diagram after segmentation by Otsu method;

[0044] Figure 4 This is a schematic diagram after the window is expanded. DETAILED DESCRIPTION

[0045] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the appearance quality inspection method of a laptop power adapter proposed by the present invention, its specific implementation method, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.

[0046] 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.

[0047] The specific scheme of the appearance quality inspection method of a laptop power adapter provided by the present invention is described in detail below with reference to the accompanying drawings.

[0048] See also Figure 1 , which shows a flowchart of a method for inspecting the appearance of a laptop power adapter provided by an embodiment of the present invention, the method comprising the following steps:

[0049] Step S001: Acquire a surface image of a laptop power adapter, and pre-process to obtain an image to be detected on the surface of the laptop power adapter.

[0050] The purpose of this embodiment is to improve the accuracy of scratch detection on a frosted surface of a laptop power adapter, so it is necessary to install a high-definition camera on the production inspection line to capture the appearance image of the laptop power adapter.

[0051] Specifically, a high-definition camera is installed on the inspection assembly line for producing laptop power adapters, and images of six surfaces of the laptop power adapter are captured by rotating a robotic arm. These images are processed by grayscale and histogram equalization to obtain surface images of the laptop power adapter after histogram equalization. Each surface image of the laptop power adapter after histogram equalization is subjected to semantic segmentation to obtain an image to be inspected that removes the background and only contains the surface of the laptop power adapter.

[0052] It should be noted that the present embodiment adopts a semantic recognition network to identify the laptop power adapter area in the surface image after the histogram equalization of the laptop power adapter. The relevant contents of the semantic recognition network are as follows: the structure of the recognition network used in the present embodiment is a multi-layer CNN architecture; the data set used is a manually annotated laptop power adapter image data set. The pixels that need to be segmented are divided into 2 categories, that is, the labeling process corresponding to the training set is: a single-channel semantic label, the corresponding position pixel belongs to the background class and is labeled as 0, and the one belonging to the laptop power adapter area is labeled as 1. The task of the network is segmentation, so the loss function used is the cross entropy loss function. The laptop power adapter area in the surface image after the histogram equalization is obtained through the semantic recognition network, thereby completing the scratch detection of the subsequent production of laptop power adapters.

[0053] Step S002: Obtain a window for each pixel in the image to be detected; obtain the degree of defect of each pixel according to the grayscale value of the pixel in the window of each pixel and the grayscale values ​​of all pixels in the image to be detected; obtain an extended window and an extended window group for each pixel; obtain the similarity between the window of each pixel and each extended window according to the grayscale fluctuation difference and gradient amplitude difference of the pixels in different windows.

[0054] It should be noted that due to the presence of frosted particles on the surface of the laptop power adapter, there are some high-grayscale bright spots on the grayscale image of the laptop power adapter surface. There are low-brightness pixels between the bright spots, which overlap with the grayscale values ​​of the shallow scratches to be inspected, making it difficult to distinguish the scratches from the background. Figure 2 , Figure 3 As shown in the figure, due to the poor segmentation effect of the Otsu method, the scratch pixels cannot be accurately identified, resulting in low detection accuracy. Figure 2 It can be seen that the grayscale of the pixels of the scratch lines in the image is significantly lower than the normal pixels around them, and the pixels of the frosted particles are the main factor causing the snowflake interference. In the pixel area of ​​the frosted particles, there are irregularly distributed bright pixels, and there are dark pixels in the gaps, while on the contrary, the dark pixels in the scratch area appear more continuously. Therefore, the image can be divided into multiple windows, and the possibility of the pixels in each window being defective pixels can be analyzed, and then the pixel segmentation threshold can be determined based on the possibility.

[0055] It should be further explained that, since the scratches on the surface of the laptop power adapter caused by mechanical scratches will cause the loss of local frosted particles, in the image performance, there are fewer bright spots at the scratched pixels, and since the scratches are continuously distributed, if there are scratched pixels in a window, there will be more than one scratched pixel in the window, which will cause the grayscale value in the window to be lower than the grayscale mean of the global image. Therefore, the fewer the number of bright spots in the pixels in each window, and the lower the grayscale value is compared with the global image, the higher the possibility that the pixel in the window is a scratch defective pixel.

[0056] Specifically, in this embodiment, the first length is preset to 3, which is used as an example for description. In other implementations, it can be set to other values; each pixel in the image is taken as the center point, the first length is taken as the side length, and a 3×3 window is constructed; thus, the defect degree of each pixel is obtained according to the gray value of the pixel, and the specific calculation formula is:

[0057]

[0058] in, Indicates The degree of defect of each pixel; Indicates The number of pixels in a window of pixels; Represents the mean gray value of all pixels in the image to be detected; Indicates The pixel window The gray value of each pixel; Expressed as an exponential function with a natural constant as base.

[0059] It should be noted that Indicates The difference between the grayscale value of the pixel point in the window of pixels and the grayscale value of the image, the greater the difference, the greater the possibility that the pixel point is a defective pixel.

[0060] It should be noted that, since the scratches on the surface of the laptop power adapter are distributed continuously and narrowly, only a small number of pixels around the scratches are scratch pixels, and the others are normal pixels. In the analysis of the window of each pixel point, the pixels belonging to the scratch defect only exist in a few windows among the eight adjacent windows; therefore, the windows around the window of each pixel point can be analyzed to determine the similarity between the window and the surrounding windows.

[0061] Specifically, the window of each pixel is expanded to several windows of the same size in the eight-neighborhood direction and analyzed together, such as Figure 4; Window No. 0 represents the window of the original pixel point, and the other 1 to 8 windows are extended windows, that is, a number of windows of the same size that are extended from the window of any pixel point in the direction of the eight-neighborhood are recorded as the extended windows of the pixel point, and the extended windows are divided with the window of the pixel point as the symmetric point to obtain 4 groups of symmetrical extended windows of the pixel point.

[0062] It should be noted that, since the scratches on the surface of the laptop power adapter are narrow and continuous, it is difficult to make the performance of the expanded multiple windows consistent with the original window. If the performance of one group of expanded windows after expansion is similar, while the performance of other groups is not similar, it means that the pixel in window 0 is likely to be a defective pixel. Because of the presence of frosted particles in the window, brighter spots and darker spots will appear, resulting in large pixel gradient changes and pixel changes. Therefore, the closer the mean values ​​of the gradient amplitudes of the two windows are, and the closer the fluctuation difference of the grayscale values ​​in the windows is, the higher the similarity between the two windows.

[0063] Specifically, the variance of the grayscale value and the mean of the gradient amplitude of each window are obtained; thus, according to the grayscale fluctuation difference and gradient amplitude difference of the pixels in different windows, the similarity between the window of each pixel and each extended window is obtained. The specific calculation formula is as follows:

[0064]

[0065] in, Indicates The pixel window and its Similarity of the extended window; Indicates The variance of the grayscale values ​​of pixels within a window of pixels; Indicates The pixel The variance of the grayscale values ​​of the pixels within the expanded window; Indicates The mean of the gradient amplitudes of pixels within a window of pixels; Indicates The pixel The mean of the gradient amplitudes of the expanded windows; represents the absolute value function.

[0066] It should be noted that Represents the difference in the variance of the grayscale values ​​of the two windows. The smaller the difference, the higher the similarity. It represents the difference in the mean values ​​of the gradient amplitudes of the two windows. The smaller the difference, the higher the similarity. The gray value variance and the mean value of the gradient amplitude reflect the intensity of the light and dark changes in a window. Since the frosted bright spots that cause the light and dark changes are evenly distributed, if the light and dark changes of the two windows are similar, the similarity of the two windows is high.

[0067] Step S003: Based on the similarity between the window of each pixel point and the two extended windows in the same extended window group, the similarity difference within each extended window group of each pixel point is obtained, and then the extended defect degree of each pixel point is obtained; based on the defect degree and the extended defect degree of each pixel point, the possibility of each pixel point being a defective pixel point is obtained.

[0068] It should be noted that by comparing the differences in similarities between the expansion groups of each pixel point, the expansion defect degree of each pixel point can be obtained. Since the expansion window of the edge pixels is not complete, the expansion defect degree of the edge pixels is not calculated. After the expansion defect degree of the remaining pixels is calculated, the average expansion defect degree of the non-edge pixels in the four neighborhoods of the edge pixel point is recorded as the expansion defect degree of the edge pixel point.

[0069] Specifically, the specific calculation formula for the extended defect degree of each pixel is:

[0070]

[0071]

[0072] in, Indicates The pixel Similarity difference within the expanded window group; Indicates The pixel window and its The first Similarity of the extended window; Indicates The pixel window and its The first Similarity of the extended window; Indicates The degree of expansion defect of each pixel; Indicates the number of extended window groups for each pixel; Indicates The pixel window and its The mean similarity of two extended window groups in an extended window group; Indicates The mean similarity between a window with pixels and all its extended windows; represents the absolute value function.

[0073] It should be noted that through Indicates The average similarity difference between the window with pixel points and its four window extension groups. The smaller the value, the The more likely a window with 1 pixel is a normal window, the lower the degree of expansion defect of the pixel. Indicates The mean similarity between the window with pixel points and its four window expansion groups is The difference between the window of a pixel point and the mean similarity of all its extended windows, the larger the difference is, the more obvious the feature of the scratch is continuous and narrowly distributed, and the higher the degree of extended defect of the pixel point is.

[0074] Furthermore, according to the defect degree and extended defect degree of each pixel, the possibility of each pixel being a defective pixel is comprehensively obtained. The specific calculation formula is:

[0075]

[0076] in, Indicates The probability that a pixel is a defective pixel; Indicates The degree of defect of each pixel; Indicates The degree of expansion defect of each pixel; Represents a linear normalization function, the normalized object is all pixels .

[0077] Step S004: Obtain the scratch pixel points after preliminary screening, and obtain the defect similarity between each scratch pixel point after preliminary screening and the central pixel point of each extended window according to the window of each scratch pixel point after preliminary screening and its extended window; based on the defect similarity between the scratch pixel point after preliminary screening and the central pixel point of its extended window, obtain several scratch pixel points through iterative expansion.

[0078] It should be noted that due to the operation of the robot on the assembly line, scratches may be formed when producing the power supply shell. These scratches are long and have the characteristics of gradually deepening from shallow to deep and gradually narrowing from wide to narrow. However, the surface of the laptop power adapter is evenly distributed with frosted anti-skid particles, which causes the gray value of the shallow scratches to overlap with the background, making it impossible to segment the complete scratches. Figure 4In the figure, when the scratch is heavy, the performance around window 0 is similar. When the scratch is light or disappears, only a few of the surrounding windows are similar, and most are not similar. Due to the continuity of scratch distribution, according to the similarity between the window of each pixel point and its expansion window, the direction is selected for expansion based on the similarity, and then the similarity is calculated based on the expanded window, and then expanded again until the boundary area where the scratch performance is not obvious is reached.

[0079] Specifically, the preset possibility threshold of this embodiment is 0.8, which is used as an example for description. Other implementations may be set to other values; pixels in the image whose possibility of being defective pixels is greater than the possibility threshold are recorded as scratch pixels after preliminary screening; each scratch pixel after preliminary screening is used as an initial expansion point, and the defect similarity between each initial expansion point and the central pixel of each expansion window is calculated. The specific calculation formula is:

[0080]

[0081] in, Indicates The pixel and its The similarity of the probability that the pixels represented by the expanded windows belong to defective pixels; Indicates The probability that a pixel is a defective pixel; Indicates The pixel The possibility that the central pixel of the expanded window is a defective pixel; represents the absolute value function.

[0082] It should be noted that through Indicates Pixels and The pixel The difference in the probability of the pixels represented by the two expanded windows being defective pixels is smaller, indicating that the similarity between the two windows is higher.

[0083] Furthermore, the preset similarity threshold of this embodiment is 0.4, which is used as an example for description. Other implementation modes may be set to other values. When the defect similarity between any initial expansion point and the central pixel point of any expansion window is greater than the similarity threshold, the expansion window is used as the next central window, and the defect similarity between the central pixel point of the central window and the central pixel point of its expansion window is analyzed, and so on, until the defect similarity between the central pixel point of the central window and the central pixel points of all its expansion windows is less than the similarity threshold, the expansion is stopped, and the scratch pixel point after the preliminary screening and all the central pixel points passed during the expansion process are recorded as scratch pixel points.

[0084] Step S005: Connect the scratch pixel points to obtain several scratch edges and several endpoints to be processed; connect to obtain several initial scratch areas and valid closed line segments according to the distribution of the endpoints to be processed; extend to obtain several extended scratch areas according to the endpoints to be processed and the scratch edges; obtain the probability of scratches according to the number of pixels in the initial scratch area and the extended scratch area in the image to be detected.

[0085] It should be noted that after obtaining the scratch pixel points, they can be connected. Since the scratch may be subjected to different forces when it is formed, one end of the scratch is smaller when subjected to force, resulting in that part of the edge cannot be recognized. Therefore, it is necessary to expand the unrecognized area to obtain a relatively complete scratch area.

[0086] Specifically, adjacent scratch pixel points are connected to obtain several scratch edges, and the unclosed endpoint of each scratch edge is recorded as an endpoint to be processed; each endpoint to be processed is connected with its nearest adjacent and unconnected endpoint to be processed to obtain several connecting line segments, and several scratch edges are combined to obtain several closed areas, which are recorded as initial scratch areas; and several connecting line segments participating in the formation of the initial scratch area are recorded as valid closed line segments, and the line segments that do not form the initial scratch area are discarded; at the same time, a straight line is fitted between the 10 pixel points closest to the endpoint to be processed and the scratch edge where it is located, and the line is extended in the direction pointing to the endpoint to be processed and stops after intersection, and the closed area formed by the obtained extended part and the valid closed line segment is recorded as the extended scratch area.

[0087] It should be noted that, by obtaining the number of pixels in the initial scratch area and the extended scratch area, the proportion of scratches in the image of the laptop power adapter can be obtained, thereby determining whether the product is a qualified product.

[0088] Specifically, the preset possibility threshold of this embodiment is 0.05, which is used as an example for description. Other implementations may be set to other values. According to the number of pixels in the initial scratch area and the extended scratch area and the number of all pixels in the image to be detected, the probability of the scratch is obtained, which is specifically expressed as follows:

[0089]

[0090] in, represents the probability of scratches, Represents the number of pixels in the initial scratch area; Represents the number of pixels in the extended scratch area; Indicates the number of pixels in the image to be detected.

[0091] If the probability of scratches in the image to be detected is greater than the possibility threshold, the power supply laptop power adapter represented by the image to be detected is marked as a non-conforming product.

[0092] At this point, this embodiment is completed.

[0093] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for inspecting the appearance of a laptop power adapter, characterized in that: The method comprises the following steps: Acquire a surface image of a laptop power adapter, and preprocess to obtain an image to be detected on the surface of the laptop power adapter; Obtain a window for each pixel in the image to be detected; obtain the degree of defect of each pixel according to the gray value of the pixel in the window of each pixel and the gray value of all pixels in the image to be detected; obtain an extended window and an extended window group for each pixel; obtain the similarity between the window of each pixel and each extended window according to the gray fluctuation difference and gradient amplitude difference of the pixels in different windows; According to the similarity between the window of each pixel and the two extended windows in the same extended window group, the similarity difference within each extended window group of each pixel is obtained, and then the extended defect degree of each pixel is obtained; according to the defect degree of each pixel and the extended defect degree, the possibility of each pixel being a defective pixel is obtained; Obtain scratch pixel points after preliminary screening, and obtain defect similarity between each scratch pixel point after preliminary screening and the central pixel point of each extended window according to the window of each scratch pixel point after preliminary screening and its extended window; obtain several scratch pixel points through iterative expansion based on the defect similarity between the scratch pixel point after preliminary screening and the central pixel point of its extended window; Connect the scratch pixel points to obtain several scratch edges and several endpoints to be processed; according to the distribution of the endpoints to be processed, connect to obtain several initial scratch areas and effective closed line segments; according to the endpoints to be processed and the scratch edges, extend to obtain several extended scratch areas; according to the number of pixels in the initial scratch area and the extended scratch area in the image to be detected, obtain the probability of the scratch.

2. According to claim 1, a method for inspecting the appearance of a laptop power adapter, characterized in that: The step of obtaining the defect degree of each pixel point according to the gray value of the pixel point in the window of each pixel point and the gray value of all the pixels in the image to be detected includes the following specific steps: in, Indicates The degree of defect of each pixel; Indicates The number of pixels in a window of pixels; Represents the mean gray value of all pixels in the image to be detected; Indicates The pixel window The gray value of each pixel; Expressed as an exponential function with a natural constant as base.

3. The appearance quality inspection method of a laptop power adapter according to claim 1, characterized in that: The specific steps of obtaining the extended window and extended window group of each pixel point are as follows: Several windows of the same size that are extended from the window of any pixel point in the direction of the eight-neighborhood are recorded as the extended windows of the pixel point, and the extended windows are divided with the window of the pixel point as the symmetric point to obtain four groups of symmetrical extended windows of the pixel point.

4. The appearance quality inspection method of a laptop power adapter according to claim 1, characterized in that: The specific steps of obtaining the similarity between each pixel window and each extended window according to the grayscale fluctuation difference and gradient amplitude difference of the pixel points in different windows are as follows: in, Indicates The pixel window and its Similarity of the extended window; Indicates The variance of the grayscale values ​​of pixels within a window of pixels; Indicates The pixel The variance of the grayscale values ​​of the pixels within the expanded window; Indicates The mean of the gradient amplitudes of pixels within a window of pixels; Indicates The pixel The mean of the gradient amplitudes of the pixels within the expanded window; represents the absolute value function.

5. The appearance quality inspection method of a laptop power adapter according to claim 1, characterized in that: The method of obtaining the similarity difference within each extended window group of each pixel point according to the similarity between the window of each pixel point and two extended windows in the same extended window group includes the following specific steps: in, Indicates The pixel The similarity difference within the expanded window group; Indicates The pixel window and its The first Similarity of the extended window; Indicates The pixel window and its The first Similarity of the extended window; represents the absolute value function.

6. The appearance quality inspection method of a laptop power adapter according to claim 5, characterized in that: The specific steps of obtaining the extended defect degree of each pixel point are as follows: in, Indicates The degree of expansion defect of each pixel; Indicates the number of extended window groups for each pixel; Indicates The pixel window and its The mean similarity between two extended windows in an extended window group; Indicates The mean similarity between a window with pixels and all its extended windows; represents the absolute value function.

7. The appearance quality inspection method of a laptop power adapter according to claim 1, characterized in that: The method of obtaining the possibility that each pixel is a defective pixel according to the defect degree and the extended defect degree of each pixel includes the following specific steps: in, Indicates The probability that a pixel is a defective pixel; Indicates The degree of defect of each pixel; Indicates The degree of expansion defect of each pixel; Represents the normalization function.

8. The appearance quality inspection method of a laptop power adapter according to claim 1, characterized in that: The defect similarity between each scratch pixel point after preliminary screening and the central pixel point of each extended window thereof is obtained according to the window of each scratch pixel point after preliminary screening and its extended window, and the specific steps include the following: in, Indicates The pixel and its The defect similarity of the central pixel of the expanded window; Indicates The probability that a pixel is a defective pixel; Indicates The pixel The possibility that the central pixel of the expanded window is a defective pixel; represents the absolute value function.

9. The appearance quality inspection method of a laptop power adapter according to claim 1, characterized in that: The defect similarity between the scratch pixel point after preliminary screening and the central pixel point of the extended window is obtained by iterative expansion, and the specific steps include the following: Take each scratch pixel point after preliminary screening as the initial expansion point. When the defect similarity between any initial expansion point and the central pixel point of any expansion window is greater than the similarity threshold, the expansion window is used as the next central window. The defect similarity between the central pixel point of the central window and the central pixel point of its expansion window is analyzed. This process is repeated until the defect similarities between the central pixel point of the central window and the central pixel points of all expansion windows are less than the similarity threshold. Then the expansion is stopped and the scratch pixel point after preliminary screening and all the central pixel points passed during the expansion process are recorded as scratch pixels.

10. The appearance quality inspection method of a laptop power adapter according to claim 1, characterized in that: The scratch pixel points are connected to obtain a plurality of scratch edges and a plurality of endpoints to be processed; according to the distribution of the endpoints to be processed, a plurality of initial scratch areas and effective closed line segments are connected; according to the endpoints to be processed and the scratch edges, a plurality of extended scratch areas are obtained by extension, and the specific steps are as follows: Connect adjacent scratch pixel points to obtain several scratch edges, and record the unclosed endpoints of each scratch edge as endpoints to be processed; Connect each endpoint to be processed with its nearest unconnected endpoint to be processed to obtain several connected line segments, and combine them with several scratch edges to obtain several closed areas, which are recorded as initial scratch areas; Several connected line segments that participate in forming the initial scratch area are recorded as valid closed line segments, and the line segments that do not form the initial scratch area are discarded; A straight line is fitted between the endpoint to be processed and several pixel points closest to the scratch edge where it is located, and the line is extended in the direction pointing to the endpoint to be processed and stops after intersection. The closed area formed by the extended part and the effective closed line segment is recorded as the extended scratch area.

Citation Information

Patent Citations

  • Intelligent detection method for surface defects of power adapter

    CN118014989A

  • Textile defect detection method based on image processing

    CN118587223A