Image processing method and device, computer-readable storage medium, and electronic device

By acquiring mark points to determine the area to be detected and performing boundary sharpening processing, combining high-angle dark field light and image recognition model, the problem of low accuracy in crack defect detection in the prior art is solved, and efficient and high-precision crack detection is achieved.

CN114897847BActive Publication Date: 2025-08-15BOE TECHNOLOGY GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210553271.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2025-08-15
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

In the prior art, the detection accuracy of crack defects in the circuit is low, especially the microcracks are difficult to detect in the early stage, and the electrical method is low and the visual detection is difficult.

Method used

By acquiring marking points in the original line image, determining the first area to be detected, and performing boundary sharpening processing, generating a target detection image, using an image recognition model to identify crack defects, using high-angle dark field light and large target surface industrial cameras for image acquisition, combining industrial telecentric lenses and light source incident angle optimization, and using models such as edge detection and convolutional neural networks for identification.

Benefits of technology

It improves the detection accuracy and efficiency of crack defects, reduces background complexity, enhances defect characteristics, reduces interference, and achieves high-precision crack detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114897847B_ABST
    Figure CN114897847B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image processing method and apparatus, a computer-readable storage medium, and an electronic device, and relates to the field of image processing technology. The method comprises: obtaining marker points in an original line image and determining a first region to be detected in the original line image based on the marker points; performing boundary sharpening on the first region to be detected to determine a second region to be detected; and generating a target detection image based on the first and second regions to be detected; and performing image recognition on the target detection image to obtain crack defects included in the original line image. This method improves the accuracy of detected crack defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of image processing technology, and in particular, to an image processing method, an image processing device, a non-transitory computer-readable storage medium, and an electronic device. Background Art

[0002] In the existing method of detecting crack defects in circuits, it can be achieved by electrically measuring the continuity of metal.

[0003] However, since microcracks will not cause short circuits in the early stages, the accuracy of the detected crack defects is low.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in this field. Summary of the Invention

[0005] The purpose of the present disclosure is to provide an image processing method, an image processing device, a non-volatile computer-readable storage medium, and an electronic device, thereby overcoming, at least to some extent, the problem of low accuracy of detected crack defects caused by the limitations and defects of related technologies.

[0006] According to one aspect of the present disclosure, there is provided an image processing method, comprising:

[0007] Acquire a marking point in the original line image, and determine a first area to be detected in the original line image according to the marking point;

[0008] performing boundary sharpening on the first area to be detected to determine a second area to be detected, and generating a target detection image based on the first area to be detected and the second area to be detected;

[0009] Image recognition is performed on the target detection image to obtain crack defects included in the original line image.

[0010] In an exemplary embodiment of the present disclosure, obtaining a marker point in an original route image includes:

[0011] Acquire an original line image, and perform grayscale processing on the original line image to obtain a grayscale line image;

[0012] The grayscale line image is binarized to obtain a binarized line image, and the binarized line image is screened according to the attribute characteristics of the marking points to obtain the marking points.

[0013] In an exemplary embodiment of the present disclosure, binarization is performed on the grayscale line image to obtain a binarized line image, including:

[0014] Obtaining a current brightness value of each pixel included in the grayscale line image, and determining whether the current brightness value is greater than a first preset threshold;

[0015] If the current brightness value is greater than the first preset threshold, replacing the current brightness value of the pixel with the first preset brightness value;

[0016] If the current brightness value is less than the first preset threshold, replacing the current brightness value of the pixel with the second preset brightness value;

[0017] The binary line image is generated according to each pixel point after the current brightness value is replaced.

[0018] In an exemplary embodiment of the present disclosure, the image processing method further includes:

[0019] The original circuit image is collected from the surface of the metal circuit to be inspected by a preset image acquisition device; wherein the image acquisition device is composed of a large-target industrial camera and an industrial telecentric lens.

[0020] In an exemplary embodiment of the present disclosure, the original circuit image is collected from the surface of the metal circuit to be inspected by a preset image acquisition device, including:

[0021] The incident angle of the light source between the industrial telecentric lens and the metal circuit surface to be inspected is configured, and based on the incident angle, the large-target industrial camera is controlled to collect the original circuit image from the metal circuit surface to be inspected through the industrial telecentric lens.

[0022] In an exemplary embodiment of the present disclosure, the light source is composed of one or more of a ring light source, one or more point light sources, and one or more strip light sources; and the incident angle is between 60° and 85°.

[0023] In an exemplary embodiment of the present disclosure, determining the first area to be detected of the original route image according to the marking point includes:

[0024] Calculating the center point position of the marking point according to the starting coordinate position of the marking point in the original route image and the size feature in the attribute feature of the marking point;

[0025] determining a size of a first area to be inspected according to a proportion of metal lines included in the original line image in the original line image;

[0026] The first area to be detected is selected from the original line image according to the position of the center point and the size of the first area to be detected.

[0027] In an exemplary embodiment of the present disclosure, performing boundary sharpening on the first area to be detected to determine a second area to be detected includes:

[0028] Performing expansion and corrosion processing on the first area to be inspected to obtain an intermediate inspection area;

[0029] The middle detection area is subjected to corrosion expansion processing to obtain the second area to be detected.

[0030] In an exemplary embodiment of the present disclosure, the first area to be inspected is subjected to expansion and corrosion processing to obtain an intermediate inspection area, including:

[0031] Extracting a first pixel to be processed from the first area to be detected and deleting the first pixel to be processed; wherein the pixel size of the first pixel to be processed does not exceed a first preset pixel value, and the current brightness value of the first pixel to be processed is greater than a first preset threshold;

[0032] The boundary lines of the metal circuits included in the first area to be inspected are smoothed, and the adhesion between two adjacent metal circuits is disconnected to obtain the middle inspection area.

[0033] In an exemplary embodiment of the present disclosure, performing corrosion expansion processing on the middle detection area to obtain the second area to be detected includes:

[0034] Extracting a second pixel to be processed from the middle detection area and filling the second pixel to be processed; wherein the pixel size of the second pixel to be processed does not exceed the first preset pixel value, and the current brightness value of the second pixel to be processed is less than the first preset threshold;

