Film capacitor production appearance defect detection method based on image processing

By combining adaptive threshold segmentation and multi-scale edge detection with dynamic mesh analysis, the problem of insufficient detection accuracy and real-time performance in thin-film capacitor production is solved, achieving efficient defect identification and rejection, and improving production efficiency and quality control.

CN120807456AInactive Publication Date: 2025-10-17WUXI CHENRUI NEW ENERGY TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510943140.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-10-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The current production of film capacitors suffers from insufficient detection accuracy, poor dynamic adaptability, and insufficient real-time performance, resulting in high false detection rate, high missed detection rate, and low production efficiency.

Method used

Adaptive threshold segmentation combined with morphological filtering is used for target foreground extraction, multi-scale Sobel operator and Canny edge detection are used for defect identification, and dynamic mesh analysis and real-time output control are combined to remove defects by linkage with the robotic arm through OPC UA protocol.

Benefits of technology

It achieves high-precision defect identification, reduces the false detection rate of burrs and protrusions, improves production efficiency, meets the real-time requirements of high-speed production lines, and enhances quality control capabilities through blockchain evidence storage technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120807456A_ABST
    Figure CN120807456A_ABST
Patent Text Reader

Abstract

The invention discloses a thin film capacitor production appearance defect detection method based on image processing, and relates to the technical field of computer vision and image processing. In order to solve the problems of high labor intensity and low efficiency of a traditional manual visual inspection method, automatic detection is realized through an image processing technology in order to overcome the defects of surface unevenness, burrs, blank leaving, edge protrusion and the like caused by process reasons in the manufacturing process of the thin film capacitor. The method comprises the following core steps: firstly, extracting a target foreground and eliminating background interference, and accurately positioning a capacitor target area by using horizontal and vertical projection; and then effectively identifying the surface defects by combining edge detection and gradient detection technologies. The method has the characteristics of low algorithm complexity and high operation speed, can meet the real-time detection requirement of the production line, and has good adaptability and high detection precision.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer vision and image processing, and particularly relates to a film capacitor production appearance defect detection method based on image processing. BACKGROUND

[0002] As a core component of electronic devices, film capacitors have seen a surge in demand in the fields of new energy vehicles and photovoltaics, and their appearance defects (such as unevenness, burrs, white space and edge protrusions) directly affect product reliability and service life. Currently, the mainstream detection still relies on manual visual inspection, which has problems such as high labor intensity, low efficiency (less than 500 pieces per hour per person), and high false detection rate of up to 15-30%. Although some automated solutions use machine vision technology, they are generally limited by incomplete background interference removal, insufficient recognition accuracy of small defects (such as burr detection rate > 40% for defects less than 0.1 mm), and poor real-time performance on high-speed production lines (processing delay > 100 ms), making it difficult to meet the industrial detection needs of 60 billion film capacitors per year.

[0003] Chinese patent CN104359920B "Image processing method for film capacitor appearance defect detection" proposes a core solution based on target foreground extraction and projection positioning, which specifically includes: due to process reasons, the surface of the capacitor may have defects such as unevenness, burrs, white space and edge protrusions during the manufacture of the film capacitor by the manufacturer. The traditional method uses manual visual inspection to detect defects on the surface of the capacitor, which has high labor intensity and low efficiency. The present application first removes unnecessary background using target foreground extraction, obtains the target capacitor area through horizontal and vertical projection, and then performs edge detection and gradient detection.

[0004] Based on the deficiencies of CN104359920B patent, the current technology faces three key problems: Precision defects: fixed threshold segmentation and single-scale gradient detection cannot adapt to the reflectivity differences of materials such as metallized film and polymer-based film, resulting in a false detection rate of > 25% for white space defects (low gray area); Poor dynamic adaptability: the existing projection positioning does not introduce a motion compensation mechanism, and when the production line speed is ≥1 m / s, the boundary box drifts by 5-8 pixels, causing defects to be missed; Real-time performance and function fragmentation: online sorting and data tracing capabilities are not integrated, such as the lack of coordinate mapping mechanism and OPC UA protocol interface in the comparison file, which cannot be linked to a robotic arm to remove defective products in real time (delay > 200 ms), and the detection report does not bind key production data such as temperature and humidity, process parameters, etc., which restricts quality tracing. SUMMARY

[0005] In view of the above existing problems, the present application is proposed.

[0006] Therefore, the application provides a method for detecting appearance defects of thin film capacitors based on image processing, which solves the problems of precision defects, poor dynamic adaptability, real-time performance and functional fragmentation.

[0007] To solve the above technical problems, the application provides the following technical solutions. In a first aspect, the application provides a method for detecting appearance defects of thin film capacitors based on image processing, comprising the following steps: S1. Target foreground extraction: collect original images of moving thin film capacitors, extract the target foreground by adaptive threshold segmentation combined with morphological filtering, and eliminate the background of the conveying belt and environmental interference; S2. Accurate projection positioning: perform horizontal projection and vertical projection analysis on the foreground target, determine the accurate bounding box of the capacitor according to the projection extreme points, and the positioning error is ≤±3 pixels; S3. Edge-gradient joint detection: calculate the edge gradient amplitude using a multi-scale Sobel operator, extract the defect contour features combined with Canny edge detection, and perform bidirectional scanning to identify burr and protrusion defects within the positioning area; S4. Surface flatness analysis: divide the capacitor surface into 0.5mm×0.5mm grids, calculate the gray variance value of each grid unit, and mark the area with variance exceeding the threshold value as concave-convex defects; S5. Defect classification decision: based on multi-feature fusion, for burr defects, the edge gradient amplitude is required to be greater than 200 gray levels and the contour aspect ratio is required to be greater than 5:1, for white space defects, the grid gray variance is required to be less than 15 and the average gray value is required to be more than 30% lower than the adjacent area, and for edge protrusions, the number of continuous interruption points found by bidirectional scanning is required to be more than 3 and the height difference is required to be greater than 8 pixels; S6. Real-time output control: map the defect image coordinates to the mechanical arm coordinate system, send accurate removal instructions to the actuator through the industrial OPC UA protocol, and generate a detection report containing the defect type, position coordinates and size parameters and upload it to the production management system.

