Straight scratch detection method and device, storage medium and electronic equipment

By calculating the second-order partial derivatives and line directions of the target image, combined with contour modeling and differential processing, the problems of high computational complexity and low efficiency in existing technologies are solved, achieving efficient and accurate straight scratch detection.

CN116309487BActive Publication Date: 2026-03-10BEIJING LUSTER LIGHTTECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-23
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing methods for detecting straight scratches have high computational complexity and low image processing efficiency, making it difficult to effectively eliminate the influence of background images, noise, uneven lighting, and other factors, leading to missed detections and false detections.

Method used

By calculating the second-order partial derivative and line direction of each pixel in the target image, combined with contour modeling and differential processing, the scratch points are determined, and interference is eliminated through collinearity detection and curvature judgment, thereby improving detection accuracy.

Benefits of technology

It achieves direct scratch detection with low computational load and high image processing efficiency, effectively eliminating the influence of background image, noise, uneven lighting and other factors, thus improving the accuracy and completeness of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116309487B_ABST
    Figure CN116309487B_ABST
Patent Text Reader

Abstract

The application discloses a straight scratch detection method and device, a storage medium and an electronic device. The method comprises the following steps: determining a target image; calculating the second-order partial derivative and the line direction of each pixel point in the target image; and determining the scratch point in the target image according to the second-order partial derivative and the line direction. The method determines the target image, determines the scratch point in the target image according to the second-order partial derivative and the line direction of each pixel point in the target image, excludes the background image, reduces the influence of noise, uneven illumination and other factors in the image on the straight scratch detection, prevents missed detection, improves the accuracy of the straight scratch point detection, judges the curvature of the scratch contour line determined by the scratch point, excludes the interference of curved impurities such as hairs, prevents false detection, improves the accuracy of the straight scratch detection, and connects the real scratch contours which are collinear at a certain distance, thereby improving the integrity and accuracy of the extracted straight scratch defect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of practical defect detection technology, and particularly to a method, apparatus, storage medium, and electronic device for detecting straight scratches. Background Technology

[0002] In visual image processing, common methods for detecting straight scratch defects include designing filters to enhance high-frequency information in the frequency domain and extracting it morphologically in the spatial domain. While this method offers highly targeted filter design, it also has high computational complexity and is inefficient for processing large images. Summary of the Invention

[0003] This invention aims to at least partially solve one of the technical problems in related technologies. Therefore, one objective of this invention is to propose a straight scratch detection method that has the advantages of low computational complexity and high image processing efficiency.

[0004] The second objective of this invention is to provide a straight scratch detection device.

[0005] A third objective of this invention is to provide a computer-readable storage medium.

[0006] The fourth objective of this invention is to provide an electronic device.

[0007] To achieve the above objectives, a first aspect of the present invention provides a method for detecting straight scratches, characterized in that the method includes: determining a target image; calculating the second-order partial derivative and line direction of each pixel in the target image; and determining scratch points in the target image based on the second-order partial derivative and the line direction.

[0008] The straight scratch detection method according to the present invention calculates the second-order partial derivative and line direction of each pixel in the target image, and determines the scratch point in the target image based on the second-order partial derivative and line direction of each pixel. It has the advantages of low computational load and high image processing efficiency.

[0009] In addition, the direct scratch detection method proposed in the above embodiments of the present invention may also have the following additional technical features:

[0010] According to an embodiment of the present invention, determining the target image includes: acquiring an image to be detected and determining a region to be detected based on a pre-established contour model; scaling the region to be detected to obtain a scaled region to be detected; constructing a background in the scaled region to obtain a region to be detected with a constructed background; and performing differential processing on the region to be detected with the constructed background to obtain the target image.

[0011] According to an embodiment of the present invention, the step of constructing a background for the scaled detection region includes: performing median filtering on the scaled detection region.

[0012] According to one embodiment of the present invention, when performing differential processing on the image after background construction, the differential formula used is as follows:

[0013] Gray = (I ori -I med )*Fat+G offset

[0014] Where Gray represents the target image, I ori I represents the area to be detected. med This represents the region to be detected after the background has been constructed, Fat represents the scaling factor used in the scaling process, and G... offset This represents the differential grayscale offset, which is determined based on the average grayscale value of the area to be detected.