[0035] The disconnected portion of the metal circuit included in the middle detection area is filled, and the boundary line of the metal circuit is smoothed twice without changing the area of the metal circuit, so as to obtain the second area to be detected.

[0036] In an exemplary embodiment of the present disclosure, generating a target detection image according to the first area to be detected and the second area to be detected includes:

[0037] performing a difference operation on a first grayscale value of each pixel included in the first area to be detected and a second grayscale value of each pixel included in the second area to be detected to obtain a third grayscale value, and determining whether the third grayscale value meets a preset condition;

[0038] If the third grayscale value meets the preset condition, the third grayscale value is used as the target grayscale value of the pixel;

[0039] If the third grayscale value does not meet the preset condition, the third grayscale value is replaced, and the replaced third grayscale value is used as the target grayscale value of the pixel;

[0040] The target detection image is generated according to the target grayscale value of each pixel.

[0041] In an exemplary embodiment of the present disclosure, performing image recognition on the target detection image to obtain the crack defect included in the original line image includes:

[0042] Performing image recognition on the target detection image using a preset image recognition model to obtain crack defects included in the original line image;

[0043] Among them, the image recognition model includes one or more of an edge detection model, a convolutional neural network model, a recurrent neural network model and a deep neural network model.

[0044] According to one aspect of the present disclosure, there is provided an image processing apparatus, comprising:

[0045] a first to-be-detected area determination module, configured to obtain marking points in an original line image and determine a first to-be-detected area of the original line image according to the marking points;

[0046] a target detection image generation module, configured to perform boundary sharpening on the first area to be detected to determine a second area to be detected, and generate a target detection image based on the first area to be detected and the second area to be detected;

[0047] An image recognition module is used to perform image recognition on the target detection image to obtain crack defects included in the original line image.

[0048] According to one aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the image processing method described above is implemented.

[0049] According to one aspect of the present disclosure, there is provided an electronic device, including:

[0050] processor; and

[0051] a memory for storing executable instructions of the processor;

[0052] The processor is configured to perform any one of the above-mentioned image processing methods by executing the executable instructions.

[0053] An image processing method provided by an embodiment of the present disclosure obtains marking points in an original line image and determines a first area to be detected of the original line image based on the marking points; then, the boundaries of the first area to be detected are sharpened to determine a second area to be detected, and a target detection image is generated based on the first area to be detected and the second area to be detected; finally, image recognition is performed on the target detection image to obtain crack defects included in the original line image; since crack defects can be detected directly by image processing without the need for electrical detection, the problem of low accuracy of detected crack defects in the prior art, which is achieved by measuring metal continuity, is solved; on the other hand, since the corresponding crack defects can be obtained by performing image recognition on the target detection image obtained after preprocessing the original line image, the accuracy of the detected crack defects is greatly improved, and the detection efficiency of crack defects is also improved.

[0054] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0056] Figure 1 The following schematically shows a flowchart of an image processing method according to an exemplary embodiment of the present disclosure.

[0057] Figure 2 A schematic diagram of an optical path used for capturing an original line image according to an exemplary embodiment of the present disclosure is schematically shown.

[0058] Figure 3 Schematically illustrates a method based on an exemplary embodiment of the present disclosure. Figure 3 An example of the original line image captured by the optical path schematic shown.

[0059] Figure 4 An example diagram schematically shows a line image acquired by other methods.

[0060] Figure 5 An example diagram schematically illustrates a comparison between different lighting angles and grayscale value differences according to an example embodiment of the present disclosure.

[0061] Figure 6 An exemplary diagram of a first area to be detected according to an exemplary embodiment of the present disclosure is schematically shown.

[0062] Figure 7 An exemplary diagram schematically illustrates a metal line before edge sharpening according to an exemplary embodiment of the present disclosure.

[0063] Figure 8 An example diagram schematically illustrates a metal circuit after edge sharpening processing according to an example embodiment of the present disclosure.

[0064] Figure 9 An example diagram of a target detection image (preprocessing result image) according to an example embodiment of the present disclosure is schematically shown.

[0065] Figure 10 An exemplary diagram schematically illustrates a method for detecting crack defects according to an exemplary embodiment of the present disclosure.

[0066] Figure 11 A block diagram schematically illustrates an image processing apparatus according to an exemplary embodiment of the present disclosure.

[0067] Figure 12 An electronic device for implementing the above-mentioned image processing method according to an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0068] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or that other methods, components, devices, steps, etc. may be employed. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0069] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0070] The metal traces in electronic products transmit signals; examples include the source / drain connections of display panels, FPC gold fingers, and IC package metal wires. During the use of electronic products, cracks in these traces can pose a significant risk of short circuits, impacting product functionality and usability. Therefore, detecting cracks in these traces is a pressing issue.

[0071] In order to solve the above problems, some crack defect detection methods can be implemented in the following ways: one is to measure the continuity of the metal circuit by electrical means; if the metal circuit is in a flowing state, it is determined that the metal circuit does not have a crack defect; if the metal circuit is in a disconnected state, it is determined that the metal circuit has a crack defect; the other is to perform visual inspection manually.

[0072] However, the above methods all have the following defects: on the one hand, the method of measuring metal continuity by electrical means is inefficient and unreliable (micro cracks will not directly cause short circuits in the early stage, but are likely to develop into larger cracks in the later stage); on the other hand, the method of using visual inspection is more difficult, which is specifically reflected in: First, the crack defect size is small, the above-mentioned metal wire size is usually at the micron level, and the crack width is below microns, making it difficult to collect pictures that meet the inspection standards; second, the environmental background is complex and the metal routing is complex, making visual processing more difficult.

[0073] Based on this, this exemplary embodiment first provides an image processing method, which can be run on a terminal device, a server, a server cluster or a cloud server, etc. Of course, those skilled in the art can also run the method disclosed in this disclosure on other platforms as needed, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the image processing method may include the following steps:

[0074] Step S110: Obtaining marking points in the original line image, and determining a first area to be detected in the original line image according to the marking points;

[0075] Step S120: sharpen the boundaries of the first area to be detected to determine a second area to be detected, and generate a target detection image based on the first area to be detected and the second area to be detected;