[0008] As the method for detecting appearance defects of thin film capacitors based on image processing according to the application A preferred scheme, wherein: the target foreground extraction of step S1 comprises: In the target foreground extraction step, an improved adaptive threshold algorithm is used for image segmentation, and the best threshold value is determined by iteratively calculating the maximum value of the inter-class variance wherein , , is the proportion of foreground / background pixels, , is the intra-class mean, is the global mean); After segmentation, morphological filtering is performed, a 5*5 circular structure is used for opening operation, closing operation is performed after eliminating ≤3 pixel noise, filling ≤2 pixel holes, and processing time ≤8ms / frame.

[0009] As the method for detecting appearance defects of a thin film capacitor in production based on image processing A preferred solution, wherein: the step S2 of accurate projection positioning comprises: The horizontal projection function is defined as , wherein B is a binary image, W is the width of the image, and the vertical projection function , wherein H is the height of the image; The boundary box determination rule is: the left boundary , the right boundary , the upper boundary , and the lower boundary ; A speed compensation algorithm is introduced for high-speed motion blur: when the line speed ≥1m / s, the boundary coordinates are offset compensated according to the motion direction , wherein k=0.25 is the calibration coefficient, v is the speed of the conveying belt, , and the exposure time is ensured to be within ±3 pixels, so that the positioning error is stable.

[0010] As the method for detecting appearance defects of a thin film capacitor in production based on image processing A preferred solution, wherein: the step S3 of edge-gradient joint detection comprises: Multi-scale Sobel operator uses three groups of convolution kernels of 3*3, 5*5 and 7*7 to calculate gradient amplitude in parallel, wherein the 3*3 kernel detects high-frequency detail response 0.05-0.2mm defect, the 5*5 kernel covers medium-frequency feature 0.2-0.5mm defect, and the 7*7 kernel captures low-frequency profile >0.5mm defect; The gradient amplitude fusion formula is +0.1 , and the effective edge points of gray levels are retained; Canny edge detection parameters are dynamically configured: the size of the Gaussian filter kernel is , wherein v is the line speed, the unit is m / s, and the double threshold is the average gray scale of the image, ; The bidirectional scanning execution process is: 100 equidistant sampling points are extracted along the capacitor boundary, the slope difference of adjacent points is calculated in the clockwise direction, and the slope difference of adjacent points is calculated in the counterclockwise direction. When three consecutive sampling points meet When the cumulative arc length is ≥0.5mm, it is marked as a burr. $ and highly mutated Pixels are marked as protrusions; The scanning process integrates motion compensation and corrects the sampling point coordinates in real time according to the speed compensation formula.

[0011] As a method for detecting appearance defects in film capacitor production based on image processing according to the present invention A preferred solution, wherein: the surface flatness analysis in step S4 is specifically as follows: The grid division adopts a dynamic calibration mechanism, which takes the actual physical size of the capacitor as the benchmark and The mapping relationship between the pixel coordinates of the bounding box and the physical size is used to divide the capacitor surface into P × Q physical grid units of 0.5 mm × 0.5 mm, where P is the number of grids divided along the length direction of the capacitor surface and Q is the number of grids divided along the width direction of the capacitor surface. Grayscale variance of each grid cell The calculation satisfies the formula: Where n is the number of pixels in the grid, is the pixel grayscale value, is the average grayscale of the grid; Variance threshold Dynamic setting based on the reflectivity of the capacitor surface material: In the formula is the mean reflectance of the calibration sample, =0.8, =10 is the empirical coefficient; When marking the variance exceeding limit grid, the continuous exceeding limit areas are merged by region growth. When the merged area is ≥0.25mm², it is determined to be a valid concave-convex defect.

[0012] As a method for detecting appearance defects in film capacitor production based on image processing according to the present invention A preferred solution, wherein: the defect classification decision in step S5 is specifically: Burr defect verification: In candidate areas with contour aspect ratio > 5:1 and gradient amplitude > 200 gray levels, Perform local Hough transform to detect straight line segments. When the number of straight line segments with an angle greater than 45° to the main edge and a length greater than 0.1 mm is detected to be ≥ 2, a burr defect is confirmed. Blank defect judgment: the "adjacent area" is defined as an eight-neighborhood area extending from the target grid as the center Domain, the average gray value calculation needs to exclude the marked defect area, when the target grid meets Wherein The average gray of the target grid is The average gray of the adjacent grid is, and the target variance 5 triggers secondary verification: edge density detection is performed in the target grid, and if the edge pixel ratio is <5%, it is finally determined as a blank defect; Edge protrusion confirmation: the continuity breakpoint detection uses sub-pixel edge positioning, and the height difference Measurement Satisfies Wherein The measured height is The reference height is determined by the ideal edge equation fitted by the least square method.