[0015] According to an embodiment of the present invention, determining the scratch point in the target image based on the second-order partial derivative and the line direction includes: determining the pixel point corresponding to the maximum pixel value within the target defect width range of the second-order partial derivative perpendicular to the line direction of each pixel point in the target image, and marking the pixel point as a target pixel point; for each target pixel point, if the second-order partial derivative of the target pixel point is greater than a first threshold, or if the second-order partial derivative of the target pixel point is less than or equal to the first threshold and greater than or equal to a second threshold and the distance from the target pixel point to the determined scratch point is less than a preset threshold, then the target pixel point is determined to be a scratch point.

[0016] According to an embodiment of the present invention, the method further includes: determining a scratch contour line based on the scratch points; determining a first endpoint and a second endpoint based on the scratch contour line, and obtaining the coordinates of the first endpoint and the second endpoint of the second endpoint; calculating the contour length of the scratch contour line; and determining the actual scratch contour line based on the coordinates of the first endpoint, the coordinates of the second endpoint, and the contour length.

[0017] According to an embodiment of the present invention, the method further includes: performing collinearity detection on each of the real scratch contour lines, and connecting the collinear real scratch contour lines to obtain a complete scratch contour line.

[0018] The straight scratch detection method according to embodiments of the present invention, by determining the target image, eliminating the background image, and reducing the influence of noise, uneven lighting, and other factors in the image on the straight scratch detection, prevents missed detections and improves the accuracy of straight scratch point detection; by judging the curvature of the scratch contour line determined by the scratch point, the interference of curved impurities such as fuzz is eliminated, preventing false detections and improving the accuracy of straight scratch detection; and by connecting the collinear real scratch contours at a certain distance, the completeness and accuracy of extracting straight scratch defects are improved.

[0019] To achieve the above objectives, a second aspect of the present invention provides a straight scratch detection device, the device comprising: a determination module for determining a target image; a calculation module for calculating the second-order partial derivative and line direction of each pixel in the target image; and a detection module for determining scratch points in the target image based on the second-order partial derivative and the line direction.

[0020] To achieve the above objectives, a third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the straight scratch detection method as proposed in the first aspect of the present invention.

[0021] To achieve the above objectives, a fourth aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the straight scratch detection method as proposed in the first aspect of the present invention.

[0022] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0023] Figure 1 This is a flowchart of a straight scratch detection method according to an embodiment of the present invention;

[0024] Figure 2 This is a flowchart illustrating the determination of a target image according to an embodiment of the present invention;

[0025] Figure 3(a) shows the effect of differential processing on the area to be detected before uneven illumination;

[0026] Figure 3(b) shows the result of Figure 3(a) after differential processing;

[0027] Figure 4(a) shows the effect of uneven illumination on the area to be tested with defects;

[0028] Figure 4(b) shows the result of Figure 4(a) after differential processing;

[0029] Figure 5 This is a flowchart illustrating the determination of scratch points in a target image according to an embodiment of the present invention;

[0030] Figure 6 A schematic diagram of a target image with scratch defects is shown;

[0031] Figure 7 It shows Figure 6 Grayscale information of each pixel on the white line;

[0032] Figure 8 This is a flowchart of a straight scratch detection method according to another embodiment of the present invention;

[0033] Figure 9 The diagram shows the detection effect of the straight scratch detection method provided by the embodiment of the present invention;

[0034] Figure 10 This is a schematic diagram of a straight scratch detection device according to an embodiment of the present invention;

[0035] Figure 11 This is a structural block diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0036] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0037] The following describes in detail the straight scratch detection method, apparatus, storage medium, and electronic device of the present invention with reference to the description 1-11 and specific embodiments.

[0038] The straight scratch detection method of this invention can be used to detect whether there are straight scratches on the appearance of a product, such as the product display screen or the product shell.

[0039] Figure 1 This is a flowchart of a straight scratch detection method according to an embodiment of the present invention. Figure 1 As shown, methods for detecting straight scratches may include:

[0040] S1, Determine the target image.

[0041] Specifically, an industrial imaging system can be used to acquire images of the display screen and casing of the product to be inspected, which can then be used as the images to be inspected. To improve the accuracy of straight scratch detection and prevent missed or false detections, image processing is performed on the images to be inspected, and the processed target images are then used for straight scratch detection to improve the accuracy of straight scratch detection.

[0042] In one embodiment of the present invention, such as Figure 2 As shown, determining the target image may include:

[0043] S11, acquire the image to be detected, and determine the region to be detected based on the pre-established contour model;

[0044] S12, scale the area to be detected to obtain the scaled area to be detected;

[0045] S13, perform background construction on the scaled detection area to obtain the detection area after background construction;

