Aluminum shell surface defect detection method
Through the hardware structure that combines a line scan camera with a programmable light source, using alternating cosine fringe patterns and least squares phase calculation, the problem of accuracy in detecting surface defects of lithium battery aluminum shells is solved, the detection accuracy is improved and the cost is reduced.
Patent Information
- Application Number
- CN202410414354.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2025-10-21
AI Technical Summary
Existing technologies make it difficult to accurately distinguish between scratches, pits and other defects on the surface of lithium battery aluminum shells and surface streaks and dirt, resulting in reduced detection accuracy.
The hardware structure is built using a line scan camera and a programmable control light source. Using a 45° angle setting, the light source projects alternating horizontal and vertical cosine fringe patterns. The phase map is calculated using the least squares method to eliminate background texture interference and achieve defect detection.
It improves the accuracy of defect detection, reduces background texture interference, achieves efficient and accurate defect detection, saves human resources and reduces production costs.
Smart Images

Figure CN120820544A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of visual inspection, and in particular to a method for detecting surface defects of an aluminum shell. Background Art
[0002] During the production process of lithium battery aluminum shells, due to process problems, some scratches, pits and other defects will appear on the surface of the aluminum shells. In addition, since the product itself has horizontal stripes and dirt interference, it is easy to affect the accuracy of appearance inspection.
[0003] Existing technologies primarily utilize ordinary light sources and line scan cameras for inspection. Low-angle lighting creates a sense of surface unevenness, making uneven defects appear as varying brightness and darkness, and detecting defects based on this characteristic.
[0004] However, conventional light sources offer poor imaging performance. While they can reveal concave and convex defects at specific angles, these defects and dirt appear as dark features under conventional light sources, while surface streaks and scratches appear as black stripes. These two features appear identical in image quality and are easily confused, reducing detection accuracy. Furthermore, due to the presence of texture interference on the aluminum shell surface, traditional optical solutions struggle to distinguish true defects. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a method for detecting surface defects of aluminum shells, which can accurately detect surface defects such as scratches and pits of lithium battery aluminum shell products during the production process.
[0006] The technical solution adopted by the present invention to solve the technical problem is: a method for detecting surface defects of an aluminum shell, comprising the following steps:
[0007] S1. Build the hardware detection structure; place the camera and the product, and the light source and the product at a set angle; during detection, the product's movement direction is perpendicular to the camera.
[0008] S2. Setting the light source lighting steps; the light source is set with multiple lighting modes, and the multiple lighting modes are cycled and alternately lit;
[0009] S3: The camera scans and captures images. The product moves at a constant speed, and the light source periodically projects four sets of horizontal cosine fringe patterns and four sets of vertical cosine fringe patterns. The camera captures the patterns on the product surface at the same frequency.
[0010] S4, splitting the scanned image; splitting the original image to obtain different longitudinal and transverse stripe images;
[0011] S5. Synthesize the generated stripe patterns; the synthesis method is:
[0012] The grating formula for the projection of cosine fringe light is as follows:
[0013]
[0014] Among them: I i (x, y): light intensity distribution of the i-th grating image; a, b: background and modulated light intensity; The main phase value at point (x, y); δ i : Phase shift value of the i-th image;
[0015] According to the projection grating formula, the following four sets of equations can be obtained:
[0016]
[0017]
[0018]
[0019]
[0020] Using the least squares method, the value of the phase diagram corresponding to each point can be obtained:
[0021]
[0022] Then the values of the phase image are proportionally mapped to 0 to 255.
[0023] Furthermore, in step S1 described in the present invention, the angle between the camera and the product surface is 45°, and the angle between the light source and the product surface is also 45°; the camera is a line scan camera, and the camera uses mirror reflection to collect mirror features; the light source is a programmable control light source; the light source's light-emitting body consists of 16 rows and 32 columns of lamp beads, and each lamp bead can be individually controlled whether to light up; the light source is connected to a light source controller.
[0024] Furthermore, in step S3 of the present invention, the switching frequency of the lighting mode of the light source is consistent with the scanning frequency of the camera, and each row of images of the camera corresponds to a lighting mode of the light source.
[0025] Furthermore, in step S3 described in the present invention, the camera moves and focuses, the center of the light source corresponds to the center of the product, and the light track covers the product; the duration of each pattern is 12μs, the pattern switching frequency is 80Khz, the phase difference between the four groups of horizontal cosine stripes is π / 2, and the phase difference between the four groups of vertical stripes is π / 2.
[0026] Furthermore, in step S4 of the present invention, the stripe pattern is extracted on the original image in alternate lines, and the split image sequence number corresponding to each line is equal to the remainder of the line divided by 8; wherein the longitudinal stripe imaging is a light-dark field transformation, and the transverse stripe imaging is a grayscale transformation.
[0027] The beneficial effects of the present invention are that it solves the defects existing in the background technology, can improve the defect presentation effect, reduce background texture interference, and improve detection accuracy; it replaces manual inspection, can achieve accurate and efficient detection of the defect, save a lot of human resources, and effectively reduce production costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION
[0029] The present invention will now be described in further detail with reference to the accompanying drawings and preferred embodiments. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0030] like Figure 1 The method shown in the figure uses customized structured light composed of lamp beads of different angles and brightness to quickly project horizontal and vertical stripe patterns on the product surface through a set stroboscopic pattern. The line scan camera collects multiple images of the product under different patterns. Through algorithm calculation, an image that shows the surface shape information of the product can be calculated. Defect detection can be performed on the shape image to eliminate the interference of surface texture and improve detection accuracy.
[0031] The specific steps are as follows:
[0032] Step 1: Hardware Setup
[0033] The camera and light source are positioned at a 45° angle to the product surface. A line scan camera, which uses specular reflection to capture product features, is used. The light source is a programmable light source with 32 columns and 16 rows of small LEDs, each individually controllable. The light source is equipped with a dedicated controller. The controller, combined with software, allows for free editing of stripe patterns and supports communication functions such as internal and external trigger modes. The product's motion is perpendicular to the line scan camera, with the camera's long side parallel to the product's long side.
[0034] Step 2: Set the light source lighting steps
[0035] The light source has 8 lighting modes, and the 8 modes are cycled and alternately lit. The first 4 lighting modes are lit in rows, and each lighting mode is lit at intervals of 4 rows; the last 4 lighting modes are lit in columns, and each lighting mode is lit at intervals of 4 columns.
[0036] like,
[0037] The first mode lights up rows 1 to 4 and rows 9 to 12;
[0038] The second pattern lights up rows 3-6 and 11-14;
[0039] The third pattern lights up rows 5-8 and 13-16;
[0040] The fourth mode lights up rows 1-2, rows 7-10, and rows 15-16;
[0041] The fifth mode lights up columns 1-4, columns 9-12, columns 17-20, and columns 25-28;
[0042] The sixth mode lights up columns 3-6, 11-14, 19-22, and 27-30;
[0043] The seventh mode lights up columns 5-8, 13-16, 21-24, and 29-32;
[0044] The eighth mode lights up columns 1-2, 7-10, 15-18, 23-26, and 31-32;
[0045] Then set the frequency of the light source switching mode to the same as the camera scanning line frequency. For example, the light source mode switching frequency is 80Khz, and the line scan camera scanning frequency is also set to 80Khz. This will make each line of the camera image correspond to each lighting mode of the light source.
[0046] Step 3: Line scanning
[0047] The line scan camera and lens can be moved up and down for focus adjustment. The center of the light source must be aligned with the center of the product, ensuring uniform coverage of the light trail. As the product moves at a constant speed, the light source periodically projects four horizontal cosine fringe patterns and four vertical cosine fringe patterns. Each pattern lasts for 12μs, with a switching frequency of 80kHz. The phase difference between the four horizontal cosine fringe patterns is π / 2, and the phase difference between the four vertical fringe patterns is π / 2. The line scan camera captures the pattern on the product surface at the same frequency.
[0048] Step 4: Split the scanned image to obtain vertical and horizontal stripe images.
[0049] The eight fringe images above (four horizontal and four vertical) are created by splitting a single original image into different horizontal and vertical fringe patterns. The vertical fringe patterns are imaged as light-dark field transitions, while the horizontal fringe patterns are imaged as grayscale transitions. The splitting principle: The fringe pattern is extracted from every other row of the original image. The split image number corresponding to each row is equal to the remainder of that row divided by 8.
[0050] Step 5: Calculation method of composite image
[0051] The first four images (horizontal fringe patterns) generate an X-phase image, while the last four images (vertical fringe patterns) generate a Y-phase image. The X-phase image shows vertical variations in concave and convex, while the Y-phase image shows horizontal phase variations. Because the product surface has slight horizontal scratches, the X-phase image was used for defect detection. Horizontal fringe patterns are invisible on the X-phase image, eliminating horizontal fringe overshoot.
[0052] The X-phase effect image is synthesized by using the generated fringe pattern through algorithm calculation. The basic principle of shape image calculation is: the grating formula of the projection of the known cosine fringe light is as follows:
[0053]
[0054] Among them: I i (x, y): light intensity distribution of the i-th grating image; a, b: background and modulated light intensity; φ(x, y): main phase value at point (x, y); δ i : Phase shift value of the i-th image; In this technology, the phase difference between the four groups of stripe light (horizontal cosine stripes) is π / 2. According to the projection grating formula, the following four sets of equations can be obtained:
[0055]
[0056]
[0057]
[0058]
[0059] Using the least squares method, the phase diagram corresponding to each point can be obtained:
[0060]
[0061] Because the phase of each point is only related to the surface normal at that point, pits and scratches have a different normal than the normal area, so they are not visible in the phase image. Dirt and surface texture only have a different surface color than the normal area, but the surface normal is consistent with the normal area, so they are not visible in the phase image.
[0062] Then multiply the value of the phase image by K and add B to map the value proportionally to 0 to 255.
[0063]
[0064] Where A is the grayscale value of the final output image, K is the grayscale amplification factor of the output image, and B is the grayscale compensation value of the output image. K and B are parameters used to adjust the grayscale of the final output image; by adjusting these two values, you can obtain an image with the best defect display effect.
[0065] Step 6: Defect manifestation
[0066] The defect effect diagram of pits and scratches on the aluminum shell surface obtained by the above method is obvious in the diagram, and the defects can be detected by image threshold segmentation.
[0067] The above description only describes specific embodiments of the present invention. Various examples do not limit the essential content of the present invention. After reading the description, ordinary technicians in the relevant technical field can make modifications or variations to the specific embodiments described above without departing from the essence and scope of the invention.
Claims
1. A method for detecting surface defects of an aluminum shell, characterized by: The following steps are included: S1. Build the hardware detection structure; place the camera and the product, and the light source and the product at a set angle; during detection, the product's movement direction is perpendicular to the camera. S2. Setting the light source lighting steps; the light source is set with multiple lighting modes, and the multiple lighting modes are cycled and alternately lit; S3: The camera scans and captures images. The product moves at a constant speed, and the light source periodically projects four sets of horizontal cosine fringe patterns and four sets of vertical cosine fringe patterns. The camera captures the patterns on the product surface at the same frequency. S4, splitting the scanned image; splitting the original image to obtain different longitudinal and transverse stripe images; S5. Synthesize the generated stripe patterns; the synthesis method is: The grating formula for the projection of cosine fringe light is as follows: Where: I i (x, y): light intensity distribution of the i-th grating image; a, b: background and modulated light intensity; φ(x, y): main phase value at point (x, y); δ i : Phase shift value of the i-th image; According to the projection grating formula, the following four sets of equations can be obtained: Using the least squares method, the value of the phase diagram corresponding to each point can be obtained: Then the values of the phase image are proportionally mapped to 0 to 255.
2. The method for detecting surface defects of an aluminum shell according to claim 1, wherein: In step S1, the angle between the camera and the product surface is 45°, and the angle between the light source and the product surface is also 45°; the camera is a line scan camera, and the camera uses mirror reflection to collect mirror features; the light source is a programmable control light source; the light source's illuminator consists of 16 rows and 32 columns of lamp beads, and each lamp bead can be individually controlled to light up; the light source is connected to a light source controller.
3. The method for detecting surface defects of an aluminum shell according to claim 1, wherein: In the step S3, the switching frequency of the lighting mode of the light source is consistent with the scanning frequency of the camera, and each row of images of the camera corresponds to a lighting mode of the light source.
4. The method for detecting surface defects of an aluminum shell according to claim 1, wherein: In step S3, the camera moves and focuses, the center of the light source corresponds to the center of the product, and the light track covers the product; the duration of each pattern is 12μs, the pattern switching frequency is 80Khz, the phase difference between the four groups of horizontal cosine stripes is π / 2, and the phase difference between the four groups of vertical stripes is π / 2.
5. The method for detecting surface defects of an aluminum shell according to claim 1, wherein: In step S4, stripe patterns are extracted from the original image in alternate lines, and the sequence number of the split image corresponding to each line is equal to the remainder of the line divided by 8; the longitudinal stripe imaging is a light-dark field transformation, and the transverse stripe imaging is a grayscale transformation.