[0013] As the method for detecting appearance defects of a thin film capacitor in production based on image processing A preferred solution, wherein: the real-time output control of step S6 specifically includes: Establish a double nonlinear mapping model of the image coordinate system (u, v) and the mechanical arm world coordinate system (x, y, z), and solve the mapping coefficients by nine-point calibration , Satisfies Where (u, v) is the defect image coordinate, and (x, y) is the mechanical arm plane coordinate; The lifting compensation of z= is set for burr defects, and the depression compensation of z= is set for protrusion defects, The reference height is; The mapping error compensation uses the RANSAC algorithm to remove coordinate abnormal points caused by vibration, so that the mapping positioning accuracy is ≤±0.05mm; Through the industrial OPC UA protocol, an instruction transmission frame is constructed, the transmission period is ≤10ms, and the response delay is <50ms; Generate a structured detection report, the data body contains defect ID, defect type enumeration value, three-dimensional position coordinates, size parameter, timestamp, material batch number, push to the MES system through the MQTT protocol, and store with the production order number, equipment ID, and process parameter binding.

[0014] As the method for detecting appearance defects of a thin film capacitor in production based on image processing A preferred solution, wherein: the real-time output control of the step S6 includes: After the mechanical arm receives the OPC UA instruction, a differentiated grabbing strategy is activated according to the defect type: for burr defects, a vacuum suction nozzle is used to contact the position 0.2 mm above the target point with a suction force of ≤5N; for protrusion defects, a three-finger gripper is switched to accurately grab the root of the protrusion with a clamping force of 8-10N, wherein N refers to Newton, the unit of force value, 1N = 1 kg·m / s², indicating the size of the grabbing force applied by the mechanical arm; Collision detection is performed before the action, the Euclidean distance between the mechanical arm path and the adjacent capacitor is calculated in real time, if the distance is <2mm, an obstacle avoidance trajectory is automatically generated, that is, a cubic Bezier curve interpolation; the elimination success rate is ≥99.5%, and the single action cycle is ≤0.5 seconds; When uploading the detection report, automatically associate the real-time data of the production line: including the environmental temperature and humidity range 20-26℃ / 45-65%RH, the equipment vibration amplitude ≤0.02g, the current process parameter winding tension 8-12N, the heat treatment temperature 115±5℃, when the environment is detected to be out of standard, mark the reliability warning mark in the report; all data is stored in encrypted JSON format and uploaded to the MES system block chain storage node through HTTPS protocol, and a data integrity check code is generated every 10 minutes.

[0015] In a second aspect, the present application provides a computer device comprising a memory and a processor, the memory storing a computer program, wherein the computer program, when executed by the processor, implements any step of the method for detecting appearance defects in the production of thin film capacitors based on image processing according to the first aspect of the present application.

[0016] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any step of the method for detecting appearance defects in the production of thin film capacitors based on image processing according to the first aspect of the present application.

[0017] The beneficial effects of the present application are significantly reflected in three core aspects: In terms of detection accuracy, through multi-scale Sobel operator fusion detection and dynamic verification mechanism (such as Hough straight line segment verification for burr defects, eight-neighborhood gray scale comparison and edge density secondary filtering for blanking defects), accurate identification of small defects is realized, the detection accuracy of burrs and protrusions is improved to 93.2%, the misjudgment rate of blanking defects is compressed to within 1.5%, which is improved by more than 65% compared with the prior art. At the same time, the motion blur compensation algorithm (according to the line speed to correct the boundary box positioning in real time) ensures that the positioning error is stably controlled within ±3 pixels under high-speed running conditions, and the material adaptive threshold technology effectively overcomes the difference in reflectivity between the metallized area and the polymer base film, so that the missing detection rate of concave and convex defects is less than 0.8%. At the industrial real-time level, the full-process processing speed is optimized: the target extraction link adopts parallel morphological filtering to compress the time consumption to within 8 ms, the edge detection is shortened to 10 ms through three-scale Sobel operator hardware acceleration, and the surface flatness analysis only needs 15 ms by using GPU parallel computing grid gray variance. This efficient processing chain supports the continuous operation of the production line at a speed of ≥1 m / s (1800 products per hour). The rejection response closed-loop system realizes 10 ms level instruction transmission through OPC UA protocol, combined with the adaptive grabbing strategy of the mechanical arm (intelligent switching of vacuum suction nozzle and three-finger gripper) to control the single action cycle within 0.5 seconds, which is 5 times more efficient than the traditional scheme. At the industrial value level, the present scheme creates significant economic benefits and quality control innovation: after completely replacing manual visual inspection, a single production line can save about 3.2 million yuan in labor costs per year (based on 20 quality inspectors). The yield is improved by more than 3%, which is due to the binding and tracing of 11 key parameters (including environmental temperature and humidity, equipment vibration amplitude, winding tension, heat treatment temperature, material batch, etc.) by the blockchain storage technology, forming a data closed loop from defect detection to process optimization. The deep integration of the detection report and the MES system (through encrypted JSON data and HTTPS transmission) not only meets the IATF 16949 quality traceability requirements, but also provides real-time reliability warning for the production line, such as automatically triggering an alarm when the environmental temperature exceeds the range of 20-26℃ or the winding tension deviates from the threshold of 8-12N, thereby reducing the batch quality risk from the root. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creating laborious work.

[0019] Figure 1 A flowchart of a method for detecting appearance defects of thin film capacitors based on image processing. DETAILED DESCRIPTION

[0020] In order to make the above-mentioned purposes, features and advantages of the present application more apparent and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the drawings of the specification.

[0021] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application, but the present application can also be implemented in other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of the present application, therefore the present application is not limited by the specific embodiments disclosed below.

[0022] Second, the "one embodiment" or "an embodiment" referred to herein means a specific feature, structure, characteristic, or combination of features and / or characteristics, which can be included in at least one implementation of the present application. The various appearances of "in one embodiment" or "in an embodiment" in the specification are not necessarily all referring to the same embodiment, although they can.