[0046] S14, perform differential processing on the region to be detected after background construction to obtain the target image.

[0047] Specifically, the process involves acquiring an image of the product to be inspected (the image to be inspected) from an industrial imaging system. This image includes the appearance of the product. To prevent background images (not representing the product's appearance) from interfering with the detection of straight scratches, a pre-established contour model is used to locate the product's contour in the image to be inspected, thus defining the product appearance region within the image. This product appearance region is then designated as the inspection area. It should be noted that the inspection area excludes the background image and includes only the product's appearance.

[0048] More specifically, the detection area is scaled, and a background is constructed on the scaled area. Scaled detection serves to reduce noise and increase speed. Background construction on the scaled area suppresses noise while preserving contour information and image details. To effectively mitigate the possibility of slight uneven illumination in the constructed area, which could lead to undetected minor scratches, differential processing is performed on the constructed area.

[0049] In order to exclude background images and reduce the influence of noise, uneven lighting and other factors in the image on straight scratch detection, the embodiments of the present invention locate the obtained image to be detected, obtain the area to be detected that does not include the background image and only includes the product appearance image, and then perform scaling, background construction and differential processing on the area to be detected in sequence to obtain the target image for straight scratch detection.

[0050] In this embodiment, constructing a background for the scaled region to be detected may include performing median filtering on the scaled region to be detected.

[0051] Specifically, a median filtering algorithm is used to construct the background of the scaled detection area.

[0052] It's important to note that the median filtering principle involves calculating and arranging the pixel values ​​within a window region, then setting the median value as the anchor pixel value. The median filtering algorithm effectively suppresses noise while preserving contour information and image details.

[0053] In this embodiment, when performing difference processing on the image after background construction, the difference formula that can be used is:

[0054] Gray = (I ori -I med )*Fat+G offset

[0055] Where Gray represents the target image, I ori Indicates the area to be detected, I med This represents the region to be detected after background construction, Fat represents the scaling factor used in the scaling process, and G... offset This represents the differential grayscale offset, which is determined based on the average grayscale value of the area to be detected.

[0056] Specifically, the grayscale value of each pixel in the target image is determined by using the grayscale value of each pixel in the target area constructed from the target area and the background, as well as the scaling factor and differential grayscale offset.

[0057] It should be noted that the scaling factor used in scaling is generally 1.

[0058] As a specific example, Figure 3(a) shows the effect of the area to be detected before differential processing when the illumination is uneven, and Figure 3(b) shows the effect of Figure 3(a) after differential processing. Figure 4(a) shows the effect of the area to be detected with defects when the illumination is uneven, and Figure 4(b) shows the effect of Figure 4(a) after differential processing.

[0059] S2, calculate the second-order partial derivative and line direction of each pixel in the target image;

[0060] Specifically, a mask of Gaussian second-order partial derivatives is constructed, representing x, xy, and yy, respectively. The constructed mask is convolved with each pixel in the target image to obtain the second-order partial derivatives of each pixel in the target image in the x, xy, and yy directions.

[0061] Based on the second-order partial derivatives of each pixel in the target image in the x, xy, and yy directions, construct the corresponding matrix [fxx, fxy, fxy, fyy]. Then, solve for the eigenvalues ​​of the matrix [fxx, fxy, fxy, fyy] and the second-order partial derivatives of each pixel in the target image. The direction of the eigenvector corresponding to the smaller eigenvalue is the line direction of that pixel, and the direction of the eigenvector corresponding to the larger eigenvalue is the normal direction of that pixel.

[0062] After obtaining the second partial derivative and line direction of each pixel in the target image, the scratch points in the target image are determined based on the second partial derivative and line direction of each pixel in the target image.

[0063] S3. Based on the second-order partial derivatives and the line direction, determine the scratch points in the target image.

[0064] In one embodiment of the present invention, such as Figure 5 As shown, determining the scratch points in the target image based on the second-order partial derivatives and line direction can include:

[0065] S31, determine the pixel corresponding to the maximum pixel value within the target defect width range of the second-order partial derivative of the line direction of each pixel in the vertical target image, and mark the pixel as the target pixel.

[0066] S32, for each target pixel, if the second partial derivative of the target pixel is greater than the first threshold, or if the second partial derivative of the target pixel is less than or equal to the first threshold but greater than or equal to the second threshold and the distance from the target pixel to the determined scratch point is less than the preset threshold, then the target pixel is determined to be a scratch point.

[0067] Specifically, the pixel corresponding to the second-order partial derivative perpendicular to the line direction of each pixel is determined, and the pixel value of each pixel within the target defect width range of that pixel is calculated. The pixel corresponding to the maximum pixel value is then identified and marked as the target pixel. The target defect width range is determined based on the width of the defect being searched.

[0068] It should be noted that the second partial derivative perpendicular to the line direction of each pixel is the second partial derivative along the normal line of each pixel.

[0069] If the second partial derivative of a target pixel is greater than the first threshold, the target pixel is recorded as a scratch. If the second partial derivative of a target pixel is less than the second threshold, the target pixel is discarded.

[0070] If the second partial derivative of the target pixel is greater than or equal to the second threshold and less than the first threshold, then it is determined whether the distance from the target pixel to the identified scratch point is less than a preset threshold, such as 5 pixels. If the second partial derivative of the target pixel is greater than or equal to the second threshold, less than the first threshold, and the distance from the target pixel to the identified scratch point is a preset threshold, then the target pixel is also considered a scratch point. Otherwise, the target pixel is discarded.

[0071] Figure 6 A schematic diagram of a target image with scratch defects is shown, wherein, Figure 6 The white line is Figure 6 The straight line along the normal direction of the pixel indicated by the middle arrow. Figure 7 It shows Figure 6 The grayscale information (pixel value) of each pixel on the white line. It should be noted that... Figure 6 The white line is a manually drawn straight line along the approximate normal direction of the defect point. It is used to display the difference in grayscale values ​​between the defect and its surroundings. The corresponding grayscale information is as follows: Figure 7 .

[0072] for Figure 6 The pixel indicated by the middle arrow is used to determine the pixel point ( Figure 6 After determining the pixel value of each pixel within the target defect width range of the pixel (indicated by the middle arrow), the pixel value of the pixel with the maximum pixel value is recorded as the target pixel. Further judgment is made on the target pixel to determine whether the target pixel is a scratch point.

[0073] The straight scratch detection method of this invention determines the target image, identifies the scratch points in the target image based on the second-order partial derivatives and line direction of each pixel, excludes the background image, and reduces the influence of noise, uneven lighting, and other factors on the straight scratch detection, thereby preventing missed detections and improving the accuracy of straight scratch point detection.

[0074] In one embodiment of the present invention, such as Figure 8 As shown, the method for detecting straight scratches may also include:

[0075] S4, Determine the scratch outline based on the scratch points;

[0076] S5, determine the first endpoint and the second endpoint based on the scratch outline, and obtain the coordinates of the first endpoint of the first endpoint and the second endpoint of the second endpoint;

[0077] S6, calculate the outline length of the scratch outline;

[0078] S7. Determine the actual scratch contour line based on the coordinates of the first endpoint, the coordinates of the second endpoint, and the contour length.

[0079] Due to interference from bent impurities such as lint, further determination is needed to ascertain whether the contour line formed by connecting the detected scratch points is a straight scratch contour line. Based on the identified scratch points, a scratch contour line is determined, and its two endpoints are identified and denoted as the first endpoint and the second endpoint, respectively. Simultaneously, the contour length of the scratch contour line is calculated. Based on the coordinates of the two endpoints (the first endpoint coordinates and the second endpoint coordinates) and the contour length, the straightness of the scratch contour line is calculated.

[0080] When calculating the straightness of the scratch contour line based on the coordinates of the two endpoints (the first endpoint coordinates and the second endpoint coordinates) and the contour length, the following expression for straightness can be used:

[0081]

[0082] Where, straightness represents straightness, P1(R1,C1) represents the coordinates of the first endpoint, P2(R2,C2) represents the coordinates of the second endpoint, and Len... xld Indicates the length of the outline.

[0083] The calculated straightness is compared with a preset straightness threshold. If the calculated straightness is greater than the preset straightness threshold, it indicates that the scratch contour is a curved contour such as a fuzzy hair, and the scratch contour is discarded. If the calculated straightness is less than the preset straightness threshold, the scratch contour is recorded as the true scratch contour. Figure 9 The diagram shows the detection effect of the straight scratch detection method provided by the embodiment of the present invention.

[0084] The straight scratch detection method of this invention improves the accuracy of straight scratch detection by judging the curvature of the scratch outline determined by the scratch point, eliminating interference from curved impurities such as fuzz, preventing false detections.

[0085] In one embodiment of the present invention, such as Figure 8 As shown, the method for detecting straight scratches may also include:

[0086] S8 performs collinearity detection on each real scratch contour line and connects the collinear real scratch contour lines to obtain the complete scratch contour line.

[0087] Since scratch defects can consist of short, discontinuous scratches, in order to prevent missing these defects, the actual scratch contours are checked for collinearity and then connected to form a complete straight scratch defect.

[0088] The straight scratch detection method of this invention connects real scratch contours that are collinear and spaced a certain distance apart, thereby improving the completeness and accuracy of extracting straight scratch defects.

[0089] This invention proposes a straight scratch detection device.

[0090] Figure 10 This is a schematic diagram of a straight scratch detection device according to an embodiment of the present invention. Figure 10 As shown, the straight scratch detection device 100 may include a determination module 10, a calculation module 20, and a detection module 30.

[0091] The determination module 10 is used to determine the target image; the calculation module 20 is used to calculate the second-order partial derivative and line direction of each pixel in the target image; and the detection module 30 is used to determine the scratch points in the target image based on the second-order partial derivative and line direction.

[0092] In one embodiment of the present invention, the determining module 10 is used to: acquire an image to be detected and determine a region to be detected based on a pre-established contour model; scale the region to be detected to obtain a scaled region to be detected; construct a background on the scaled region to obtain a region to be detected with a constructed background; and perform differential processing on the region to be detected with a constructed background to obtain a target image.

[0093] In this embodiment, background construction is performed on the scaled detection area, including: median filtering of the scaled detection area.

[0094] In this embodiment, the difference formula used when performing difference processing on the image after background construction is as follows:

[0095] Gray = (I ori -I med )*Fat+G offset

[0096] Where Gray represents the target image, I ori Indicates the area to be detected, I med This represents the region to be detected after background construction, Fat represents the scaling factor used in the scaling process, and G... offset This represents the differential grayscale offset, which is determined based on the average grayscale value of the area to be detected.

[0097] In one embodiment of the present invention, the detection module 30 is used to determine the maximum value of the second partial derivative of all pixels in the line direction of each pixel in the vertical target image within the width range of the target defect, and mark the pixel as a target pixel; for each target pixel, if the second partial derivative of the target pixel is greater than a first threshold, or if the second partial derivative of the target pixel is less than or equal to the first threshold but greater than or equal to a second threshold and the distance from the target pixel to the determined scratch point is less than a preset threshold, then the target pixel is determined to be a scratch point.

[0098] The straight scratch detection device of this invention determines the scratch points in the target image based on the second-order partial derivative and line direction of each pixel in the target image, excludes the background image, and reduces the influence of noise, uneven lighting and other factors in the image on the straight scratch detection, thereby preventing missed detection and improving the accuracy of straight scratch point detection.

[0099] In one embodiment of the present invention, the straight scratch detection device 100 may further include a real detection module. The real detection module is used to determine the scratch contour line based on the scratch points; determine the first endpoint and the second endpoint based on the scratch contour line, and obtain the coordinates of the first endpoint of the first endpoint and the second endpoint of the second endpoint; calculate the contour length of the scratch contour line; and determine the real scratch contour line based on the coordinates of the first endpoint, the coordinates of the second endpoint, and the contour length.

[0100] The real detection module in the straight scratch detection device of this invention improves the accuracy of straight scratch detection by judging the curvature of the scratch contour line determined by the scratch point and eliminating the interference of curved impurities such as fuzz.

[0101] In one embodiment of the present invention, the straight scratch detection device 100 may further include a complete detection module. The complete detection module is used to perform collinearity detection on each real scratch contour line and connect the collinear real scratch contour lines to obtain a complete scratch contour line.

[0102] The complete detection module in the straight scratch detection device of this invention connects the actual scratch contours that are collinear and spaced a certain distance apart, thereby improving the completeness and accuracy of extracting straight scratch defects.

[0103] This invention proposes a computer-readable storage medium.

[0104] In this embodiment, a computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, it implements the straight scratch detection method described above.

[0105] This invention proposes an electronic device.

[0106] In this embodiment, the electronic device may include a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, it implements the straight scratch detection method described above.

[0107] Figure 11 This is a structural block diagram of an electronic device according to an embodiment of the present invention.

[0108] like Figure 11As shown, the electronic device 500 includes a processor 501 and a memory 503. The processor 501 and the memory 503 are connected, for example, via a bus 502. Optionally, the electronic device 500 may also include a transceiver 504. It should be noted that in practical applications, the transceiver 504 is not limited to one type, and the structure of this electronic device 500 does not constitute a limitation on the embodiments of the present invention.

[0109] Processor 501 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this invention. Processor 501 may also be a combination that implements computational functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0110] Bus 502 may include a pathway for transmitting information between the aforementioned components. Bus 502 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 502 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0111] The memory 503 stores a computer program corresponding to the straight scratch detection method of the above embodiments of the present invention. This computer program is controlled and executed by the processor 501. The processor 501 executes the computer program stored in the memory 503 to implement the content shown in the foregoing method embodiments.

