A defect detection method and device based on image stitching and cropping
Through image stitching and cropping technology, real-time defect detection of lithium battery poles is achieved, solving the problem that long-rolled lithium battery images cannot obtain accurate defect information in real time, improving detection efficiency and accuracy, and is suitable for long-length lithium battery poles piece.
Patent Information
- Application Number
- CN202411244542.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-09-06
AI Technical Summary
The existing lithium battery electrode plate coating defect detection methods are inefficient when processing long coils, and cannot obtain defect information in real time. In addition, traditional offline detection has lag, making it difficult to timely discover and correct problems in the production process.
Using defect detection methods based on image stitching and cropping, row images are continuously collected through the image acquisition module, the image storage module stores and indexes, the image stitching module splices to form a complete image, the defect detection module performs defect detection, and updates the crop index according to the index information. The image cropping module trims to generate images to be stitched to achieve real-time detection.
Real-time detection of lithium battery pole plates is realized, and defect location, size and quantity information can be obtained immediately, detection efficiency is improved, overlapping areas is reduced, false detection and missed detection are avoided, and accurate counting and quantization are achieved.
Smart Images

Figure CN118762011B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a defect detection method and device based on image splicing and cropping. Background Art
[0002] Lithium batteries are widely used in portable electronic devices, electric vehicles, and energy storage systems, and their performance and safety are crucial to these applications. The performance of lithium batteries depends largely on the quality of the electrode, which is directly affected by the coating process. In an ideal coating process, the positive and negative electrode materials are evenly coated on the current collector (usually aluminum foil and copper foil). However, due to the shortcomings of the manufacturing process, various defects may occur during the coating process. There are three more serious defects: (1) exposed foil, that is, some areas are not coated, resulting in reduced battery capacity and unstable performance; (2) scratches on the coating surface, which may cause short circuits and other safety issues; (3) foreign matter or particles in the coating, which may cause internal short circuits in the battery.
[0003] Therefore, coating defect detection of lithium battery pole pieces can improve battery performance, safety and production efficiency, while reducing production costs and improving product quality. This not only helps manufacturers maintain their competitive advantage in the market, but also provides consumers with higher performance and safer lithium battery products.
[0004] Patent document CN109636717A discloses a lithium battery coating detection and analysis method, which uses a first camera to photograph the upper surface of the pole piece, and a second camera to photograph the lower surface of the pole piece, and splices the images collected separately for further alignment analysis. The splicing method in the article requires that after obtaining the complete data of the image, it must align along the edge, and then analyze the alignment, so it is time-consuming; in addition, in order to observe the edge alignment, it is necessary to obtain an image of the entire pole piece, which takes up a lot of memory space, especially when the pole piece is very large and long, the disadvantage is more obvious.
[0005] The length of the pole piece of the lithium battery used in electric vehicles can reach several hundred meters; and the pole piece length of the lithium battery used in large energy storage systems may exceed 500 meters, or even reach more than 1000 meters due to the need for higher capacity and larger size. In this case, the method disclosed in the above patent cannot effectively obtain the location, size, and number of all defects. Therefore, the detection of lithium battery pole piece defects mostly adopts offline methods. However, the traditional offline detection method of lithium batteries has lags, making it difficult to detect and correct problems in the production process in a timely manner. Summary of the invention
[0006] The present invention provides a defect detection method and device based on image stitching and cropping, which are suitable for online defect detection of pole pieces with a long length.
[0007] A defect detection method based on image stitching and cropping, comprising:
[0008] The image acquisition module continuously acquires the line image to be detected and transmits it to the image storage module;
[0009] The image storage module stores the received row images of a preset number of rows as the current image and sets an index, and sends the current image and index information to the image stitching module;
[0010] The image stitching module receives the image to be stitched and its index sent by the image cropping module, stitches the image to be stitched and the current image into a current complete image, updates the index information according to the index of the image to be stitched, and sends it to the defect detection module;
[0011] The defect detection module performs defect detection on the current complete image, obtains defect information according to the updated index information, determines a cropping index according to the defect information and updates the current complete image, and sends the updated current complete image and the cropping index to the image cropping module;
[0012] The image cropping module crops the updated current complete image according to the cropping index to obtain the image to be spliced and its index, and sends the image to be spliced and its index to the image splicing module.
[0013] Furthermore, the defect information includes defect size, defect quantity and defect position, and the defect detection module sends the defect information to the result storage module for storage.
[0014] Furthermore, if the current image received by the image stitching module is the first image, it is determined that the first current image is the current complete image.
[0015] Furthermore, the defect detection module determines the starting row index, ending row index, starting column index and ending column index of the defect according to the updated index information, and determines the defect size, defect quantity and defect position according to the starting row index, ending row index, starting column index and ending column index of the defect.
[0016] Furthermore, after the defect detection module determines that the current complete image is not the last image, the cropping index is determined according to the defect information and the current complete image is updated, including:
[0017] Add 1 to the tail row index of the current complete image as the initial cropping start row index;
[0018] Traversing all defects in the current complete image, and judging whether the defect is located at the bottom of the current complete image according to the end row index of the defect;
[0019] If the defect is not located at the bottom of the current complete image, after storing the corresponding defect information, the pixel value of the area surrounded by the corresponding defect outer contour is set as the background pixel value;
[0020] If the defect is located at the bottom of the current complete image, and the starting row index of the bottom defect is less than the cropping starting row index, the cropping starting row index is updated according to the starting row index of the bottom defect;
[0021] If there is no defect at the bottom of the current complete image, the cropping start row index is not updated;
[0022] After the traversal is completed, the updated current complete image and cropping start row index are obtained.
[0023] Furthermore, the image cropping module crops the updated current complete image according to the cropping index to obtain the image to be spliced and its index, including:
[0024] Compare the cropping start row index with the updated end row index of the current complete image, and if the cropping start row index is greater than the updated end row index of the current complete image, set the image to be spliced to empty;
[0025] If the cropping start row index is less than or equal to the last row index of the updated current complete image, the area in the updated current complete image whose row index is less than the cropping start row index is deleted, and the remaining area is used as the image to be spliced, and the start row index of the image to be spliced is obtained.
[0026] Furthermore, the image stitching module stitches the image to be stitched and the current image into a current complete image, and updates the index information according to the index of the image to be stitched, including:
[0027] The last row of the image to be spliced and the first row of the current image are spliced to obtain a current complete image, and the starting row index of the image to be spliced is used as the starting row index of the current complete image.
[0028] Further, judging whether the defect is located at the bottom of the current complete image includes:
[0029] The end row index of the defect is compared with the tail row index of the current complete image. If they are the same, it is determined that the defect is located at the bottom of the current complete image.
[0030] Furthermore, the time taken by the image acquisition module to acquire a preset number of row images is greater than or equal to the sum of the time taken by the image storage module, the image stitching module, the defect detection module and the image cropping module to perform image processing and transmission.
[0031] A defect detection device based on image stitching and cropping applied to the above method comprises:
[0032] An image acquisition module, used for continuously acquiring the line image to be detected and transmitting it to the image storage module;
[0033] An image storage module, used for storing a preset number of received row images as a current image and setting an index, and sending the current image and index information to an image stitching module;
[0034] An image stitching module is used to receive the image to be stitched and its index sent by the image cropping module, stitch the image to be stitched and the current image into a current complete image, and update the index information according to the index of the image to be stitched, and send it to the defect detection module;
[0035] a defect detection module, configured to perform defect detection on the current complete image, obtain defect information according to the updated index information, determine a cropping index according to the defect information and update the current complete image, and send the updated current complete image and the cropping index to an image cropping module;
[0036] The image cropping module is used to crop the updated current complete image according to the cropping index to obtain the image to be spliced and its index, and send the image to be spliced and its index to the image splicing module.
[0037] The defect detection method and device based on image stitching and cropping provided by the present invention have at least the following beneficial effects:
[0038] (1) It can realize real-time detection of lithium battery electrode defects. When the image acquisition is completed, the location, size, and quantity information of the defects can be obtained immediately, which solves the problem that long-roll lithium battery images cannot obtain accurate defect information in real time;
[0039] (2) The overlapping area will be adjusted according to the current image situation. Compared with other image stitching methods with overlapping, the method proposed in the present invention has a small overlapping area and no redundancy, so it is more efficient;
[0040] (3) Through the splicing operation at the image segmentation point, we can avoid the false detection and missed detection caused by the use of ordinary image segmentation methods for long-roll images, and achieve accurate counting and precise quantification;
[0041] (4) In the present invention, the hardware part can be realized by a linear array camera and an FPGA, and the principle of the software part is easy to understand, easy to reproduce, and has strong universality. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 The present invention provides a flowchart of an embodiment of a defect detection method based on image stitching and cropping.
[0043] Figure 2A schematic structural diagram of an embodiment of a defect detection device based on image stitching and cropping provided by the present invention.
[0044] Figure 3 The present invention provides a flowchart of another embodiment of the defect detection method based on image stitching and cropping.
[0045] Figure 4 A timing diagram of image processing in the defect detection method based on image stitching and cropping provided by the invention.
[0046] Figure 5 An original schematic diagram of a lithium battery electrode in an application scenario of the defect detection method based on image stitching and cropping provided by the present invention.
[0047] Figure 6(a) to Figure 6(d) A schematic diagram of the process of the first round of defect detection in an application scenario of the defect detection method based on image stitching and cropping provided by the present invention.
[0048] Figure 7 A schematic diagram of an image to be stitched obtained after a first round of defect detection in an application scenario of the defect detection method based on image stitching and cropping provided by the present invention.
[0049] Figure 8(a) to Figure 8(d) A schematic diagram of the process of the second round of defect detection in an application scenario of the defect detection method based on image stitching and cropping provided by the present invention.
[0050] FIG. 9( a ) and FIG. 9( b ) are schematic diagrams of the process of the third round of defect detection in an application scenario of the defect detection method based on image stitching and cropping provided by the present invention.
[0051] Fig.10 A schematic diagram of an image to be stitched obtained after the third round of defect detection in an application scenario of the defect detection method based on image stitching and cropping provided by the present invention.
[0052] Figure 11(a) to Figure 11(e) A schematic diagram of the process of the fourth round of defect detection in an application scenario of the defect detection method based on image stitching and cropping provided by the present invention. DETAILED DESCRIPTION
[0053] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0054] refer to Figures 1 to 3 In some embodiments, a defect detection method based on image stitching and cropping is provided, comprising:
[0055] S1, the image acquisition module 1 continuously acquires the line image to be detected and transmits it to the image storage module 2;
[0056] S2, the image storage module 2 stores the received row images of the preset number of rows as the current image and sets an index, and sends the current image and index information to the image stitching module 3;
[0057] S3, the image stitching module 3 receives the image to be stitched and its index sent by the image cropping module 5, stitches the image to be stitched and the current image into a current complete image, and updates the index information according to the index of the image to be stitched, and sends it to the defect detection module 4;
[0058] S4, the defect detection module 4 performs defect detection on the current complete image, obtains defect information according to the updated index information, determines a cropping index according to the defect information and updates the current complete image, and sends the updated current complete image and cropping index to the image cropping module 5;
[0059] S5 , the image cropping module 5 crops the updated current complete image according to the cropping index to obtain the image to be spliced and its index, and sends the image to be spliced and its index to the image splicing module 3 .
[0060] Specifically, in step S1, a line image of the pole piece to be inspected can be collected by a line array camera. The line image can be an image of a row of pixels. The image acquisition module controls the line array camera to continuously collect line images and continuously transmits the line images to the image storage module 2. Assuming that there are NUM line images in total, each line image is named img_line_0, img_line_1, ..., img_line_(NUM-1) in sequence.
[0061] In step S2, the image storage module 2 receives the row images transmitted by the image acquisition module 1. Whenever the number of received row images reaches a preset number of rows, it is stored as the current image img_now_i, and the starting row index line_begin_now_i of the current image img_now_i is set. Then, the current image img_now_i and its starting row index line_begin_now_i are sent to the image stitching module 3.
[0062] Assuming that the preset number of rows is N, that is, the image storage module 2 stores N rows of row images, the image acquisition module 1 continuously transmits the row images img_line_0, img_line_1, ... to the image cache queue of the image storage module 2. After receiving img_line_(N-1), the image storage module 2 needs to use the row images img_line_0 to img_line_(N-1) as the current image img_now_0, and at this time, the starting row index line_begin_now_0 of the current image is 0. The current image img_now_0 and the starting row index line_begin_now_0 of the current image are transmitted to the image stitching module 3, and the image cache queue is cleared.
[0063] The image acquisition module 1 continues to transmit the line images img_line_N, img_line_(N+1) ... to the image cache queue of the image storage module 2. After receiving the line image img_line_(2*N-1), the image storage module 2 needs to use the line images img_line_N to img_line_(2*N-1) as the current image img_now_1. At this time, the starting line index of the current image line_begin_now_1 = N. The current image img_now_1 and the starting line index of the current image line_begin_now_1 are transmitted to the image stitching module 3, and the image cache queue is cleared.
[0064] Repeat the above steps until no new row images are sent to the image acquisition module 1, then the last current image is img_now_((NUM / N) 向上取整 -1), the number of rows of the last current image is NUM-((NUM / N) 向上取整 -1)*N, the current image start line index is line_begin_now_((NUM / N) 向上取整 -1)=((NUM / N) 向上取整 -1)*N. Set the current image img_now_((NUM / N) 向上取整 -1) and the starting line index of the current image line_begin_now_((NUM / N) 向上取整 -1) transmit to the image stitching module 3 and clear the image cache queue.
[0065] Furthermore, in step S3, the image stitching module 3 receives the image to be stitched img_cut_(i-1) and its starting row index line_begin_cut_(i-1) sent by the image cropping module 5, receives the current image img_now_i and the starting row index line_begin_now_i of the current image transmitted by the image storage module 2, and then stitches the image to be stitched img_cut_(i-1) and the current image img_now_i into the current complete image img_total_i, updates the starting row index line_begin_total_i of the current complete image, and transmits the current complete image img_total_i and the updated index information line_begin_total_i to the defect acquisition module 4.
[0066] If the current image is img_now_0, the current complete image img_total_0 = img_now_0, and the starting line index line_begin_total_0 of the current complete image = 0. That is, if the current image received by the image stitching module 3 is the first image, the first current image is determined to be the current complete image.
[0067] If the current image is img_now_i, (i=1,2,...(NUM / N) 向上取整 -1), then: assuming that the image to be stitched img_cut_(i-1) has a total of x rows, the row images included from top to bottom are img_line_a, img_line_(a+1), ..., img_line_(a+x-1); the current image is img_now_i, the number of rows is y, and the row images included from top to bottom are img_line_(a+x), img_line_(a+x+1), ..., img_line_(a+x+y-1). Image stitching module 3 stitches img_cut_(i-1) and img_now_i into the current complete image img_total_i. At this time, img_total_i has a total of x+y rows, and the row images included from top to bottom are img_line_a, img_line_(a+1), ..., img_line_(a+x-1), img_line_(a+x), img_line_(a+x+1), ..., img_line_(a+x+y-1). The starting row index line_begin_total_i of the current complete image img_total_i is a.
[0068] Specifically, the image stitching module 3 stitches the image to be stitched img_cut_(i-1) and the current image img_now_i into the current complete image img_total_i, that is, stitches the last row of the image to be stitched img_cut_(i-1) and the first row of the current image img_now_i to obtain the current complete image img_total_i, and uses the starting row index of the image to be stitched as the starting row index of the current complete image img_total_i.
[0069] The current complete image img_total_i (i=0,1,2,...(NUM / N) 向上取整 -1) and the starting line index line_begin_total_i of the current complete image are transmitted to the defect acquisition module 4.
[0070] Furthermore, in step S4, the defect detection module 4 may perform defect detection based on existing defect detection technology, and identify, locate, quantify, and count defects on the current complete image img_total_i. In some embodiments, the defect information includes defect size, defect quantity, and defect location.
[0071] Specifically, the defect detection module 4 determines the starting row index, ending row index, starting column index and ending column index of the defect based on the updated index information, that is, the index information of the current complete image, and the outer contours of each defect in the current complete image, and determines the defect size, the number of defects and the defect position based on the starting row index, ending row index, starting column index and ending column index of the defect.
[0072] Assume that there are h defects in total. The starting row of the j-th (j=0,1,...,h-1) defect is row_begin_j, the ending row is row_end_j, the starting column is col_begin_j, and the ending column is col_end_j.
[0073] In some embodiments, the defect detection module 4 sends the above-mentioned defect information to the result storage module 6 for storage.
[0074] Specifically, the result storage module 6 stores the position, size and number of defects, including a defect number variable numD and numD one-dimensional arrays defect_b[5] (b=0,1,...numD-1) of length 5. Defect_b[5] consists of the starting row index, starting column index, height, width and area of a defect.
[0075] In the initial state, numD=0, and the number of one-dimensional arrays is 0.
[0076] Further, in step S4, the cropping index is the cropping start row index, and the defect detection module first needs to determine that the current complete image is not the last image, and then determine the cropping index according to the defect information and update the current complete image, specifically including:
[0077] S41, adding 1 to the last row index of the current complete image as the initial cropping start row index;
[0078] S42, traversing all defects in the current complete image, and judging whether the defect is located at the bottom of the current complete image according to the end row index of the defect;
[0079] S43, if the defect is not located at the bottom of the current complete image, after storing the corresponding defect information, the pixel value of the area surrounded by the corresponding defect outer contour is set as the background pixel value;
[0080] S44, if the defect is located at the bottom of the current complete image, and the starting row index of the bottom defect is less than the cropping starting row index, then updating the cropping starting row index according to the starting row index of the bottom defect;
[0081] S45, if there is no defect at the bottom of the current complete image, then the cropping start row index is not updated;
[0082] S46. After the traversal is completed, the updated current complete image and cropping start row index are obtained.
[0083] Specifically, in step S41, firstly, the end line index line_end_total_i of the current complete image img_total_i is calculated, and the crop start line index line_begin_cut_i is initialized. Assuming that the total number of lines of img_total_i is num, then:
[0084] line_end_total_i=num+line_begin_total_i;
[0085] line_begin_cut_i=line_end_total_i+1.
[0086] That is, the tail row index of the current complete image plus 1 is used as the initial cropping start row index.
[0087] Further, in step S42, all defects in the current complete image are traversed, and the current complete image img_total_i is not the last image, that is, i<(NUM / N) 向上取整-1, determine whether the defect is located at the bottom of the current complete image: compare the end row index of the defect with the tail row index of the current complete image. If they are the same, it is determined that the defect is located at the bottom of the current complete image. If the end row index of the defect is less than the tail row index of the current complete image, the defect is not located at the bottom of the current complete image.
[0088] Specifically, in step S43, if the end row index row_end_m of defect m is less than the end row index line_end_total_i of the current complete image, then the defect quantity variable numD in the result storage module 6 is updated; and a one-dimensional array defect_numD[5] with a length of 5 is newly created in the result storage module, and the five parameters of the center row index row_center_m, center column index col_center_m, height height_m, width weight_m, and area area_m of defect m are stored in the array, that is, defect_numD[5]={row_center_m,col_center_m,height_m,weight_m,area_m}; finally, the pixel value of the area enclosed by the outer contour of the defect is set as the image background pixel value, that is, the defect is "deleted" in img_total_i. Among them:
[0089] numD=numD+1;
[0090] row_center_m=(row_begin_m+row_end_m) / 2;
[0091] col_center_m=(col_begin_m+col_end_m) / 2;
[0092] height=row_end_m-row_begin_m+1;
[0093] weight=col_end_m-col_begin_m+1;
[0094] area = the area enclosed by the outer contour of the defect.
[0095] Furthermore, in step S44, if the defect is located at the bottom of the current complete image, that is, the end row index row_end_m of the defect m is equal to the line_end_total_i of the current complete image, the crop start row index line_begin_cut_i is compared with the start row index row_begin_m of the defect m. If line_begin_cut_i>row_begin_m, the crop start row index line_begin_cut_i=row_begin_m is updated to obtain the crop start row index line_begin_cut_i=row_begin_m, otherwise no current operation is performed.
[0096] Furthermore, in step S45, if there is no defect at the bottom of the current complete image, the cropping start row index will not be updated.
[0097] If the current complete image img_total_i is the last image, that is, i=(NUM / N) 向上取整 -1, then there is no need to initially crop the starting row index, nor is there a need to compare the defect's ending row index with the current complete image's tail row index. For each defect, update the defect quantity variable numD in the result storage module 6; and create a new one-dimensional array defect_(numD-1)[5] with a length of 5 in the result storage module 6, and store the defect m's center row index row_center_m, center column index col_center_m, height height_m, width weight_m, and area area_m in the array, that is, defect_numD[5]={row_center_m,col_center_m,height_m,weight_m,area_m}; finally, set the pixel value of the area enclosed by the outer contour of the defect to the image background pixel value, that is, "delete" the defect in img_total_i. Among them:
[0098] numD=numD+1;
[0099] row_center_m=(row_begin_m+row_end_m) / 2;
[0100] col_center_m=(col_begin_m+col_end_m) / 2;
[0101] height=row_end_m-row_begin_m+1;
[0102] weight=col_end_m-col_begin_m+1;
[0103] area = the area enclosed by the outer contour of the defect.
[0104] Furthermore, in step S46 , after the defect traversal is completed, the current cropping start line index line_begin_cut_i and the updated current complete image img_total_i are transmitted to the image cropping module 5 .
[0105] Furthermore, in step S5, the image cropping module 5 crops the updated current complete image according to the cropping index to obtain the image to be stitched and its index, including:
[0106] S51, comparing the cropping start row index with the updated end row index of the current complete image, if the cropping start row index is greater than the updated end row index of the current complete image, setting the image to be stitched to empty;
[0107] S52: If the cropping start row index is less than or equal to the last row index of the updated current complete image, delete the area in the updated current complete image whose row index is less than the cropping start row index, use the remaining area as the image to be stitched, and obtain the start row index of the image to be stitched.
[0108] Specifically, if the cropping start row index line_begin_cut_i> the end row index line_end_total_i of the current complete image, the image to be spliced img_cut_i is empty, that is, there is no image to be spliced img_cut_i, indicating that there is no defect at the bottom of the corresponding current complete image, so no cropping and splicing are required. The starting row index of the image to be spliced transmitted to the image splicing module is line_begin_cut_i.
[0109] If the cropping start line index line_begin_cut_i ≤ the end line index line_end_total_i of the current complete image, the image to be stitched img_cut_i is the image with defects at the bottom of the current complete image img_total_i, that is, the start line index of the image to be stitched img_cut_i is line_begin_cut_i, and the end line index is line_end_total_i. The image to be stitched img_cut_i and its start line index line_begin_cut_i are sent to the image stitching module 3.
[0110] Furthermore, in some embodiments, the time taken by the image acquisition module 1 to acquire a preset number of row images is greater than or equal to the sum of the time taken by the image storage module, the image stitching module, the defect detection module and the image cropping module to perform image processing and transmission.
[0111] Specifically, the working time of each module needs to be considered when designing the system, such as Figure 4 As shown. Assume that the time required for the image acquisition module to acquire 1 line of image and transmit it to the image storage module 2 is t_line; the time required for the image storage module 2 to obtain the current image img_now, the starting line line_begin_now of the current image, and transmit it to the image stitching module 3 is t_imgNow; the time required for the image stitching module 3 to obtain the current complete image img_total, the starting line index line_begin_total of the current complete image, and transmit it to the defect acquisition module 4 is t_imgTotal; the time required for the defect acquisition module 4 to identify, locate, quantify, and count defects, and transmit the cropping index and the updated current complete image to the image cropping module 5 is t_defect; the time required for the image cropping module 5 to obtain the image to be stitched img_cut, the starting line index line_begin_cut of the image to be stitched, and transmit it to the image stitching module 3 is t_cut. Then it needs to meet the following requirements:
[0112] t_line * N ≥ t_imgNow + t_imgTotal + t_defect + t_cut.
[0113] The method provided in this embodiment is further described below through specific application scenarios.
[0114] like Figure 5 As shown, assuming that a roll of lithium battery pole pieces has a width of 10 columns (unit: pixel points) and a height of 55 rows (unit: pixel points), and the current storage image acquired by the image storage module 2 each time is 15 rows, then: let numD=0, NUM=55, N=15.
[0115] The image storage module 2 obtains the current image img_now_0, as shown in FIG6(a), and the starting row index of the current image is 0.
[0116] Since this is the first image, the current complete image img_total_0 obtained by the image stitching module 3 is img_now_0, and the starting row index of the current complete image is 0.
[0117] The current complete image tail row index is 14, and the defect acquisition module 4 detects 4 defects.
[0118] Initialize cropping start row index = 14 + 1 = 15.
[0119] The first defect has a starting row index of 0, an ending row index of 1, a starting column index of 3, and an ending column index of 5. At this time, the defect area is 5, because the ending row index of the defect is less than the ending row index of the current complete image, so numD = 0 + 1 = 1, defect_0[5] = {1, 4, 2, 3, 5}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_0 is shown in Figure 6(b).
[0120] The second defect has a starting row index of 4, an ending row index of 6, a starting column index of 3, and an ending column index of 4. At this time, the defect area is 5, because the ending row index of the defect is less than the ending row index of the current complete image, so numD = 1 + 1 = 2, defect_1[5] = {5, 4, 3, 2, 5}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_0 is shown in Figure 6(c).
[0121] The start row index of the third defect is 12, the end row index is 14, the start column index is 1, and the end column index is 3. Because the end row index of the defect = the end row index of the current complete image, and the initialized crop start row index > the start row index, the crop start row index is updated = the start row index of the defect = 12.
[0122] The starting row index of the 4th defect is 12, the ending row index is 13, the starting column index is 6, and the ending column index is 7. At this time, the defect area is 4, because the ending row index of the defect is less than the ending row index of the current complete image, so numD = 2 + 1 = 3, defect_2[5] = {13, 7, 2, 2, 4}. And the pixel value inside the outer contour of the defect is set to the background pixel value. At this time, the current complete image img_total_0 is shown in Figure 6 (d).
[0123] The updated current complete image img_total_0 and the cropping start line index 12 as shown in FIG. 6( d ) are sent to the image cropping module 5 for cropping, and the obtained image to be stitched img_cut_0 is as follows: Figure 7 shown.
[0124] The image storage module 2 obtains the current image img_now_1. As shown in FIG8(a), the starting row index of the current image img_now_1 is 15.
[0125] The image stitching module 3 stitches the current image img_now_1 and the image to be stitched img_cut_0 into the current complete image img_total_0, as shown in FIG8(b), where the starting row index of the current complete image is 12.
[0126] The current complete image img_total_0 has a last row index of 29, and the defect acquisition module detects 2 defects.
[0127] Initialize cropping start row index = 29 + 1 = 30.
[0128] The first defect has a starting row index of 12, an ending row index of 15, a starting column index of 1, and an ending column index of 3. At this time, the defect area is 10. Because the ending row index of the defect is less than the ending row index of the current complete image, numD = 3 + 1 = 4, and defect_3[5] = {14, 2, 4, 3, 10}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_0 is shown in Figure 8(c).
[0129] The second defect has a starting row index of 21, an ending row index of 22, a starting column index of 4, and an ending column index of 6. At this time, the defect area is 6, because the ending row index of the defect is less than the ending row index of the current complete image, so numD = 4 + 1 = 5, defect_4[5] = {22, 5, 2, 3, 6}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_0 is shown in Figure 8 (d).
[0130] Because the cropping start row index is greater than the current complete image end row index, the image to be stitched img_cut_1 is empty and the cropping start row index is 30.
[0131] The image storage module 2 obtains the current image img_now_2, as shown in FIG9(a), and the starting row index of the current image is 30.
[0132] Since img_cut_1 is empty, the current image img_now_2 is the current complete image img_total_0, as shown in FIG9(a), and the starting row index of the current complete image is 30.
[0133] The current complete image tail row index is 44, and the defect acquisition module detects 3 defects.
[0134] Initialize cropping start row index = 44 + 1 = 45.
[0135] The first defect has a starting row index of 33, an ending row index of 35, a starting column index of 4, and an ending column index of 6. At this time, the defect area is 8, because the end row of the defect is less than the end row index of the current complete image, so numD = 5 + 1 = 6, defect_5[5] = {34, 5, 3, 3, 8}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_0 is shown in Figure 9(b).
[0136] The second defect has a starting row index of 42, an ending row index of 44, a starting column index of 2, and an ending column index of 4. Because the defect's ending row index = the current complete image's end row index, and the cropping starting row index > the defect's starting row index, the updated cropping starting row index = the defect's starting row index = 42.
[0137] The start row index of the third defect is 43, the end row index is 44, the start column index is 7, and the end column index is 9. Because the end row index of the defect = the end row index of the current complete image, but the crop start row index < the start row index of the defect, the crop start row index remains unchanged at 42.
[0138] At this time, the image cropping module 5 obtains the updated current complete image img_total_0, as shown in FIG9( b ), and the cropping start line index 42, and obtains the image to be stitched img_cut_2 after cropping, as shown in FIG9( b ). Fig.10 shown.
[0139] The image storage module 2 obtains the current image img_now_3, as shown in FIG11(a), and the starting row index of the current image is 45.
[0140] The image stitching module 3 stitches the current image img_now_3 and the image to be stitched img_cut_2 into the current complete image img_total_3, as shown in FIG11(b), and the starting row index of the current complete image is 42.
[0141] The current complete image tail line index is 54, and the defect acquisition module detects 3 defects.
[0142] Since the current image is the last image, there is no need to initialize the cropping start row index, nor is there any need to compare the defect end row with the current complete image end row index.
[0143] The first defect has a starting row index of 42, an ending row index of 44, a starting column index of 2, and an ending column index of 4. At this time, the defect area is 8, numD = 6 + 1 = 7, and defect_6[5] = {43, 3, 3, 3, 8}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_3 is shown in Figure 11(c).
[0144] The second defect has a starting row index of 43, an ending row index of 45, a starting column index of 7, and an ending column index of 9. At this time, the defect area is 8, numD = 7 + 1 = 8, and defect_7[5] = {44, 8, 3, 3, 8}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_3 is shown in Figure 11 (d).
[0145] The starting row index of the third defect is 53, the ending row index is 54, the starting column index is 3, and the ending column index is 5. At this time, the defect area is 5, numD=8+1=9, and defect_8[5]={54,4,2,3,5}. The pixel values within the outer contour of the defect are set to the background pixel values. At this time, the current complete image img_total_3 is shown in Figure 11(e).
[0146] In summary, the result storage module 6 has numD=9, and the defect array is:
[0147] defect_0[5]={1,4,2,3,5}
[0148] defect_1[5]={5,4,3,2,5}
[0149] defect_2[5]={13,7,2,2,4}
[0150] defect_3[5]={14,2,4,3,10}
[0151] defect_4[5]={22,5,2,3,6}
[0152] defect_5[5]={34,5,3,3,8}
[0153] defect_6[5]={43,3,3,3,8}
[0154] defect_7[5]={44,8,3,3,8}
[0155] defect_8[5]={54,4,2,3,5}
[0156] The location, size and quantity information of defects can be clearly obtained.
[0157] refer to Figure 2 In some embodiments, a defect detection device based on image stitching and cropping applied to the above method is also provided, comprising:
[0158] The image acquisition module 1 is used to continuously acquire the line image to be detected and transmit it to the image storage module;
[0159] The image storage module 2 is used to store the received row images of a preset number of rows as the current image and set an index, and send the current image and index information to the image stitching module;
[0160] The image stitching module 3 is used to receive the image to be stitched and its index sent by the image cropping module, stitch the image to be stitched and the current image into a current complete image, and update the index information according to the index of the image to be stitched, and send it to the defect detection module;
[0161] A defect detection module 4 is used to perform defect detection on the current complete image, obtain defect information according to the updated index information, determine a cropping index according to the defect information and update the current complete image, and send the updated current complete image and cropping index to an image cropping module;
[0162] The image cropping module 5 is used to crop the updated current complete image according to the cropping index to obtain the image to be spliced and its index, and send the image to be spliced and its index to the image splicing module.
[0163] Please refer to the above embodiments for the specific working principle, which will not be described in detail here.
[0164] The defect detection method and device based on image stitching and cropping provided in the above embodiments have at least the following beneficial effects:
[0165] (1) It can realize real-time detection of lithium battery electrode defects. When the image acquisition is completed, the location, size, and quantity information of the defects can be obtained immediately, which solves the problem that long-roll lithium battery images cannot obtain accurate defect information in real time;
[0166] (2) The overlapping area will be adjusted according to the current image situation. Compared with other image stitching methods with overlap, the method proposed in the above embodiment has a small overlapping area and no redundancy, so it is more efficient.
[0167] (3) Through the splicing operation at the image segmentation point, we can avoid the false detection and missed detection caused by the use of ordinary image segmentation methods for long-roll images, and achieve accurate counting and precise quantification;
[0168] (4) In this solution, the hardware part can be implemented by a linear array camera and FPGA. The principle of the software part is easy to understand, easy to reproduce, and has strong universality.
[0169] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A defect detection method based on image stitching and cropping, characterized in that: include: The image acquisition module continuously acquires the line image to be detected and transmits it to the image storage module; The image storage module stores the received row images of a preset number of rows as the current image and sets an index, and sends the current image and index information to the image stitching module; The image stitching module receives the image to be stitched and its index sent by the image cropping module, stitches the image to be stitched and the current image into a current complete image, updates the index information according to the index of the image to be stitched, and sends it to the defect detection module; The defect detection module performs defect detection on the current complete image, obtains defect information according to the updated index information, determines a cropping index according to the defect information and updates the current complete image, and sends the updated current complete image and the cropping index to the image cropping module; The image cropping module crops the updated current complete image according to the cropping index to obtain the image to be stitched and its index, and sends the image to be stitched and its index to the image stitching module; After the defect detection module determines that the current complete image is not the last image, determining a cropping index according to the defect information and updating the current complete image includes: Add 1 to the tail row index of the current complete image as the initial cropping start row index; Traversing all defects in the current complete image, and judging whether the defect is located at the bottom of the current complete image according to the end row index of the defect; If the defect is not located at the bottom of the current complete image, after storing the corresponding defect information, the pixel value of the area surrounded by the corresponding defect outer contour is set as the background pixel value; If the defect is located at the bottom of the current complete image, and the starting row index of the bottom defect is less than the cropping starting row index, the cropping starting row index is updated according to the starting row index of the bottom defect; If there is no defect at the bottom of the current complete image, the cropping start row index is not updated; After the traversal is completed, the updated current complete image and cropping start row index are obtained.
2. The method according to claim 1, characterized in that The defect information includes defect size, defect quantity and defect location, and the defect detection module sends the defect information to the result storage module for storage.
3. The method according to claim 1, characterized in that If the current image received by the image stitching module is the first image, the first current image is determined to be the current complete image.
4. The method according to claim 1 or 2, characterized in that: The defect detection module determines the starting row index, ending row index, starting column index and ending column index of the defect according to the updated index information, and determines the defect size, defect quantity and defect position according to the starting row index, ending row index, starting column index and ending column index of the defect.
5. The method according to claim 1, characterized in that The image cropping module crops the updated current complete image according to the cropping index to obtain the image to be spliced and its index, including: Compare the cropping start row index with the updated end row index of the current complete image, and if the cropping start row index is greater than the updated end row index of the current complete image, set the image to be spliced to empty; If the cropping start row index is less than or equal to the last row index of the updated current complete image, the area in the updated current complete image whose row index is less than the cropping start row index is deleted, and the remaining area is used as the image to be spliced, and the start row index of the image to be spliced is obtained.
6. The method according to claim 5, characterized in that The image stitching module stitches the image to be stitched and the current image into a current complete image, and updates the index information according to the index of the image to be stitched, including: The last row of the image to be spliced and the first row of the current image are spliced to obtain a current complete image, and the starting row index of the image to be spliced is used as the starting row index of the current complete image.
7. The method according to claim 1, characterized in that Determine whether the defect is located at the bottom of the current complete image, including: The end row index of the defect is compared with the tail row index of the current complete image. If they are the same, it is determined that the defect is located at the bottom of the current complete image.
8. The method according to claim 1, characterized in that The time taken by the image acquisition module to acquire a preset number of row images is greater than or equal to the sum of the time taken by the image storage module, the image stitching module, the defect detection module and the image cropping module to perform image processing and transmission.
9. A defect detection device based on image stitching and cropping using the method according to any one of claims 1 to 8, characterized in that: include: An image acquisition module, used for continuously acquiring the line image to be detected and transmitting it to the image storage module; An image storage module, used for storing a preset number of received row images as a current image and setting an index, and sending the current image and index information to an image stitching module; An image stitching module is used to receive the image to be stitched and its index sent by the image cropping module, stitch the image to be stitched and the current image into a current complete image, and update the index information according to the index of the image to be stitched, and send it to the defect detection module; a defect detection module, configured to perform defect detection on the current complete image, obtain defect information according to the updated index information, determine a cropping index according to the defect information and update the current complete image, and send the updated current complete image and the cropping index to an image cropping module; An image cropping module, used for cropping the updated current complete image according to the cropping index to obtain the image to be spliced and its index, and sending the image to be spliced and its index to the image splicing module; After the defect detection module determines that the current complete image is not the last image, determining a cropping index according to the defect information and updating the current complete image includes: Add 1 to the tail row index of the current complete image as the initial cropping start row index; Traversing all defects in the current complete image, and judging whether the defect is located at the bottom of the current complete image according to the end row index of the defect; If the defect is not located at the bottom of the current complete image, after storing the corresponding defect information, the pixel value of the area surrounded by the corresponding defect outer contour is set as the background pixel value; If the defect is located at the bottom of the current complete image, and the starting row index of the bottom defect is less than the cropping starting row index, the cropping starting row index is updated according to the starting row index of the bottom defect; If there is no defect at the bottom of the current complete image, the cropping start row index is not updated; After the traversal is completed, the updated current complete image and cropping start row index are obtained.
Citation Information
Patent Citations
Lithium battery coating detection and analysis method, system, apparatus and storage medium
CN109636717A
Scratch defect detection method and device, computing equipment and storage medium
CN111444921A
System and method for detecting coating vehicle body finish paint defects
CN115290668A