[0023] Referring to FIG. 1, for one embodiment of the present application, the embodiment provides a method for detecting appearance defects of thin film capacitors in production based on image processing, including the following steps: S1. Target foreground extraction: collect original images of moving thin film capacitors, extract target foreground by adaptive threshold segmentation combined with morphological filtering, and eliminate conveyor belt background and environmental interference; S2. Projection accurate positioning: perform horizontal projection and vertical projection analysis on the foreground target, determine the accurate bounding box of the capacitor according to the projection extreme points, and the positioning error is ≤±3 pixels; S3. Edge-gradient joint detection: calculate the edge gradient amplitude using a multi-scale Sobel operator, extract defect contour features combined with Canny edge detection, and perform bidirectional scanning to identify burr and protrusion defects within the positioning area; S4. Surface flatness analysis: divide the capacitor surface into 0.5mm x 0.5mm grids, calculate the gray variance value of each grid unit, and mark the area with variance exceeding the threshold value as concave-convex defects; S5. Defect classification decision: based on multi-feature fusion, for burr defects, the edge gradient amplitude is required to be greater than 200 gray levels and the contour aspect ratio is required to be greater than 5:1, for white space defects, the grid gray variance is required to be less than 15 and the average gray value is required to be more than 30% lower than the adjacent area, and for edge protrusions, the number of continuity interruption points found by bidirectional scanning is required to be more than 3 and the height difference is required to be greater than 8 pixels; S6. Real-time output control: map the defect image coordinates to the mechanical arm coordinate system, send accurate removal instructions to the actuator through the industrial OPC UA protocol, and synchronously generate a detection report containing defect type, location coordinates, and size parameters and upload it to the production management system.

[0024] The target foreground extraction of step S1 includes: In the target foreground extraction step, an improved adaptive threshold algorithm is used for image segmentation, and the best threshold value is determined by iteratively calculating the maximum value of inter-class variance wherein , , is the proportion of foreground / background pixels, , is the intra-class mean, For global mean value) After segmentation, morphological filtering is performed, a 5x5 circular structure is used for opening operation, ≤3 pixel noise is removed, and then closing operation is performed, ≤2 pixel holes are filled, and the processing time is ≤8 ms / frame.

[0025] The projection accurate positioning of step S2 includes: The horizontal projection function is defined as , where B is a binary image, W is the image width, and the vertical projection function , where H is the image height. The boundary box determination rule is: the left boundary , the right boundary , the upper boundary , and the lower boundary . A speed compensation algorithm is introduced for high-speed motion blur: when the line speed ≥1 m / s, a offset compensation is applied to the boundary coordinates according to the motion direction, where k=0.25 is the calibration coefficient, v is the conveyor belt speed, is the exposure time, which ensures that the positioning error is stable within ±3 pixels.

[0026] The edge-gradient joint detection of step S3 includes: Multi-scale Sobel operator uses 3x3, 5x5, and 7x7 convolution kernels to calculate gradient amplitude in parallel, where 3x3 kernel detects high-frequency detail response 0.05-0.2mm defect, 5x5 kernel covers medium-frequency feature 0.2-0.5mm defect, and 7x7 kernel captures low-frequency profile >0.5mm defect; The gradient amplitude fusion formula is +0.1 , and the effective edge points of gray level are retained; Canny edge detection parameters are dynamically configured: the Gaussian filter kernel size , where v is the line speed in m / s, and the double threshold is the average gray level of the image. ; The bidirectional scanning execution process is: along the capacitance boundary, 100 equidistant sampling points are extracted, the slope difference of adjacent points is calculated in clockwise direction , and the slope difference of adjacent points is calculated in counterclockwise direction ; When the continuous 3 sampling points meet and the cumulative arc length ≥0.5mm, it is marked as burr, and when it meets and the height mutation pixel, it is marked as protrusion; The scanning process integrates motion compensation, and the sampling point coordinates are corrected in real time according to the speed compensation formula.

[0027] The surface flatness analysis of step S4 is specifically: The grid division adopts a dynamic calibration mechanism, taking the actual physical size of the capacitor as the benchmark, and through the mapping relationship between the pixel coordinates and the physical size of the bounding box, the capacitor surface is equally divided into P x Q physical grid units of 0.5 mm x 0.5 mm, wherein P is the number of grid divisions along the length direction of the capacitor surface, and Q is the number of grid divisions along the width direction of the capacitor surface. The gray variance of each grid unit The gray variance of each grid unit The formula is satisfied: Wherein n is the number of pixels in the grid, is the pixel gray value, is the average gray value of the grid; The variance threshold According to the reflectivity of the capacitor surface material, the reflectivity is dynamically set: In the formula is the average reflectivity of the calibration sample, = 0.8, = 10 is an empirical coefficient; When the variance exceeding grid is marked, the regional growth and merging of the continuous exceeding area are performed, and when the area of the merged area is greater than or equal to 0.25 mm2, it is determined as an effective concave-convex defect.

[0028] The defect classification decision of step S5 is specifically: Burr defect verification: in the candidate area with a contour length-width ratio > 5:1 and a gradient amplitude > 200 gray levels, Perform local Hough transform to detect straight line segments, and when the number of straight line segments with an angle > 45° with the main edge and a length > 0.1 mm is greater than or equal to 2, the burr defect is confirmed; Blank defect determination: the "adjacent area" is defined as an eight-neighborhood area expanded with the target grid as the center , and the average gray value calculation needs to exclude the marked defect area, when the target grid satisfies , wherein is the average gray value of the target grid, is the average gray value of the adjacent grid, and the target variance 5 triggers secondary verification: edge density detection is performed in the target grid, and if the edge pixel ratio is less than 5%, it is finally determined as a blank defect; Edge protrusion confirmation: the continuity breakpoint detection adopts sub-pixel edge positioning, and the height difference measurement satisfies , wherein is the measured height, is the reference height, and the reference position is determined by the ideal edge equation fitted by the least square method.