[0112] Among them, electronic devices 500 include, but are not limited to: mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 11The electronic device 500 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0113] The computer-readable storage medium and electronic device of this invention utilize the above-described straight scratch detection method to detect the surface of a product, determine whether there are scratches on the product surface, effectively exclude background images, and reduce the influence of factors such as noise and uneven lighting in the image on the straight scratch detection, thereby improving the accuracy and completeness of straight scratch defect detection.

[0114] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0115] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0116] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0117] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this invention and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0118] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0119] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0120] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "over," and "on top" of the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.

[0121] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A straight scratch detection method characterized by, The method comprises: determining a target image; calculating the second-order partial derivative and line direction of each pixel point in the target image; determining a scratch point in the target image according to the second-order partial derivative and the line direction, wherein the determination of the scratch point in the target image according to the second-order partial derivative and the line direction comprises: determining a pixel point corresponding to the maximum pixel value in the target defect width range of the second-order partial derivative perpendicular to the line direction of each pixel point in the target image, and marking the pixel point as a target pixel point; for each target pixel point, if the second-order partial derivative of the target pixel point is greater than a first threshold, or the second-order partial derivative of the target pixel point is less than or equal to the first threshold, greater than or equal to a second threshold, and the distance from the target pixel point to the determined scratch point is less than a preset threshold, then the target pixel point is determined as a scratch point.