[0076] Step S130: Perform image recognition on the target detection image to obtain crack defects included in the original line image.

[0077] In the above-mentioned image processing method, on the one hand, by obtaining the marking points in the original line image, and determining the first area to be detected of the original line image based on the marking points; then the boundaries of the first area to be detected are sharpened to determine the second area to be detected, and a target detection image is generated based on the first area to be detected and the second area to be detected; finally, image recognition is performed on the target detection image to obtain the crack defects included in the original line image; since the crack defects can be detected directly by image processing without the need for electrical detection, the problem of low accuracy of the detected crack defects in the prior art by measuring metal continuity is solved; on the other hand, since the corresponding crack defects can be obtained by performing image recognition on the target detection image obtained after preprocessing the original line image, the accuracy of the detected crack defects is greatly improved, and the detection efficiency of the crack defects is also improved.

[0078] Hereinafter, the image processing method according to an exemplary embodiment of the present disclosure will be explained and illustrated in detail with reference to the accompanying drawings.

[0079] First, the purpose of the present invention is explained and illustrated. Specifically, to solve the problem of crack detection in metal circuits of LCDs (Liquid Crystal Displays), OLEDs (Organic Light-Emitting Diodes), ICs (Integrated Circuits), PCBs (Printed Circuit Boards), and the like, the present invention proposes a method for acquiring a raw circuit image under high-angle dark field lighting, preprocessing the raw circuit image, and finally performing image recognition on the preprocessed raw circuit image to obtain crack defects. Furthermore, because the raw circuit image is acquired under high-angle dark field lighting, the crack features of the metal circuit can be clearly captured, while enhancing the defect features while weakening the background (enhancing the grayscale difference between the defect and the normal background by more than 50%), thereby reducing interference. Furthermore, by preprocessing the raw circuit image (screening the metal circuit and shielding the background area), the lower edge features of the metal circuit can be weakened, reducing background complexity, thereby improving detection accuracy and efficiency.

[0080] Next, the optical path diagram used to collect the original line image involved in the exemplary embodiment of the present disclosure is explained and illustrated. Figure 2 As shown, the optical path schematic diagram may include an image acquisition device 210 and a metal circuit 220 to be inspected; wherein, the image acquisition device may include a large-target industrial camera 211 and an industrial telecentric lens 212, a light source 230 is arranged between the metal circuit to be inspected and the industrial telecentric lens, and the incident angle of the light source between the industrial telecentric lens and the surface of the metal circuit to be inspected; there is a crack defect 221 on the surface of the metal circuit.