[0029] The real-time output control of step S6 specifically includes: A double nonlinear mapping model of the image coordinate system (u, v) and the mechanical arm world coordinate system (x, y, z) is established, and the mapping coefficients are solved by nine-point calibration method , , satisfying where (u, v) is the defect image coordinate, and (x, y) is the mechanical arm plane coordinate; The lifting compensation of z= is set for the burr defect, and the depression compensation of z= is set for the protrusion defect, is the reference height; The mapping error compensation adopts the RANSAC algorithm to remove the coordinate abnormal points caused by vibration, so that the mapping positioning accuracy is ≤±0.05 mm; An instruction transmission frame is constructed through the industrial OPC UA protocol, the transmission period is ≤10 ms, and the response delay is <50 ms; A structured detection report is generated, the data body contains defect ID, defect type enumeration value, three-dimensional position coordinate, size parameter, timestamp, material batch number, is pushed to the MES system through the MQTT protocol, and is stored by binding with the production order number, equipment ID and process parameter.

[0030] The elimination instruction execution process in the real-time output control of step S6 includes: After the mechanical arm receives the OPC UA instruction, the differentiated grabbing strategy is activated according to the defect type: for the burr defect, a vacuum suction nozzle is used to contact the position 0.2 mm above the target point with ≤5N suction force, and for the protrusion defect, a three-fingered gripper is switched to accurately grab the root of the protrusion with 8-10N clamping force, wherein N refers to Newton, the unit of force value, 1N = 1 kg·m / s², indicating the size of the grabbing force applied by the mechanical arm; Collision detection is performed before the action is performed, the Euclidean distance between the mechanical arm path and the adjacent capacitor is calculated in real time, if the distance is <2 mm, an obstacle avoidance trajectory, i.e. a cubic Bezier curve interpolation, is automatically generated; the elimination success rate is ≥99.5%, and the single action period is ≤0.5 seconds; When the detection report is uploaded, the production line real-time data is automatically associated: including the environmental temperature and humidity range 20-26℃ / 45-65%RH, the equipment vibration amplitude ≤0.02g, the current process parameter winding tension 8-12N, the heat treatment temperature 115±5℃, when the environment is detected to be out of standard, the reliability warning mark is marked in the report; all data is stored in encrypted JSON format and uploaded to the MES system block chain storage node through HTTPS protocol, and data integrity check code is generated every 10 minutes.

[0031] The following is the workflow and specific implementation of the method embodiment of the film capacitor production appearance defect detection based on image processing: Step 1: Target foreground extraction The industrial camera captures the original image of the moving film capacitor on the transmission belt at a rate of 100 frames per second, and the transmission belt speed is controlled within the range of 0.5-1.2m / s. The improved Otsu adaptive threshold algorithm is used for image segmentation: first, the image gray histogram is calculated iteratively to find the best segmentation threshold that maximizes the variance between foreground and background classes; then a 5x5 circular structural element is used to perform morphological processing, first open operation to eliminate noise points less than 3 pixels, and then close operation to fill internal holes less than 2 pixels. Finally, the binary foreground image excluding the background of the transmission belt is output, and the single-frame processing time is strictly controlled within 8 milliseconds to ensure synchronization with the production line speed.

[0032] Step 2: Projection accurate positioning The horizontal direction projection (pixel value cumulative sum of each row) and vertical direction projection (pixel value cumulative sum of each column) are calculated for the binary foreground image. The bounding box determination rule is: the first position that exceeds 5% of the maximum projection value in the horizontal projection is defined as the upper boundary, and the last position that exceeds 5% is defined as the lower boundary; the first position that exceeds 5% in the vertical projection is defined as the left boundary, and the last position that exceeds 5% is defined as the right boundary. For high-speed motion scenes, when the transmission belt speed ≥1m / s, real-time compensation is applied to the boundary coordinates according to the motion direction: for every 0.1m / s increase in speed, the boundary position is offset by 0.025mm, ensuring that the final positioning error does not exceed ±3 pixels. This compensation parameter is optimized through 200 calibration tests.

[0033] Step 3: Edge-gradient joint detection Three different size Sobel operators are used to calculate the edge gradient in parallel: a small 3x3 kernel captures fine burrs of 0.05-0.2mm, a medium 5x5 kernel covers 0.2-0.5mm defects, and a large 7x7 kernel identifies macro protrusions over 0.5mm. The three-channel results are fused with weights of 0.6:0.3:0.1, and the effective edge points with a fusion gradient value greater than 150 gray levels are retained. The Canny edge detection is performed synchronously, and the size of the Gaussian filter kernel is dynamically adjusted according to the production line speed: for every 0.5m / s increase in speed, the filter kernel is expanded by 0.05 units. In the precise positioning area, bidirectional scanning is performed along the capacitance profile: clockwise to detect burr features with a length exceeding 0.5mm and a slope mutation greater than 0.3, and counterclockwise to capture protrusion defects with a height mutation exceeding 8 pixels and continuous interruption.