2. The straight scribe damage detection method of claim 1, wherein The determination of the target image comprises: obtaining a to-be-detected image, and determining a to-be-detected region according to a pre-established contour model; scaling the to-be-detected region to obtain a scaled to-be-detected region; constructing a background for the scaled to-be-detected region to obtain a background-constructed to-be-detected region; performing difference processing on the background-constructed to-be-detected region to obtain the target image.

3. The straight scribe damage detection method of claim 2, wherein The background construction for the scaled to-be-detected region comprises: performing median filtering processing on the scaled to-be-detected region.

4. The straight scribe damage detection method of claim 2, wherein The difference formula used when performing difference processing on the background-constructed image is: wherein, represents the target image, represents the region to be detected, represents the region to be detected after the background construction, represents a scaling factor used in the scaling process, represents a differential gray scale offset determined according to the average gray scale value of the region to be detected.

5. The straight scribe damage detection method of claim 1, wherein The method further comprises: determining a scratch contour line according to the scratch point; determining a first end point and a second end point according to the scratch contour line, and obtaining a first end point coordinate of the first end point and a second end point coordinate of the second end point; calculating the contour length of the scratch contour line; determining a real scratch contour line according to the first end point coordinate, the second end point coordinate, and the contour length.

6. The straight scribe damage detection method of claim 5, wherein The method further comprises: performing collinearity detection on each real scratch contour line, and connecting the collinear real scratch contour lines to obtain a complete scratch contour line.

7. A straight scratch detection device characterized by comprising: The device comprises: a determination module for determining a target image; a calculation module for calculating the second-order partial derivative and line direction of each pixel point in the target image; a detection module for determining a scratch point in the target image according to the second-order partial derivative and the line direction; the detection module is configured to determine a pixel point corresponding to the maximum pixel value in the target defect width range of the second-order partial derivative perpendicular to the line direction of each pixel point in the target image, and mark the pixel point as a target pixel point; for each target pixel point, if the second-order partial derivative of the target pixel point is greater than a first threshold, or the second-order partial derivative of the target pixel point is less than or equal to the first threshold, greater than or equal to a second threshold, and the distance from the target pixel point to the determined scratch point is less than a preset threshold, then the target pixel point is determined as a scratch point.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the straight scratch detection method of any one of claims 1-6.

9. An electronic device comprising a memory, a processor, the memory having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the straight scratch detection method of any one of claims 1-6.

Citation Information

Patent Citations

  • Defect detection method and device

    CN112767400A

  • Automatic machine of vision on detection device for workpiece with complex curved surface

    EP4016058A1