Thin-film capacitor image pre-detection method and electronic device
By using automated image processing technology, the contour and corner information of the thin-film capacitor substrate are extracted, solving the problem of low efficiency in manual pre-inspection and achieving efficient and accurate electrode sheet detection.
Patent Information
- Application Number
- CN202311047454.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-18
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-08-18
AI Technical Summary
In the current inspection of thin-film capacitor electrode sheets, manual pre-inspection is inefficient and prone to errors, making it difficult to meet the requirements of high-efficiency automation.
By acquiring base film images, contour information is extracted using preset compression and edge extraction algorithms, connected contours are fitted, target contours and corner coordinates are determined, the tilt angle of the base film is automatically detected, and the base film angle is adjusted by rotating the image or camera to meet the preset range.
This technology enables automated pre-inspection of thin-film capacitor electrode sheets, improving inspection efficiency, reducing human error, and ensuring that image quality meets the requirements of subsequent inspections.
Smart Images

Figure CN117274161B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer image processing, in particular to a film capacitor image pre-detection method and electronic equipment. BACKGROUND
[0002] In the manufacturing process of a film capacitor, the electrode sheet (or inner electrode) of the film capacitor usually needs to be detected to ensure the quality of the electrode sheet. The electrode sheet is usually printed on a flexible base film, that is, a base film has a large number of electrode sheets printed thereon. At present, the detection of the electrode sheet usually uses a machine vision algorithm to automatically detect the image area of a single electrode sheet to improve the detection efficiency. This detection method needs to segment the independent electrode sheet image area from the original image, and in the process of segmenting the electrode sheet image area, the original image needs to be pre-detected to ensure that the original image is a valid image. The current pre-detection method is usually manual naked-eye detection, and the pre-detection content includes the inclination angle of the base film in the original image. This pre-detection method is low in efficiency and prone to errors. SUMMARY
[0003] Therefore, the purpose of the embodiments of the present application is to provide a film capacitor image pre-detection method and electronic equipment, which can improve the problems of low efficiency and errors caused by manual image pre-detection.
[0004] To achieve the above technical purpose, the technical solution adopted by the present application is as follows:
[0005] In a first aspect, the embodiments of the present application provide a film capacitor image pre-detection method, which comprises:
[0006] obtaining an original image obtained by shooting a base film, wherein the base film includes a rectangular positioning mark located at a corner point of the base film and a plurality of electrode sheets arranged in an array for manufacturing a film capacitor;
[0007] compressing the original image based on a preset compression ratio to obtain a first image compressed;
[0008] extracting contour information from the first image by a preset edge extraction algorithm;
[0009] fitting the contour information in the first image to obtain a second image with connected contours;
[0010] selecting a contour surrounding the largest area from the second image as a target contour of the base film;
[0011] determining a first position coordinate of a corner point from the target contour;
[0012] convert the first position coordinate of the corner point in the second image into a second position coordinate of a corresponding corner point on the original image according to a preset interpolation algorithm and a preset compression ratio;
[0013] obtain a region containing the rectangular positioning mark from cropping of the original image based on the second position coordinate and a first preset cropping frame, to serve as a first region of interest;
[0014] determine a contour of the rectangular positioning mark from the first region of interest;
[0015] determine an inclination angle of the rectangular positioning mark according to the contour of the rectangular positioning mark, to serve as an inclination angle of the base film in the original image.
[0016] With reference to the first aspect, in some optional embodiments, the method further includes:
[0017] rotate the original image according to the inclination angle of the base film, so that the inclination angle of the base film after rotation is within a first preset angle range;
[0018] Alternatively, rotate a camera that captures the original image, or rotate a bearing table on which the base film is placed, according to the inclination angle of the base film, so that the inclination angle of the base film in an original image captured by the camera after the rotation operation is within the first preset angle range.
[0019] With reference to the first aspect, in some optional embodiments, the contour information is extracted from the first image by a preset edge extraction algorithm, including:
[0020] the first image is subjected to contour extraction by a preset Canny operator, to obtain the contour information of the first image.
[0021] With reference to the first aspect, in some optional embodiments, the contour information in the first image is fitted to obtain a second image with a connected contour, including:
[0022] the first image is subjected to a closing operation with a first preset size of a convolution kernel and iterated for a first specified number of times, to obtain an intermediate image with a connected contour;
[0023] the intermediate image is subjected to an opening operation with the first preset size of the convolution kernel and iterated for a second specified number of times, to obtain the second image with burrs removed.
[0024] With reference to the first aspect, in some optional embodiments, the inclination angle of the rectangular positioning mark is determined according to the contour of the rectangular positioning mark, including:
[0025] fitting the contour of the rectangular positioning mark by a preset minAreaRect operator to obtain a contour line of the connected rectangular positioning mark;
[0026] determining an inclination angle of the rectangular positioning mark according to the contour line of the connected rectangular positioning mark.
[0027] In combination with the first aspect, in some optional embodiments, the method further includes:
[0028] determining an area of a region surrounded by the contour with the largest area in the second image;
[0029] when the area ratio of the region area to the area of the first image is less than a first preset area ratio, obtaining a defect indicating that the electrode sheet with missing printing exists.
[0030] In combination with the first aspect, in some optional embodiments, the method further includes:
[0031] performing binarization on the first image according to a first gray scale threshold to obtain a binary image, the first gray scale threshold being half of the sum of a foreground gray scale value and a background gray scale value of the first image;
[0032] if the total area ratio of the pixel points representing black in the binary image to the area of the first image is less than a second preset area ratio, issuing prompt information indicating that the original image is a back image obtained by shooting the back of the base film.
[0033] In combination with the first aspect, in some optional embodiments, the method further includes:
[0034] cropping the right upper corner region and the left lower corner region of the original image from the original image based on the first position coordinates of the corner points in the second image and the first preset cropping frame;
[0035] performing a third specified number of closed operation operations on the right upper corner region and the left lower corner region with a convolution kernel of a second preset size to obtain a third image and a fourth image, respectively;
[0036] performing a fourth specified number of open operation operations on the third image and the fourth image with the convolution kernel of the second preset size to obtain a fifth image and a sixth image, respectively;
[0037] performing an inverted binarization operation on the fifth image according to a second gray scale threshold to obtain a seventh image, and performing an inverted binarization operation on the sixth image according to a third gray scale threshold to obtain an eighth image, the second gray scale threshold being twice the foreground gray scale value of the fifth image, and the third gray scale threshold being twice the foreground gray scale value of the sixth image.
[0038] extracting right boundary information from the seventh image and extracting lower boundary information from the eighth image;
[0039] determining position coordinates of four corner points of the basement membrane from the original image according to the right boundary information and the lower boundary information;
[0040] cropping four corner point regions corresponding to the four corner points from the original image according to the position coordinates of the four corner points and a second preset cropping frame;
[0041] performing binarization processing on each of the four corner point regions by using a fourth gray scale threshold, to obtain four binarized corner point regions, the fourth gray scale threshold being half of a sum of a foreground gray scale value and a background gray scale value of a single corner point region;
[0042] statistically determining an inclination angle of a longitudinal target straight line in the four binarized corner point regions by using a Hough straight line, wherein a ratio of a length of the longitudinal target straight line to a preset length of a single electrode sheet is greater than or equal to a third preset ratio;
[0043] if an average inclination angle of all longitudinal target straight lines of any corner point region is not within a second preset angle range representing normality, issuing prompt information representing that an electrode sheet in the basement membrane of the original image is tilted.
[0044] With reference to the first aspect, in some optional embodiments, the corner point includes a left upper corner point of the target contour.
[0045] In a second aspect, an embodiment of the present application further provides an electronic device, which includes a processor and a memory coupled with each other, and the memory stores a computer program, when the computer program is executed by the processor, the electronic device executes the method described above.
[0046] The application with the technical scheme has the following advantages:
[0047] In the technical scheme provided in the application, the original image is compressed to obtain a compressed first image, and the compressed first image is beneficial to reduce the subsequent image operation amount. Then, the contour information is extracted from the first image by using a preset edge extraction algorithm; the contour information in the first image is fitted to obtain a second image with a connected contour; the contour with the largest area is selected from the second image as a target contour of the base film; the first position coordinates of the corner points are determined from the target contour; the first position coordinates of the corner points in the second image are converted into second position coordinates of the corresponding corner points on the original image according to a preset interpolation algorithm and a preset compression ratio; the second position coordinates and a first preset cropping frame are used to crop the original image to obtain a rectangular positioning mark region as a first region of interest; the contour of the rectangular positioning mark is determined from the first region of interest; and the tilt angle of the rectangular positioning mark is determined according to the contour of the rectangular positioning mark as the tilt angle of the base film in the original image. In this way, the positioning mark on the positioning image is automatically detected, and the contour of the positioning mark is used to realize automatic detection of the tilt angle of the base film, so that the existing manual detection can be replaced, and the problems of low efficiency and easy errors caused by manual image pre-detection can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0048] The application can be further illustrated by the non-limiting embodiments shown in the accompanying drawings. It should be understood that the following drawings only show some embodiments of the application, and therefore should not be considered as limiting the scope, and other related drawings can also be obtained by those skilled in the art without creative labor.
[0049] Figure 1 The flowchart of the thin film capacitance image pre-detection method provided in the embodiments of the application.
[0050] Figure 2 The contrast diagram of the right upper corner region of the original image after open operation, close operation and binarization processing provided in the embodiments of the application.
[0051] Figure 3 The contrast diagram of the left lower corner region of the original image after open operation, close operation and binarization processing provided in the embodiments of the application. DETAILED DESCRIPTION
[0052] The application will be described in detail below with reference to the drawings and specific embodiments. It should be noted that in the drawings or description, similar or identical parts are denoted by the same reference numerals, and the implementation modes not shown or described in the drawings are in the form known to those skilled in the art. In the description of the application, the terms "first", "second", etc. are only used for differentiation and description, and cannot be understood as indicating or implying relative importance.
[0053] Please refer to Figure 1 This application provides a method for pre-detecting thin-film capacitor images, which can be applied to electronic devices and executed or implemented by the electronic devices. The electronic devices may include a processing module and a storage module. The storage module stores a computer program, which, when executed by the processing module, enables the electronic devices to perform the corresponding steps in the following method for pre-detecting thin-film capacitor images.
[0054] In this embodiment, the electronic device may be, but is not limited to, a server, a personal computer, or similar devices. The processing module may be a GPU (Graphics Processing Unit) used to execute the various steps of the method. The thin-film capacitance image pre-detection method may include the following steps:
[0055] Step 110: Obtain the original image of the base film obtained by photographing it, wherein the base film includes rectangular positioning marks located at the corners of the base film and multiple electrode sheets arranged in an array for making thin film capacitors.
[0056] Step 120: Based on a preset compression ratio, compress the original image to obtain a compressed first image;
[0057] Step 130: Extract contour information from the first image using a preset edge extraction algorithm;
[0058] Step 140: Fit the contour information in the first image to obtain a second image with connected contours;
[0059] Step 150: Select the contour with the largest enclosing area from the second image as the target contour of the base film;
[0060] Step 160: Determine the first position coordinates of the corner points from the target contour;
[0061] Step 170: According to the preset interpolation algorithm and the preset compression ratio, the first position coordinates of the corner point in the second image are converted into the second position coordinates of the corresponding corner point in the original image;
[0062] Step 180: Based on the second position coordinates and the first preset cropping box, crop the image area containing the rectangular positioning mark from the original image to obtain the first region of interest;
[0063] Step 190: Determine the outline of the rectangular positioning target from the first region of interest;
[0064] At step 200, an inclination angle of the rectangular positioning mark is determined according to the contour of the rectangular positioning mark, as an inclination angle of the base film in the original image.
[0065] The steps of the film capacitor image pre-checking method will be described in detail as follows.
[0066] At step 110, the processing module of the electronic device can obtain the original image from the local (storage module) or can obtain the original image from the camera in real time. The manner of obtaining the original image is not limited here.
[0067] It should be noted that the original image is an image obtained by the camera shooting the base film placed on the workbench. The base film has a plurality of electrode pieces arranged in an array for making a film capacitor printed thereon. In addition, the base film is usually rectangular, and the four corners of the base film are usually provided with rectangular positioning marks for contour positioning. The rectangular positioning marks are usually printed in black.
[0068] At step 120, the preset compression ratio can be 20 times, 40 times, etc., which can be flexibly set according to actual conditions. The processing module can use a linear interpolation algorithm to compress the original image, so that the first image can be obtained. In this way, the amount of calculation of subsequent image processing can be reduced, the time length of image processing can be shortened, and the efficiency of image processing can be improved.
[0069] At step 130, the preset edge extraction algorithm can be flexibly determined according to actual conditions. For example, the preset edge extraction algorithm can be a Canny operator-based edge extraction algorithm.
[0070] Specifically, step 130 extracts contour information from the first image by using the preset edge extraction algorithm, which can include:
[0071] The first image is subjected to contour extraction by using a convolution kernel with a first preset size through the preset Canny operator, so that the contour information of the first image is obtained.
[0072] In this embodiment, various preset sizes of the convolution kernel (such as the first preset size and the second preset size described below) can be flexibly set according to actual conditions.
[0073] As an example, the size of the convolution kernel of the Canny operator is set to 3x3, the threshold parameter of the smaller pixel value / grayscale value in the Canny operator is set to the grayscale value of the foreground of the film capacitor, and the larger threshold parameter is set to the grayscale value of the background. The foreground refers to the image area of the electrode piece, and the background refers to the image area of the non-electrode piece. After Canny operation, all contour information of the image can be obtained.
[0074] In the embodiment, the step 140 fits the contour information in the first image to obtain a second image with a connected contour, including:
[0075] The first image is subjected to a closing operation with a convolution kernel of a first preset size, and the operation is iterated for a first specified number of times to obtain an intermediate image with a connected contour.
[0076] The intermediate image is subjected to an opening operation with the convolution kernel of the first preset size, and the operation is iterated for a second specified number of times to obtain the second image with burr removed.
[0077] As an example, the fitting manner of the contour information can be that: the first image is subjected to a closing operation with a convolution kernel of a size of 3*3 and the operation is iterated for 5 times. After the operation, the first image is fitted into a connected rectangle, which can replace the edge feature information after the Canny operation. Then, the image subjected to the closing operation is subjected to an opening operation with a convolution kernel of a size of 3*3 and the operation is iterated for 3 times. The purpose of this step is to remove the burr feature of the fitted connected rectangle edge. In this way, the peripheral contour information of the film capacitor can be found, and the interference of other contours can be reduced, and then the second image with a connected contour can be obtained.
[0078] In the embodiment, the purpose of the step 150 is to find the contour of the base film. Since there is interference of other contours (such as electrode sheets and positioning marks), and in order to fit a complete film capacitor image, the method sorts the found contours by area, and takes out the contour with the largest enclosed area as the contour of the base film.
[0079] In the step 160, the corner point can be the top-left corner point of the base film. Of course, in other embodiments, the corner point can also be other corner points of the four corners of the base film, which are not limited here. After obtaining the target contour of the base film, the top-left corner coordinate of the base film contour and the width w and height h of the base film contour can be returned.
[0080] In the step 170, since the first image and the second image are compressed images of the original image, after the top-left corner coordinate of the base film is determined in the second image, inverse operation needs to be performed based on a preset compression ratio and an interpolation algorithm to obtain the top-left corner coordinate (i.e., the second position coordinate) of the base film on the original image.
[0081] In the embodiment, the purpose of step 180 is to crop a region of interest (ROI) containing the rectangular positioning mark from the original image. The upper-left corner coordinate of the base film is usually the same as the upper-left corner coordinate of the positioning mark. In order to crop a region containing a complete rectangular positioning mark, the upper-left corner coordinate of the base film can be offset. That is, the x-coordinate of the obtained second coordinate is reduced by (compression ratio*2) pixels, and the y-coordinate is also reduced by (compression ratio*2) pixels, and the obtained coordinate is used as the positioning point. The positioning point in combination with the first preset cropping frame can crop a ROI containing a complete rectangular positioning mark. The size of the first preset cropping frame can be flexibly determined according to actual conditions, as long as the first preset cropping frame can crop a region containing the upper-left rectangular positioning mark based on the positioning point. As an example, the size of the first preset cropping frame can be selected as 1000 pixels in width and height.
[0082] In step 190, after obtaining the first region of interest, the approximate region of the black positioning mark at the upper-left corner of the base film can be obtained. The purpose of step 190 is to reposition the black positioning mark at the upper-left corner of the base film, fit the contour of the positioning mark, and finally obtain accurate angle information.
[0083] Since the black positioning mark is a rectangle, a binaryzation can be directly performed. The threshold value of the binaryzation is selected as foreground, which can just segment the positioning mark, and the accurate coordinates of the four corners of the positioning mark can be obtained. Then, the contour of the positioning mark is found.
[0084] In step 200, the tilt angle of the rectangular positioning mark is determined according to the contour of the rectangular positioning mark, including:
[0085] The contour line of the connected rectangular positioning mark is obtained by fitting the contour of the rectangular positioning mark through a preset minAreaRect operator.
[0086] The tilt angle of the rectangular positioning mark is determined according to the contour line of the connected rectangular positioning mark.
[0087] Understandably, the electronic device can calculate the angle of the black positioning mark by using the minAreaRect operator. The angle can be used as the tilt angle a of the base film in the original image.
[0088] In the embodiment, the purpose of steps 110 to 180 is to ensure that the region containing the rectangular positioning mark can be accurately cropped from the original image while reducing the amount of calculation. The tilt angle of the contour of the rectangular positioning mark can be used as the tilt angle of the base film.
[0089] In the embodiment, the method can further include:
[0090] According to the inclination angle of the base film, the original image is rotated so that the inclination angle of the base film after rotation is within a first preset angle range.
[0091] Alternatively, according to the inclination angle of the base film, a camera that captures the original image is rotated, or a support platform on which the base film is placed is rotated, so that the inclination angle of the base film in the original image captured by the camera after the rotation operation is within the first preset angle range.
[0092] In this embodiment, based on the inclination angle of the base film, the original image is rotated, or the original camera is rotated, or the platform on which the base film is placed is rotated, so that the inclination angle of the base film in the image after the rotation operation is 0° or close to 0°. In this way, it is beneficial for subsequent segmentation of the electrode sheet area and detection of electrode sheet defects using the image. The image segmentation and defect detection method is a conventional method. In addition, the first preset angle range can be flexibly determined according to actual conditions. For example, the first preset angle range can be within ±3°.
[0093] In this embodiment, the method can further include:
[0094] determining the area of the area surrounded by the contour with the largest area in the second image;
[0095] when the area ratio of the area to the area of the first image is less than a first preset ratio, obtaining a defect indicating that the base film has a missing electrode sheet.
[0096] Understandably, missing printing refers to a large area of blank area on the base film missing / omitting the electrode sheet. In order to roughly detect whether there is a large area of missing printing in the image, as an example, from step 150, the target contour with the largest area in the second image is selected, and the area of the contour is calculated. If the area ratio of the area to the area of the second image is less than 70% (the first preset ratio can be flexibly set according to actual conditions), it is determined that the original image has a large area of missing printing defect.
[0097] In this embodiment, the method can further include:
[0098] According to the first gray scale threshold, the first image is binarized to obtain a binary image, and the first gray scale threshold is half of the sum of the foreground gray scale value and the background gray scale value of the first image.
[0099] If the total area of the pixel points representing black in the binary image accounts for less than a second preset ratio of the area of the first image, a prompt information indicating that the original image is a back image obtained by shooting the back of the base film is sent.
[0100] It can be understood that the back of the base film is usually all white, and therefore, the area of the white region accounts for a large proportion in the image obtained by shooting the back of the base film. In the embodiment, the first image is binarized, and then it is detected whether the total area of the black pixels in the binarized image is less than 20% of the area of the first image. If yes, it is indicated that the original image is the back image obtained by shooting the back of the base film, and is an unqualified image. If no, it is indicated that the original image is the image obtained by shooting the front of the base film.
[0101] In the embodiment, the method can further include:
[0102] In step 310, the right upper corner image region and the left lower corner image region of the original image are cropped from the original image based on the first position coordinates of the corner points in the second image and the first preset cropping frame.
[0103] In step 320, the right upper corner image region and the left lower corner image region are subjected to a third specified number of closed operation operations with a convolution kernel of a second preset size, to obtain a third image and a fourth image, respectively.
[0104] In step 330, the third image and the fourth image are subjected to a fourth specified number of open operation operations with the convolution kernel of the second preset size, to obtain a fifth image and a sixth image, respectively.
[0105] In step 340, the fifth image is subjected to an inverted binarization operation according to a second gray scale threshold, to obtain a seventh image, and the sixth image is subjected to an inverted binarization operation according to a third gray scale threshold, to obtain an eighth image. The second gray scale threshold is twice the foreground gray scale value of the fifth image, and the third gray scale threshold is twice the foreground gray scale value of the sixth image.
[0106] In step 350, right boundary information is extracted from the seventh image, and lower boundary information is extracted from the eighth image.
[0107] In step 360, the position coordinates of the four corner points of the base film are determined from the original image according to the right boundary information and the lower boundary information.
[0108] In step 370, four corner point image regions corresponding to the four corner points are cropped from the original image according to the position coordinates of the four corner points and a second preset cropping frame.
[0109] In step 380, each of the four corner point image regions is subjected to binarization processing with a fourth gray scale threshold, to obtain four binarized corner point image regions. The fourth gray scale threshold is half the sum of the foreground gray scale value and the background gray scale value of a single corner point image region.
[0110] Step 390, the slope angle of the longitudinal target straight line in the four corner point image area of the binary image is calculated by Hough straight line statistics, wherein the length of the longitudinal target straight line is greater than or equal to the third preset proportion of the preset single electrode sheet length;
[0111] Step 400, if the average slope angle of all longitudinal target straight lines in any corner point image area is not in the second preset angle range representing normality, a prompt information representing that the electrode sheet in the base film of the original image is tilted is sent out.
[0112] In the embodiment, the purpose of steps 310 to 400 is to detect whether the electrode sheet in the image is tilted, and the purpose of steps 110 to 200 is to detect whether the base film on the image is tilted.
[0113] It can be understood that if the base film is not tilted and the electrode sheet is tilted, it indicates that the electrode sheet printed by the base film has a tilt defect; if the base film and the electrode sheet are both tilted and the tilt directions or tilt angles are different, it still indicates that the electrode sheet printed by the base film has a tilt defect; if the base film and the electrode sheet are both tilted and the tilt directions and tilt angles are the same, it indicates that the electrode sheet has no tilt defect; if the base film and the electrode sheet are both not tilted, it indicates that the electrode sheet has no tilt defect.
[0114] As an example, please refer to Figure 2 and Figure 3 , for the right upper corner image area and the left lower corner image area of the base film, the implementation process of steps 310 to 400 can be as follows:
[0115] In order to detect whether the electrode sheet in the image is tilted, four regions can be obtained by cropping the four corners of the original image, one part is the upper left corner, the second part is the lower left corner, the third part is the lower right corner, and the fourth part is the upper right corner. Since the capacitance image has a black rectangular positioning mark at the "upper left corner", "lower right corner", "lower left corner", and "upper right corner", this method can artificially offset a distance by calculating the coordinate relationship of the four parts, and take a part of the ROI region, fit the angle of the longitudinal straight line in the ROI region, to calculate whether the electrode sheet in each region is tilted.
[0116] Specifically, based on steps 110 to 200, the accurate coordinates of the upper left corner of the base film can be calculated, and the accurate tilt angle of the entire base film can be obtained. In order to obtain the right boundary information of the base film, first, the original image is offset to the right upper corner coordinates after accurate positioning, then for the right upper corner coordinates, the x-axis is offset to the w*cosα(radian)*0.8 times position, and the y-coordinate is offset to the h*sinα*0.8 times position, and a ROI region with a width and height of 1000 pixels is taken from the original image as desired, as shown in Figure 2(a) shown. Wherein, the purpose of offsetting the x-axis coordinate and y-axis coordinate is to clip the ROI containing the rectangular positioning mark, Figure 2 The maximum black rectangular region in (a) is the rectangular positioning mark.
[0117] In order to locate the right boundary information of the base film, the method first offsets the original image to the lower left corner of the image region as shown in Figure 2 (a) as the ROI region (the upper right corner of the original image), and performs 5 times of "closed operation" of 3*3 convolution kernel on the ROI region to obtain the image as shown in Figure 2 (b) shown (referring to the fourth image). The closed operation is to connect the regions in the image. Then, 3 times of "open operation" of 3*3 convolution kernel is performed on the image as shown in Figure 2 (b) to obtain the image as shown in Figure 2 (c) shown (referring to the sixth image), which is to connect the black regions in the image and reduce the area of the white region. Finally, once "inverted binaryzation operation" is performed on the image as shown in Figure 2 (c) to obtain the image as shown in Figure 2 (d) shown (referring to the seventh image). The threshold value of the inverted binaryzation operation is taken as 2 times of the foreground, and the pixel value of the corresponding region of the positioning mark in the image is recorded as 255. This step can reduce most of the unnecessary contour information and retain the final desired ROI region. Then, once contour finding is performed, the largest area contour is taken as the final target, and the coordinates of the upper right corner of the target and the width and height thereof are returned. In this way, the accurate position of the right boundary of the base film can be obtained.
[0118] In order to obtain the accurate coordinates of the lower boundary of the base film, the original image is also offset to the lower left corner after fine positioning, the y-axis is offset to the coordinate of w*cosα*0.8, and the x-axis is the x-coordinate of the upper left corner coordinate after fine positioning. Similarly, the width and height of 1000 pixels are taken as the desired ROI region, as shown in Figure 3 (a) shown (the lower left corner of the original image). In order to obtain the lower boundary information, the method first offsets the image as shown in Figure 3 (a) as the current ROI region, and performs 5 times of "closed operation" of 3*3 convolution kernel on the ROI region to obtain the image as shown in Figure 3 (b) shown (referring to the fourth image). The closed operation is to connect the regions in the image. Then, 3 times of "open operation" of 3*3 convolution kernel is performed on the image as shown in Figure 3 (b) to obtain the image as shown in Figure 3 (c) shown (referring to the sixth image), which is to connect the black regions in the image and reduce the area of the white region. Finally, once "inverted binaryzation operation" is performed on the image as shown in Figure 3 (c) to obtain the image as shown in Figure 3(d) the image shown (referring to the eighth image described above). The threshold value of the inversion binary operation is taken as 2 times the foreground, and the corresponding region in the image can be marked as 255. This operation can reduce most of the unwanted contour information and retain the final desired ROI region. Then, a contour search is performed, and the largest area contour is taken as the final target, and the left lower corner coordinates and the width and height of the final target are returned. In this way, the accurate position of the lower boundary can be obtained. After the left lower corner coordinates and the right upper corner coordinates are obtained, based on the inclination of the positioning mark, the boundary information of the four corners of the base film can be obtained.
[0119] Suppose that the left upper corner region coordinates of the base film are (x1, y1), the left lower corner coordinates are (x2, y2), the right upper corner coordinates are (x3, y3), and the right lower corner coordinates are (x4, y4). The ROI region of the left upper corner is x1*cosα (radian system)*0.3, y1*sinα*0.3. The left lower corner region is x2*cosα*0.3, y2*sinα*0.3. The right upper corner is x3*cosα*0.3, y3*sinα*0.3. The right lower corner is x4*cosα*0.3, y4*sinα*0.3. Then, an ROI region with a width and height of 1000 is taken based on the coordinates, a global binary operation is performed, the threshold value is taken as half of the foreground plus the background, all electrode images are segmented, the vertical straight line angle is calculated using the Hough straight line, the straight line less than 80% of the normal electrode height is not counted, the horizontal straight line is not counted, and the average value of the effective vertical straight line angle is taken as the inclination angle information of each region electrode sheet. In this way, the inclination angle information of the four regions can be calculated. If the inclination angle of the electrode sheet of any region is not within the second preset angle range, it indicates that the electrode sheet of the corresponding region is inclined. The second preset angle range can be flexibly set according to the actual situation, and is not specifically limited here.
[0120] Based on the above design, the method can detect whether the base film of the original image is inclined, whether the base film has a large area of missing printing, whether the base film is placed as the back, and whether the electrodes on the base film are inclined, so as to realize automatic pre-checking of the thin film capacitor in the production and manufacturing process, so as to ensure that the original image is an effective image. The effective original image will be used for defect detection of a single electrode sheet in the later stage, and the detection method is a conventional method, which is not described here.
[0121] In this embodiment, the processing module can be an integrated circuit chip with signal processing capability. The processing module can be a general-purpose processor. For example, the processor can be a central processing unit (CPU), a graphics processing unit, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0122] The storage module can be, but is not limited to, a random access memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, etc. In the embodiment, the storage module can be used to store the original image, various intermediate images (such as the first image, the second image, etc.) in the image processing process, the corner coordinates and the tilt angle of the base film, etc. Of course, the storage module can also be used to store a program, and the processing module executes the program after receiving an execution instruction.
[0123] It should be noted that the skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the electronic device described above can refer to the corresponding process of each step in the foregoing method, which will not be described in detail here.
[0124] Through the description of the foregoing embodiments, the skilled in the art can clearly understand that the present application can be implemented by hardware, or can be implemented by means of software and a necessary general hardware platform. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.), and includes a plurality of instructions for causing a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0125] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented by other means. The device and method embodiments described above are only schematic. For example, the flowcharts and block diagrams in the drawings show the possible implementation architectures, functions and operations of the systems, methods and computer program products according to the embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code, which includes one or more executable instructions for implementing the specified logical functions. It should also be noted that each block in the block diagrams and / or flowcharts, and the combination of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system for implementing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0126] The above merely provides an example of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method for image pre-detection of thin-film capacitors, characterized in that, The method includes: Acquire the original image obtained by photographing the base film, wherein the base film includes rectangular positioning marks located at the corners of the base film and multiple electrode sheets arranged in an array for fabricating thin film capacitors; Based on a preset compression ratio, the original image is compressed to obtain a compressed first image; Contour information is extracted from the first image using a preset edge extraction algorithm; The contour information in the first image is fitted to obtain a second image with connected contours; Select the contour with the largest enclosing area from the second image as the target contour of the base film; Determine the first position coordinates of the corner points from the target contour; According to the preset interpolation algorithm and the preset compression ratio, the first position coordinates of the corner point in the second image are converted into the second position coordinates of the corresponding corner point in the original image; Based on the second position coordinates and the first preset cropping box, a region containing the rectangular positioning mark is cropped from the original image to serve as the first region of interest; The outline of the rectangular positioning target is determined from the first region of interest; Based on the outline of the rectangular positioning mark, the tilt angle of the rectangular positioning mark is determined as the tilt angle of the base film in the original image.
2. The method according to claim 1, characterized in that, The method further includes: The original image is rotated according to the tilt angle of the base film so that the tilt angle of the rotated base film is within a first preset angle range; Alternatively, the camera that captures the original image may be rotated, or the support platform on which the base film is placed may be rotated, depending on the tilt angle of the base film, so that the tilt angle of the base film in the original image captured by the camera again after the rotation operation is within the first preset angle range.
3. The method according to claim 1, characterized in that, Contour information is extracted from the first image using a preset edge extraction algorithm, including: The contour information of the first image is obtained by extracting the contour of the first image using a pre-defined Canny operator and a convolution kernel of a first pre-defined size.
4. The method according to claim 1, characterized in that, Fitting the contour information in the first image to obtain a second image with connected contours includes: Using a convolution kernel of a first preset size, perform a closing operation on the first image and iterate the operation a first specified number of times to obtain an intermediate image with a connected contour. Using a convolution kernel of the first preset size, an opening operation is performed on the intermediate image, and the operation is iterated a second time to obtain the second image with burrs removed.
5. The method according to claim 1, characterized in that, Determining the tilt angle of the rectangular positioning mark based on its outline includes: The contour of the rectangular positioning mark is fitted using the preset minAreaRect operator to obtain the contour lines connecting the rectangular positioning mark. The tilt angle of the rectangular positioning mark is determined based on the outline of the rectangular positioning mark.
6. The method according to claim 1, characterized in that, The method further includes: Determine the area of the image region enclosed by the contour with the largest enclosing area in the second image; When the area of the image region is less than the area of the first image, it indicates that the base film has a defect of missing electrode sheet.
7. The method according to claim 1, characterized in that, The method further includes: The first image is binarized according to the first gray level threshold to obtain a binary image. The first gray level threshold is half of the sum of the foreground gray level and the background gray level of the first image. If the ratio of the total area of the black pixels in the binary image to the area of the first image is less than a second preset ratio, a prompt message indicating that the original image is a back image obtained by photographing the back of the base film is issued.
8. The method according to claim 1, characterized in that, The method further includes: Based on the first position coordinates of the corner points in the second image and the first preset cropping box, the upper right corner area and the lower left corner area of the original image are cropped from the original image. Using a convolution kernel of the second preset size, perform a third specified number of closing operations on the upper right corner image area and the lower left corner image area to obtain the third image and the fourth image respectively; Using a convolution kernel of the second preset size, perform a fourth specified number of opening operations on the third and fourth images to obtain the fifth and sixth images respectively; Based on the second grayscale threshold, the fifth image is subjected to inverse binarization to obtain the seventh image, and based on the third grayscale threshold, the sixth image is subjected to inverse binarization to obtain the eighth image. The second grayscale threshold is twice the foreground grayscale value of the fifth image, and the third grayscale threshold is twice the foreground grayscale value of the sixth image. Extract the right boundary information from the seventh image and the lower boundary information from the eighth image; Based on the right boundary information and the lower boundary information, the position coordinates of the four corner points of the base film are determined from the original image; Based on the position coordinates of the four corner points and the second preset cropping frame, four corner point image areas corresponding to the four corner points are cropped from the original image; The four corner point image areas are binarized using a fourth gray threshold to obtain four binarized corner point image areas. The fourth gray threshold is half the sum of the foreground gray value and the background gray value of a single corner point image area. The tilt angle of the longitudinal target line in the four corner point areas of the binarized graph is statistically determined by Hough line, wherein the ratio of the length of the longitudinal target line to the preset length of a single electrode sheet is greater than or equal to a third preset proportion. If the average tilt angle of all longitudinal target lines in any corner area is not within the second preset angle range representing normal, a prompt message indicating that the electrode sheet in the base film representing the original image is tilted will be issued.
9. The method according to any one of claims 1-8, characterized in that, The corner point includes the top left corner point of the target contour.
10. An electronic device, characterized in that, The electronic device includes a processor and a memory coupled together, the memory storing a computer program that, when executed by the processor, causes the electronic device to perform the method as described in any one of claims 1-9.
Citation Information
Patent Citations
Electrolytic capacitor detecting method for improving general Hough transform
CN104778707A
Image recognition method and related equipment
CN116152814A