[0034] Step 4: Surface flatness analysis The grid is dynamically divided according to the actual physical size of the capacitor: for example, a 10mm x 5mm capacitor is divided into 20 x 10 0.5mm x 0.5mm physical grid cells. The gray variance calculation of each grid uses an extended weighted method: the edge grid is extended outward by 5% of the area for cross-grid sampling, eliminating errors caused by cutting burrs. The variance threshold is set differently according to the material: the threshold for the metallized area is 18, and the threshold for the polymer-based film area is 12. For grid cells exceeding the threshold, eight-neighbor region merging is performed, and only when the merged area is ≥0.25mm² (equivalent to 4 complete grids) and the shape is approximately circular (eccentricity ≤0.7), it is determined as an effective concave-convex defect. The entire process is accelerated using GPU parallel processing, with a processing time of ≤15 milliseconds.

[0035] Step 5: Defect classification decision Burr defects must meet three conditions: gradient amplitude >200 gray levels, profile aspect ratio >5:1, and local Hough transform detects at least two straight line segments with length >0.1mm and angle >45° with the main edge. The blank defect judgment uses a three-level verification: target grid variance <15, average gray value ≤70% of the average value of the neighborhood, and edge pixel ratio <5%, and finally verifies that the continuous low gray area is rectangularly distributed (aspect ratio 1:2 to 2:1). When confirming edge protrusions, first fit the ideal edge curve using the least squares method as a reference, and then detect the vertical deviation of the next 5 sampling points from the reference >8 pixels. Real-time motion compensation is introduced in the decision-making process, and the speed offset parameters from Step 2 are reused to correct the detection coordinates.

[0036] Step 6: Real-time output control The conversion of the defect image coordinates to the robot coordinates adopts a double nonlinear mapping model established by a nine-point calibration method: a calibration board is placed on the working plane of the robot, and the image coordinates and actual coordinates of 9 feature points are collected to solve the conversion coefficients containing cross terms. During execution, the operation is dynamically adjusted according to the defect type: for burr defects, a vacuum suction nozzle is used to quickly suck at a position 0.2 mm above the target point with a suction force of ≤5N; for protrusion defects, a three-finger gripper is switched on to apply a clamping force of 8-10N at the root of the protrusion. Before the action, the robot path and the distance to the adjacent capacitor are calculated in real time, and if the distance is less than 2mm, a cubic Bezier curve obstacle avoidance trajectory is generated. At the same time, a structured detection report is generated, including 11 types of process data such as defect three-dimensional coordinates (including TOP / BOTTOM layer identification), size parameters, environmental temperature and humidity, winding tension, etc., which are uploaded to the MES system blockchain node through HTTPS encryption, and a data fingerprint is generated every 10 minutes to check the integrity.

[0037] The embodiment also provides a computer device suitable for the case of the image processing-based film capacitor production appearance defect detection method, including a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions to realize the image processing-based film capacitor production appearance defect detection method proposed in the above embodiment.

[0038] The computer device can be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be achieved through WIFI, operator network, NFC (near field communication) or other technologies. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.

[0039] The embodiment also provides a storage medium having a computer program stored thereon, the program being executed by a processor to implement a method for detecting appearance defects of a film capacitor in production based on image processing as proposed in the above embodiment; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk or an optical disk.

[0040] In summary, the beneficial effects of the present application are mainly embodied in three core aspects: In terms of detection accuracy, the precise identification of small defects is achieved through multi-scale Sobel operator fusion detection and dynamic verification mechanism (such as Hough straight line segment verification for burr defects, eight-neighborhood gray scale comparison for white space defects, and edge density secondary filtering), which improves the detection accuracy of burrs and protrusions to 93.2%, and reduces the false judgment rate of white space defects to less than 1.5%, which is more than 65% higher than the prior art. At the same time, the motion blur compensation algorithm (real-time correction of boundary box positioning according to line speed) ensures that the positioning error is stably controlled within ±3 pixels under high-speed running conditions, and the material adaptive threshold technology effectively overcomes the reflection difference between the metallized area and the polymer base film, so that the missing detection rate of concave-convex defects is less than 0.8%. In terms of industrial real-time performance, the processing speed of the whole process is optimized: the target extraction link uses parallel morphological filtering to compress the time consumption to less than 8ms, the edge detection is shortened to 10ms through three-scale Sobel operator hardware acceleration, and the surface flatness analysis uses GPU parallel computing grid gray variance only for 15ms. This efficient processing chain supports the continuous operation of the production line at a speed of ≥1m / s (processing 1800 products per hour). The rejection response closed-loop system realizes 10ms-level instruction transmission through OPC UA protocol, and combines with the adaptive grabbing strategy of the mechanical arm (intelligent switching of vacuum suction nozzle and three-finger gripper) to control the single action cycle within 0.5 seconds, which is 5 times more efficient than the traditional scheme. In terms of industrial value, this solution has created significant economic benefits and revolutionized quality control. By fully replacing manual visual inspection, a single production line can save approximately 3.2 million yuan in labor costs annually (based on 20 quality inspectors). Yield has increased by over 3%, thanks to blockchain-based evidence storage and traceability of 11 key parameters (including ambient temperature and humidity, equipment vibration amplitude, winding tension, heat treatment temperature, and material batch), creating a closed-loop data loop from defect detection to process optimization. Deep integration of test reports with the MES system (via encrypted JSON data and HTTPS transmission) not only meets IATF 16949 quality traceability requirements but also provides real-time reliability alerts for the production line. For example, automatic alerts are triggered when the ambient temperature exceeds the 20–26°C range or the winding tension deviates from the 8–12N threshold, mitigating batch quality risks at the root.

