Product defect detection method, electronic equipment and storage medium
Through automated image processing technology, design drawings are used to determine the detection location and area, and the similarity algorithm judges defects, solving the problem of low manual detection efficiency and achieving efficient and accurate product defect detection.
Patent Information
- Application Number
- CN202411196246.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-24
AI Technical Summary
In the prior art, manual detection of defects of products such as keyboards are not efficient and are easily affected by subjective factors, resulting in inaccurate detection results and low efficiency.
By acquiring the image of the product to be tested, determining the detection position and area according to the design drawing, comparing the detection area with the reference area using a similarity algorithm, and automatically identifying and determining whether the defect exists or not.
It improves the accuracy and efficiency of product defect detection, reduces the influence of artificial subjective factors, and ensures the reliability of the test results.
Smart Images

Figure CN119180787A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of detection technology, and in particular to a product defect detection method, electronic equipment and storage medium. Background Art
[0002] In the field of product manufacturing, in order to ensure product quality and production efficiency, it is often necessary to perform defect detection on products. Take the keyboard on a laptop as an example. As the main interface for users to interact with the device, its quality is directly related to the user experience and product image. If there are defects such as repeated keys or stains on the keyboard, it will directly affect the user experience and have a negative impact on the product image. Therefore, it is particularly important to perform efficient and accurate defect detection on the keyboard on the laptop.
[0003] Related technologies often rely on manual defect detection, which is easily affected by subjective factors, such as the fatigue level of the inspectors and fluctuations in attention, resulting in poor defect detection efficiency of the product. Summary of the invention
[0004] In view of the above, it is necessary to provide a product defect detection method, electronic device and storage medium that can solve the technical problem of poor efficiency of product defect detection.
[0005] On the one hand, the present application provides a product defect detection method, the method comprising: acquiring an image of a product to be tested, determining a corresponding detection area in the image according to a detection position, wherein the detection position is determined based on a design drawing of the product to be tested, and determining a detection result of the product to be tested based on a comparison between the detection area and a reference area corresponding to the detection position.
[0006] In some embodiments of the present application, the product to be tested includes a keyboard or a stamp.
[0007] In some embodiments of the present application, if the product to be tested is a keyboard, the method further includes: obtaining design drawings of multiple types of keyboards, determining the position of each key in each type of keyboard based on the preprocessed images corresponding to the design drawings of each type of keyboard, and establishing a corresponding relationship between the identification information corresponding to each type of keyboard and the positions of all keys in each type of keyboard.
[0008] In some embodiments of the present application, determining the position of each key in each type of keyboard based on a preprocessed image corresponding to a design drawing of each type of keyboard includes: detecting the outline of each key in the preprocessed image, and determining the position of each key based on the vertices of an inscribed rectangle in the outline.
[0009] In some embodiments of the present application, the determination of the detection position includes: according to identification information corresponding to the product to be tested, taking the positions of all keys corresponding to the product to be tested as the detection position.
[0010] In some embodiments of the present application, determining the reference area includes: obtaining an image of a keyboard that belongs to the same category as the product to be tested and has correctly installed keys as a reference image, calibrating the reference image so that the calibrated reference image is aligned with the corresponding design drawing, and determining the reference area from the calibrated reference image according to the detection position.
[0011] In some embodiments of the present application, determining the inspection result of the product to be tested based on the comparison between the inspection area and the reference area corresponding to the inspection position includes: based on the reference area, calculating the similarity corresponding to each pixel point in the inspection area using a preset algorithm, and determining whether the inspection area includes a defective area according to the preprocessing value corresponding to the similarity of each pixel point, if the inspection area includes at least one defective area, determining that the product to be tested is defective, and if the inspection area does not include any defective area, determining that the product to be tested is not defective.
[0012] In some embodiments of the present application, determining whether the detection area includes a defective area according to the preprocessing value corresponding to the similarity of each pixel point includes: determining whether the detection area includes abnormal pixels according to the preprocessing value corresponding to the similarity of each pixel point, if the detection area includes the abnormal pixels, determining the area of the candidate area constituted by the abnormal pixels, if the area of the candidate area constituted by the abnormal pixels is greater than or equal to a preset threshold, determining that the candidate area is a defective area, and if the area is less than the preset threshold, determining that the candidate area is not a defective area.
[0013] On the other hand, the present application provides an electronic device, comprising: a memory storing at least one instruction; and a processor executing the at least one instruction to implement the product defect detection method.
[0014] On the other hand, the present application provides a computer-readable storage medium, wherein at least one instruction is stored in the computer-readable storage medium, and when the at least one instruction is executed by a processor in an electronic device, the product defect detection method is implemented.
[0015] In the product defect detection method of the present embodiment, since the design drawing can accurately reflect the layout, shape, size and other features of the product to be tested, the detection position is determined based on the design drawing of the product to be tested, and the accuracy of the detection position can be ensured. Since the detection position has a corresponding reference area, the detection area can be quickly compared with the corresponding reference area, so as to quickly identify whether there are deviations, anomalies or defects in the detection area that are inconsistent with the reference area. Since the reference area is standardized and can reflect the expected state of the product to be tested, the detection result of the product to be tested can be quickly and accurately determined by comparison, thereby improving the efficiency of product defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a schematic diagram of a keyboard with repeated keys provided in one embodiment of the present application.
[0017] Figure 2 It is a flow chart of a product defect detection method provided in one embodiment of the present application.
[0018] Figure 3 It is a schematic diagram of an image of a product to be tested after correction provided in an embodiment of the present application.
[0019] Figure 4 It is a schematic diagram of a design drawing of a product to be tested provided in one embodiment of the present application.
[0020] Figure 5 It is a schematic diagram of the outline of a key in a design diagram provided in an embodiment of the present application.
[0021] Figure 6 It is a schematic diagram for determining the detection area provided in one embodiment of the present application.
[0022] Figure 7 It is a schematic diagram of a corrected reference image provided in an embodiment of the present application.
[0023] Figure 8 It is a schematic diagram for determining a reference area provided in an embodiment of the present application.
[0024] Fig. 9 It is a schematic diagram comparing a detection area and a reference area provided in an embodiment of the present application.
[0025] Fig.10 It is a test schematic diagram of a first set of test images provided in an embodiment of the present application.
[0026] Fig.11 It is a test schematic diagram of a second set of test images provided in an embodiment of the present application.
[0027] Fig.12 It is a test schematic diagram of the third group of test images provided in an embodiment of the present application.
[0028] Fig.13 It is a test schematic diagram of the fourth group of test images provided in an embodiment of the present application.
[0029] Fig.14 It is a test schematic diagram of the fifth group of test images provided in an embodiment of the present application.
[0030] Fig.15 It is a structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0031] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0032] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. The following embodiments and features in the embodiments may be combined with each other without conflict.
[0033] In the field of product manufacturing, in order to ensure product quality and production efficiency, it is often necessary to perform defect detection on products. Take the keyboard on a laptop as an example. As the main interface for users to interact with the device, its quality is directly related to the user experience and product image. If there are defects such as repeated keys or stains on the keyboard, it will directly affect the user experience and have a negative impact on the product image. Therefore, it is particularly important to perform efficient and accurate defect detection on the keyboard on the laptop.
[0034] like Figure 1 , is a schematic diagram of a keyboard with repeated keys provided by an embodiment of the present application. Figure 1 In the figure, the key Q, key F, key B, key C and key L selected by the rectangular box are the repeat keys on the keyboard.
[0035] Related technologies often rely on manual defect detection, which is easily affected by subjective factors, such as the fatigue level of the inspectors and fluctuations in attention, resulting in poor defect detection efficiency of the product.
[0036] The embodiment of the present application provides a product defect detection method, which can improve the efficiency of product defect detection. The product defect detection method provided in the embodiment of the present application can be applied to one or more electronic devices, and the electronic device can be a laptop computer, a mobile phone, a computer, a server and other devices. The present application does not limit the type of electronic device.
[0037] like Figure 2 FIG. 1 is a flowchart of a product defect detection method provided by an embodiment of the present application. According to different requirements, the order of each step in the flowchart can be adjusted according to actual requirements, and some steps can be omitted. The method is applied to electronic devices, such as Fig.15 An electronic device 10 is shown.
[0038] S11, obtaining an image of the product to be tested.
[0039] In some embodiments of the present application, the products to be tested include but are not limited to: keyboards and seals, and the present application does not limit the types of products to be tested. In order to clearly illustrate the product defect detection method provided in the embodiments of the present application, the keyboard will be used as an example of the product to be tested.
[0040] In some embodiments of the present application, the electronic device may obtain the image of the product to be tested by a variety of methods, and the present application does not limit the method for obtaining the image.
[0041] The electronic device can photograph the laptop computer through a photographing device to obtain an image of the laptop computer, detect the outline of the keyboard in the image of the laptop computer, and cut out the area corresponding to the keyboard in the laptop computer according to the outline of the keyboard, thereby obtaining an image of the product to be tested.
[0042] Among them, in order to reduce the interference of factors such as ambient light and reflection on the shooting quality, a dark box can be introduced as a shooting environment, so as to provide a stable and controllable dark environment for shooting. In order to make the image of the laptop clearer, the shooting environment can be supplemented with light by a light source. For example, the light source can be a backlight with an opening in the middle, and the size of the light-emitting surface of the backlight can be 45x30 cm or 60x40 cm, etc., so that it can be fully covered and illuminated. The shooting device can be a camera or a camera, etc., and this application is not limited to this. The position of the shooting device and the light source can be set to an adjustable type, so as to be flexibly adjusted according to the shooting requirements to ensure the shooting effect. The shooting angle can be vertical shooting, and a certain height can be maintained between the shooting device and the laptop. For example, the vertical height between the shooting device and the laptop can be 40 cm. In order to avoid affecting the imaging effect due to the movement or vibration of the laptop, the laptop can be fixed on the fixture to ensure the stability of the laptop.
[0043] In other embodiments, due to factors such as the shooting angle, the keyboard may be tilted in the cropped area. In this case, the cropped area can be corrected so that the corrected area is aligned with the design drawing of the product to be tested, and the corrected area is used as the image to be tested. Figure 3 FIG. 1 is a schematic diagram of an image of a product to be tested after correction provided by an embodiment of the present application. The introduction of the design drawing will be described below.
[0044] S12, determining a corresponding detection area in the image of the product to be tested according to the detection position, wherein the detection position is determined based on a design drawing of the product to be tested.
[0045] In some embodiments of the present application, the design drawing may be an image including key information such as the appearance, structure, size, and functional layout of the product to be tested. The design drawing may be an image including key information such as the appearance, structure, size, and functional layout of the product to be tested. Figure 4 , which is a schematic diagram of a design drawing of a product to be tested provided in one embodiment of the present application. Figure 4 It is a design drawing of the keyboard, which can reflect information such as the layout and size of the keys in the keyboard.
[0046] In some embodiments of the present application, the detection position may be the position of the product to be tested in the design drawing corresponding to the product to be tested, and the detection area may be the area corresponding to the product to be tested in the image of the product to be tested. For example, if the product to be tested is a keyboard, the detection position may be the position of each key in the design drawing, and the detection area may be the area corresponding to each key in the image of the product to be tested, thereby obtaining multiple detection areas. If the product to be tested is a seal, the detection position may be the position of the seal in the design drawing, and the detection area may be the area corresponding to the seal in the image of the product to be tested.
[0047] Regarding the method for determining the detection position, taking the product to be tested as a keyboard as an example, the electronic device can obtain design drawings of multiple types of keyboards, determine the position of each key in each type of keyboard based on the preprocessed images corresponding to the design drawings of each type of keyboard, and establish a corresponding relationship between the identification information corresponding to each type of keyboard and the positions of all keys in each type of keyboard.
[0048] The identification information can be used to identify the identity information of the keyboard. For example, the identification information can be the serial number (SN) or barcode of the keyboard, or the identification information can be the serial number or barcode of the laptop computer where the keyboard is located, and this application does not limit this. The preprocessed image corresponding to the design drawing of each type of keyboard can be obtained by preprocessing the design drawing of each type of keyboard. The preprocessing includes but is not limited to: grayscale processing and binarization processing.
[0049] According to the corresponding relationship, by identifying the identification information corresponding to the product to be tested, the positions of all buttons in the product to be tested can be determined as the detection positions.
[0050] The electronic device can detect the outline of each key in the preprocessed image, and determine the position of each key according to the vertices of the inscribed rectangle in the outline.
[0051] The present application does not limit the method for detecting the outline of a key. For example, the pixel points in the preprocessed image that are less than or equal to the preset value can be determined as the pixel points that constitute the outline of the key, so that the outline of each key can be determined, wherein the preset value can be customized, and the present application does not limit this. For example, Figure 5 , which is a schematic diagram of the outline of a key in a design diagram provided in an embodiment of the present application. Figure 5 In the image, the white edge of each key represents the outline of the key. The above examples of the method for detecting the outline of the key are only examples, and are not limited to this in practical applications. For example, the electronic device can also determine the outline of each key in the preprocessed image by an edge detection algorithm. The edge detection algorithm can be a Canny algorithm, a Sobel operator, etc.
[0052] Exemplarily, the electronic device may determine the coordinates of all or part of the vertices of the inscribed rectangle in the outline of each key as the position of the key. For example, the coordinates of the upper left vertex and the coordinates of the lower right vertex, or the coordinates of the upper left vertex and the coordinates of the lower right vertex in the inscribed rectangle in the outline of each key are determined as the position of the key.
[0053] According to the identification information corresponding to the product to be tested, the electronic device can determine the positions of all buttons corresponding to the product to be tested as the detection positions.
[0054] Exemplarily, by reading the serial number corresponding to the product to be tested, or by scanning and identifying the barcode of the product to be tested, the electronic device can determine the position of the key corresponding to the product to be tested, and determine the position of the key corresponding to the product to be tested as the detection position.
[0055] In other embodiments of the present application, the electronic device can establish a correspondence between each type of product to be tested and the design drawing of each type of product to be tested. By directly reading the serial number corresponding to the product to be tested, or by scanning and identifying the barcode of the product to be tested, the electronic device can determine the design drawing corresponding to the product to be tested, and determine the detection position corresponding to the product to be tested from the determined design drawing.
[0056] In some embodiments of the present application, a corresponding detection area may be determined from an image of the product to be detected based on the detection position.
[0057] In other embodiments, the electronic device may utilize techniques such as cutout to cut out or segment the detection area from the image of the product to be detected according to the detection position.
[0058] For example, if the detection position is the coordinates of the upper left corner vertex and the lower right corner vertex in the inscribed rectangle, the electronic device can determine the rectangular outline corresponding to the button in the image of the product to be tested by detecting the position, and use the area within the rectangular outline as the detection area. Figure 6 , which is a schematic diagram of determining the detection area provided in one embodiment of the present application. Figure 6 In the figure, the white rectangle corresponds to the outline of each key. Figure 3 The rectangular outline corresponding to each button in the image of the product to be tested is shown, and the area within the rectangular outline is used as the detection area.
[0059] In this embodiment, since the design drawing can accurately reflect the layout, shape, size and other features of the product to be tested, the detection position is determined based on the design drawing of the product to be tested, so that the accuracy of the detection position can be ensured.
[0060] S13, determining the detection result of the product to be detected based on the comparison between the detection area and the reference area corresponding to the detection position.
[0061] In some embodiments of the present application, taking the product to be tested as a keyboard as an example, determining the reference area includes: obtaining an image of a keyboard that belongs to the same category as the product to be tested and has correctly installed keys as a reference image, correcting the reference image so that the corrected reference image is aligned with the corresponding design image, and determining the reference area from the corrected reference image according to the detection position.
[0062] The method for obtaining the reference image can refer to the description of the method for obtaining the image of the product to be tested in step S11, and this application will not repeat the description. In practical applications, the reference image corresponding to the product to be tested can be the first image of a product of the same category as the product to be tested that can be received by the electronic device.
[0063] Exemplarily, the correspondence between each type of product to be tested and the reference diagram of each type of product to be tested can be displayed. When the reference diagram corresponding to the product to be tested cannot be found (such as the first test), a prompt text can be generated, wherein the prompt text prompts the user to create the corresponding reference diagram. When the reference diagram corresponding to each type of product to be tested is received, the design diagram corresponding to each type of product to be tested and the reference diagram can be simultaneously visualized for the user to view and confirm.
[0064] The area corresponding to the detection position in the corrected reference image can be determined as the reference area. If there are multiple detection positions, the reference area corresponding to each detection position can be determined from the reference image.
[0065] In other embodiments, a cutout technique may be used to cut out a reference area corresponding to each detection position from a reference image, thereby obtaining a reference area corresponding to each detection position.
[0066] For example, Figure 7 As shown in FIG. 1 , it is a schematic diagram of a reference image after correction provided by an embodiment of the present application. Figure 8 , which is a schematic diagram of determining a reference area provided in an embodiment of the present application. Figure 8 In the figure, the white rectangle corresponds to the outline of each key. Figure 7 The reference diagram shown shows a rectangular outline corresponding to each key, and the area within the rectangular outline is used as a reference area.
[0067] like Fig. 9 , which is a schematic diagram comparing a detection area and a reference area provided in an embodiment of the present application. Fig. 9 The upper part of Figure 8 The reference area shown, Fig. 9 The lower part of Figure 6 By comparison, it can be determined Figure 6 In the reference area shown, the F button, the B button, the C button, the Q button, the L button, and the right bracket button (see Fig. 9 The thick rectangle) and Figure 8 The key E, key D, key G, key L, key O and left bracket key at the corresponding positions are different.
[0068] In some embodiments of the present application, based on the comparison between the detection area and the reference area corresponding to the detection position, determining the detection result of the product to be tested includes: based on the reference area, using a preset algorithm to calculate the similarity corresponding to each pixel point in the detection area, and determining whether the detection area includes a defective area according to the preprocessing value corresponding to the similarity of each pixel point. If the detection area includes at least one defective area, it can be determined that the product to be tested has defects. If the detection area does not include any defective area, it can be determined that the product to be tested does not have defects.
[0069] Among them, the preset algorithm can be a structural similarity (SSIM) algorithm. The calculation method of the similarity of each pixel in the detection area can refer to the formula of the structural similarity algorithm, and this application will not describe it in detail. The preprocessing value corresponding to the similarity of each pixel can be obtained by preprocessing the similarity of each pixel. The preprocessing of the similarity of each pixel can include steps such as contrast enhancement, binarization and morphological operations, and the morphological operations can be corrosion and expansion, etc.
[0070] For example, a first region can be generated based on the similarity of each pixel in the detection area, contrast enhancement processing can be performed on the first region to obtain a second region, the second region can be binarized to obtain a binary image, morphological operations such as corrosion and expansion can be performed on the binary image to obtain a third region, and the pixel value of each pixel in the third region can be determined as the preprocessed value corresponding to the corresponding pixel in the detection area.
[0071] Exemplarily, the electronic device can determine whether the detection area includes abnormal pixels by using the preprocessing value corresponding to each pixel in the detection area. If the detection area includes abnormal pixels, the area of the candidate area formed by the abnormal pixels is determined. If the area is greater than or equal to a preset threshold, the candidate area is determined to be a defective area, or if the area is less than the preset threshold, the candidate area is determined not to be a defective area. If the detection area includes at least one candidate area as a defective area, it can be determined that the detection area includes a defective area.
[0072] The preset threshold value may be customized, and this application does not limit this. For example, the preset threshold value may be 7.
[0073] In other embodiments of the present application, the electronic device may frame a defective area and visually display the framed defective area and the area of the defective area.
[0074] In the case of multiple detection areas, it can be determined whether each detection area includes a defective area. If all detection areas include at least one defective area, it can be determined that the product to be tested has defects, and if all detection areas do not include any defective area, it can be determined that the product to be tested does not have defects.
[0075] In this embodiment, when the area is greater than or equal to the preset threshold, the probability that the candidate area does not match the corresponding area in the reference area is high, and the candidate area is determined not to be a defect area, which can ensure the accuracy of the candidate area. When the area is less than the preset threshold, the probability that the candidate area does not match the corresponding area in the reference area is low, and therefore the candidate area is determined not to be a defect area, which can ensure the accuracy of the candidate area.
[0076] In order to ensure the accuracy of product detection, the product defect detection method provided in the embodiment of the present application was tested multiple times using multiple groups of test images. Each group of test images includes a test image and a reference image. Fig.10 , which is a test schematic diagram of a first set of test images provided in an embodiment of the present application. Fig.10 (a) is the reference image and Fig.10 (b) in the figure is the image to be tested in the first set of test images. Fig.10 (c) in FIG. 1 is the first region corresponding to the first set of test images. Fig.10 (d) in is the second area corresponding to the first set of test images. Fig.10 (e) in FIG. 1 is the third region corresponding to the first set of test images. Fig.10 As can be seen from (f) in the figure, the product defect detection method provided in the embodiment of the present application can frame out the defective area in the image to be tested that is inconsistent with the reference image and display the area 278 of the defective area.
[0077] like Fig.11 , which is a test schematic diagram of a second set of test images provided in an embodiment of the present application. Fig.11 (a) is the reference image and Fig.11 (b) in the figure is the image to be tested in the second set of test images. Fig.11 (c) in FIG. 1 is the second region corresponding to the second set of test images. Fig.11 (d) in FIG. 1 is the second region corresponding to the second set of test images. Fig.11 (e) in FIG. 1 is the third region corresponding to the second set of test images. Fig.11 As can be seen from (f) in the figure, the product defect detection method provided in the embodiment of the present application can select four defect areas in the test image that do not match the reference image and display the area of each defect area. The areas of the four defect areas are 606, 70, 70 and 539 respectively.
[0078] like Fig.12 , which is a test schematic diagram of a third group of test images provided in an embodiment of the present application. Fig.12 (a) is the reference image and Fig.12 (b) in the figure is the image to be tested in the third set of test images. Fig.12 (c) in FIG. 1 is the third region corresponding to the third set of test images. Fig.12 (d) in FIG. 1 is the third region corresponding to the third set of test images. Fig.12 (e) in FIG. 1 is the third region corresponding to the third set of test images. Fig.12 As can be seen from (f) in the figure, the product defect detection method provided in the embodiment of the present application can frame the defect areas in the image to be tested that are inconsistent with the reference image and display the area 50 of each defect area.
[0079] like Fig.13 , which is a test schematic diagram of the fourth group of test images provided in an embodiment of the present application. Fig.13 (a) is the reference image and Fig.13 (b) in the figure is the image to be tested in the fourth set of test images. Fig.13 (c) in FIG. 1 is the third region corresponding to the fourth set of test images. Fig.13 (d) in FIG. 1 is the third region corresponding to the fourth set of test images. Fig.13 (e) in FIG. 1 is the third region corresponding to the fourth set of test images. Fig.13 As can be seen from (f) in the figure, the product defect detection method provided in the embodiment of the present application can select four defect areas in the test image that are inconsistent with the reference image and display the area of each defect area. The areas of the four defect areas are 10, 10, 8, and 271, respectively.
[0080] like Fig.14 , which is a test schematic diagram of the fifth group of test images provided in an embodiment of the present application. Fig.14 (a) is the reference image and Fig.14 (b) in the figure is the image to be tested in the fifth set of test images. Fig.14 (c) in FIG. 1 is the third region corresponding to the fifth set of test images. Fig.14 (d) in FIG. 1 is the third region corresponding to the fifth set of test images. Fig.14 (e) in FIG. 1 is the third region corresponding to the fifth set of test images. Fig.14 As can be seen from (f) in the figure, the product defect detection method provided in the embodiment of the present application can select two defect areas in the test image that do not match the reference image and display the area of each defect area. The areas of the two defect areas are 6 and 9 respectively.
[0081] In the product defect detection method provided in the embodiment of the present application, since the design drawing can accurately reflect the layout, shape, size and other features of the product to be tested, the detection position is determined based on the design drawing of the product to be tested, and the accuracy of the detection position can be ensured. Since the detection position has a corresponding reference area, the detection area can be quickly compared with the corresponding reference area, so as to quickly identify whether there are deviations, anomalies or defects in the detection area that are inconsistent with the reference area. Since the reference area is standardized and can reflect the expected state of the product to be tested, the detection result of the product to be tested can be quickly and accurately determined by comparison, thereby improving the defect detection efficiency of the product.
[0082] like Fig.15 The electronic device 10 may be a mobile phone, a tablet computer, a notebook computer, a computer, a server or other electronic device, and the embodiment of the application does not impose any restrictions on the specific type of the electronic device.
[0083] like Fig.15 As shown, the electronic device 10 may include a communication module 101, a memory 102, a processor 103, an input / output (I / O) interface 104 and a bus 105. The processor 103 is coupled to the communication module 101, the memory 102 and the input / output interface 104 through the bus 105.
[0084] The communication module 101 may include a wired communication module and / or a wireless communication module. The wired communication module may provide one or more wired communication solutions such as universal serial bus (USB), controller area network bus (CAN, Controller Area Network). The wireless communication module may provide one or more wireless communication solutions such as wireless fidelity (wireless fidelity, Wi-Fi), Bluetooth (Bluetooth, BT), mobile communication network, frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR), etc.
[0085] The memory 102 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM). The random access memory can be directly read and written by the processor 103, and can be used to store executable programs (such as machine instructions) of other running programs, and can also be used to store user and application data. The random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc.
[0086] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 103. The non-volatile memory may include a disk storage device and a flash memory.
[0087] The memory 102 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 103. The one or more computer programs include multiple instructions. When the multiple instructions are executed by the processor 103, the product defect detection method executed on the electronic device 10 can be implemented.
[0088] In other embodiments, Fig.15 The electronic device 10 shown also includes an external memory interface for connecting to an external memory to expand the storage capacity of the electronic device 10 .
[0089] The processor 103 may include one or more processing units, for example, the processor 103 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0090] The processor 103 provides computing and control capabilities. For example, the processor 103 is used to execute a computer program stored in the memory 102 to implement the above-mentioned product defect detection method.
[0091] The input / output interface 104 is used to provide a channel for user input or output. For example, the input / output interface 104 can be used to connect various input and output devices, such as a mouse, keyboard, touch device, display screen, etc., so that the user can enter information or visualize information.
[0092] The bus 105 is at least used to provide a channel for mutual communication among the communication module 101 , the memory 102 , the processor 103 , and the input / output interface 104 in the electronic device 10 .
[0093] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0094] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the methods in the above-mentioned embodiments of the present application.
[0095] The computer-readable storage medium may be an internal memory of the electronic device described in the above embodiment, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device.
[0096] In some embodiments, the computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the electronic device, etc.
[0097] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0098] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0099] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0100] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present application is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0101] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in this application can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A product defect detection method, characterized in that: The method comprises: Acquire an image of the product to be tested; Determining a corresponding detection area in the image according to a detection position, wherein the detection position is determined based on a design drawing of the product to be detected; Based on the comparison between the detection area and a reference area corresponding to the detection position, the detection result of the product to be detected is determined.
2. The product defect detection method according to claim 1, characterized in that: The product to be tested includes a keyboard or a seal.
3. The product defect detection method according to claim 2, characterized in that: If the product to be tested is a keyboard, the method further includes: Get the design drawings of various keyboards; Determining the position of each key in each type of keyboard according to the preprocessed image corresponding to the design drawing of each type of keyboard; A correspondence between the identification information corresponding to each type of keyboard and the positions of all keys in each type of keyboard is established.
4. The product defect detection method according to claim 3, characterized in that: Determining the position of each key in each type of keyboard according to the preprocessed image corresponding to the design drawing of each type of keyboard comprises: Detecting the contour of each key in the preprocessed image; The position of each key is determined according to the vertices of the inscribed rectangle in the outline.
5. The product defect detection method according to claim 3 or 4, characterized in that: The determination of the detection position includes: According to the identification information corresponding to the product to be tested, the positions of all the buttons corresponding to the product to be tested are used as the detection positions.
6. The product defect detection method according to claim 3, characterized in that: Determining the reference area includes: Acquire an image of a keyboard that is of the same category as the product to be tested and has correctly installed keys as a reference image; Correcting the reference image so that the corrected reference image is aligned with the corresponding design image; The reference area is determined from the corrected reference image according to the detected position.
7. The product defect detection method according to claim 1, characterized in that: The determining the detection result of the product to be tested based on the comparison between the detection area and the reference area corresponding to the detection position includes: Based on the reference area, a preset algorithm is used to calculate the similarity corresponding to each pixel point in the detection area; Determining whether the detection area includes a defect area according to the preprocessing value corresponding to the similarity of each pixel point; If the detection area includes at least one defective area, determining that the product to be tested has a defect; If the inspection area does not include any defective area, it is determined that the product to be inspected has no defects.
8. The product defect detection method according to claim 7, characterized in that: The determining, according to the preprocessing value corresponding to the similarity of each pixel point, whether the detection area includes a defect area comprises: Determining whether the detection area includes abnormal pixels according to the preprocessing value corresponding to the similarity of each pixel; If the detection area includes the abnormal pixel point, determine the area of the candidate area formed by the abnormal pixel point; If the area of the candidate region formed by the abnormal pixels is greater than or equal to a preset threshold, the candidate region is determined to be a defect region; if the area is less than the preset threshold, the candidate region is determined not to be a defect region; If the detection area does not include the abnormal pixel point, it is determined that the detection area does not include the defective area.
9. An electronic device, characterized in that: The electronic device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the product defect detection method according to any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the product defect detection method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Measuring system for measuring pitches between keycaps on keyboard
TWI939053B