[0081] It should be noted that the exemplary embodiment of the present disclosure uses a high-angle (specifically, the incident angle of the light source between the industrial telecentric lens and the surface of the metal circuit to be detected is high) dark field light solution for image processing, and is used with a large-target industrial camera and an industrial telecentric lens for image acquisition. At the same time, since the surface of the metal circuit is a glossy surface, when high-angle light hits the metal circuit, total reflection occurs, and no reflected light is captured by the camera. When there is a crack on the metal circuit, the light hits the crack and is diffusely reflected, so that the reflected light is captured by the camera, thereby capturing the crack characteristics. The original circuit image collected can be referenced. Figure 3 shown; based on Figure 3 The original circuit diagram shown shows that compared with the images collected by other schemes (for details, please refer to Figure 4 As shown in FIG, the crack characteristics presented by the original circuit diagram collected using the optical path schematic diagram recorded in the exemplary embodiment of the present disclosure are more obvious, and the grayscale value difference can reach more than 50, while the grayscale value difference of the image defects collected by other optical schemes is only 20 to 30.

[0082] Furthermore, the light source used in the exemplary embodiments of the present disclosure can be used alone or in combination with a ring light source, one to several point light sources, or one to several strip light sources according to the specific circuit conditions; generally, a ring light source can be preferred; wherein, the difference between different lighting angles and grayscale values can be specifically compared. Figure 5 As shown. Figure 5 From the comparison between the incident angle and the grayscale value, it can be seen that the lighting angle is preferably between 60° and 85°; of course, more preferably, it can be set between 75° and 80°.

[0083] The following, combined Figure 2-Figure 5 right Figure 1 The image processing method shown in is explained and illustrated in detail.

[0084] In step S110 , marking points in the original road image are acquired, and a first area to be detected in the original road image is determined according to the marking points.

[0085] In this example embodiment, first, the marking points (Mark points) in the original circuit image are obtained; wherein, the Mark points are the position identification points of the PCB applied to the automatic placement machine in the circuit board design, and the preferred shapes of the Mark points may include circular, T-shaped or cross-shaped, and the color is obviously different from the surrounding background color; at the same time, in order to ensure the recognition effect of the printing equipment and the placement equipment, the empty area of the Mark points should be free of other traces, silk screens or pads, etc.; each surface of the PCB board has at least one pair of Mark points located in the diagonal direction of the PCB board, with the relative distance as far as possible and asymmetric about the center. Further, the acquisition of the marking points can be achieved in the following way: first, the original circuit image is obtained, and the original circuit image is gray-scaled to obtain a gray-scale circuit image; second, the gray-scale circuit image is binarized to obtain a binary circuit image, and the binary circuit image is screened according to the attribute characteristics of the marking points to obtain the marking points.

[0086] Specifically, in actual application, it is first necessary to collect the original circuit image from the surface of the metal circuit to be detected through a preset image acquisition device; wherein, the image acquisition device is composed of a large-target industrial camera and an industrial telecentric lens; wherein, in the process of controlling the image acquisition device to collect the original circuit image, first, it is necessary to configure the incident angle of the light source between the industrial telecentric lens and the metal circuit surface to be detected; then, based on the incident angle, the large-target industrial camera is controlled to collect the original circuit image from the surface of the metal circuit to be detected through the industrial telecentric lens. wherein, the light source used in the image acquisition process can be realized individually by a ring light source, one or more point light sources, and one or more strip light sources, or can be realized in combination, and this example does not impose any special restrictions on this; at the same time, in order to ensure the effect of the collected original circuit image, the incident angle of the light source needs to be between 60° and 85°. It should be noted here that in the process of capturing the original line image, high-angle dark field light can be used for capture; where high angle refers to the high angle of incidence of the light source, and dark field indicates whether it is total reflection; and since the surface of the metal line is a glossy surface, when high-angle light hits the metal line, total reflection occurs, and thus no reflected light is captured by the camera (that is, when there is no crack defect, total reflection occurs and the corresponding original line image cannot be captured); and when there is a crack on the metal line, the light hits the crack and is diffusely reflected, so that the reflected light is captured by the camera, thereby capturing the crack characteristics and obtaining the above-mentioned original line image.

[0087] Secondly, after obtaining the original line image, the original line image can be subjected to Gaussian filtering to eliminate the noise included in the original line image. The specific Gaussian filtering process can be shown in the following formula (1) and formula (2):

[0088]

[0089]

[0090] Among them, w is the Gaussian filter kernel, the kernel size is 70*70, △i and △j are the absolute values of the horizontal and vertical coordinate offsets from the position (i, j) in the filter kernel to the center of the kernel, σ 2 Indicates the variance of the Gaussian filter, and the specific value can be 1.5; further, the large-scale Gaussian filter kernel is subjected to matrix convolution operation with the original line image photo The noise in the original line image can be eliminated. It should be noted that the size of the Gaussian filter kernel and the variance of the Gaussian filter can also take other values. Those skilled in the art can choose them according to actual needs. This example does not impose any special restrictions on this. It should be noted that the noise points involved here generally refer to points with a size of less than 3*3 pixels. Of course, they can also be points of other pixel sizes. This example does not impose any special restrictions on this.

[0091] Furthermore, after noise removal is completed, the original circuit image after noise removal can be grayscale processed to obtain a grayscale circuit image. In the obtained grayscale circuit image, the current brightness value of each pixel can be divided into any value between 0 and 255 according to the brightness intensity of each pixel. Then, the grayscale circuit image is binarized to obtain a binary circuit image. It should be noted here that since the mark point, like the metal circuit, has a lower grayscale value than other gray metal areas in a dark field light environment, this grayscale value difference can facilitate the capture of the mark point, thereby improving the accuracy of the captured mark point while improving the efficiency of the mark point capture.

[0092] In the process of binarizing a grayscale line image to obtain a binary line image, the following method can be used: first, obtain the current brightness value of each pixel included in the grayscale line image, and determine whether the current brightness value is greater than a first preset threshold; second, if the current brightness value is greater than the first preset threshold, replace the current brightness value of the pixel with the first preset brightness value; if the current brightness value is less than the first preset threshold, replace the current brightness value of the pixel with the second preset brightness value; finally, generate the binary line image based on each pixel after the current brightness value is replaced. Specifically, the first preset threshold can be set to 1, or other values, and this example does not impose any special restrictions on this; then, determine whether the current brightness value of each pixel is greater than the first preset threshold 1. If so, replace the current brightness value of the pixel with the first preset brightness value; if not, replace the current brightness value of the pixel with the second preset brightness value; wherein, in the process of setting the first preset brightness value and the second preset brightness value, they can be set according to actual needs, and this example does not impose any special restrictions on this.

[0093] It should be noted here that the purpose of binarizing the original line image after noise removal is to increase the contrast between the brightness values of each pixel, making the bright parts brighter and the dark parts darker, thereby facilitating the extraction of the center point; therefore, the selection rules of the first preset brightness value and the second preset brightness value can be selected according to the rule of "making the bright parts brighter and the dark parts darker"; for example, the first preset brightness value can be 255, and the second preset brightness value can be 0; or other values that can meet the above rules, and this example does not impose any special restrictions on this.

[0094] Furthermore, after obtaining the binary line image, the binary line image can be filtered according to the attribute characteristics of the mark points to obtain the mark points; wherein the attribute characteristics of the mark points refer to the morphological characteristics of the mark points, and the morphological characteristics of the mark points may include the size of the mark points (such as length and width) and the aspect ratio, etc.; then, the binary line image is filtered based on the morphological characteristics to obtain the mark points.

[0095] At this point, the Mark points have been extracted from the original line image; next, the first area to be inspected in the original line image needs to be determined based on the Mark points. Specifically, this can be achieved as follows: first, the center point position of the Mark point is calculated based on the starting coordinate position of the Mark point in the original line image and the size characteristics of the Mark point's attribute characteristics; second, the size of the first area to be inspected is determined based on the proportion of metal lines included in the original line image; then, based on the center point position and the size of the first area to be inspected, the first area to be inspected is selected from the original line image.

[0096] Specifically, the first detection area can be considered as ROI (Region Of Interest). In the process of selecting the first detection area, first, the center point position of the Mark point needs to be calculated; wherein, the center point position of the Mark point can be calculated in the following way: first, determine the starting coordinate position of the Mark point in the original line image (for example, the starting coordinate point position of the upper left corner) and the length value and width value; then, based on the starting coordinate position and the length value and width value, the center point position (x1, y1) can be obtained; further, it is necessary to set the size (width, height) of the ROI according to the size of the area occupied by the metal line in the original line image; finally, the center point position (x1, y1) of the Mark point is used as the reference point, and the size (width, height) of the ROI is used to cut out the ROI area image on the original image to generate the ROI image, which is the first detection area; wherein, the obtained first detection area can be specifically referred to Figure 6 shown.

[0097] In step S120 , the boundary of the first area to be detected is sharpened to determine a second area to be detected, and a target detection image is generated based on the first area to be detected and the second area to be detected.

[0098] In this exemplary embodiment, the first region to be inspected is first subjected to boundary sharpening to determine the second region to be inspected. The boundary sharpening referred to herein refers to sharpening the boundaries of the metal traces within the first region to be inspected. Specifically, the boundary sharpening process can be implemented as follows: first, dilation and etching are performed on the first region to be inspected to obtain an intermediate inspection region; second, dilation and etching are performed on the intermediate inspection region to obtain the second region to be inspected.

[0099] In an exemplary embodiment, the first area to be detected is subjected to expansion and corrosion processing to obtain an intermediate detection area, which can be achieved as follows: first, extracting a first pixel to be processed from the first area to be detected and deleting the first pixel to be processed; wherein the pixel size of the first pixel to be processed does not exceed a first preset pixel value, and the current brightness value of the first pixel to be processed is greater than a first preset threshold value; second, smoothing the boundary line of the metal circuit included in the first area to be detected, and disconnecting the adhesion between two adjacent metal circuits to obtain the intermediate detection area. That is, in a specific application process, first, binarizing the ROI map of the first area to be detected based on a second preset threshold value and then performing expansion and corrosion processing to eliminate small bright spots in the metal circuit area (the first pixel to be processed whose pixel size does not exceed the first preset pixel value and whose current brightness value is greater than the first preset threshold value); at the same time, smoothing the boundary of the metal circuit and disconnecting the adhesion between adjacent metal circuits to obtain an intermediate detection area.

[0100] In one embodiment, the middle detection area is subjected to corrosion expansion processing to obtain the second area to be detected, which can be achieved as follows: first, the second pixel to be processed is extracted from the middle detection area, and the second pixel to be processed is filled; wherein the pixel size of the second pixel to be processed does not exceed the first preset pixel value, and the current brightness value of the second pixel to be processed is less than the first preset threshold value; secondly, the disconnected portion of the metal circuit included in the middle detection area is filled, and the boundary line of the metal circuit is smoothed twice without changing the area of the metal circuit to obtain the second area to be detected. That is, the small dark spots (the second pixel to be processed whose current brightness value is less than the first preset threshold value and whose pixel size does not exceed the first preset pixel value) and the disconnected contour lines in the metal circuit included in the middle detection area can be filled, and the boundary of the metal circuit can be smoothed again without changing the area of the gold wire.

[0101] It should be noted here that the expansion and corrosion processing of a picture and the corrosion and expansion processing of an image are completely different operations; usually, in order to preserve the image features as much as possible, the expansion and corrosion operations are performed in pairs; in the scheme described in this example embodiment, the purpose of expansion first and then corrosion is to eliminate the smaller bright spots in the metal circuit area, smooth the boundaries of the metal circuit, and disconnect the adhesion between adjacent metal circuits; further, the purpose of corrosion first and then expansion is to fill the smaller dark spots and disconnected contour lines in the metal circuit, and smooth the boundaries of the metal circuit again without changing the area of the metal circuit. Of course, due to different operation purposes and interference to be eliminated, the parameter selection for expansion corrosion and corrosion expansion will be different. The specific selection value will select the optimal value according to the characteristics of the picture, and this city does not impose special restrictions on this. In addition, when there is a large noise point in the image after binarization that destroys the gold wire boundary, the gold wire boundary can be restored through one or more sharpening processes, wherein the metal circuit before the boundary sharpening process can refer to Figure 7 As shown, the metal circuit after edge sharpening can refer to Figure 8 shown.

[0102] At this point, the boundary sharpening process of the metal circuit included in the first area to be detected is completely completed. Furthermore, after the boundary sharpening is completed, it is necessary to generate a target detection image. Among them, generating a target detection image based on the first area to be detected and the second area to be detected can be achieved in the following way: first, performing a difference operation on the first grayscale value of each pixel included in the first area to be detected and the second grayscale value of each pixel included in the second area to be detected to obtain a third grayscale value, and judging whether the third grayscale value meets the preset conditions; secondly, if the third grayscale value meets the preset conditions, the third grayscale value is used as the target grayscale value of the pixel; if the third grayscale value does not meet the preset conditions, the third grayscale value is replaced, and the replaced third grayscale value is used as the target grayscale value of the pixel; finally, the target detection image is generated according to the target grayscale value of each pixel.

[0103] Specifically, in the process of generating the target detection image, the ROI map (the first area to be detected) and the above-mentioned boundary sharpening map (the second area to be detected) can be subtracted to obtain the target detection image, which can also be called the preprocessing result map; wherein, since the metal line area of the boundary sharpening map (the second area to be detected) is completely black, and the non-metal line area is completely white; therefore, after the subtraction, the area map of the metal line will be completely preserved, and the area map of the non-metal line will be completely black, and then the result map after the subtraction is binarized, and the boundary is found to obtain the following Figure 9 The preprocessing result diagram (i.e., target detection image) shown in FIG; wherein, from Figure 9As can be seen in the preprocessing result diagram shown, the gold line edge has been completely eliminated and the image background complexity has also been reduced. Subsequently, the crack can be screened out with a simple target recognition algorithm. It should be noted here that in the process of performing image subtraction operations on the first area to be detected and the second area to be detected, the specific implementation method is: subtract the grayscale values of the pixels corresponding to the two images with consistent rows and columns one by one; if the result of the subtraction of a certain pixel is less than 0, then the pixel value of the point is set to 0; since the boundary sharpening area is a binary image, the grayscale value of the gold line area is 0, and the grayscale value of the non-gold line area is 255. After being subtracted by the ROI image, the gold line area data in the result image is completely preserved, and the pixels in the non-gold line area are 0. This can eliminate the interference between lines and thus achieve the purpose of improving the accuracy of the target detection image obtained.

[0104] In step S130, image recognition is performed on the target detection image to obtain crack defects included in the original line image.

[0105] Specifically, the target detection image can be subjected to image recognition by a preset image recognition model to obtain the crack defects included in the original line image; wherein the image recognition model includes an edge detection model, a convolutional neural network model, a recurrent neural network model, a deep neural network model, etc. It should be noted that Figure 9 As can be seen from the preprocessing result diagram shown, the gold wire edge has been completely eliminated and the image background complexity has also been reduced. Subsequently, a simple target recognition algorithm can be used to identify / screen out cracks. In the process of crack identification / screening, taking traditional algorithm target recognition as an example, since the defect target is mainly cracks, which are linear defects, edge detection operators can be used for target recognition. Commonly used edge detection operators include Robe operator, Sobel operator, Laplace operator, Canny operator, etc. Further, one of the operators is selected and the appropriate parameters are adjusted to identify the cracks (which may also introduce some interference). Then, a secondary screening is performed through morphology (mainly length, aspect ratio, straight line angle, etc.), thereby more accurately capturing the target defects.

[0106] It should be further explained here that in order to further improve the detection results of crack defects, this application introduces convolutional neural network models, recurrent neural network models and deep neural network models to identify crack defects. At the same time, since the images input into the convolutional neural network model, the recurrent neural network model and the deep neural network model are images after preprocessing; therefore, in the specific recognition process, no other processing is required, and the target detection image is directly input into the convolutional neural network model or the recurrent neural network model or the deep neural network model, and the output result obtained is the corresponding crack defect detection result. Of course, since crack defect detection is different from other types of image recognition, the training data set and test data set used in the process of pre-training the above models are also images related to crack defects.

[0107] The following, combined Figure 10 The crack defect detection method involved in the exemplary embodiment of the present disclosure is further explained and illustrated. Specifically, refer to Figure 10 As shown, the following steps may be included:

[0108] Step S1001: Capture the original circuit image. Specifically, this can be accomplished by using a large-area industrial camera and an industrial telecentric lens. Since the metal circuit surface is smooth, total reflection occurs when high-angle light strikes the metal circuit, resulting in no reflected light being captured by the camera. However, when there is a crack on the metal circuit, light strikes the crack and is diffusely reflected, resulting in reflected light being captured by the camera, thereby capturing the crack's characteristics.

[0109] Step S1002: Mark point identification. Specifically, metal cross or T-shaped marks are usually pre-set in the circuit area for easy detection. Also, like metal lines, the grayscale value of the mark point is lower than that of other gray metal areas in a dark field light environment. The mark point can be captured by using this grayscale value difference. For example, after Gaussian filtering to remove noise from the original image, the image can be binarized with a set threshold of 1. Then, the binarized image is filtered according to morphological characteristics (mark point size, aspect ratio, etc.).

[0110] Step S1003, ROI selection; specifically, the size of the ROI can be set to (width, height) according to the size of the area where the metal circuit is located, and then based on the center point of the Mark (x1, y1) as the reference point, the ROI area image is intercepted on the original image to generate the ROI image;

[0111] Step S1004: edge sharpening. Specifically, the ROI image is subjected to expansion and corrosion processing to eliminate small bright spots in the gold wire area, smooth the gold wire edge, and disconnect the adjacent wires. Then, the ROI image is subjected to corrosion and expansion processing again to fill small dark spots and broken contour lines in the gold wire, and smooth the gold wire edge again without changing the gold wire area.

[0112] Step S1005, generating a preprocessing result image; specifically, subtracting the ROI image from the edge sharpening image; since the gold line area of the edge sharpening image is completely black and the non-gold line area is completely white, the gold line area image will be completely preserved after subtraction, while the non-gold line image will be completely black. Then, the gold lines in the subtracted result image are binarized and the boundaries are found to obtain the preprocessing result image;

[0113] In step S1006, the preprocessing result image is identified to obtain crack defects. Specifically, it can be seen from the preprocessing result image that the edge of the gold wire has been completely eliminated and the image background complexity has also been reduced. Subsequently, a simple target recognition algorithm can be used to screen out the crack defects.

[0114] At this point, the identification / screening of crack defects has been completed. Based on the above-described scheme, it can be concluded that the method disclosed in the exemplary embodiment of the present disclosure can, on the one hand, solve the problem in the prior art that the method of measuring metal continuity by electrical means is inefficient and unreliable (microcracks will not directly cause short circuits in the early stage, but are prone to develop into larger cracks in the later stage). The identified crack defects can be repaired, thereby avoiding the problem of short circuits. On the other hand, it solves the problem of the high difficulty of the visual detection method in the prior art, and there is no need to identify crack defects through visual detection methods.

[0115] The exemplary embodiment of the present disclosure also provides an image processing device. Specifically, refer to Figure 11 As shown, the image processing device may include a first to-be-detected area determination module 1110, a target detection image generation module 1120, and an image recognition module 1130. Among them:

[0116] The first to-be-detected area determination module 1110 may be configured to obtain marker points in the original route image and determine the first to-be-detected area of the original route image based on the marker points;

[0117] The target detection image generation module 1120 may be configured to perform boundary sharpening on the first area to be detected to determine a second area to be detected, and generate a target detection image based on the first area to be detected and the second area to be detected;

[0118] The image recognition module 1130 may be configured to perform image recognition on the target detection image to obtain crack defects included in the original line image.

[0119] In an exemplary embodiment of the present disclosure, obtaining a marker point in an original route image includes:

[0120] Acquire an original line image, and perform grayscale processing on the original line image to obtain a grayscale line image;

[0121] The grayscale line image is binarized to obtain a binarized line image, and the binarized line image is screened according to the attribute characteristics of the marking points to obtain the marking points.

[0122] In an exemplary embodiment of the present disclosure, binarization is performed on the grayscale line image to obtain a binarized line image, including:

[0123] Obtaining a current brightness value of each pixel included in the grayscale line image, and determining whether the current brightness value is greater than a first preset threshold;

[0124] If the current brightness value is greater than the first preset threshold, replacing the current brightness value of the pixel with the first preset brightness value;

[0125] If the current brightness value is less than the first preset threshold, replacing the current brightness value of the pixel with the second preset brightness value;

[0126] The binary line image is generated according to each pixel point after the current brightness value is replaced.

[0127] In an exemplary embodiment of the present disclosure, the image processing apparatus further includes:

[0128] The original circuit image acquisition module can be used to acquire the original circuit image from the surface of the metal circuit to be inspected through a preset image acquisition device; wherein the image acquisition device is composed of a large-target industrial camera and an industrial telecentric lens.

[0129] In an exemplary embodiment of the present disclosure, the original circuit image is collected from the surface of the metal circuit to be inspected by a preset image acquisition device, including:

[0130] The incident angle of the light source between the industrial telecentric lens and the metal circuit surface to be inspected is configured, and based on the incident angle, the large-target industrial camera is controlled to collect the original circuit image from the metal circuit surface to be inspected through the industrial telecentric lens.

[0131] In an exemplary embodiment of the present disclosure, the light source is composed of one or more of a ring light source, one or more point light sources, and one or more strip light sources; and the incident angle is between 60° and 85°.

[0132] In an exemplary embodiment of the present disclosure, determining the first area to be detected of the original route image according to the marking point includes:

[0133] Calculating the center point position of the marking point according to the starting coordinate position of the marking point in the original route image and the size feature in the attribute feature of the marking point;

[0134] determining a size of a first area to be inspected according to a proportion of metal lines included in the original line image in the original line image;

[0135] The first area to be detected is selected from the original line image according to the position of the center point and the size of the first area to be detected.

[0136] In an exemplary embodiment of the present disclosure, performing boundary sharpening on the first area to be detected to determine a second area to be detected includes:

[0137] Performing expansion and corrosion processing on the first area to be inspected to obtain an intermediate inspection area;

[0138] The middle detection area is subjected to corrosion expansion processing to obtain the second area to be detected.

[0139] In an exemplary embodiment of the present disclosure, the first area to be inspected is subjected to expansion and corrosion processing to obtain an intermediate inspection area, including:

[0140] Extracting a first pixel to be processed from the first area to be detected and deleting the first pixel to be processed; wherein the pixel size of the first pixel to be processed does not exceed a first preset pixel value, and the current brightness value of the first pixel to be processed is greater than a first preset threshold;

[0141] The boundary lines of the metal circuits included in the first area to be inspected are smoothed, and the adhesion between two adjacent metal circuits is disconnected to obtain the middle inspection area.

[0142] In an exemplary embodiment of the present disclosure, performing corrosion expansion processing on the middle detection area to obtain the second area to be detected includes:

[0143] Extracting a second pixel to be processed from the middle detection area and filling the second pixel to be processed; wherein the pixel size of the second pixel to be processed does not exceed the first preset pixel value, and the current brightness value of the second pixel to be processed is less than the first preset threshold;

[0144] The disconnected portion of the metal circuit included in the middle detection area is filled, and the boundary line of the metal circuit is smoothed twice without changing the area of the metal circuit, so as to obtain the second area to be detected.

[0145] In an exemplary embodiment of the present disclosure, generating a target detection image according to the first area to be detected and the second area to be detected includes:

[0146] performing a difference operation on a first grayscale value of each pixel included in the first area to be detected and a second grayscale value of each pixel included in the second area to be detected to obtain a third grayscale value, and determining whether the third grayscale value meets a preset condition;

[0147] If the third grayscale value meets the preset condition, the third grayscale value is used as the target grayscale value of the pixel;

[0148] If the third grayscale value does not meet the preset condition, the third grayscale value is replaced, and the replaced third grayscale value is used as the target grayscale value of the pixel;

[0149] The target detection image is generated according to the target grayscale value of each pixel.

[0150] In an exemplary embodiment of the present disclosure, performing image recognition on the target detection image to obtain the crack defect included in the original line image includes:

[0151] Performing image recognition on the target detection image using a preset image recognition model to obtain crack defects included in the original line image;

[0152] Among them, the image recognition model includes one or more of an edge detection model, a convolutional neural network model, a recurrent neural network model and a deep neural network model.

[0153] The specific details of each module in the above-mentioned image processing device have been described in detail in the corresponding image processing method, and therefore will not be repeated here.

[0154] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0155] Furthermore, although the steps of the method of the present disclosure are described in a particular order in the accompanying drawings, this does not require or imply that the steps must be performed in this particular order, or that all steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0156] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0157] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods, or program products. Therefore, various aspects of the present disclosure may be implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits," "modules," or "systems."

