Pit defect detection method, system, equipment, storage medium and product
By establishing the grayscale images of upper tolerance and lower tolerance, screening abnormal pixel points to detect pit defects in the metal plate of the PEM electrolytic cell, solving the detection performance problems caused by the difference in light source brightness, and achieving efficient and accurate pit defect detection.
Patent Information
- Application Number
- CN202411492025.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-10-24
AI Technical Summary
In the production of PEM electrolytic cell metal plates, the imaging results of pit defects are differentiated due to different brightness of the light source, resulting in a large number of training samples to ensure the detection performance of the deep learning model, thereby improving the training calculation amount and hardware configuration requirements.
By acquiring multiple grayscale images of the metal plates of normal electrolytic cells, establishing grayscale images of the upper tolerance and lower tolerance, comparing the grayscale images of the metal plates of the electrolytic cells to be detected with these tolerance images, filtering out abnormal pixel points, and determining pit defects.
Reduces the number of images, improves detection efficiency and accuracy, and reduces hardware configuration requirements.
Smart Images

Figure CN119540149B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, and in particular relates to a pit defect detection method, system, equipment, storage medium and product. Background Art
[0002] During the production of metal plates for PEM (proton exchange membrane) electrolyzers, the shape, depth, and area of the pits on the plates vary. Furthermore, the imaging quality of 2D line scan cameras is highly dependent on the light source, resulting in differences in the image quality of the same pit defect due to different light source brightness. Furthermore, most pit defect detection methods utilize deep learning using unrecorded images (i.e., images of products containing pits, dents, or grooves). Insufficient image sample data can affect the detection performance of the deep learning model, leading to missed detections. To improve the detection performance of deep learning models, a large amount of image sample data is required. The continuous increase in image sample data increases the computational complexity of training the deep learning model, placing high demands on the equipment hardware configuration. Summary of the Invention
[0003] The purpose of the present invention is to provide a pit defect detection method, system, equipment, storage medium and product to solve the problem that when using NG images as training samples, the imaging results of pit defects are differentiated due to different light source brightness, which in turn requires a large number of training samples to ensure the detection performance of the deep learning model. The large number of training samples leads to an increase in training calculation amount and high hardware configuration requirements.
[0004] The present invention solves the above technical problems through the following technical solutions: a pit defect detection method, comprising:
[0005] Acquire multiple grayscale images of normal electrolytic cell metal plates;
[0006] Obtaining an upper tolerance grayscale image and a lower tolerance grayscale image according to a plurality of normal grayscale images of the electrolytic cell metal plates;
[0007] Acquire a grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the process of acquiring the grayscale image of the metal plate of the electrolytic cell to be inspected is completely consistent with the process of acquiring the grayscale image of the metal plate of a normal electrolytic cell;
[0008] Comparing the grayscale image of the metal plate of the electrolytic cell to be inspected with the upper tolerance grayscale image, and selecting a first pixel from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the first pixel is greater than the grayscale value of the corresponding pixel in the upper tolerance grayscale image;
[0009] Comparing the grayscale image of the metal plate of the electrolytic cell to be inspected with the lower tolerance grayscale image, and selecting a second pixel from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the second pixel is less than the grayscale value of the corresponding pixel in the lower tolerance grayscale image;
[0010] Merging all first pixel points and all second pixel points according to pixel coordinates to obtain an abnormal pixel point set;
[0011] It is determined whether a pit defect exists on the metal plate of the electrolytic cell to be inspected based on the abnormal pixel point set.
[0012] Furthermore, a dual-axis array camera photographing device is used to obtain multiple grayscale images of normal electrolytic cell metal plates, wherein the dual-axis array camera photographing device includes an X-axis motion mechanism, a Y-axis motion mechanism, a linear array camera, and a control module, wherein the X-axis motion mechanism is movably disposed on the Y-axis motion mechanism, and the linear array camera is movably disposed on the X-axis motion mechanism; the control module is connected to the X-axis motion mechanism, the Y-axis motion mechanism, and the linear array camera; the specific process of obtaining each normal electrolytic cell metal plate grayscale image includes:
[0013] The control module moves the linear array camera to the scanning starting position by controlling the X-axis motion mechanism and the Y-axis motion mechanism;
[0014] Trigger the linear array camera to start collecting images, and each time the linear array camera moves, a frame of linear array scanning is triggered;
[0015] When the linear array camera moves to the scanning end position, the linear array camera is controlled to stop collecting images, and all frames of linear array scanning results are spliced and grayscale converted to obtain a normal grayscale image of the electrolytic cell metal plate.
[0016] Furthermore, an upper tolerance grayscale image and a lower tolerance grayscale image are obtained based on a plurality of normal grayscale images of the electrolytic cell metal plates, including:
[0017] Convert each normal grayscale image of the electrolytic cell metal plate into a two-dimensional array. The specific conversion formula is:
[0018] Value (x,y) =Img(x,y);
[0019] Among them, Img(x,y) represents the grayscale value of the pixel point (x,y) in the grayscale image of the normal electrolytic cell metal plate; Value (x,y) Represents the numerical value corresponding to the row index x and column index y in the two-dimensional array;
[0020] Determine the maximum and minimum values at each index position based on all two-dimensional arrays;
[0021] An upper tolerance grayscale image is generated according to the maximum value of each index position, and a lower tolerance grayscale image is generated according to the minimum value of each index position.
[0022] Furthermore, judging whether there is a pit defect on the metal plate of the electrolytic cell to be inspected based on the abnormal pixel point set includes:
[0023] For any two pixels in the abnormal pixel set, determine whether the two pixels are connected;
[0024] Determine a connected branch based on the connected relationship between any two pixels in the abnormal pixel set; wherein all pixels on each connected branch are connected;
[0025] When the number of pixels on the connected branch is greater than or equal to a quantity threshold, the area corresponding to the connected branch is a pit area; when the number of pixels on the connected branch is less than the quantity threshold, the area corresponding to the connected branch is a noise point.
[0026] Furthermore, when any two pixels in the abnormal pixel set satisfy the following inequality, the two pixels are connected:
[0027] xi-xj≤△d and yi-yj≤△d;
[0028] Among them, (xi,yi) represents the pixel coordinates of one pixel point, (xj,yj) represents the pixel coordinates of the other pixel point, i≠j, and △d represents the pixel distance threshold.
[0029] Based on the same concept, the present invention provides a pit defect detection system, comprising:
[0030] An image acquisition unit, configured to acquire multiple grayscale images of normal electrolytic cell metal plates; and to acquire grayscale images of the electrolytic cell metal plates to be inspected; wherein the grayscale image acquisition process of the electrolytic cell metal plates to be inspected is identical to the grayscale image acquisition process of the normal electrolytic cell metal plates;
[0031] An image processing unit is configured to obtain a plurality of normal grayscale images of the electrolytic cell metal plates from the image acquisition unit; and obtain an upper tolerance grayscale image and a lower tolerance grayscale image based on the plurality of normal grayscale images of the electrolytic cell metal plates;
[0032] Used to obtain a grayscale image of the metal plate of the electrolytic cell to be inspected from the image acquisition unit; compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the upper tolerance grayscale image, and filter out a first pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the first pixel point is greater than the grayscale value of the corresponding pixel point in the upper tolerance grayscale image; compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the lower tolerance grayscale image, and filter out a second pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the second pixel point is less than the grayscale value of the corresponding pixel point in the lower tolerance grayscale image;
[0033] Merging all first pixel points and all second pixel points according to pixel coordinates to obtain an abnormal pixel point set;
[0034] It is determined whether a pit defect exists on the metal plate of the electrolytic cell to be inspected based on the abnormal pixel point set.
[0035] Furthermore, the image acquisition unit is a dual-axis array camera photographing device, which includes an X-axis motion mechanism, a Y-axis motion mechanism, a linear array camera and a control module. The X-axis motion mechanism is movably arranged on the Y-axis motion mechanism, and the linear array camera is movably arranged on the X-axis motion mechanism; the control module is connected to the X-axis motion mechanism, the Y-axis motion mechanism and the linear array camera.
[0036] Based on the same concept, the present invention also provides an electronic device, including a memory, a processor, and a computer program / instruction stored in the memory, wherein the processor executes the computer program / instruction to implement the pit defect detection method as described above.
[0037] Based on the same concept, the present invention also provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the above-mentioned pit defect detection method is implemented.
[0038] Based on the same concept, the present invention also provides a computer program product, including a computer program / instruction, which implements the above-mentioned pit defect detection method when executed by a processor.
[0039] Beneficial effects
[0040] Compared with the prior art, the advantages of the present invention are:
[0041] This invention breaks the previous thinking of using NG images to train deep learning models and then using the deep learning models to detect pit defects. It obtains upper tolerance grayscale images and lower tolerance grayscale images based on normal product images, and then determines abnormal pixels based on the upper tolerance grayscale images and lower tolerance grayscale images. Finally, pit defect detection is performed based on the abnormal pixels. This not only greatly reduces the number of images, improves detection efficiency and detection accuracy, but also reduces hardware configuration requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only one embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 is a flow chart of a pit defect detection method according to an embodiment of the present invention;
[0044] Figure 2 is a grayscale image of the metal plate of the electrolytic cell to be inspected in an embodiment of the present invention;
[0045] Figure 3 is an abnormal pixel point marking image in the abnormal pixel point set in an embodiment of the present invention;
[0046] Figure 4 is a diagram of the pit area detected when the number threshold is 10 in an embodiment of the present invention;
[0047] Figure 5 This is the pit detection result in the actual product in the embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following is a clear and complete description of the technical solutions of the present invention in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts are within the scope of protection of the present invention.
[0049] The following specific embodiments are used to describe the technical solution of the present application in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0050] Example 1
[0051] A pit defect detection method provided by an embodiment of the present invention includes the following steps:
[0052] Step 1: Obtain multiple grayscale images of normal electrolytic cell metal plates.
[0053] In a specific embodiment of the present invention, a dual-axis array camera photographing device is used to acquire multiple grayscale images of normal electrolytic cell metal plates. The dual-axis array camera photographing device includes an X-axis motion mechanism, a Y-axis motion mechanism, a linear array camera, and a control module. The X-axis motion mechanism is movably mounted on the Y-axis motion mechanism, and the linear array camera is movably mounted on the X-axis motion mechanism. The control module is connected to the X-axis motion mechanism, the Y-axis motion mechanism, and the linear array camera. The X-axis motion mechanism is used to control the movement of the linear array camera in the X direction, and the Y-axis motion mechanism is used to control the movement of the linear array camera in the Y direction. Before acquiring multiple grayscale images of normal electrolytic cell metal plates using the dual-axis array camera photographing device, the linear array camera is first controlled to be in a reset state and zero position. In this embodiment, the specific implementation process of controlling the linear array camera to be in the reset state is as follows:
[0054] The control module sends a reset signal (e.g., +5V) to the line scan camera via the motion control card. This triggers the line scan camera to reset. Resetting a line scan camera involves clearing its cached data. When triggered by the reset signal, the line scan camera automatically clears its cached image data.
[0055] First limit sensors are provided on the X-axis motion mechanism and the Y-axis motion mechanism. The positions corresponding to the two first limit sensors are zero positions. In this embodiment, the first limit sensors are photoelectric sensors. The specific implementation process of controlling the line array camera to the zero position (i.e., the scanning starting position) is as follows:
[0056] The control module controls the X-axis motion mechanism through the motion control card, causing the line scan camera to move along the X direction. When the line scan camera triggers the photoelectric sensor on the X-axis motion mechanism, the control module controls the X-axis motion mechanism to stop working through the motion control card.
[0057] The control module controls the Y-axis motion mechanism through the motion control card, causing the X-axis motion mechanism and the linear array camera to move along the Y direction. When the X-axis motion mechanism and the linear array camera trigger the photoelectric sensor on the Y-axis motion mechanism, the control module controls the Y-axis motion mechanism to stop working through the motion control card.
[0058] Similarly, second limit sensors are provided on the X-axis motion mechanism and the Y-axis motion mechanism. The positions corresponding to the two second limit sensors or one of the second limit sensors are the scanning end positions. The control module controls the operation of the X-axis motion mechanism and the Y-axis motion mechanism to place the linear array camera at the scanning end position.
[0059] In a specific embodiment of the present invention, the specific implementation process of using a dual-axis array camera device to obtain a grayscale image of each normal electrolytic cell metal plate includes:
[0060] Step 1.1: Place a normal electrolytic cell metal plate on the detection platform and click the start button. The control module controls the X-axis motion mechanism and the Y-axis motion mechanism to move the linear array camera to the scanning starting position.
[0061] Step 1.2: The control module sends a +5V start signal to the linear scan camera through the motion control card, triggering the linear scan camera to start capturing images.
[0062] Step 1.3: The control module controls the X-axis motion mechanism through the motion control card, causing the line scan camera to move along the X direction. Each movement of the line scan camera triggers a frame of line scan.
[0063] Step 1.4: When the line scan camera moves to the scanning end position (i.e., the position corresponding to the second limit sensor of the X-axis motion mechanism), the control module controls the line scan camera to stop acquiring images. That is, the control module sends a +5V stop electrical signal to the line scan camera, and the line scan camera stops acquiring images.
[0064] Step 1.5: The control module stitches and grayscale converts all the frame line array scanning results to obtain a grayscale image of a normal electrolytic cell metal plate.
[0065] The distance the linear scan camera moves each time (i.e., the scanning interval) is determined by the pulse transmission frame rate of the control module. In this embodiment, the control module controls the linear scan camera to send four pulse signals to the linear scan camera for every 0.018mm movement. Each time the linear scan camera receives four pulse signals, a linear scan frame is triggered. By controlling the X-axis motion mechanism to operate continuously, the linear scan camera performs linear scans at equal intervals, ensuring image uniformity. In this embodiment, the result of each linear scan frame is an image with a width of 3200 pixels and a height of 1 pixel. The results of all linear scan frames are spliced sequentially in the height direction to obtain the original image of a normal electrolytic cell metal plate. Finally, the image is converted to a grayscale image. The specific conversion formula is:
[0066] Img(x,y)=Orimg (x,y) ×255÷4.4 (1)
[0067] Among them, Img(x,y) represents the grayscale value of the pixel (x,y) in the grayscale image, Orimg (x,y) Represents the value of the pixel (x, y) in the original image. 4.4 is the effective field of view of the linear array camera in the height direction, and 0 to 255 is the grayscale value range.
[0068] Each time the line array camera acquires a complete grayscale image, it moves from the scan start position to the scan end position, with the same scanning interval. Because each grayscale image of a normal electrolytic cell metal plate and the grayscale image of the electrolytic cell metal plate to be inspected are captured by the same dual-axis array camera device, and the scan start position, scan end position, and scan interval are exactly the same, the width and height of each grayscale image of the normal electrolytic cell metal plate and the grayscale image of the electrolytic cell metal plate to be inspected are exactly the same, and the same or different grayscale values can be obtained at the same pixel.
[0069] In another specific embodiment of the present invention, the dual-axis array camera photographing device can also adopt existing technology, specifically refer to the patent document with authorization announcement number CN114710617B, entitled Dual-axis Array Camera Photographing Method, System, Device and Storage Medium.
[0070] Step 2: Obtain an upper tolerance grayscale image and a lower tolerance grayscale image based on multiple normal grayscale images of the electrolytic cell metal plates.
[0071] In a specific embodiment of the present invention, obtaining an upper tolerance grayscale image and a lower tolerance grayscale image based on a plurality of normal grayscale images of electrolytic cell metal plates includes:
[0072] Step 2.1: Convert each grayscale image of a normal electrolytic cell metal plate into a two-dimensional array. The specific conversion formula is:
[0073] Valuei (x,y) =Imgi(x,y) (2)
[0074] Among them, Imgi(x,y) represents the grayscale value of the pixel (x,y) in the grayscale image of the normal electrolytic cell metal plate; Valuei (x,y) Represents the numerical value corresponding to the row index x and column index y in the i-th two-dimensional array.
[0075] Step 2.2: Determine the maximum and minimum values at each index position based on all two-dimensional arrays.
[0076] Since each grayscale image of a normal electrolytic cell metal plate is captured by the same dual-axis array camera device, and the scanning start position, scanning end position and scanning interval are completely consistent, the width and height of each grayscale image of a normal electrolytic cell metal plate are completely consistent.
[0077] The maximum value for each index position is:
[0078] MaxValue (x,y) =Max(Value1 (x,y) ,Value2 (x,y) ,…,Valuei (x,y),…,ValueN (x,y) )(3)
[0079] Among them, MaxValue (x,y) represents the maximum value of the index position (x, y), Max represents the maximum value function, and N represents the number of grayscale images of the normal electrolytic cell metal plate. In this embodiment, N is set to 5.
[0080] The minimum value at each index position is:
[0081] MinValue (x,y) =Min(Value1 (x,y) ,Value2 (x,y) ,…,Valuei (x,y) ,…,ValueN (x,y) )(4)
[0082] Among them, MinValue (x,y) Indicates the minimum value of the index position (x, y), and Min represents the minimum value function.
[0083] Step 2.3: Generate an upper tolerance grayscale image based on the maximum value of each index position, and generate a lower tolerance grayscale image based on the minimum value of each index position.
[0084] The upper tolerance grayscale image can be expressed as:
[0085] (5)
[0086] The lower tolerance grayscale image can be expressed as:
[0087] (6)
[0088] Where MaxImage represents the upper tolerance grayscale image, MinImage represents the lower tolerance grayscale image, h represents the height of the upper tolerance grayscale image or the lower tolerance grayscale image, and w represents the width of the upper tolerance grayscale image or the lower tolerance grayscale image. In this embodiment, w is 3200, and h is the number of scanning frames of the line array camera.
[0089] Step 3: Obtain a grayscale image of the metal plate of the electrolytic cell to be inspected.
[0090] A dual-axis array camera photographing device is used to obtain a grayscale image of the metal plate of the electrolytic cell to be inspected, and the grayscale image acquisition process of the metal plate of the electrolytic cell to be inspected is completely consistent with the grayscale image acquisition process of the metal plate of a normal electrolytic cell, that is, the scanning starting position, scanning end position and scanning interval of the grayscale image of the metal plate of the electrolytic cell to be inspected are completely consistent with the scanning starting position, scanning end position and scanning interval of each grayscale image of the metal plate of a normal electrolytic cell. Figure 2A grayscale image of the metal plates of the electrolysis cell to be inspected is shown.
[0091] Step 4: Compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the upper tolerance grayscale image, and select the first pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected.
[0092] The pixel value of the first pixel is greater than the grayscale value of the corresponding pixel in the upper tolerance grayscale image, that is, the pixel whose grayscale value is greater than the corresponding pixel in the upper tolerance grayscale image is screened out from the grayscale image of the electrolytic cell metal plate to be inspected, which can be expressed as:
[0093] UpPixelList (x,y) ={(x,y)|GetGray(MaxImage (x,y) )-GetGray(CurrentImage (x,y) )>0} (7)
[0094] Among them, UpPixelList (x,y) Indicates the first pixel, GetGray means getting the gray value of the pixel, MaxImage (x,y) Represents the pixel point (x, y) in the upper tolerance grayscale image, CurrentImage (x,y) Represents the pixel point (x, y) in the grayscale image of the electrolytic cell metal plate to be inspected.
[0095] Step 5: Compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the lower tolerance grayscale image, and select a second pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected.
[0096] The pixel value of the second pixel is smaller than the grayscale value of the corresponding pixel in the lower tolerance grayscale image. That is, the pixel whose grayscale value is smaller than the corresponding pixel in the lower tolerance grayscale image is screened out from the grayscale image of the electrolytic cell metal plate to be inspected. It can be expressed as:
[0097] DownPixelList (x,y) ={(x,y)|GetGray(MinImage (x,y) )-GetGray(CurrentImage (x,y) )<0}(8)
[0098] Among them, DownPixelList (x,y) Indicates the second pixel, MinImage (x,y) Represents the pixel point (x,y) in the lower tolerance grayscale image.
[0099] Step 6: Merge all first pixel points and all second pixel points according to pixel coordinates to obtain an abnormal pixel point set.
[0100] In this embodiment, the abnormal pixel point set can be expressed as:
[0101] ErrorPixelList=UpPixelList&DownPixelList (9)
[0102] Among them, ErrorPixelList represents an abnormal pixel set, UpPixelList represents a first pixel set, DownPixelList represents a second pixel set, and & represents a merge symbol. Figure 3 Abnormal pixels in the abnormal pixel set are marked.
[0103] Step 7: Determine whether there is a pit defect on the metal plate of the electrolytic cell to be inspected based on the abnormal pixel set.
[0104] In a specific embodiment of the present invention, judging whether a pit defect exists on the metal plate of the electrolytic cell to be inspected based on a set of abnormal pixels includes:
[0105] Step 7.1: For any two pixels in the abnormal pixel set, determine whether the two pixels are connected.
[0106] In this embodiment, when any two pixels in the abnormal pixel set satisfy inequality (10), the two pixels are connected:
[0107] xi-xj≤△d and yi-yj≤△d (10)
[0108] Where (xi,yi) represents the pixel coordinates of the i-th pixel, (xj,yj) represents the pixel coordinates of the j-th pixel, i ≠ j, and Δd represents the pixel distance threshold. In this embodiment, Δd is set to 1. The fact that two pixels are connected indicates that they belong to the same abnormal area on the metal plate of the electrolytic cell to be inspected.
[0109] Step 7.2: Determine a connected branch based on the connected relationship between any two pixels in the abnormal pixel set; wherein all pixels on each connected branch are connected.
[0110] For example, if the first pixel in the abnormal pixel set ErrorPixelList is connected to the second pixel, the second pixel is connected to the third pixel, the third pixel is connected to the fifth pixel, ..., then the first pixel, the second pixel, the third pixel, the fifth pixel, ..., form a connected branch.
[0111] Step 7.3: Locate the pit area according to each connected branch.
[0112] When the number of pixels on the connected branch is greater than or equal to the number threshold, the area corresponding to the connected branch is a pit area, and the pit area is marked on the grayscale image of the metal plate of the electrolytic cell to be detected to achieve pit detection;
[0113] When the number of pixels on the connected branch is less than the number threshold, the area corresponding to the connected branch is a noise point and belongs to a non-pit area, that is, a normal area.
[0114] In a specific embodiment of the present invention, the number threshold is determined based on the pit area detection requirement. For example, if the pit area detection requirement is that the pit area must be greater than 0.2 mm² (i.e., pits larger than 0.2 mm² are detected), the number of pixels is calculated based on the pit area. Each pixel is 0.018 mm², and the area connected by 10 pixels is equal to 0.18 mm². Therefore, a number threshold of 10 satisfies the pit area detection requirement. Figure 4 The pit areas detected when the number threshold is 10 are shown.
[0115] Figure 5 The results of pit detection in actual products are shown. Figure 5 It can be seen that the method of the present invention can accurately detect the pits and their specific positions.
[0116] This method uses a 2D linear array camera, triggered by pulses, to scan the metal plates of a normal electrolytic cell frame by frame, capturing grayscale images of the plates. Based on these grayscale images, standard product template images (i.e., upper and lower tolerance grayscale images) are then created. By comparing sensitive features such as image color difference and area of the product under inspection with the standard product template images, the presence of pit defects in the product under inspection is determined. This method can more specifically identify pitted areas; abnormal areas are typically brighter or darker. This method uses the grayscale difference between abnormal and normal areas to quickly detect pit defects, significantly reducing the number of images required, improving detection efficiency and accuracy, and lowering hardware requirements.
[0117] Example 2
[0118] A pit defect detection system provided by an embodiment of the present invention includes an image acquisition unit and an image processing unit.
[0119] The image acquisition unit is used to acquire multiple grayscale images of normal electrolytic cell metal plates; and is used to acquire grayscale images of the electrolytic cell metal plates to be inspected; wherein the grayscale image acquisition process of the electrolytic cell metal plates to be inspected is completely consistent with the grayscale image acquisition process of the normal electrolytic cell metal plates;
[0120] The image processing unit is used to obtain a plurality of normal grayscale images of the electrolytic cell metal plates from the image acquisition unit; obtain an upper tolerance grayscale image and a lower tolerance grayscale image based on the plurality of normal grayscale images of the electrolytic cell metal plates;
[0121] The image processing unit is used to obtain a grayscale image of the metal plate of the electrolytic cell to be inspected from the image acquisition unit; compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the upper tolerance grayscale image, and filter out a first pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the first pixel point is greater than the grayscale value of the corresponding pixel point in the upper tolerance grayscale image; compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the lower tolerance grayscale image, and filter out a second pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the second pixel point is less than the grayscale value of the corresponding pixel point in the lower tolerance grayscale image; merge all the first pixel points and all the second pixel points according to the pixel coordinates to obtain an abnormal pixel point set; and judge whether the metal plate of the electrolytic cell to be inspected has a pit defect based on the abnormal pixel point set.
[0122] In a specific embodiment of the present invention, the image acquisition unit is a dual-axis array camera device, which includes an X-axis motion mechanism, a Y-axis motion mechanism, a linear array camera, and a control module. The X-axis motion mechanism is movably mounted on the Y-axis motion mechanism, and the linear array camera is movably mounted on the X-axis motion mechanism. The control module is connected to the X-axis motion mechanism, the Y-axis motion mechanism, and the linear array camera. The specific implementation process of using the dual-axis array camera device to obtain a grayscale image of each normal electrolytic cell metal plate includes:
[0123] Place a normal electrolytic cell metal plate on the detection platform and click the start button. The control module controls the X-axis motion mechanism and the Y-axis motion mechanism to move the linear array camera to the scanning starting position.
[0124] The control module sends a +5V start signal to the linear scan camera through the motion control card, triggering the linear scan camera to start collecting images.
[0125] The control module controls the X-axis motion mechanism through the motion control card, so that the linear array camera moves along the X direction. Each time the linear array camera moves, a frame of linear array scanning is triggered.
[0126] When the linear scan camera moves to the scanning end position (i.e., the position corresponding to the second limit sensor of the X-axis motion mechanism), the control module controls the linear scan camera to stop acquiring images, that is, the control module sends a +5V stop electrical signal to the linear scan camera, and the linear scan camera stops acquiring images;
[0127] The control module stitches and grayscale converts the linear array scanning results of all frames to obtain a grayscale image of a normal electrolytic cell metal plate.
[0128] The distance the linear array camera moves each time (i.e., the scanning interval) is determined by the pulse transmission frame rate of the control module. In this embodiment, the control module controls the linear array camera to move 0.018 mm and sends four pulse signals to the linear array camera. Each time the linear array camera receives four pulse signals, it triggers a frame of linear array scanning. By controlling the X-axis motion mechanism to work continuously, the linear array camera performs linear array scans at equal intervals, ensuring image uniformity. In this embodiment, the result of each linear array scan is an image with a width of 3200 pixels and a height of 1 pixel. All the linear array scan results are spliced in sequence in the height direction to obtain an original image of a normal electrolytic cell metal plate. Finally, the image is converted to a grayscale image, as shown in Formula (1).
[0129] Each time the line array camera acquires a complete grayscale image, it moves from the scan start position to the scan end position, with the same scanning interval. Because each grayscale image of a normal electrolytic cell metal plate and the grayscale image of the electrolytic cell metal plate to be inspected are captured by the same dual-axis array camera device, and the scan start position, scan end position, and scan interval are exactly the same, the width and height of each grayscale image of the normal electrolytic cell metal plate and the grayscale image of the electrolytic cell metal plate to be inspected are exactly the same, and the same or different grayscale values can be obtained at the same pixel.
[0130] In a specific embodiment of the present invention, the image processing unit is used to obtain an upper tolerance grayscale image and a lower tolerance grayscale image based on a plurality of normal grayscale images of the electrolytic cell metal plates, including:
[0131] Each grayscale image of a normal electrolytic cell metal plate is converted into a two-dimensional array. The specific conversion formula is shown in formula (2);
[0132] Determine the maximum and minimum values at each index position based on all two-dimensional arrays;
[0133] An upper tolerance grayscale image is generated according to the maximum value of each index position, and a lower tolerance grayscale image is generated according to the minimum value of each index position.
[0134] In a specific embodiment of the present invention, the image processing unit is used to determine whether there is a pit defect on the metal plate of the electrolytic cell to be inspected based on the abnormal pixel set, including:
[0135] For any two pixels in the abnormal pixel set, determine whether the two pixels are connected;
[0136] Determine a connected branch based on the connected relationship between any two pixels in the abnormal pixel set; wherein all pixels on each connected branch are connected;
[0137] The pit area is located according to each connected branch.
[0138] When the number of pixels on the connected branch is greater than or equal to the number threshold, the area corresponding to the connected branch is the pit area. The pit area is marked on the grayscale image of the metal plate of the electrolytic cell to be detected to achieve pit detection; when the number of pixels on the connected branch is less than the number threshold, the area corresponding to the connected branch is a noise point, which belongs to the non-pit area, that is, the normal area.
[0139] Example 3
[0140] An embodiment of the present invention also provides an electronic device, which includes: a memory, a processor, and a computer program / instructions stored in the memory, and the processor executes the computer program / instructions to implement the pit defect detection method in the embodiment of the present application.
[0141] Although not shown, the electronic device includes a processor that can perform various appropriate operations and processes based on programs and / or data stored in a read-only memory (ROM) or programs and / or data loaded from a storage portion into a random access memory (RAM). The processor can be a multi-core processor or can include multiple processors. In some embodiments, the processor can include a general-purpose main processor and one or more special coprocessors, such as a central processing unit, a graphics processing unit (GPU), a neural network processor (NPU), a digital signal processor (DSP), etc. Various programs and data required for device operation are also stored in the RAM. The processor, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0142] The processor and memory are used together to execute the program / instructions stored in the memory. When the program / instructions are executed by the computer, the methods, steps or functions described in the above embodiments can be implemented.
[0143] Although not shown, an embodiment of the present invention further provides a computer-readable storage medium having a computer program / instruction stored thereon, which, when executed by a processor, implements the pit defect detection method in the embodiment of the present application.
[0144] Computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0145] Although not shown, an embodiment of the present invention further provides a computer program product, including: a computer program / instruction, which implements the pit defect detection method in the embodiment of the present application when executed by a processor.
[0146] The above disclosure is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field can easily think of changes or modifications within the technical scope disclosed in the present invention, and they should all be covered by the scope of protection of the present invention.
Claims
1. A pit defect detection method, characterized in that: The detection method comprises: Acquire multiple grayscale images of normal electrolytic cell metal plates; An upper tolerance grayscale image and a lower tolerance grayscale image are obtained based on multiple grayscale images of normal electrolytic cell metal plates, specifically including: Convert each normal grayscale image of the electrolytic cell metal plate into a two-dimensional array. The specific conversion formula is: Value (x,y) =Img(x,y); Among them, Img(x,y) represents the grayscale value of the pixel point (x,y) in the grayscale image of the normal electrolytic cell metal plate; Value (x,y) Represents the numerical value corresponding to the row index x and column index y in the two-dimensional array; Determine the maximum and minimum values at each index position based on all two-dimensional arrays; Generate an upper tolerance grayscale image based on the maximum value of each index position, and generate a lower tolerance grayscale image based on the minimum value of each index position; Acquire a grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the process of acquiring the grayscale image of the metal plate of the electrolytic cell to be inspected is completely consistent with the process of acquiring the grayscale image of the metal plate of a normal electrolytic cell; Comparing the grayscale image of the metal plate of the electrolytic cell to be inspected with the upper tolerance grayscale image, and selecting a first pixel from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the first pixel is greater than the grayscale value of the corresponding pixel in the upper tolerance grayscale image; Comparing the grayscale image of the metal plate of the electrolytic cell to be inspected with the lower tolerance grayscale image, and selecting a second pixel from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the second pixel is less than the grayscale value of the corresponding pixel in the lower tolerance grayscale image; Merging all first pixel points and all second pixel points according to pixel coordinates to obtain an abnormal pixel point set; It is determined whether a pit defect exists on the metal plate of the electrolytic cell to be inspected based on the abnormal pixel point set.
2. The pit defect detection method according to claim 1, characterized in that: A dual-axis array camera photographing device is used to acquire multiple grayscale images of normal electrolytic cell metal plates. The dual-axis array camera photographing device includes an X-axis motion mechanism, a Y-axis motion mechanism, a linear array camera, and a control module. The X-axis motion mechanism is movably mounted on the Y-axis motion mechanism, and the linear array camera is movably mounted on the X-axis motion mechanism. The control module is connected to the X-axis motion mechanism, the Y-axis motion mechanism, and the linear array camera. The specific process of acquiring each normal electrolytic cell metal plate grayscale image includes: The control module moves the linear array camera to the scanning starting position by controlling the X-axis motion mechanism and the Y-axis motion mechanism; Trigger the linear array camera to start collecting images, and each time the linear array camera moves, a frame of linear array scanning is triggered; When the linear array camera moves to the scanning end position, the linear array camera is controlled to stop collecting images, and all frames of linear array scanning results are spliced and grayscale converted to obtain a normal grayscale image of the electrolytic cell metal plate.
3. The pit defect detection method according to claim 1 or 2, characterized in that: Judging whether a pit defect exists on the metal plate of the electrolytic cell to be inspected according to the abnormal pixel point set includes: For any two pixels in the abnormal pixel set, determine whether the two pixels are connected; Determine a connected branch based on the connected relationship between any two pixels in the abnormal pixel set; wherein all pixels on each connected branch are connected; When the number of pixels on the connected branch is greater than or equal to a quantity threshold, the area corresponding to the connected branch is a pit area; when the number of pixels on the connected branch is less than the quantity threshold, the area corresponding to the connected branch is a noise point.
4. The pit defect detection method according to claim 3, characterized in that: When any two pixels in the abnormal pixel set satisfy the following inequality, the two pixels are connected: xi-xj≤△d and yi-yj≤△d; Among them, (xi,yi) represents the pixel coordinates of one pixel point, (xj,yj) represents the pixel coordinates of the other pixel point, i≠j, and △d represents the pixel distance threshold.
5. A pit defect detection system, characterized in that: The detection system comprises: An image acquisition unit, configured to acquire multiple grayscale images of normal electrolytic cell metal plates; and to acquire grayscale images of the electrolytic cell metal plates to be inspected; wherein the grayscale image acquisition process of the electrolytic cell metal plates to be inspected is identical to the grayscale image acquisition process of the normal electrolytic cell metal plates; An image processing unit is configured to obtain a plurality of normal grayscale images of the electrolytic cell metal plates from the image acquisition unit; and obtain an upper tolerance grayscale image and a lower tolerance grayscale image based on the plurality of normal grayscale images of the electrolytic cell metal plates, specifically comprising: Convert each normal grayscale image of the electrolytic cell metal plate into a two-dimensional array. The specific conversion formula is: Value (x,y) =Img(x,y); Among them, Img(x,y) represents the grayscale value of the pixel point (x,y) in the grayscale image of the normal electrolytic cell metal plate; Value (x,y) Represents the numerical value corresponding to the row index x and column index y in the two-dimensional array; Determine the maximum and minimum values at each index position based on all two-dimensional arrays; Generate an upper tolerance grayscale image based on the maximum value of each index position, and generate a lower tolerance grayscale image based on the minimum value of each index position; Used to obtain a grayscale image of the metal plate of the electrolytic cell to be inspected from the image acquisition unit; compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the upper tolerance grayscale image, and filter out a first pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the first pixel point is greater than the grayscale value of the corresponding pixel point in the upper tolerance grayscale image; compare the grayscale image of the metal plate of the electrolytic cell to be inspected with the lower tolerance grayscale image, and filter out a second pixel point from the grayscale image of the metal plate of the electrolytic cell to be inspected; wherein the pixel value of the second pixel point is less than the grayscale value of the corresponding pixel point in the lower tolerance grayscale image; Merging all first pixel points and all second pixel points according to pixel coordinates to obtain an abnormal pixel point set; It is determined whether a pit defect exists on the metal plate of the electrolytic cell to be inspected based on the abnormal pixel point set.
6. The pit defect detection system according to claim 5, characterized in that: The image acquisition unit is a dual-axis array camera photographing device, which includes an X-axis motion mechanism, a Y-axis motion mechanism, a linear array camera and a control module. The X-axis motion mechanism is movably arranged on the Y-axis motion mechanism, and the linear array camera is movably arranged on the X-axis motion mechanism; the control module is connected to the X-axis motion mechanism, the Y-axis motion mechanism and the linear array camera.
7. An electronic device comprising a memory, a processor, and a computer program / instruction stored in the memory, characterized in that: The processor executes the computer program / instructions to implement the pit defect detection method according to any one of claims 1 to 4.
8. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the pit defect detection method according to any one of claims 1 to 4 is implemented.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the pit defect detection method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and storage medium
CN112884071A
Quality detection method for wafer matched with solid state disk
CN116740058A
Defect detection system and method, storage medium and electronic equipment
CN117058078A