[0041] Example 2, referring to Table 1, is the second embodiment of the present invention. To further verify the technical solution of the present invention, the following is the experimental simulation data and analysis of Example 2, which is verified based on the key technical indicators of a method for detecting appearance defects in thin film capacitor production based on image processing: The details are shown in Table 1 below: Table 1: Experimental data on film capacitor appearance defect detection performance Experimental analysis 1. Breakthrough in defect detection capabilities Burr detection: Achieves a 93.2% recognition rate for samples with 0.1mm-level burrs (multi-scale Sobel fusion + Hough line verification), a 31.7% improvement over traditional solutions. All missed samples are boundary burrs (less than 0.05mm) obscured by electrodes. White space misjudgment control: The misjudgment rate is reduced to 1.3% (eight-neighborhood dynamic calculation + edge density filtering). Traditional solutions have a misjudgment rate of 28.6% in metal reflective areas due to fixed thresholds. Protrusion positioning: Sub-pixel edge fitting enables positioning accuracy of ±0.03mm, meeting the needs of precision rejection (three-finger gripper operation tolerance ±0.05mm). 2. Dynamic performance advantages High-speed stability: The motion compensation algorithm controls the positioning error to ±2.8 pixels at a high speed of 1.5m / s (traditional solutions exceed ±8 pixels), ensuring the input accuracy of edge-gradient detection. Real-time performance: 48ms single-frame processing speed (including robot arm command transmission) supports production line operation at 1.2m / s (OPC UA frame period ≤ 10ms). Traditional solutions cannot break the 100ms bottleneck due to the lack of hardware acceleration. 3. System-level benefits Rejection success rate 94.7%: Differentiated grabbing strategy (burr suction nozzle / protruding clamping jaw) combined with Bezier obstacle avoidance trajectory, avoiding collision caused rejection failure. Yield improvement 3.2%: Blockchain binding winding tension traceability out of 12 times tension over limit (> 12N) caused by white space defects, process parameter optimization, continuous yield improvement. Key experimental data Test samples: 2000 thin film capacitors (metallization / base film ratio 1:1) Equipment configuration: Basler acA2440 camera (5 million pixels) / KUKA KR6 robot arm Environmental conditions: temperature 23 ± 2 ℃, humidity 50 ± 5% RH It should be noted that the above examples are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solutions of the present application can be modified or replaced equivalently without departing from the spirit and scope of the present application, which should be covered in the scope of the claims of the present application.

Claims

1. A method for detecting appearance defects in film capacitor production based on image processing, characterized in that: The following steps are involved: S1. Target foreground extraction: Collect the original image of the moving thin-film capacitor and extract the target foreground through adaptive threshold segmentation combined with morphological filtering, eliminating the conveyor belt background and environmental interference; S2. Projection Precision Positioning: Analyze the horizontal and vertical projections of the foreground object and determine the precise bounding box of the capacitor based on the projection extreme points, with a positioning error of ≤±3 pixels. S3. Joint edge-gradient detection: A multi-scale Sobel operator is used to calculate edge gradient amplitudes, combined with Canny edge detection to extract defect contour features. Bidirectional scanning is performed within the localized area to identify burrs and protrusions. S4. Surface Flatness Analysis: Divide the capacitor surface into a 0.5 mm x 0.5 mm grid. Calculate the grayscale variance of each grid cell. Mark areas where the variance exceeds the threshold as concave or convex defects. S5. Defect classification decision: Based on multi-feature fusion, burr defects require an edge gradient amplitude greater than 200 grayscale levels and a contour aspect ratio greater than 5:

1. White space defects require a grid grayscale variance less than 15 and an average grayscale value at least 30% lower than that of adjacent areas. For edge protrusions, bidirectional scanning requires more than three continuous discontinuities and a height difference greater than 8 pixels. S6. Real-time output control: The defect image coordinates are mapped to the robot arm coordinate system, and precise removal instructions are sent to the actuator via the industrial OPC UA protocol. A test report containing defect type, location coordinates, and dimensional parameters is simultaneously generated and uploaded to the production management system.

2. The method for detecting appearance defects in film capacitor production based on image processing according to claim 1, characterized in that , the target foreground extraction in step S1 includes: In the target foreground extraction step, an improved adaptive threshold algorithm is used for image segmentation, and the optimal threshold is determined by iteratively calculating the maximum value of the inter-class variance. in , , is the ratio of foreground / background pixels, , is the intra-class mean, is the global mean); After segmentation, morphological filtering is performed using a 5×5 circular structure for opening, eliminating noise ≤3 pixels, and then closing to fill holes ≤2 pixels. The processing time is ≤8ms / frame.

3. The method for detecting appearance defects in film capacitor production based on image processing according to claim 2, characterized in that The precise projection positioning of step S2 includes: The horizontal projection function is defined as , where B is a binary image, W is the image width, and the vertical projection function is , where H is the image height; The bounding box determination rule is: left boundary , right border , upper boundary , the lower boundary ; Introducing speed compensation algorithm for high-speed motion blur: When the production line speed is ≥1m / s, the boundary coordinates are applied according to the direction of motion. Offset compensation, where k=0.25 is the calibration coefficient, v is the conveyor speed, The exposure time was set to ensure that the positioning error was stable within ±3 pixels.