[0158] Refer to the following Figure 12 12 is a diagram to describe the electronic device 1200 according to this embodiment of the present disclosure. Figure 12 The electronic device 1200 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0159] like Figure 12 As shown, electronic device 1200 is implemented as a general-purpose computing device. Components of electronic device 1200 may include, but are not limited to, the aforementioned at least one processing unit 1210, the aforementioned at least one storage unit 1220, a bus 1230 connecting various system components (including storage unit 1220 and processing unit 1210), and a display unit 1240.

[0160] The storage unit stores program codes, which can be executed by the processing unit 1210, so that the processing unit 1210 performs the steps described in the "Exemplary Method" section of the present disclosure according to various exemplary embodiments. For example, the processing unit 1210 can perform the following steps: Figure 1 Step S110 shown in the figure: obtaining marking points in the original line image, and determining a first area to be detected in the original line image based on the marking points; step S120: performing boundary sharpening on the first area to be detected to determine a second area to be detected, and generating a target detection image based on the first area to be detected and the second area to be detected; step S130: performing image recognition on the target detection image to obtain crack defects included in the original line image.

[0161] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 12201 and / or a cache memory unit 12202 , and may further include a read-only memory unit (ROM) 12203 .

[0162] The storage unit 1220 may also include a program / utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0163] The bus 1230 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0164] The electronic device 1200 can also communicate with one or more external devices 1300 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 1200, and / or any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication can occur via an input / output (I / O) interface 1250. Furthermore, the electronic device 1200 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 1200, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0165] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

