Pit defect detection method, system and equipment, storage medium and product
By generating upper and lower tolerance grayscale images and comparing them, abnormal pixel points are selected to judge pit defects, the imaging differentiation problem caused by light source brightness in the prior art is solved, detection efficiency and accuracy are improved, and hardware configuration requirements are reduced.
Patent Information
- Application Number
- CN202411492025.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-10-24
AI Technical Summary
In the prior art, NG images are used as training samples. 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. A large number of training samples lead to an increase in the training calculation amount and high hardware configuration requirements.
By acquiring multiple grayscale images of the metal plates of normal electrolytic cells, a grayscale image of upper tolerance and lower tolerance are generated, a grayscale image of the metal plate of the electrolytic cells to be detected is compared with the upper and lower tolerance images, abnormal pixel points are selected, and a combination is used to determine whether there are pit defects.
This greatly reduces the number of images, improves detection efficiency and detection accuracy, reduces hardware configuration requirements, and solves the problem of differentiation of light source brightness on imaging results.
Smart Images

Figure CN119540149A_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] In the production process of metal plates for PEM (proton exchange membrane) electrolyzers, the shape, depth, and area of the pits on the metal plates vary. In addition, the imaging effect of 2D linear array cameras is highly dependent on the light source, resulting in different imaging of the same pit defect with different light source brightness. At the same time, most methods for detecting pit defects use NG images (i.e., images of products with pits, dents, or grooves) for deep learning. If the image sample data is insufficient, it may affect the detection performance of the deep learning model and cause missed detections. In order to improve the detection performance of the deep learning model, a large amount of image sample data is required. The continuous increase in image sample data leads to an increase in the amount of calculation when training the deep learning model, which places high demands on the hardware configuration of the equipment. Summary of the invention
[0003] The purpose of the present invention is to provide a pit defect detection method, system, device, 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 the different brightness of the light source, which in turn requires a large number of training samples to ensure the detection performance of the deep learning model. However, a 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: Acquire multiple grayscale images of normal electrolytic cell metal plates; An upper tolerance grayscale image and a lower tolerance grayscale image are obtained according to a plurality of normal grayscale images of the electrolytic cell metal plates; Acquire a grayscale image of the metal plate of the electrolytic cell to be detected; wherein the process of acquiring the grayscale image of the metal plate of the electrolytic cell to be detected 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 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; 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 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 point coordinates to obtain an abnormal pixel point set; It is determined whether there is a pit defect on the metal plate of the electrolytic cell to be inspected according to the abnormal pixel point set.
[0005] 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, 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; the specific acquisition process of 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; The linear array camera is triggered 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 frame linear array scanning results are spliced and grayscale converted to obtain a normal grayscale image of the electrolytic cell metal plate.
[0006] Furthermore, an upper tolerance grayscale image and a lower tolerance grayscale image are obtained according to a plurality of grayscale images of normal electrolytic cell metal plates, 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; 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.
[0007] Further, judging whether there is a pit defect 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 according to 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 the number 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 number threshold, the area corresponding to the connected branch is a noise point.
[0008] Furthermore, 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 another pixel point, i≠j, and △d represents the pixel distance threshold.
[0009] Based on the same concept, the present invention provides a pit defect detection system, comprising: An image acquisition unit, used for acquiring a plurality of grayscale images of normal electrolytic cell metal plates; and for acquiring a grayscale image of a metal plate of an electrolytic cell to be detected; wherein the acquisition process of the grayscale image of the metal plate of the electrolytic cell to be detected is completely consistent with the acquisition process of the grayscale image of the metal plate of the normal electrolytic cell; An image processing unit, used for acquiring a plurality of normal grayscale images of the electrolytic cell metal plates from the image acquisition unit; obtaining an upper tolerance grayscale image and a lower tolerance grayscale image according to the plurality of normal grayscale images of the electrolytic cell metal plates; Used to obtain a grayscale image of the metal plate of the electrolytic cell to be detected from the image acquisition unit; compare the grayscale image of the metal plate of the electrolytic cell to be detected 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 detected; 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 detected 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 detected; 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 point coordinates to obtain an abnormal pixel point set; It is determined whether there is a pit defect on the metal plate of the electrolytic cell to be inspected according to the abnormal pixel point set.
[0010] 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 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.
[0011] 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.
[0012] Based on the same concept, the present invention also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the pit defect detection method as described above is implemented.
[0013] Based on the same concept, the present invention also provides a computer program product, including a computer program / instruction, which implements the pit defect detection method as described above when executed by a processor.
[0014] Beneficial Effects Compared with the prior art, the advantages of the present invention are: The present 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 the 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
[0015] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. 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 creative work.
[0016] Figure 1 is a flow chart of a pit defect detection method according to an embodiment of the present invention; Figure 2 is a grayscale image of a metal plate of an electrolytic cell to be inspected in an embodiment of the present invention; Figure 3 is an abnormal pixel point marking image in the abnormal pixel point set in an embodiment of the present invention; Figure 4 is a pit area diagram detected when the quantity threshold is 10 in an embodiment of the present invention; Figure 5 It is the pit detection result in the actual product in the embodiment of the present invention. DETAILED DESCRIPTION
[0017] The following is a clear and complete description of the technical solutions in the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] The technical solution of the present application is described in detail with specific embodiments below. 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.
[0019] Example 1 A pit defect detection method provided by an embodiment of the present invention comprises the following steps: Step 1: Obtain multiple grayscale images of normal electrolytic cell metal plates.
[0020] In a specific embodiment of the present invention, 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, wherein 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 the dual-axis array camera photographing device is used to obtain multiple grayscale images of normal electrolytic cell metal plates, 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 a reset state is as follows: The control module sends a reset electrical signal (e.g. +5V) to the linear scan camera through the motion control card, and the linear scan camera is reset under the triggering of the reset electrical signal; wherein, the linear scan camera reset means clearing the cache data of the linear scan camera. Under the triggering of the reset electrical signal, the linear scan camera can automatically clear the image data in its own cache.
[0021] The 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. The first limit sensors of this embodiment are photoelectric sensors. The specific implementation process of controlling the linear array camera to be at zero position (i.e., the scanning starting position) is as follows: The control module controls the X-axis motion mechanism to work through the motion control card, so that the linear array camera moves along the X direction; when the linear array 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; The control module controls the Y-axis motion mechanism to work through the motion control card, so that the X-axis motion mechanism and the linear array camera 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.
[0022] 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 X-axis motion mechanism and the Y-axis motion mechanism to operate so that the linear array camera is at the scanning end position.
[0023] In a specific embodiment of the present invention, the specific implementation process of using a dual-axis array camera to obtain a grayscale image of each normal electrolytic cell metal plate includes: Step 1.1: Place a normal electrolytic cell metal plate on the detection platform, click the start button, and the control module controls the X-axis motion mechanism and the Y-axis motion mechanism to move the linear array camera to the scanning start position; Step 1.2: The control module sends a +5V start electrical signal to the linear array camera through the motion control card, triggering the linear array camera to start collecting images; Step 1.3: The control module controls the X-axis motion mechanism through the motion control card to move the linear array camera along the X direction, and each time the linear array camera moves, a frame of linear array scanning is triggered; Step 1.4: When the linear array 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 array camera to stop collecting images, that is, the control module sends a +5V stop electrical signal to the linear array camera, and the linear array camera stops collecting images; Step 1.5: The control module performs splicing and grayscale conversion on all frame line array scanning results to obtain a grayscale image of a normal electrolytic cell metal plate.
[0024] The distance that the linear array camera moves each time (i.e., the scanning interval) is determined by the pulse sending frame rate of the control module. In this embodiment, the control module controls the linear array camera to move 0.018 mm and sends 4 pulse signals to the linear array camera. Each time the linear array camera receives 4 pulse signals, it triggers a frame of linear array scanning. By controlling the X-axis motion mechanism to work continuously, the linear array camera will perform linear array scanning at equal intervals to ensure the uniformity of the image. In this embodiment, the result of each frame of linear array scanning is an image with a width of 3200 pixels and a height of 1 pixel. All frames of linear array scanning 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 into a grayscale image. The specific conversion formula is: Img(x,y)=Orimg (x,y) ×255÷4.4 (1) 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~255 is the grayscale value range.
[0025] Each time the linear array camera acquires a complete grayscale image, it moves from the scanning start position to the scanning end position, and the scanning interval is the same. Since each grayscale image of a normal electrolytic cell metal plate and the grayscale image of the electrolytic cell metal plate to be tested are acquired by the same dual-axis array camera photographing 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 and the grayscale image of the electrolytic cell metal plate to be tested are completely consistent, and the same or different grayscale values can be obtained at the same pixel point.
[0026] 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 and titled Dual-axis array camera photographing method, system, device and storage medium.
[0027] Step 2: Obtain an upper tolerance grayscale image and a lower tolerance grayscale image based on multiple grayscale images of normal electrolytic cell metal plates.
[0028] In a specific embodiment of the present invention, obtaining an upper tolerance grayscale image and a lower tolerance grayscale image according to a plurality of normal grayscale images of electrolytic cell metal plates includes: Step 2.1: Convert each grayscale image of a normal electrolytic cell metal plate into a two-dimensional array. The specific conversion formula is: Value (x,y) =Imgi(x,y) (2) Among them, Imgi(x,y) represents the gray value of the pixel (x,y) in the gray image of the i-th 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.
[0029] Step 2.2: Determine the maximum and minimum values at each index position based on all two-dimensional arrays.
[0030] Since each grayscale image of a normal electrolytic cell metal plate is collected 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.
[0031] The maximum value for each index position is: MaxValue (x,y) =Max(Value1 (x,y) ,Value2 (x,y) ,…,Value (x,y) ,…,ValueN (x,y) ) (3) 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.
[0032] The minimum value for each index position is: MinValue (x,y) =Min(Value1 (x,y) ,Value2 (x,y) ,…,Value (x,y) ,…,ValueN (x,y) ) (4) Among them, MinValue (x,y) Indicates the minimum value of the index position (x, y), and Min represents the minimum value function.
[0033] Step 2.3: Generate an upper tolerance grayscale image according to the maximum value of each index position, and generate a lower tolerance grayscale image according to the minimum value of each index position.
[0034] The upper tolerance grayscale image can be expressed as: (5) The lower tolerance grayscale image can be expressed as: (6) Wherein, 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.
[0035] Step 3: Obtain a grayscale image of the metal plate of the electrolytic cell to be inspected.
[0036] 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 normal electrolytic cell metal plate, that is, the scanning start 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 start position, scanning end position and scanning interval of each grayscale image of the metal plate of the normal electrolytic cell. Figure 2A grayscale image of the metal plates of the electrolytic cell to be inspected is shown.
[0037] 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.
[0038] 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 metal plate of the electrolytic cell to be detected, which can be expressed as: UpPixelList (x,y) ={(x,y)|GetGray(MaxImage (x,y) )-GetGray(CurrentImage (x,y) )>0} (7) Among them, UpPixelList (x,y) Indicates the first pixel, GetGray means getting the gray value of the pixel, MaxImage (x,y) Represents the pixel (x, y) in the upper tolerance grayscale image, CurrentImage (x,y) Represents the pixel point (x, y) in the grayscale image of the metal plate of the electrolytic cell to be inspected.
[0039] 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.
[0040] 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 metal plate of the electrolytic cell to be detected, which can be expressed as: DownPixelList (x,y) ={(x,y)|GetGray(MinImage (x,y) )-GetGray(CurrentImage (x,y) )<0}(8) Among them, DownPixelList (x,y) Indicates the second pixel, MinImage (x,y) Represents the pixel (x,y) in the lower tolerance grayscale image.
[0041] Step 6: Merge all first pixel points and all second pixel points according to pixel coordinates to obtain an abnormal pixel point set.
[0042] In this embodiment, the abnormal pixel set can be expressed as: ErrorPixelList=UpPixelList&DownPixelList (9) 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 The abnormal pixels in the abnormal pixel set are marked.
[0043] 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 point set.
[0044] In a specific embodiment of the present invention, judging whether there is a pit defect on the metal plate of the electrolytic cell to be inspected according to the abnormal pixel point set includes: Step 7.1: For any two pixels in the abnormal pixel set, determine whether the two pixels are connected.
[0045] In this embodiment, when any two pixels in the abnormal pixel set satisfy inequality (10), the two pixels are connected: xi-xj≤△d and yi-yj≤△d (10) Wherein, (xi,yi) represents the pixel coordinates of the i-th pixel point, (xj,yj) represents the pixel coordinates of the j-th pixel point, i≠j, and △d represents the pixel distance threshold. In this embodiment, △d is taken as 1. The connection between two pixel points indicates that the two pixel points belong to the same abnormal area on the metal plate of the electrolytic cell to be detected.
[0046] 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.
[0047] Exemplarily, 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.
[0048] Step 7.3: Locate the pit area according to each connected branch.
[0049] 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; 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.
[0050] In a specific embodiment of the present invention, the quantity threshold is determined according to the pit area detection requirement. For example, if the pit area detection requirement is that the pit area is greater than 0.2mm² (i.e., pits with an area greater than 0.2mm² are detected), the number of pixels is calculated according to the pit area, and the size of each pixel is 0.018. The area connected by 10 pixels is equal to 0.18mm², that is, the quantity threshold is set to 10, which can meet the pit area detection requirement. Figure 4 The pit areas detected when the number threshold is 10 are shown.
[0051] Figure 5 The results of pit detection in actual products are shown in Figure 5 It can be seen that the method of the present invention can accurately detect the pits and their specific positions.
[0052] The present invention uses a 2D linear array camera to obtain a grayscale image of a normal electrolytic cell metal plate in a pulse-triggered frame-by-frame scanning manner, establishes a product standard template image (i.e., an upper tolerance grayscale image and a lower tolerance grayscale image) based on the grayscale image of the normal electrolytic cell metal plate, and compares the image color difference, area and other sensitive features of the product to be inspected with the product standard template image to determine whether the product to be inspected has a pit defect. The present invention can mark the pit area, which is more targeted; the abnormal area is usually brighter or darker, and the present invention quickly detects the pit defect through the grayscale difference between the abnormal area and the normal area, greatly reducing the number of images, improving the detection efficiency and detection accuracy, and reducing the hardware configuration requirements.
[0053] Example 2 A pit defect detection system provided by an embodiment of the present invention includes an image acquisition unit and an image processing unit.
[0054] 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 tested; wherein the acquisition process of the grayscale images of the electrolytic cell metal plates to be tested is completely consistent with the acquisition process of the grayscale images of the normal electrolytic cell metal plates; 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; and obtain an upper tolerance grayscale image and a lower tolerance grayscale image according to the plurality of normal grayscale images of the electrolytic cell metal plates; The image processing unit is used to obtain a grayscale image of the metal plate of the electrolytic cell to be detected from the image acquisition unit; compare the grayscale image of the metal plate of the electrolytic cell to be detected 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 detected; 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 detected 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 detected; 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 point coordinates to obtain an abnormal pixel point set; and judge whether there is a pit defect in the metal plate of the electrolytic cell to be detected according to the abnormal pixel point set.
[0055] In a specific embodiment of the present invention, 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. The specific implementation process of using the dual-axis array camera photographing device to obtain each normal grayscale image of the electrolytic cell metal plate includes: Place a normal electrolytic cell metal plate on the detection platform, click the start button, and the control module controls the X-axis motion mechanism and the Y-axis motion mechanism to move the linear array camera to the scanning start position; The control module sends a +5V start electrical signal to the linear array camera through the motion control card, triggering the linear array camera to start collecting images; The control module controls the X-axis motion mechanism through the motion control card to move the linear array camera along the X direction, 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 (i.e., the position corresponding to the second limit sensor of the X-axis motion mechanism), the control module controls the linear array camera to stop collecting images, that is, the control module sends a +5V stop electrical signal to the linear array camera, and the linear array camera stops collecting images; The control module performs splicing and grayscale conversion on all frame line array scanning results to obtain a grayscale image of a normal electrolytic cell metal plate.
[0056] The distance that the linear array camera moves each time (i.e., the scanning interval) is determined by the pulse sending frame rate of the control module. In this embodiment, the control module controls the linear array camera to move 0.018 mm each time, and sends 4 pulse signals to the linear array camera. Each time the linear array camera receives 4 pulse signals, it triggers a frame of linear array scanning; by controlling the X-axis motion mechanism to work continuously, the linear array camera will perform linear array scanning at equal intervals to ensure the uniformity of the image. In this embodiment, the result of each frame of linear array scanning is an image with a width of 3200 pixels and a height of 1 pixel. All frames of linear array scanning 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 into a grayscale image, as shown in formula (1).
[0057] Each time the linear array camera acquires a complete grayscale image, it moves from the scanning start position to the scanning end position, and the scanning interval is the same. Since each grayscale image of a normal electrolytic cell metal plate and the grayscale image of the electrolytic cell metal plate to be tested are acquired by the same dual-axis array camera photographing 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 and the grayscale image of the electrolytic cell metal plate to be tested are completely consistent, and the same or different grayscale values can be obtained at the same pixel point.
[0058] 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 according to a plurality of normal grayscale images of the electrolytic cell metal plates, including: 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); Determine the maximum and minimum values at each index position based on all two-dimensional arrays; 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.
[0059] 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 according to the abnormal pixel point set, including: For any two pixels in the abnormal pixel set, determine whether the two pixels are connected; Determine a connected branch according to the connected relationship between any two pixels in the abnormal pixel set; wherein all pixels on each connected branch are connected; The pit area is located according to each connected branch.
[0060] When the number of pixels on the connected branch is greater than or equal to the quantity threshold, the area corresponding to the connected branch is the 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; 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, which belongs to the non-pit area, that is, the normal area.
[0061] Example 3 An embodiment of the present invention further 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.
[0062] Although not shown, the electronic device includes a processor that can perform various appropriate operations and processes according to the programs and / or data stored in the read-only memory (ROM) or the programs and / or data loaded from the storage part into the 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. In RAM, various programs and data required for device operation are also stored. The processor, ROM, and RAM are connected to each other via a bus. The input / output (I / O) interface is also connected to the bus.
[0063] The processor and the 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.
[0064] Although not shown, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the pit defect detection method in the embodiment of the present application is implemented.
[0065] 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. 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, 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 temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0066] 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.
[0067] What is disclosed above is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or modifications within the technical scope disclosed in the present invention, which should be covered within the protection scope 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 according to a plurality of normal grayscale images of the electrolytic cell metal plates; Acquire a grayscale image of the metal plate of the electrolytic cell to be detected; wherein the process of acquiring the grayscale image of the metal plate of the electrolytic cell to be detected 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 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; 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 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 point coordinates to obtain an abnormal pixel point set; It is determined whether there is a pit defect on the metal plate of the electrolytic cell to be inspected according to 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 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 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; the specific acquisition process of 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; The linear array camera is triggered 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 frame 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, characterized in that: An upper tolerance grayscale image and a lower tolerance grayscale image are obtained according to a plurality of normal grayscale images of the electrolytic cell metal plates, 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; 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.
4. The pit defect detection method according to any one of claims 1 to 3, characterized in that: Judging whether there is a pit defect 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 according to 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 the number 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 number threshold, the area corresponding to the connected branch is a noise point.
5. The pit defect detection method according to claim 4, 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 another pixel point, i≠j, and △d represents the pixel distance threshold.
6. A pit defect detection system, characterized in that: The detection system comprises: An image acquisition unit, used for acquiring a plurality of grayscale images of normal electrolytic cell metal plates; and for acquiring a grayscale image of a metal plate of an electrolytic cell to be detected; wherein the acquisition process of the grayscale image of the metal plate of the electrolytic cell to be detected is completely consistent with the acquisition process of the grayscale image of the metal plate of the normal electrolytic cell; An image processing unit, used for acquiring a plurality of normal grayscale images of the electrolytic cell metal plates from the image acquisition unit; obtaining an upper tolerance grayscale image and a lower tolerance grayscale image according to the plurality of normal grayscale images of the electrolytic cell metal plates; Used to obtain a grayscale image of the metal plate of the electrolytic cell to be detected from the image acquisition unit; compare the grayscale image of the metal plate of the electrolytic cell to be detected 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 detected; 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 detected 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 detected; 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 point coordinates to obtain an abnormal pixel point set; It is determined whether there is a pit defect on the metal plate of the electrolytic cell to be inspected according to the abnormal pixel point set.
7. The pit defect detection system according to claim 6, 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 with the X-axis motion mechanism, the Y-axis motion mechanism and the linear array camera.
8. 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 5.
9. 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 as described in any one of claims 1 to 5 is implemented.
10. 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 as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Silicon chip detection method and device
CN107845090A
Linear array camera-based in-place grinding wheel quick full-field detection method and system
CN108426537A
Detection method and detection system
CN111724335A
Image processing method and device, electronic equipment and storage medium
CN112884071A
Optical detection method and system based on product defect and readable storage medium
CN113674273A
Cited By
Metal plate pit defect detection method and system based on dense connection network
CN121391867A
A metal plate pit defect detection method and system based on a dense connection network
CN121391867B