4. The method for detecting appearance defects in thin film capacitor production based on image processing according to claim 3, characterized in that: The edge-gradient joint detection in step S3 includes: The multi-scale Sobel operator uses three groups of convolution kernels, 3×3, 5×5, and 7×7, to parallelly calculate the gradient amplitude. The 3×3 kernel detects high-frequency detail responses to defects between 0.05 and 0.2 mm, the 5×5 kernel covers mid-frequency features between 0.2 and 0.5 mm, and the 7×7 kernel captures low-frequency contours of defects greater than 0.5 mm. The gradient amplitude fusion formula is: +0.1 ,reserve Grayscale effective edge points; Dynamic configuration of Canny edge detection parameters: Gaussian filter kernel size , where v is the production line speed in m / s, dual threshold The average grayscale of the image, ; The bidirectional scanning process is as follows: 100 equally spaced sampling points are extracted along the capacitor boundary, and the slope difference of adjacent points is calculated in a clockwise direction. , calculated in counterclockwise direction ; When three consecutive sampling points meet When the cumulative arc length is ≥0.5mm, it is marked as a burr. $ and highly mutated Pixels are marked as protrusions; The scanning process integrates motion compensation and corrects the sampling point coordinates in real time according to the speed compensation formula.

5. The method for detecting appearance defects in film capacitor production based on image processing according to claim 4, characterized in that The surface flatness analysis in step S4 is specifically as follows: The grid division adopts a dynamic calibration mechanism, which takes the actual physical size of the capacitor as the benchmark and The mapping relationship between the pixel coordinates of the bounding box and the physical size is used to divide the capacitor surface into P × Q physical grid units of 0.5 mm × 0.5 mm, where P is the number of grids divided along the length direction of the capacitor surface and Q is the number of grids divided along the width direction of the capacitor surface. Grayscale variance of each grid cell The calculation satisfies the formula: Where n is the number of pixels in the grid, is the pixel grayscale value, is the average grayscale of the grid; Variance threshold Dynamic setting based on the reflectivity of the capacitor surface material: In the formula is the mean reflectance of the calibration sample, =0.8, =10 is the empirical coefficient; When marking the variance exceeding limit grid, the continuous exceeding limit areas are merged by region growth. When the merged area is ≥0.25mm², it is determined to be a valid concave-convex defect.

6. The method for detecting appearance defects in thin film capacitor production based on image processing according to claim 5, characterized in that: The defect classification decision in step S5 is specifically: Burr defect verification: In candidate areas with contour aspect ratio > 5:1 and gradient amplitude > 200 gray levels, Perform local Hough transform to detect straight line segments. When the number of straight line segments with an angle greater than 45° to the main edge and a length greater than 0.1 mm is detected to be ≥ 2, a burr defect is confirmed. White space defect determination: The "adjacent area" is defined as the eight-neighborhood area extending from the target grid as the center. The calculation of the average gray value needs to exclude the marked defect area. When the target grid meets ,in is the average grayscale of the target grid, is the average grayscale of the neighborhood grid, and the target variance Trigger secondary verification at 5 o'clock: perform edge density detection within the target grid. If the edge pixel ratio is less than 5%, it is finally determined to be a blank defect; Edge protrusion confirmation: Continuity break point detection uses sub-pixel edge positioning, height difference Measurement satisfy ,in is the measured height, is the reference height, and the reference position is determined by the ideal edge equation fitted by the least squares method.

7. The method for detecting appearance defects in film capacitor production based on image processing according to claim 6, characterized in that The real-time output control of step S6 specifically includes: Establish a dual nonlinear mapping model between the image coordinate system (u, v) and the robot world coordinate system (x, y, z), and solve the mapping coefficients through the nine-point calibration method , ,satisfy Where (u, v) is the coordinate of the defect image, and (x, y) is the coordinate of the robot plane; For burr defects, set z= Lift compensation, set z= for protrusion defects Downward pressure compensation, is the reference height; Mapping error compensation uses the RANSAC algorithm to eliminate coordinate abnormal points caused by vibration, making the mapping positioning accuracy ≤±0.05mm; The command transmission frame is constructed through the industrial OPC UA protocol, with a transmission cycle of ≤10ms and a response delay of <50ms; Generate a structured inspection report. The data body includes defect ID, defect type enumeration value, 3D position coordinates, dimensional parameters, timestamp, and material batch number. It is pushed to the MES system via the MQTT protocol and stored in conjunction with the production order number, equipment ID, and process parameters.

8. The method for detecting appearance defects in film capacitor production based on image processing according to claim 7, characterized in that The process of executing the instruction to be eliminated in the real-time output control of step S6 includes: After receiving OPC UA commands, the robotic arm activates differentiated grasping strategies based on the defect type: for burr defects, a vacuum nozzle is used to contact the target point 0.2 mm above the target point with a suction force of ≤5N. For protrusion defects, a three-finger gripper is used to precisely grasp the protrusion base with a gripping force of 8-10N. N refers to Newton, a unit of force (1N = 1 kg·m / s²), which represents the grasping force applied by the robotic arm. Before executing an action, collision detection is performed and the Euclidean distance between the robot arm path and the adjacent capacitor is calculated in real time. If the distance is less than 2mm, an obstacle avoidance trajectory is automatically generated, i.e., cubic Bezier curve interpolation. The elimination success rate is ≥99.5%, and the single action cycle is ≤0.5 seconds. When the test report is uploaded, it is automatically linked to the real-time data of the production line: including the ambient temperature and humidity range of 20-26℃ / 45-65%RH, the equipment vibration amplitude ≤0.02g, the current process parameters of winding tension 8-12N, and the heat treatment temperature 115±5℃. When the environment is detected to be out of standard, a reliability warning mark will be marked in the report; all data is stored in encrypted JSON format and uploaded to the MES system blockchain evidence node via the HTTPS protocol, and a data integrity check code is generated every 10 minutes.

Citation Information

Patent Citations

  • An image processing method for the detection of appearance defects of thin film capacitors

    CN104359920B