[0166] In exemplary embodiments of the present disclosure, a computer-readable storage medium is also provided, on which is stored a program product capable of implementing the aforementioned methods of this specification. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product comprising program code. When the program product is executed on a terminal device, the program code is configured to cause the terminal device to execute the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present disclosure.

[0167] According to an embodiment of the present disclosure, a program product for implementing the above-mentioned method can be a portable compact disc read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0168] The program product may be implemented in any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0169] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0170] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0171] The program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0172] Furthermore, the figures above are merely illustrative of the processes included in the methods according to exemplary embodiments of the present disclosure and are not intended to be limiting. It is readily understood that the processes illustrated in the figures above do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0173] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow from the general principles of the present disclosure and include common knowledge or customary techniques in the art not invented herein. The specification and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.

Claims

1. An image processing method, characterized in that: include: Obtaining marking points in an original circuit image, and determining a first area to be detected of the original circuit image based on the marking points; wherein the marking points are position identification points of a PCB applied to an automatic placement machine in a circuit board design, and each surface of the PCB board has at least one pair of marking points located in a diagonal direction of the PCB board, and the marking points are obtained by: obtaining an original circuit image, and performing grayscale processing on the original circuit image to obtain a grayscale circuit image; performing binarization processing on the grayscale circuit image to obtain a binarized circuit image, and screening the binarized circuit image based on the attribute characteristics of the marking points to obtain the marking points; Sharpening the boundaries of the first area to be detected to determine the second area to be detected, and generating a target detection image based on the first area to be detected and the second area to be detected; wherein the target detection image is obtained in the following manner: performing a difference operation on the first grayscale value of each pixel included in the first area to be detected and the second grayscale value of each pixel included in the second area to be detected to obtain a third grayscale value, and judging whether the third grayscale value meets a preset condition; if the third grayscale value meets the preset condition, using the third grayscale value as the target grayscale value of the pixel; if the third grayscale value does not meet the preset condition, replacing the third grayscale value, and using the replaced third grayscale value as the target grayscale value of the pixel; generating the target detection image based on the target grayscale value of each pixel; Performing image recognition on the target detection image to obtain the crack defect included in the original line image; wherein the crack defect is obtained in the following manner: performing image recognition on the target detection image through a preset image recognition model to obtain the crack defect included in the original line image.

2. The image processing method according to claim 1, wherein: Binarizing the grayscale line image to obtain a binary line image includes: Obtaining a current brightness value of each pixel included in the grayscale line image, and determining whether the current brightness value is greater than a first preset threshold; If the current brightness value is greater than the first preset threshold, replacing the current brightness value of the pixel with the first preset brightness value; If the current brightness value is less than the first preset threshold, replacing the current brightness value of the pixel with the second preset brightness value; The binary line image is generated according to each pixel point after the current brightness value is replaced.

3. The image processing method according to claim 1, wherein: The image processing method further includes: The original circuit image is collected from the surface of the metal circuit to be inspected by a preset image acquisition device; wherein the image acquisition device is composed of a large-target industrial camera and an industrial telecentric lens.

4. The image processing method according to claim 3, wherein: The original circuit image is collected from the surface of the metal circuit to be inspected by a preset image acquisition device, including: The incident angle of the light source between the industrial telecentric lens and the metal circuit surface to be inspected is configured, and based on the incident angle, the large-target industrial camera is controlled to collect the original circuit image from the metal circuit surface to be inspected through the industrial telecentric lens.

5. The image processing method according to claim 4, characterized in that The light source is composed of one or more of a ring light source, one or more point light sources, and one or more strip light sources; and the incident angle is between 60° and 85°.

6. The image processing method according to claim 1, wherein: Determining a first area to be detected in the original route image according to the marking point includes: Calculating the center point position of the marking point according to the starting coordinate position of the marking point in the original route image and the size feature in the attribute feature of the marking point; determining a size of a first area to be inspected according to a proportion of metal lines included in the original line image in the original line image; The first area to be detected is selected from the original line image according to the position of the center point and the size of the first area to be detected.

7. The image processing method according to claim 1, wherein: Sharpening the boundary of the first area to be detected to determine a second area to be detected includes: Performing expansion and corrosion processing on the first area to be inspected to obtain an intermediate inspection area; The middle detection area is subjected to corrosion expansion processing to obtain the second area to be detected.

8. The image processing method according to claim 7, wherein: Performing expansion and corrosion processing on the first area to be inspected to obtain an intermediate inspection area, including: Extracting a first pixel to be processed from the first area to be detected and deleting the first pixel to be processed; wherein the pixel size of the first pixel to be processed does not exceed a first preset pixel value, and the current brightness value of the first pixel to be processed is greater than a first preset threshold; The boundary lines of the metal circuits included in the first area to be inspected are smoothed, and the adhesion between two adjacent metal circuits is disconnected to obtain the middle inspection area.

9. The image processing method according to claim 7, wherein: Performing corrosion expansion processing on the middle detection area to obtain the second area to be detected, including: Extracting a second pixel to be processed from the middle detection area and filling the second pixel to be processed; wherein the pixel size of the second pixel to be processed does not exceed the first preset pixel value, and the current brightness value of the second pixel to be processed is less than the first preset threshold; The disconnected portion of the metal circuit included in the middle detection area is filled, and the boundary line of the metal circuit is smoothed twice without changing the area of the metal circuit, so as to obtain the second area to be detected.

10. The image processing method according to claim 1, wherein: The image recognition model includes one or more of an edge detection model, a convolutional neural network model, a recurrent neural network model, and a deep neural network model.

11. An image processing device, characterized in that: include: A first to-be-detected area determination module is configured to obtain marking points in an original circuit image and determine a first to-be-detected area of the original circuit image based on the marking points. The marking points are position identification points of a PCB applied to an automatic placement machine in circuit board design. Each surface of the PCB has at least one pair of marking points located in a diagonal direction of the PCB. The marking points are obtained by: obtaining an original circuit image and performing grayscale processing on the original circuit image to obtain a grayscale circuit image; binarizing the grayscale circuit image to obtain a binarized circuit image, and screening the binarized circuit image based on attribute characteristics of the marking points to obtain the marking points. A target detection image generation module is used to perform boundary sharpening on the first area to be detected to determine the second area to be detected, and generate a target detection image based on the first area to be detected and the second area to be detected; wherein, the target detection image is obtained in the following manner: performing a difference operation on the first grayscale value of each pixel included in the first area to be detected and the second grayscale value of each pixel included in the second area to be detected to obtain a third grayscale value, and judging whether the third grayscale value meets a preset condition; if the third grayscale value meets the preset condition, the third grayscale value is used as the target grayscale value of the pixel; if the third grayscale value does not meet the preset condition, the third grayscale value is replaced, and the replaced third grayscale value is used as the target grayscale value of the pixel; the target detection image is generated according to the target grayscale value of each pixel; An image recognition module is used to perform image recognition on the target detection image to obtain crack defects included in the original line image; wherein the crack defects are obtained in the following manner: image recognition is performed on the target detection image through a preset image recognition model to obtain crack defects included in the original line image.

12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 10 is implemented.

13. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to perform the image processing method according to any one of claims 1 to 10 by executing the executable instructions.

Citation Information

Patent Citations

  • Local threshold segmentation method and defect detection method

    CN111062910A

  • Line detection method, device and equipment and computer readable storage medium

    CN113379726A