Coiled material detection method

By dynamically adjusting the camera and light source, combined with the grayscale adaptive algorithm, the problem of low efficiency and accuracy of existing web inspection equipment is solved, and real-time and efficient web defect detection is achieved.

CN118655136APending Publication Date: 2024-09-17RES INST OF ZHEJIANG UNIV TAIZHOU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410495252.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2021-12-06
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

It is difficult for existing web inspection equipment to achieve real-time, efficient, and high-quality defect detection, and the camera position and angle require manual adjustment, which affects the detection effect.

Method used

A web detection system is designed, including an operating console, a support frame, a slide, a slider, a camera module and a light source module. By dynamically adjusting the position of the camera module and the brightness of the light source, real-time detection of the web is achieved, and gray Degree-adaptive algorithms optimize image acquisition and analysis.

Benefits of technology

It achieves real-time and accurate detection of web defects, improves detection efficiency and quality, reduces human intervention, and adapts to the detection needs of different web types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118655136A
    Figure CN118655136A
Patent Text Reader

Abstract

According to the coiled material detection method, by setting an image gray value dynamic adjustment process, intelligent switching of a light source and automatic adjustment of light source brightness and camera exposure, it is guaranteed that the gray value of an image collected by a camera module reaches a set range; by running the flaw marking process, the position of the flaw on the coiled material can be accurately recorded and displayed in real time, so that the current flaw and historical flaw information can be checked.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This patent application is a divisional application of application number 202111516676.2 filed on December 6, 2021, entitled "A grayscale adaptive coil detection system, device and algorithm" Technical Field

[0002] The present invention relates to the field of image detection, and in particular to a coiled material detection method. Background Art

[0003] At present, during the production and processing of coils, roller production lines are used for transmission. The coils remain unfolded on the roller production lines and move forward flat. In order to detect defects in the coils in a timely manner, coil defect detection is often carried out during the coil production line transmission process. Different types of coils contain different defects. For example, PVB coils mainly include defects such as crystal points, insect spots, black spots and bubbles, while synthetic leather coils mainly include scratches, bubbles, burrs, uneven glue coating and other defects. Coil defect detection mainly includes two steps: camera acquisition of images and processor analysis of images.

[0004] For camera image acquisition, most of the current defect detection equipment uses line scan cameras, which are fixedly installed on a bracket so that the camera lens faces the production line and cooperates with a fixed light source to complete the collection of web images. In traditional equipment, the position, angle, and exposure parameters of the camera need to be adjusted in advance, and usually manually, which is extremely inconvenient; on the other hand, once the production line starts operating, it is difficult for operators to access the camera, and it is impossible to achieve dynamic adaptive adjustment of the defect detection equipment to the web production line, which affects the image quality collected by the camera.

[0005] For the processor to analyze the image, in the current defect detection method, due to the low efficiency of the detection method, the defect detection of the image often lags, which in turn leads to a slow alarm speed for the defect, missing the location of the defect or inaccurate location judgment, and requiring manual review of the coil, which is time-consuming and labor-intensive, and also reduces the production efficiency of the coil. In addition, since the camera collects images when the assembly line is in operation, it will cause image blur, affecting the analysis results of the image, so the image needs to be filtered first. In the existing image analysis method, the same filtering parameters are often used for the entire image to complete the image filtering; however, since there are different degrees of blur in the same image, using the same filtering parameters will result in unsatisfactory filtering effects in some areas.

[0006] Therefore, existing coil assembly line inspection devices and inspection methods are difficult to meet the needs of real-time, efficient and high-quality coil defect detection. Summary of the invention

[0007] The purpose of the present invention is to solve the deficiencies of the prior art and provide a coil material detection method.

[0008] In order to solve the above problems, the present invention adopts the following technical solutions:

[0009] A coiled material detection device comprises an operating table, a support frame, a slide, a sliding rod, a camera module and a light source module; wherein there are two support frames, and the two support frames are symmetrically arranged on both sides of an assembly line; the sliding frame is slidably arranged on the support frame, and the sliding frame can slide up and down along the support frame; the sliding rod is hingedly arranged on the slides of the two support frames; the camera module is slidably arranged on the sliding rod; the light source module is arranged on the support frame, and the light source module corresponds to the coiled material on the assembly line; the operating table is arranged on the ground, and the operating table is communicatively connected with the camera module and the light source module; the operating table comprises a display and a processor.

[0010] A grayscale adaptive coil detection system comprises the following steps:

[0011] Step 1: The console receives the power-on command, and the processor starts the power-on initialization process; after the power-on initialization process is completed, the display shows the power-on interface; the power-on interface includes "enter system" and "exit system" buttons, which correspond to the "enter system" command and the "exit system" command respectively;

[0012] Step 2: The console receives the operation instruction of the power-on interface, and determines whether it is an "exit system" instruction or an "enter system" instruction; if it is an "exit system" instruction, the console is closed and the step ends; if it is an "enter system" instruction, the display jumps from the power-on interface to the defect detection interface, and starts multiple line scan camera acquisition threads; the defect detection interface includes "clear", "detection / pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" buttons, which correspond to the "clear", "detection / pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" instructions respectively; the defect detection interface also includes an image display area, which displays the image collected by the camera module in real time; a detection area slider is set in the image display area, and the detection area slider corresponds to the "detection area division" instruction;

[0013] Step 3: The operation console determines whether it has received the operation instruction of the defect detection interface; if it has received the operation instruction, it proceeds to step 4, otherwise it returns to step 3;

[0014] Step 4: The console receives the instruction and determines the type of operation instruction, executes the corresponding action, and ends the step; if it is a "detect / pause" instruction, it determines whether it is a "detect" instruction or a "pause" instruction; if it is a "detect" instruction, it enters the real-time detection process until the "pause" instruction is received, and returns to step 3; if it is a "pause" instruction, the real-time detection process ends and returns to step 3; it should be noted that when the defect detection interface is entered for the first time after power-on, the "detect" button is displayed, corresponding to the "detect" instruction. After the "detect" button is clicked, it will switch to the "pause" button. After the "pause" button is clicked, it will switch to the "detect" button. The "pause" button corresponds to the "pause" instruction.

[0015] Furthermore, the real-time detection process in step 4 includes the following steps:

[0016] Step 61: The operating console acquires image data through a line scan camera; and performs a deep copy of the image data;

[0017] Step 62: Initialize the detection algorithm return parameters and convert the current product detection defect parameters into an algorithm data format; wherein the algorithm data format is a format corresponding to the algorithm detection process;

[0018] Step 63: Input the product detection defect parameters converted into the algorithm data format, the deep copy image data and the initialized detection algorithm return parameters into the set detection algorithm process, and return the detection algorithm result; detect the defects and gray value parameters in the image data through the detection algorithm process;

[0019] Step 64: traverse the detection algorithm results and filter out the detection algorithm results judged as defects;

[0020] Step 65: sequentially determine whether the position of the defect detection algorithm result is within the detection range;

[0021] Step 66: Obtain defect information of defect points within the detection range, add them to the defect list and marking queue, and record the defect information to the database; the defect information includes the detected defect image, defect location, defect type and defect screenshot, and the defect image is the spliced ​​image data including the defect;

[0022] Step 67: Acquire image data, and complete the grayscale value dynamic adjustment process according to the image data, and adjust the exposure of the line scan camera and the brightness of the light source module;

[0023] Step 68: Complete the defect handling process according to the defect information;

[0024] Step 69: Release the resources used in the detection thread and end the step.

[0025] Furthermore, the dynamic adjustment of the grayscale value in step 67 includes the following steps:

[0026] Step 6701: the operating console obtains the real-time stitched image data A1 collected by all line scan cameras, and detects the overall grayscale value of the stitched image data A1;

[0027] Step 6702: Determine the relationship between the overall gray value of the image A1 and the set limit value X1; if the overall gray value of the image is less than the limit value X1, it means that the image data A1 is an image close to pure black; if the overall gray value of the image is less than the limit value X1, start the light source switching process, clear the line scan camera exposure adjustment flag after completing the light source switching process, and enter step 6703; otherwise, directly enter step 6703;

[0028] Step 6703: determine whether there is an unprocessed detection thread; if there is an unprocessed detection thread, end the step; otherwise, proceed to step 6704; the detection thread represents an algorithm detection of the image;

[0029] Step 6704: The operation console does not perform a real-time detection process, and segments the image data A1 according to the set segmentation parameters;

[0030] Step 6705: Calculate the overall grayscale value of each segment image for the obtained segmented images, and determine the relationship between the ratio of the overall grayscale value of the set segment image A2 to the average grayscale value of the other segment images and the set value X2; if the ratio is greater than the set value X2, the image is considered abnormal and the step ends; if the ratio is less than or equal to the set value X2, proceed to step 6706;

[0031] Step 6706: Determine whether the current image data A1 is the first frame image captured by the line scan camera; if it is the first frame image, directly proceed to step 6712; otherwise, proceed to step 6707;

[0032] Step 6707: Obtain n frames of image data before the current image data A1 of the line scan camera. If the image data before the current image data A1 is less than n frames, obtain all images before the image data A1.

[0033] Step 6708: Calculate the average grayscale value of the previous image data obtained in step 6707, and compare the average grayscale value with the overall grayscale value of segment image A2 to determine the relationship between the difference between the two and the ratio of the overall grayscale value of segment image A2 and the set value X3; if the difference ratio is greater than the set value X3, the image is considered abnormal and the step ends; if the ratio is less than or equal to the set value X3, proceed to step 6709;

[0034] Step 6709: obtaining new image data A3 formed by stitching data collected by all line scan cameras, and obtaining the overall grayscale value of the image data A3;

[0035] Step 6710: compare the overall grayscale value of the image data A3 with the set system grayscale value range (X3, X4); if the overall grayscale value of the spliced ​​image data A3 is greater than the system grayscale value upper limit X4, proceed to step 6711; if the overall grayscale value of the spliced ​​image data A3 is less than the system grayscale value lower limit X3, proceed to step 6712; otherwise, directly proceed to step 6713;

[0036] Step 6711: if the overall grayscale value of the image data A3 is greater than the upper limit of the system grayscale value X4, determine whether the brightness of the light source module is greater than the set minimum value X5; if the brightness of the light source module is greater than the set minimum value X5, reduce the brightness of the light source module, clear the line scan camera exposure adjustment flag, and enter step 6713; otherwise, directly enter step 6713; wherein the brightness of the light source module is measured and adjusted by power;

[0037] Step 6712: if the overall grayscale value of the image data A3 is less than the lower limit of the grayscale value of the system X3, it is determined whether the brightness of the light source module is less than the set maximum value X6; if the brightness of the light source module is less than the set maximum value X6, the brightness of the light source module is enhanced, and the exposure adjustment flag of the line scan camera is cleared, and the process proceeds to step 6713; otherwise, the process proceeds directly to step 6713;

[0038] Step 6713: Obtain the exposure adjustment flags of all line scan cameras and determine whether the exposure adjustment has been completed; if the exposure adjustment has been completed, proceed to step 6723; otherwise, proceed to step 6714;

[0039] Step 6714: obtaining the number of the line scan camera that has not completed exposure adjustment; controlling the line scan camera with a set number to collect image data A4; setting the number to the line scan camera with the smallest number among the line scan cameras that have not completed exposure adjustment;

[0040] Step 6715: Determine whether the grayscale value precision adjustment flag of the line scan camera is turned on; if the grayscale value precision adjustment flag is turned on, proceed to step 6716; otherwise, proceed to step 6719; wherein the grayscale value precision adjustment flag can be turned on and off by external input;

[0041] Step 6716: The grayscale value precision adjustment flag is turned on, and the relationship between the overall grayscale value of the image data A4 and the high-precision grayscale value range (X7, X8) is determined; if the overall grayscale value of the image data A4 is less than X7, then the process proceeds to step 6717; if the overall grayscale value of the image data A4 is greater than X8, then the process proceeds to step 6718; otherwise, it indicates that the grayscale value of the image data A4 meets the high-precision grayscale value range, and the grayscale value precision adjustment flag is turned off, and the line scan camera exposure adjustment flag is input, indicating that exposure adjustment has been performed, and then the process proceeds to step 6722;

[0042] Step 6717: if the overall grayscale value of the image data A4 is less than X7, the relationship between the current exposure of the line scan camera and the set upper exposure limit X9 is determined; if the current exposure of the line scan camera is greater than the upper exposure limit X9, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is increased, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;

[0043] Step 6718: if the overall grayscale value of the image data A4 is greater than X8, the relationship between the current exposure of the line scan camera and the set exposure lower limit X10 is determined; if the current exposure of the line scan camera is less than the exposure lower limit X10, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is reduced, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;

[0044] Step 6719: if the grayscale value precise adjustment flag is not turned on, determine the relationship between the overall grayscale value of the image data A4 and the grayscale value adjustment range (X11, X12); if the overall grayscale value of the image data A4 is less than X11, proceed to step 6720; if the overall grayscale value of the image data A4 is greater than X12, proceed to step 6720; otherwise, it means that the grayscale value of the image data A4 meets the grayscale value adjustment range, and the line scan camera exposure adjustment flag is input, and proceed to step 6722;

[0045] Step 6720: if the overall gray value of the image data A4 is less than X11, determine the relationship between the current exposure of the line scan camera and the set upper exposure limit X9; if the current exposure of the line scan camera is greater than the upper exposure limit X9, indicate that it cannot be adjusted, input the line scan camera exposure adjustment flag, and proceed to step 6722; otherwise, increase the line scan camera exposure, input the line scan camera exposure adjustment flag, and proceed to step 6722;

[0046] Step 6721: the overall grayscale value of the image data A4 is greater than X12, and the relationship between the current exposure of the line scan camera and the set exposure lower limit X10 is determined; if the current exposure of the line scan camera is less than the exposure lower limit X10, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is reduced, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;

[0047] Step 6722: Obtain the exposure adjustment flags of all line scan cameras and determine whether the exposure adjustment has been completed; if the exposure adjustment has been completed, proceed to step 6723; otherwise, return to step 6714;

[0048] Step 6723: All line scan cameras have completed exposure adjustment, and the dynamic adjustment of grayscale values ​​is ended.

[0049] Furthermore, in the light source switching process of step 6702, it is first necessary to determine the switching status of the front light source and the backlight source in the light source module; then, enhance the brightness of the light source turned on in the light source module, and determine the change in the grayscale value of the image data collected at this time. If the overall grayscale value increase of the image is greater than the set threshold X2, it is considered that there is no need to change the light source, otherwise switch the light group from the front light source to the backlight source or from the backlight source to the front light source.

[0050] Furthermore, the defect handling process in step 68 includes the following steps:

[0051] Step 681: updating the display data of the defect detection interface, including the defect information display area and the defect photo wall, according to the defect information;

[0052] Step 682: Complete the defect marking process according to the marking queue and defect information;

[0053] Step 683: Issue a defect alarm based on the defect information.

[0054] Furthermore, the defect marking process in step 682 includes the following steps:

[0055] Step 6821: Obtain defect information and a marking queue, where the defect information includes a defect image; the defect image is stitched image data including defects;

[0056] Step 6822: respectively obtain the roll length and width of the defect image to be marked, and determine whether they are 0; if either the roll length or the width is 0, end the step; otherwise, proceed to step 6823; wherein the roll length of the defect image represents the length of the roll material displayed in the defect image, and the width of the defect image represents the width of the roll material displayed in the defect image;

[0057] Step 6823: Generate a white background image with the same length and width according to the roll length and width of the defective image;

[0058] Step 6824: Mark a detection roll length scale at a set position of the white background image; the detection roll length indicates the roll length of the roll corresponding to the collected image data;

[0059] Step 6825: Find the position of the defect point on the white background image according to the position information in the defect information, and mark it to obtain a marked image; the mark includes information such as text, pattern, color, etc.;

[0060] Step 6826: Determine whether the image display area of ​​the defect detection interface displays a marking image; if a marking image is displayed, connect the newly obtained marking image to the bottom of the old marking image; if the real-time marking image is not displayed, directly display the marking image;

[0061] Step 6827: Determine whether the pixel length of the marking image displayed in the image display area is greater than the set control size upper limit Y; if it is greater than the set control size upper limit Y, crop the marking image displayed in the image display area and retain the image with a length of Y1 pixels at the tail of the marking image, where the tail is the side of the marking image close to the real-time detection roll length;

[0062] Step 6828: Control the marking image displayed in the image display area to slide to the end;

[0063] Step 6829: Release image resources and update volume length data; end step.

[0064] Furthermore, in the defect alarm of step 683, it is first necessary to obtain the defect information; then traverse the defect information to obtain the defect point with the highest alarm priority, and the alarm priority is set according to the type of the defect point. Different alarm priorities correspond to different alarm light flashing times and alarm light colors; then take the maximum value of the alarm light flashing times of different colors of the defect point, and determine the maximum value as the alarm time; finally, according to the alarm time, control the alarm to sound, and according to the flashing time of the alarm lights of different colors, control the alarm light to flash, and complete the defect alarm.

[0065] A coil detection algorithm, the detection algorithm is based on the coil detection system, and the detection algorithm comprises the following steps:

[0066] Step S1: The operating console obtains images captured by all line scan cameras and counts the number of images;

[0067] Step S2: Determine whether the acquired image is a multi-channel image; if it is a multi-channel image, convert it into a grayscale image and proceed to step S3; otherwise, directly proceed to step S3;

[0068] Step S3: Select images in sequence, calculate the image size, and complete the cropping of each group of images and obtain the image grayscale value according to the left and right undetected areas; wherein each group of images represents images collected by different line scan cameras at the same time;

[0069] Step S4: Calculate whether there are periodic stripes based on the full image background evaluation; if there are periodic textures, it is a textured material and needs to be detexturized. After detexturization is completed, proceed to the next step; otherwise, proceed directly to the next step;

[0070] Step S5: according to the gray value of the image, the image clarity adaptive process is completed, the corresponding filtering level is determined, the image filtering is completed, and the total defect area in the image is obtained;

[0071] Step S6: Based on the clustering method, the total defect area is processed with multiple defects in the neighborhood, and the defect areas that meet the requirements are connected;

[0072] Step S7: obtaining a defect output priority according to the defect area or the defect connected area area; and sorting the defects according to the defect output priority;

[0073] Step S8: Obtain defect information, and determine whether the defect information meets the set threshold range requirements in order of defect output priority; if the defect information meets the set threshold requirements, put the defect information into the output queue in order;

[0074] Step S9: Determine whether the defect information in the output queue exceeds the set output quantity upper limit of the defect information; if it exceeds the set output quantity upper limit of the defect information, output the set output quantity of defect information according to the defect output priority order, and end the step; otherwise, output all the defect information in the queue, and end the step.

[0075] Furthermore, in step S7, the defect output priority is determined by the size of the connected domain area.

[0076] The beneficial effects of the present invention are:

[0077] The camera module can be accurately positioned by adjusting the height adjustment device on the support frame, rotating the slide bar, and adjusting the position of the camera module on the slide bar.

[0078] By setting fans in the camera module, and four fans responsible for air intake and air exhaust respectively, the line scan camera can be efficiently cooled;

[0079] An air duct is provided corresponding to the fan responsible for air discharge, and the air outlet of the air duct is located outside the glass of the camera module housing to prevent dust from falling outside the glass;

[0080] By setting the light source module including the front light source and the back light source, the brightness requirements within the lens range of the line scan camera in the defect detection of various materials are met, and the image shooting requirements are met;

[0081] The backlight module includes a light source and a shading sheet, and the shading sheets are installed on both sides of the light source. The installation height of the shading sheets can be adjusted, thereby achieving precise adjustment of the scattering range of the light source;

[0082] Connect the camera module through the system initialization process, obtain image data, display it in real time, and complete the defect detection of the coil according to the set algorithm;

[0083] By setting the dynamic adjustment process of image grayscale value, the intelligent switching of light source, automatic adjustment of light source brightness and camera exposure are controlled, so as to ensure that the grayscale value of the image collected by the camera module is within the set range;

[0084] By running the defect marking process, the location of the defect on the coil can be accurately recorded and displayed in real time, so that the current defect and historical defect information can be viewed;

[0085] The images of multiple line scan cameras are stitched and displayed in real time, so that the real-time interface of system defects can fully display the width of the coil;

[0086] By extracting the grayscale abnormal area in the image, mainly extracting the area with abnormal grayscale value compared with the image background, and distinguishing different defects after judging the morphological characteristics, the defect type can be identified and distinguished;

[0087] Through image stripe removal processing, the stripe area is extracted, and a spatial filter is obtained according to the periodicity of the stripes to achieve filtering processing for regularly distributed stripes, thereby preventing the stripes from interfering with the subsequent clarity adaptation process and defect judgment;

[0088] By performing segmented definition adaptive detection on the image, the same image with a wide width can be filtered using corresponding filter kernels according to parameters such as grayscale value, thus obtaining a better filtering effect and ensuring that the filtered image meets the image processing requirements;

[0089] By processing the connected domain of defects based on the clustering algorithm, the defects that meet the conditions can be connected, the efficiency of the algorithm is improved, and the detection of small but densely distributed defects can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 It is a three-dimensional diagram of the operation table of the first embodiment of the present invention;

[0091] Figure 2 It is a front view of the operation table of the first embodiment of the present invention;

[0092] Figure 3 It is a schematic diagram of the connection between the camera frame and the slide frame according to the first embodiment of the present invention;

[0093] Figure 4 This is a front view of the camera module of the first embodiment of the present invention with the front panel of the housing opened;

[0094] Figure 5 A bottom view of a camera module according to a first embodiment of the present invention;

[0095] Figure 6 It is a front view of the light source frame and the light source module of the first embodiment of the present invention;

[0096] Figure 7 A three-dimensional diagram of a light source frame and a light source module according to a first embodiment of the present invention;

[0097] Figure 8 The three-dimensional structure of the operating table according to the first embodiment of the present invention Figure 2 ;

[0098] Fig. 9 This is a system overall flow chart of Embodiment 1 of the present invention;

[0099] Fig.10 This is a flowchart of the power-on initialization process of the first embodiment of the present invention;

[0100] Fig.11 This is a flowchart of database connection and reading process according to the first embodiment of the present invention;

[0101] Fig.12 This is a flowchart of the alarm module initialization process according to the first embodiment of the present invention;

[0102] Fig.13 This is a flowchart of the startup defect information display process of the first embodiment of the present invention;

[0103] Fig.14 This is a flowchart of the real-time defect detection process of the first embodiment of the present invention;

[0104] Fig.15 This is a flowchart of the dynamic adjustment of the grayscale value of an image according to the first embodiment of the present invention;

[0105] Fig.16 This is a flowchart of the defective photo wall information update process according to the first embodiment of the present invention;

[0106] Fig.17 This is a flowchart of the real-time defect marking process of the first embodiment of the present invention;

[0107] Fig.18 This is a flowchart of the defect detection alarm process of the first embodiment of the present invention;

[0108] Fig.19This is a flowchart of displaying historical defect information of historical volumes according to the first embodiment of the present invention;

[0109] Fig. 20 A flowchart of a historical volume defect detection report generation process according to the first embodiment of the present invention;

[0110] Fig.21 This is a flow chart of the parameter operation interface of the first embodiment of the present invention;

[0111] Fig. 22 This is a flow chart of defect detection parameter setting according to the first embodiment of the present invention;

[0112] Fig.23 Flow chart of defect classification parameter setting in embodiment 1 of the present invention

[0113] Fig.24 This is a schematic diagram of a real-time defect detection interface according to the first embodiment of the present invention;

[0114] Fig.25 This is a schematic diagram of a parameter setting interface of the first embodiment of the present invention;

[0115] Fig.26 This is a schematic diagram of the system parameter setting interface of the first embodiment of the present invention;

[0116] Fig. 27 This is a schematic diagram of a defect detection parameter setting interface according to the first embodiment of the present invention;

[0117] Fig.28 This is a schematic diagram of a defect classification setting interface according to the first embodiment of the present invention;

[0118] Fig.29 This is a schematic diagram of a historical volume information display interface according to the first embodiment of the present invention;

[0119] Fig.30 This is a schematic diagram of a historical volume defect statistics interface according to the first embodiment of the present invention;

[0120] Fig.31 This is a flow chart of a coil detection algorithm according to Embodiment 1 of the present invention;

[0121] Fig.32 This is a flow chart of image cropping in Embodiment 1 of the present invention;

[0122] Fig.33 This is a flow chart of coil detexturing according to Embodiment 1 of the present invention;

[0123] Fig.34 is a schematic diagram of the outline of the first embodiment of the present invention;

[0124] Fig.35 The contrast and variance trends of the image S in the first embodiment of the present invention;

[0125] Fig.36 The grayscale energy, inverse difference and correlation trend of the image S in the first embodiment of the present invention;

[0126] Fig.37 This is a flowchart of the adjacent domain multi-defect processing according to the first embodiment of the present invention;

[0127] Fig.38 This is a flow chart of confirming defect output priority according to the first embodiment of the present invention;

[0128] Fig.39 This is a flow chart of a defect recognition feature algorithm according to Embodiment 2 of the present invention;

[0129] Fig.40 Schematic diagram of defect types and images according to the second embodiment of the present invention.

[0130] Explanation of the accompanying drawings: support frame 1, height adjustment device 11, column 12, camera frame 13, light source frame 14, slide 2, rotation adjustment device 21, slide rod 3, horizontal adjustment device 31, camera module 4, camera housing 41, air outlet 42, air duct 43, fan 44, line scan camera 45, light source module 5, front light source 51, arc lampshade 52, light-transmitting gap 53, backlight source 54, light source 55, shading sheet 56, coil 6. DETAILED DESCRIPTION

[0131] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0132] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0133] Embodiment 1:

[0134] like Figure 1 , 2As shown, a coil inspection device based on a line scan camera includes an operating table, a support frame 1, a slide 2, a slide bar 3, a camera module 4 and a light source module 5; wherein there are two support frames 1, and the two support frames 1 are symmetrically arranged on both sides of the assembly line; the slide 2 is slidably arranged on the support frame 1, and the slide 2 can slide up and down along the support frame 1; a height adjustment device 11 is arranged between the slide 2 and the support frame 1; the slide bar 3 is hingedly arranged on the slide 2 of the two support frames 1; the camera module 4 is slidably arranged on the slide bar 3 through a horizontal adjustment device 31; the light source module 5 is arranged on the support frame 1, and is respectively located above and below the coil 6 on the assembly line; the operating table is arranged on the ground, and the operating table is communicatively connected with the camera module 4 and the light source module 5; the operating table includes a display and a processor.

[0135] like Figure 3 As shown, the support frame 1 includes a column 12, a camera frame 13 and a light source frame 14, wherein there are two columns 12, and the two columns 12 are symmetrically arranged on both sides of the assembly line; the camera frame 13 and the light source frame 14 are arranged on the two columns 12, and the camera frame 13 is arranged above the light source frame 14. The camera frame 13 includes two vertical bars and a cross bar, the cross bar is arranged at the bottom of the two vertical bars, and the two vertical bars are arranged parallel to each other; a slide rail is arranged on the vertical bar; the slide 2 is arranged between the two vertical bars, and is slidably connected with the slide rail on the vertical bar, and can slide along the slide rail; the slide 2 and the cross bar are parallel to each other; a height adjustment device 11 is arranged between the cross bar and the slide 2, and the height adjustment device 11 can be an electric push rod or a cylinder. In this example, the height adjustment device 11 is a 150mm electric push rod, and the two ends of the electric push rod are respectively hinged to the cross bar and the slide 2. The height of the slide 2 can be adjusted by the action of the electric push rod. The light source frame 14 is in a square structure, and two light source frames 14 are symmetrically arranged on the two pillars 12 .

[0136] The slide 2 is hingedly provided with a slide bar 3, which is located between the camera frames 13 on the two support frames 1. The slide bar 3 can rotate around the hinged part, and in this example, the slide bar 3 rotates around the central axis. A rotation adjustment device 21 is also provided between the slide bar 3 and the slide 2. In this example, the rotation adjustment device 21 is a stepper motor, which is provided at the hinged part of one end of the slide bar 3. The stepper motor is used to control the rotation of the slide bar 3, and then the angle of the camera module 4 on the slide bar 3 is controlled. The slide bar is provided with a horizontal adjustment device 31, which can be a rodless cylinder, a screw structure or a hand-cranked module. In this example, the horizontal adjustment device 31 adopts a hand-cranked module with a length of 1100mm. The camera module 4 is provided on the slider of the hand-cranked module, and can realize position adjustment with the action of the hand-cranked module. At least one camera module 4 is provided on the horizontal adjustment device 31, and the line scan cameras 45 in different camera modules 4 are connected to the same trigger to ensure simultaneous image acquisition.

[0137] like Figure 4 , 5 As shown, the camera module 4 includes a camera housing 41, a fan 44 and a line scan camera 45, wherein the line scan camera 45 and the fan 44 are both arranged inside the camera housing 41. In this example, four fans 44 are arranged inside the camera housing 41, wherein two fans 44 form a group, which are respectively arranged at the upper and lower parts of the line scan camera 45, the fan group located at the upper part of the line scan camera 45 is used to cool the line scan camera 45, and the fan group 44 located at the lower part of the line scan camera 45 is used to prevent dust from falling on the lens of the line scan camera 45 and the inner side of the glass at the bottom of the housing; it should be noted that the fan 44 will not block the lens area of ​​the line scan camera 45. In this example, one fan 44 in each group of fans 44 is responsible for air intake, and the other fan 44 is responsible for air discharge. The two fans 44 on the same side of the upper and lower parts of the line scan camera 45 are responsible for air intake and air discharge respectively. For example, the fan 44 on the upper left side is responsible for air intake, and the fan 44 on the lower left side is responsible for air discharge. The purpose is to form an up-and-down circulation air duct in the housing of the camera module 4 to improve the cooling efficiency of the fan 44 on the line scan camera 45. An air outlet 42 or an air duct 43 is provided on the housing corresponding to the fan 44; in this example, the air duct 43 is provided at the position of the air outlet fan 44 at the lower part of the line scan camera 45. One end of the air duct 43 is connected to the fan 44, and the other end faces the outer side of the glass at the bottom of the housing to prevent dust from falling on the outer side of the glass at the bottom of the housing, thereby ensuring the image quality captured by the line scan camera 45. The other three fans 44 are provided with air outlets 42 on the housing correspondingly.

[0138] like Figure 6-8As shown, the light source module 5 includes a front light source 51 and a back light source 54, the front light source 51 is arranged on the upper rod of the light source frame 14, and the back light source 54 is arranged on the lower rod of the light source frame 14; the coil 6 on the assembly line passes between the front light source 51 and the back light source 54; wherein the front light source 51 is also located between the assembly line and the camera module 4. The front light source 51 is a dome light source, including an arc lampshade 52, and a light-transmitting slit 53 is arranged on the arc lampshade 52, and the light-transmitting slit 53 is in a straight line shape, and the light-transmitting slit 53 is directly opposite to the line scan camera 45 in the camera module 4. In this example, the front light source 51 is slidably arranged on the upper rod of the light source frame 14, so that the horizontal position of the front light source 51 on the assembly line is adjustable, which is convenient for realizing the corresponding relationship between the line scan camera 45 and the light-transmitting slit 53. The two ends of the back light source 54 are hinged to the light source frame 14, so that the back light source 54 can rotate around the hinged part. The backlight source 54 includes a light source 55 and a light shielding sheet 56, wherein both ends of the light source 55 are hinged to the stand; the light shielding sheet 56 is arranged on both sides of the light source, and the light shielding sheet 56 fits with the inner wall of the outer shell of the light source 55. The upper and lower ends of the light shielding sheet 56 are connected, so that the light emitted by the light source 55 can pass through the light shielding sheet 56 and emit, and the light shielding sheet 56 limits the divergence of the light. The outer periphery of the light shielding sheet 56 is provided with a cylindrical protrusion, and a waist-shaped hole is correspondingly provided on the outer shell of the light source 55. The waist-shaped hole matches the cylindrical protrusion. In this example, the waist-shaped hole is vertically arranged, so that the light shielding sheet 56 can be adjusted up and down in the waist-shaped hole, and the height of the light shielding sheet 56 extending out of the light source 55 is controlled, thereby controlling the scattering range of the light.

[0139] During the implementation process, the camera module 4 is accurately adjusted in position by adjusting the height adjustment device on the support frame 1, rotating the slide bar 3, and adjusting the position of the camera module 4 on the slide bar 3; a fan 44 is set in the camera module 4, and four fans 44 are responsible for air intake and air outlet respectively, so as to ensure that the line scan camera 45 is efficiently cooled; an air duct 43 is set corresponding to the fan 44 responsible for air outlet, and the air outlet 42 of the air duct 43 is located on the glass outside of the housing of the camera module 4 to prevent dust from falling on the outside of the glass; the light source module 5 is set to include a front light source 51 and a backlight source 54, so as to fully ensure that the brightness within the lens range of the line scan camera 45 is sufficient to meet the image shooting requirements; the backlight source 54 is set to include a light source 55 and a shading sheet 56, and the shading sheet 56 is embedded in the light source 55, and the depth of the shading sheet 56 and the light source 55 embedded in the light source 55 is adjustable, so as to adjust the spreading angle of the light source 55 and accurately control the lighting range of the lighting module.

[0140] like Fig. 9 As shown, a coil inspection system based on a line scan camera includes the following steps:

[0141] Step 1: The console receives the power-on command, and the processor starts the power-on initialization process; after the power-on initialization process is completed, the display shows the power-on interface; the power-on interface includes "enter system" and "exit system" buttons, which correspond to the "enter system" command and the "exit system" command respectively;

[0142] Step 2: The console receives the operation instruction of the power-on interface, and determines whether it is an "exit system" instruction or an "enter system" instruction; if it is an "exit system" instruction, the console is closed and the step ends; if it is an "enter system" instruction, the display jumps from the power-on interface to the defect detection interface, and starts multiple line scan camera acquisition threads; the defect detection interface includes "clear", "detection / pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" buttons, which correspond to the "clear", "detection / pause", "historical roll", "roll change", "setting", "forward", "backward" and "exit" instructions respectively; the defect detection interface also includes an image display area, which displays the image collected by the camera module in real time; a detection area slider is set in the image display area, and the detection area slider corresponds to the "detection area division" instruction;

[0143] Step 3: The operation console determines whether it has received the operation instruction of the defect detection interface; if it has received the operation instruction, it proceeds to step 4, otherwise it returns to step 3;

[0144] Step 4: and determine the type of operation instruction; if it is a "clear" instruction, go to step 5; if it is a "detection / pause" instruction, go to step 6; if it is a "historical volume" instruction, go to step 7; if it is a "change volume" instruction, go to step 8; if it is a "set" instruction, go to step 9; if it is a "forward" or "backward" instruction, go to step 10; if it is a "exit" instruction, go to step 11; if it is a "detection area division" instruction, go to step 12;

[0145] Step 5: The console receives a "clear" command and prompts the user whether to clear the historical information prompt. In this example, the historical information is the historical program exception information, etc. If a confirmation command is received, the historical information prompt is cleared; if a denial command is received, the process returns to step 3;

[0146] Step 6: The console receives the "Detect / Pause" command and determines whether it is a "Detect" command or a "Pause" command; if it is a "Detect" command, the console enters the real-time detection process until a "Pause" command is received, and returns to step 3; if it is a "Pause" command, the real-time detection process ends and returns to step 3; it should be noted that when the defect detection interface is entered for the first time after powering on, the "Detect" button is displayed, corresponding to the "Detect" command, and the "Detect" button will switch to the "Pause" button after being clicked, and the "Pause" button will switch to the "Detect" button after being clicked, and the "Pause" button corresponds to the "Pause" command;

[0147] Step 7: The console receives the "historical volume" command, controls the display to enter the historical volume interface, starts the historical volume interface process, and returns to step 3 after the historical volume interface process ends;

[0148] Step 8: The console receives the "change roll" command and determines whether the real-time detection process is turned on; if the real-time detection process is turned on, the display prompts "Please pause real-time detection first" and returns to step 3; if the real-time detection process is not turned on, the roll number, roll length and other information are updated according to the input, and the display image resources are released, the corresponding data is written into the database, and the return is to step 3;

[0149] Step 9: The console receives the "Set" command, creates and enters the setting interface; exits the setting interface and returns to step 3;

[0150] Step 10: The console receives a "forward" or "backward" instruction, and determines whether it is a "forward" instruction or a "backward" instruction; if it is a "forward" instruction, further determine whether it is the last page of the current image, if it is the last page, give a prompt and return to step 3, if it is not the last page, advance one page and return to step 3; if it is a "backward" instruction, further determine whether it is the first page of the current image, if it is the first page, give a prompt and return to step 3, if it is not the first page, go back one page and return to step 3;

[0151] Step 11: The console receives the "exit" command and prompts the user whether to confirm to exit the system; if confirmed, the step ends; if not confirmed, the step returns to step 3;

[0152] Step 12: When the console receives the "detection area division" command, it modifies the values ​​of the left and right non-detection areas of the image accordingly, saves the modified values ​​into the system parameters, and returns to step 3.

[0153] like Fig.10 As shown, the power-on initialization process in step 1 includes the following steps:

[0154] Step 101: The console completes the initialization of the power-on detection interface;

[0155] Step 102: After completing the interface initialization, proceed with the database connection process;

[0156] Step 103: After completing the database connection process, read the database data; the database data includes system configuration parameters, camera configuration parameters, defect detection internal parameters, defect detection product parameters, etc.;

[0157] Step 104: controlling the storage device in the console to be connected to the line scan camera so that the data collected by the line scan camera can be stored in the storage device; in this example, the storage device is a capture card;

[0158] Step 105: Connect the serial port and check each serial port channel;

[0159] Step 106: Verify the initialization status, including verifying whether the process of steps 101 to 105 is successfully completed;

[0160] If there are abnormal steps, the user is prompted to choose to enter the system or exit the system; if the user chooses to enter the system, the boot interface is entered and the steps are ended; if the user chooses to exit the system, the system is exited and the steps are ended;

[0161] If there is no abnormal step, directly enter the power-on interface and end the step.

[0162] The boot detection interface initialization process of step 101 includes the following steps:

[0163] Step 1011: The operation console obtains the current time and date through the network connection;

[0164] Step 1012: Start date acquisition and timer display;

[0165] Step 1013: Initialize the power-on detection related variables, including the result flags of database connection and reading, the result flags of storage device and line scan camera connection, and the result flags of serial port module connection; during the operation of the console system, the values ​​of the above flags will be set according to the initialization status;

[0166] Step 1014: obtaining a startup interface control and completing display settings of the startup interface control; entering the startup interface, and displaying the startup interface control;

[0167] Step 1015: Create threads for database connection and database reading, threads for storage device and line scan camera connection, and threads for serial port to IO module, and then end the step.

[0168] The purpose of creating the flag bit in step 1013 is to facilitate the verification of the initialization status in step 106. By reading the flag bit, the completion status of steps 102 to 105 can be obtained.

[0169] like Fig.11 As shown, the database connection process in step 102 includes the following steps:

[0170] Step 1021: Obtain setting information, call the database connection function, and enter setting information; the setting information is the information provided by the console or pre-entered information, and the setting information includes the database server name, user name, and password;

[0171] Step 1022: Get the return value of the database connection function, and determine the database connection status according to the return value. The database connection status includes database connection success, database connection failure, and database connection abnormality. If the database connection is successful, go to step 1023; if the database connection fails, go to step 1024; if the database connection is abnormal, go to step 1025;

[0172] Step 1023: The database connection is successful, the database connection flag is set to the database connection success state, and the control display is set to the database connection success, and the process goes to step 1026;

[0173] Step 1024: if the database connection fails, the database connection flag is set to the database connection failure state, and the control display is set to database connection failure; the database connection failure information is written into the system log file, a database connection failure prompt dialog box is popped up, and the step ends;

[0174] Step 1025: Database connection is abnormal, the database connection flag is set to the database connection abnormal state, and the control display is set to database connection abnormal; the database connection abnormal information is written into the system log file, and a database connection failure prompt dialog box is popped up, and the step ends; wherein the database connection abnormality means that the database connection function displays an abnormal result other than connection success and connection failure;

[0175] Step 1026: If the database connection is successful, determine whether the project database exists in the database; if the project database exists, end the step; otherwise, create the project database and end the step.

[0176] The project database in step 1026 includes a system parameter table, a camera configuration parameter table, a product defect parameter table, a real-time detection parameter table, a historical roll information record table, and a historical roll defect information table. In the process of creating a project database, it is necessary to configure the system parameter table, the camera configuration parameter table, the product defect parameter table, the real-time detection parameter table, the historical roll information record table, and the historical roll defect information table, and set the table creation command, table existence judgment command, data table search command, and data table insertion command for each data table. In this example, the contents of each data table are as follows:

[0177] System parameter table, named systemparameter: "Number of cameras", "System configuration selected camera", "Detection parameter selected camera", "Serial port number", "Left edge detection position", "Right edge detection position", "Software version number", "Administrator password", "Operator password", "Technician password";

[0178] The camera configuration parameter table is named CameraParameter: "Camera type", "Maximum exposure", "Minimum exposure", "Adjustment scale", "Upper grayscale limit", "Lower grayscale limit", "Magnification", "Upper limit of defect number", "Dynamic dark threshold", "Dynamic bright threshold", "Dynamic extremely dark threshold", "Dynamic extremely bright threshold", "Normal dark threshold", "Normal bright threshold", "Large area dynamic dark threshold", "Number of segments", "Detection segments", "Averaging convolution kernel 1", "Averaging convolution kernel 2", "Averaging convolution kernel 3", "Averaging convolution kernel 4";

[0179] Product defect parameter table, named ProductDefectParameter: "Product Name", "Defect Name", "Priority", "Upper limit of horizontal width", "Lower limit of horizontal width", "Upper limit of vertical length", "Lower limit of vertical length", "Upper limit of vertical length to line width", "Lower limit of vertical length to line width", "Upper limit of horizontal width to vertical length", "Lower limit of horizontal width to vertical length", "Upper limit of area", "Lower limit of area", "Upper limit of bright area ratio", "Lower limit of bright area ratio", "Upper limit of hole area ratio", "Lower limit of hole area ratio", "Upper limit of dark area ratio", "Lower limit of dark area ratio", "Whether to display mark symbol", "Font style", "Font size", "Mark character", "Color R", "Color G", "Color B", "Red light alarm switch", "Red light alarm duration", "Green light alarm switch", "Green light alarm duration", "Yellow light alarm switch", "Yellow light alarm duration";

[0180] Real-time inspection parameter table: "Current shift", "Current roll number", "Current inspection product", "Current inspection defect";

[0181] Historical volume information record table: "Volume number", "Width", "Detected length";

[0182] Historical roll defect information table: "Roll number", "Defect number", "Camera number", "Product name", "Defect name", "Image address", "Width", "Length", "Working vertical position", "Working horizontal position", "Working edge", "Transmission edge", "Area", "Dark and light holes", "Line width ratio", and "Detection time".

[0183] In step 103, during the process of reading the database, it is first necessary to determine whether there is data in the project database. The data here represents the specific data of the data table in step 102; if there is data, the corresponding data is read, and the corresponding device configuration is completed according to the read data; if there is no data, the default data is written, and the data of each data table is read and stored in the program, and the corresponding device configuration is completed at the same time. In this example, the default data of the project database includes:

[0184] Default data of the system parameter table: The default value of the number of cameras is 2; The default value of the camera configuration parameter camera number selection is 1; The default value of the serial port number is COM5; The default value of the left edge detection position is 100, in mm; The default value of the right edge detection position is 100, in mm; The default value of the software version number is V1.0; The default value of the administrator password is 123456; The default value of the operator password is 123456, and the default value of the technician password is 123456;

[0185] Default data of the camera configuration parameter table: Camera number, which is incremented from 1 according to the camera number; Maximum exposure time, the default value is 950; Minimum exposure time, the default value is 50; Exposure adjustment scale default value is 10; Grayscale upper limit default value is 160; Grayscale lower limit default value is 120; Camera magnification default value is 8.822; Defect upper limit default value is 10; Dynamic dark threshold default value is 50, dynamic bright threshold default value is 50, dynamic extremely dark threshold default value is 60, dynamic extremely bright threshold default value is 60, normal dark threshold default value is 45, normal bright threshold default value is 45, large area dynamic dark threshold default value is 60, segment number default value is 10, detection segment default value is 5, average convolution kernel 1 default value is 5, average convolution kernel 2 default value is 30, average convolution kernel 3 default value is 80, average convolution kernel 4 default value is 130;

[0186] The defect names in the product defect parameter table include nine types by default: small black spots, medium black spots, large black spots, small white spots, medium white spots, large white spots, small holes, medium holes and large holes. For each type, its defect parameters are set, including:

[0187] Small black dots: The default value of product name is PVB, the default value of defect name is small black dots, the default value of priority level is 1, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0), the default value of horizontal width ratio vertical length upper limit is 0), the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.35, the default value of area lower limit is 0.1, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 0, hole area The default value of the lower limit is 0, the default value of the upper limit of the dark area ratio is 1.1, the default value of the lower limit of the dark area ratio is 0.4, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is b, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.

[0188] Medium black spot: The default value of product name is PVB, the default value of defect name is medium black spot, the default value of priority level is 2, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.5, the default value of area lower limit is 0.35, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 0, the default value of hole area ratio The default value of the lower limit is 0, the default value of the upper limit of the dark area ratio is 1.1, the default value of the lower limit of the dark area ratio is 0.4, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is B, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.

[0189] Big Black Spot: The default value of Product Name is PVB, the default value of Defect Name is Big Black Spot, the default value of Priority is 3, the default value of Horizontal Width Upper Limit is 0, the default value of Horizontal Width Lower Limit is 0, the default value of Vertical Length Upper Limit is 0, the default value of Vertical Length Lower Limit is 0, the default value of Vertical Length Ratio Line Width Upper Limit is 0, the default value of Vertical Length Ratio Line Width Lower Limit is 0, the default value of Horizontal Width Ratio Vertical Width Upper Limit is 0, the default value of Horizontal Width Ratio Vertical Width Lower Limit is 0, the default value of Area Upper Limit is 2000, the default value of Area Lower Limit is 0.5, the default value of Bright Area Ratio Upper Limit is 0, the default value of Bright Area Ratio Lower Limit is 0, the default value of Hole Area Ratio Upper Limit is 0, the default value of Hole Area Ratio Lower Limit is The default value of the upper limit is 0, the default value of the dark area ratio upper limit is 1.1, the default value of the dark area ratio lower limit is 0.4, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is B, the default value of color R is 255, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.

[0190] Small white dots: The default value of product name is PVB, the default value of defect name is small white dots, the default value of priority level is 4, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.35, the default value of area lower limit is 0.1, the default value of bright area ratio upper limit is 1.1, the default value of bright area ratio lower limit is 0.4, the default value of hole area ratio upper limit is 0, The default value of the lower limit of hole area ratio is 0, the default value of the upper limit of dark area ratio is 0, the default value of the lower limit of dark area ratio is 0, the default value of whether to display mark symbol is True, the default value of font style is Songti, the default value of font size is 12, the default value of mark character is w, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of red light alarm switch is True, the default value of red light alarm duration is 1, the default value of green light alarm switch is False, the default value of green light alarm duration is 0, the default value of yellow light alarm switch is False, the default value of yellow light alarm duration is 0.

[0191] Middle white point: The default value of product name is PVB, the default value of defect name is middle white point, the default value of priority level is 5, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.5, the default value of area lower limit is 0.35, the default value of bright area ratio upper limit is 1.1, the default value of bright area ratio lower limit is 0.4, the default value of hole area ratio upper limit is 0, The default value of hole area ratio lower limit is 0, the default value of dark area ratio upper limit is 0, the default value of dark area ratio lower limit is 0, the default value of whether to display mark symbol is True, the default value of font style is Songti, the default value of font size is 12, the default value of mark character is W, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of red light alarm switch is True, the default value of red light alarm duration is 1, the default value of green light alarm switch is False, the default value of green light alarm duration is 0, the default value of yellow light alarm switch is False, the default value of yellow light alarm duration is 0.

[0192] White Spot: The default value of Product Name is PVB, the default value of Defect Name is White Spot, the default value of Priority is 6, the default value of Horizontal Width Upper Limit is 0, the default value of Horizontal Width Lower Limit is 0, the default value of Vertical Length Upper Limit is 0, the default value of Vertical Length Lower Limit is 0, the default value of Vertical Length Ratio Line Width Upper Limit is 0, the default value of Vertical Length Ratio Line Width Lower Limit is 0, the default value of Horizontal Width Ratio Vertical Width Upper Limit is 0, the default value of Horizontal Width Ratio Vertical Width Lower Limit is 0, the default value of Area Upper Limit is 2000, the default value of Area Lower Limit is 0.5, the default value of Bright Area Ratio Upper Limit is 1.1, the default value of Bright Area Ratio Lower Limit is 0.4, the default value of Hole Area Ratio Upper Limit is 0, Hole The default value of area ratio lower limit is 0, the default value of dark area ratio upper limit is 0, the default value of dark area ratio lower limit is 0, the default value of whether to display mark symbol is True, the default value of font style is Songti, the default value of font size is 12, the default value of mark character is W, the default value of color R is 255, the default value of color G is 0, the default value of color B is 0, the default value of red light alarm switch is True, the default value of red light alarm duration is 1, the default value of green light alarm switch is False, the default value of green light alarm duration is 0, the default value of yellow light alarm switch is False, the default value of yellow light alarm duration is 0.

[0193] Small holes: The default value of product name is PVB, the default value of defect name is small holes, the default value of priority level is 7, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.35, the default value of area lower limit is 0.1, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 1.1, hole surface The default value of the lower limit of the area ratio is 0.4, the default value of the upper limit of the dark area ratio is 0, the default value of the lower limit of the dark area ratio is 0, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is h, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.

[0194] Medium Hole: The default value of product name is PVB, the default value of defect name is medium hole, the default value of priority level is 8, the default value of horizontal width upper limit is 0, the default value of horizontal width lower limit is 0, the default value of vertical length upper limit is 0, the default value of vertical length lower limit is 0, the default value of vertical length ratio line width upper limit is 0, the default value of vertical length ratio line width lower limit is 0, the default value of horizontal width ratio vertical length upper limit is 0, the default value of horizontal width ratio vertical length lower limit is 0, the default value of area upper limit is 0.5, the default value of area lower limit is 0.35, the default value of bright area ratio upper limit is 0, the default value of bright area ratio lower limit is 0, the default value of hole area ratio upper limit is 1.1, hole surface The default value of the lower limit of the area ratio is 0.4, the default value of the upper limit of the dark area ratio is 0, the default value of the lower limit of the dark area ratio is 0, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is H, the default value of color R is 0, the default value of color G is 0, the default value of color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, and the default value of the yellow light alarm duration is 0.

[0195] Large Holes: The default value of Product Name is PVB, the default value of Defect Name is Large Holes, the default value of Priority is 9, the default value of Width Upper Limit is 0, the default value of Width Lower Limit is 0, the default value of Length Upper Limit is 0, the default value of Length Lower Limit is 0, the default value of Length Ratio Line Width Upper Limit is 0, the default value of Length Ratio Line Width Lower Limit is 0, the default value of Width Ratio Vertical Upper Limit is 0, the default value of Width Ratio Vertical Lower Limit is 0, the default value of Area Upper Limit is 2000, the default value of Area Lower Limit is 0.5, the default value of Bright Area Ratio Upper Limit is 0, the default value of Bright Area Ratio Lower Limit is 0, the default value of Hole Area Ratio Upper Limit is 1.1, Hole Area The default value of the lower limit is 0.4, the default value of the upper limit of the dark area ratio is 0, the default value of the lower limit of the dark area ratio is 0, the default value of whether to display the mark symbol is True, the default value of the font style is Songti, the default value of the font size is 12, the default value of the mark character is H, the default value of the color R is 255, the default value of the color G is 0, the default value of the color B is 0, the default value of the red light alarm switch is True, the default value of the red light alarm duration is 1, the default value of the green light alarm switch is False, the default value of the green light alarm duration is 0, the default value of the yellow light alarm switch is False, the default value of the yellow light alarm duration is 0;

[0196] Default data of real-time detection parameter table: the default value of current shift is 1, the default value of current roll number is 1, the default value of current detection product is PVB, the default value of current detection defect is small black dot;

[0197] Default data of historical volume information record table: volume number, width, detected length;

[0198] The default data of historical roll defect information: roll number, defect number, camera number, product name, defect name, image address, width, length, work vertical position, work horizontal position, work edge, transmission edge, area, dark and light holes, line width ratio, and detection time.

[0199] like Fig.12 As shown, the verification of the serial port in step 105 is mainly performed by comparing the serial port number read from the database with the baud rate to open the serial port and the returned operation result to obtain the verification result. The process of connecting the serial port and performing the verification includes:

[0200] Step 1051: Add a serial port callback function and set the processing method for different serial port return signals;

[0201] Step 1052: Open the serial port;

[0202] Step 1053: Determine the serial port connection status and return the serial port connection status;

[0203] Step 1054: judging whether the serial port has completed the connection according to the returned serial port status; if the serial port has completed the connection, proceeding to step 1055; otherwise, giving a prompt and ending the step;

[0204] Step 1055: Read the connected serial port address, set the serial port address to 0, and read the return value; if the return value is "FE4200AD24", it means that the serial port address is set successfully; otherwise, a prompt is given and the step ends;

[0205] Step 1056: Open and close each channel of the serial port in turn, send a self-test command to the opened channel, and determine whether the channel is normal according to the return value;

[0206] Step 1057: Complete the verification of each channel of the serial port and end the step.

[0207] The image display area of ​​the defect detection interface in step 2 includes an upper part and a lower part, wherein the upper part displays the marking image, which is obtained through the real-time detection process, and the lower part displays the image captured by the line scan camera in real time. In this example, the lower part displays the image spliced ​​by the line scan camera. It should be noted that when the defect detection interface enters the real-time detection process, the "Clear", "History Volume", "Change Volume", "Set", "Forward", "Backward" and "Exit" buttons of the defect detection interface will be disabled, and only the "Detect / Pause" button will be enabled.

[0208] The real-time display of the image acquired by the line scan camera includes the following steps:

[0209] Step 21: The line scan camera collects images and transmits the camera's image buffer to the operation console;

[0210] Step 22: The console receives the image buffer and converts the camera buffer into image data through the callback function of the line scan camera;

[0211] Step 23: Store the image data in the image queues in sequence, and determine whether all queues have image data caches; if all queues have image data caches, take out the first image data of each queue to form a real-time image list; if any queue is empty, return to step 21;

[0212] Step 24: After taking out the first image from each queue, clear the image buffer of each image queue;

[0213] Step 25: stitch the retrieved images, display the stitched images in the image display area, and end the step.

[0214] The number of image queues in step 23 is related to the number of line scan cameras. For example, if ten camera modules are arranged on the slide bar for image acquisition, the image queues are set to 10, and the image data acquired by each line scan camera will be stored in the corresponding queue.

[0215] A detection area slider is set at the top of the image display area of ​​the defect detection interface. In this example, there are two detection area sliders, which are set on the left and right sides respectively. In this example, the right image of the left slider and the left image of the right slider are the detection area of ​​the image, and the left image of the left slider and the right image of the right slider are the non-detection area of ​​the image.

[0216] The defect detection interface also includes a defect photo wall area, which is located on the right side of the defect detection interface in this example. The defect photo wall is used to display defect screenshots. The defect screenshots are images showing defect areas captured from defect images. The defect screenshots are obtained through real-time detection processes. In this example, the length and width of the defect screenshots and the detection roll length of the image data to which the defect screenshots belong are also set corresponding to the defect screenshots. The detection roll length indicates the roll length of the coil corresponding to the collected image data; the "forward" and "backward" buttons are set in the defect photo wall area, and the "forward" and "backward" buttons are used to control the photos displayed in the defect photo wall. The defect detection interface also includes a coil real-time defect information display area, which displays specific information about the current coil, including product name, class number, roll number, detection roll length, width, vehicle speed, number of defects, uniformity, and system time. In this example, the coil real-time defect information display area is located at the top of the defect detection interface. The defect detection interface also includes the latest defect information display area, which is located on the left side of the defect detection interface in this example, including type, vertical position, horizontal position, edge, transfer edge, dark and bright holes, line width ratio, width, length, area, camera number, roll number, number, and detection time. The defect detection interface also includes a message prompt box. In this example, the message prompt box is set at the bottom left of the defect detection interface, where the "clear" button is set in the message prompt box. The message prompt box is used to display prompts such as program abnormalities or automatic exposure adjustment. The bottom of the defect detection interface also displays data such as the number of camera images, the number of camera caches, and the number of processed images.

[0217] like Fig.13 As shown, the data displayed on the defect detection interface is updated in real time, including the detection roll length, width, vehicle speed information in the defect information display area, as well as the number of camera pictures, camera buffer number, and processed image number information. The data is updated in real time. First, the roll length, vehicle speed, camera picture number, processed image number, and camera buffer number need to be updated according to the current detected roll length, assembly line transmission speed, number of camera pictures, number of processed pictures, and number of unprocessed pictures; secondly, the width data is judged and updated according to the detection area slider set in the image display area; finally, the class number and roll number data of the roll are judged and updated. In this example, the class number and roll number data of the roll are determined according to the user's input.

[0218] like Fig.14 As shown, the real-time detection process in step 6 includes the following steps:

[0219] Step 61: the operating console acquires image data through a line scan camera; and performs a deep copy of the image data; a deep copy means that the source object and the copy object are copied independently of each other, which is an existing copy technology;

[0220] Step 62: Initialize the detection algorithm return parameters and convert the current product detection defect parameters into an algorithm data format; wherein the algorithm data format is a format corresponding to the algorithm detection process;

[0221] Step 63: Input the product defect detection parameters converted into the algorithm data format, the deep copy image data, and the initialized detection algorithm return parameters into the set detection algorithm process, and return the detection algorithm result; detect defects and grayscale values ​​and other parameters in the image data through the detection algorithm process. In this example, the defects include small black dots, medium black dots, large black dots, small white dots, medium white dots, large white dots, small holes, medium holes, and large holes;

[0222] Step 64: traverse the detection algorithm results and filter out the detection algorithm results judged as defects;

[0223] Step 65: determine in turn whether the position of the defect detection algorithm result is within the detection range; in this example, it is represented by whether the horizontal coordinate of the position of the detection algorithm result is within the range corresponding to the "detection area division" instruction;

[0224] Step 66: Obtain defect information of defect points within the detection range, add them to the defect list and marking queue, and record the defect information to the database; the defect information includes the detected defect image, defect location, defect type, and defect screenshot, etc. The defect image is the spliced ​​image data including the defect;

[0225] Step 67: Acquire image data, and complete the grayscale value dynamic adjustment process according to the image data, adjust the exposure of the line scan camera and the brightness of the light source module, etc.;

[0226] Step 68: Complete the defect handling process according to the defect information;

[0227] Step 69: Release the resources used in the detection thread and end the step.

[0228] To obtain image data in step 61, it is first necessary to obtain the image buffer of the camera module, and then convert the camera buffer into image data through the callback function of the line scan camera.

[0229] In step 62, the defect detection parameters in the algorithm data format include:

[0230] a) Defect name: defectName.

[0231] b) Defect screening length threshold lower limit (mm): detectLengthArrayFrom.

[0232] c) Defect screening length threshold (mm): detectLengthArrayTo.

[0233] d) Defect screening width threshold lower limit (mm): detectWidthArrayFrom.

[0234] e) Defect screening width threshold (mm): detectWidthArrayTo.

[0235] f) The lower limit of the defect screening area threshold in mm2, 0 means that this criterion is not used as a criterion: detectAreaArrayFrom.

[0236] g) Upper limit of defect screening area threshold mm2, 0 means no upper limit: detectAreaArrayTo.

[0237] h) Lower limit of the ratio of defect screening width to length: detectWidthLengthArrayFrom.

[0238] i) Upper limit of defect screening width and length ratio: detectWidthLengthArrayTo.

[0239] j) The lower limit of the ratio of defect screening line width to length: detectLineWidthLengthArrayFrom.

[0240] k) Upper limit of the ratio of defect screening line width to length: detectLineWidthLengthArrayTo.

[0241] l) Lower limit of defect bright area ratio: detectLightRegionPercentsArrayFrom.

[0242] m) Upper limit of defect bright area ratio: detectLightRegionPercentsArrayTo.

[0243] n) The lower limit of the dark area ratio of defects: detectDarkRegionPercentsArrayFrom.

[0244] o) Upper limit of the proportion of dark area of ​​defects: detectDarkRegionPercentsArrayTo.

[0245] p) Lower limit of defect hole area ratio: detectHoleRegionPercentsArrayFrom.

[0246] q) Upper limit of defect hole area ratio: detectHoleRegionPercentsArrayTo.

[0247] r) Length of the left undetected area: LeftDetectOneImageAbandonWidth.

[0248] s) Length of the right non-detection area: RightDetectOneImageAbandonWidth.

[0249] t) Maximum number of detected defects: maxDefectNumber.

[0250] u) Common dark threshold: CommonDarkThresh.

[0251] v) Dynamic dark threshold: DynamicDarkThresh.

[0252] w) Dynamic Very Dark Threshold: DynamicVeryDarkThresh.

[0253] x) Dynamic Big Area Dark Threshold: Dynamic Big Area Dark Thresh.

[0254] y) Common light threshold: CommonLightThresh.

[0255] z) Dynamic light threshold: DynamicLightThresh.

[0256] aa) Dynamic Very Light Threshold: DynamicVeryLightThresh.

[0257] bb) Image magnification (piexels / mm): CameraImageMagnification.

[0258] cc) Camera grayscale adjustment segment number: CameraImageGrayAdjustImageSectionNum.

[0259] dd) Camera grayscale adjustment detection section: CameraImageGrayAdjustDetectSection.

[0260] In step 63, the detection algorithm results returned include:

[0261] a) Return result: result: (0: qualified detection, 1: defective, -1: abnormal detection, -2: incorrect output detection parameters, -3: image is empty, 10: image is too bright, 11: image is too dark).

[0262] b) Gray value: ImageGray.

[0263] c) Number of photos: picNumber.

[0264] d) Defect list arrayDefectsClass.

[0265] e) Defect center X coordinate array: arrayDefectCenterX.

[0266] f) Defect center Y coordinate array: arrayDefectCenterY.

[0267] / / Minimum bounding rectangle of defect

[0268] g)arrayDefectRectangleX.

[0269] h)arrayDefectRectangleY.

[0270] i)arrayDefectRectangleWidth.

[0271] j)arrayDefectRectangleHeight.

[0272] k) Defect area array: arrayDefectArea.

[0273] l) Defect length array: arrayDefectLength.

[0274] m) Defect width array: arrayDefectWidth.

[0275] n) Defect width length ratio array: arrayDefectWidthLength.

[0276] o) Defect line length ratio array: arrayDefectLineWidthLength.

[0277] p) Defect hole area ratio array: arrayDefectHoleRegionPercents.

[0278] q) Defective light area ratio array: arrayDefectLightRegionPercents.

[0279] r) Defect dark area ratio array: arrayDefectDarkRegionPercents.

[0280] s) Average grayscale: imageMean.

[0281] t) Grayscale variance: imageDeviation.

[0282] u) Image width: mm:imageWidth.

[0283] v) Image height: mm:imageHeight.

[0284] w) Detection area width: mm: detectRegionWidth.

[0285] Before traversing the detection algorithm results in step 65, the detection algorithm results need to be converted from the algorithm data format to the C# data format to facilitate screening of the detection algorithm results.

[0286] like Fig.15 As shown, the gray value dynamic adjustment in step 67 includes the following steps:

[0287] Step 6701: the operating console obtains the real-time stitched image data A1 collected by all line scan cameras, and detects the overall grayscale value of the stitched image data A1;

[0288] Step 6702: determine the relationship between the overall gray value of the image A1 and the set limit value X1; in this example, the overall gray value of the image is less than the limit value X1, indicating that the image data A1 is an image close to pure black; if the overall gray value of the image is less than the limit value X1, the light source switching process is started, and after the light source switching process is completed, the line scan camera exposure adjustment flag is cleared and the process proceeds to step 6703; otherwise, the process proceeds directly to step 6703;

[0289] Step 6703: determine whether there is an unprocessed detection thread; if there is an unprocessed detection thread, end the step; otherwise, proceed to step 6704; the detection thread represents an algorithm detection of the image;

[0290] Step 6704: The operation console does not perform a real-time detection process, and segments the image data A1 according to the set segmentation parameters; in this example, it is set to 10 segments;

[0291] Step 6705: Calculate the overall grayscale value of each segment image for the obtained segmented images, and determine the relationship between the ratio of the overall grayscale value of the set segment image A2 to the average grayscale value of other segment images and the set value X2. In this example, the set segment image A2 is the segment image of the 5th segment. If the ratio is greater than the set value X2, the image is considered abnormal, and the step ends. In this example, the set value X2 is 0.1. If the ratio is less than or equal to the set value X2, proceed to step 6706.

[0292] Step 6706: Determine whether the current image data A1 is the first frame image captured by the line scan camera; if it is the first frame image, directly proceed to step 6712; otherwise, proceed to step 6707;

[0293] Step 6707: Obtain n frames of image data before the current image data A1 of the line scan camera. If the image data before the current image data A1 is less than n frames, obtain all images before the image data A1. In this example, n is 10.

[0294] Step 6708: Calculate the average grayscale value of the previous image data obtained in step 6707, and compare the average grayscale value with the overall grayscale value of segment image A2 to determine the relationship between the difference between the two and the ratio of the overall grayscale value of segment image A2 and the set value X3; if the difference ratio is greater than the set value X3, the image is considered abnormal and the step ends. In this example, the set value X3 is 0.1; if the ratio is less than or equal to the set value X3, proceed to step 6709;

[0295] Step 6709: obtaining new image data A3 formed by stitching data collected by all line scan cameras, and obtaining the overall grayscale value of the image data A3;

[0296] Step 6710: compare the overall grayscale value of the image data A3 with the set system grayscale value range (X3, X4); if the overall grayscale value of the spliced ​​image data A3 is greater than the system grayscale value upper limit X4, proceed to step 6711; if the overall grayscale value of the spliced ​​image data A3 is less than the system grayscale value lower limit X3, proceed to step 6712; otherwise, directly proceed to step 6713;

[0297] Step 6711: if the overall grayscale value of the image data A3 is greater than the upper limit of the system grayscale value X4, determine whether the brightness of the light source module is greater than the set minimum value X5; if the brightness of the light source module is greater than the set minimum value X5, reduce the brightness of the light source module, clear the line scan camera exposure adjustment flag, and enter step 6713; otherwise, directly enter step 6713; wherein the brightness of the light source module is measured and adjusted by power;

[0298] Step 6712: if the overall grayscale value of the image data A3 is less than the lower limit of the grayscale value of the system X3, it is determined whether the brightness of the light source module is less than the set maximum value X6; if the brightness of the light source module is less than the set maximum value X6, the brightness of the light source module is enhanced, and the exposure adjustment flag of the line scan camera is cleared, and the process proceeds to step 6713; otherwise, the process proceeds directly to step 6713;

[0299] Step 6713: Obtain the exposure adjustment flags of all line scan cameras and determine whether the exposure adjustment has been completed; if the exposure adjustment has been completed, proceed to step 6723; otherwise, proceed to step 6714;

[0300] Step 6714: obtaining the serial number of the line scan camera that has not completed the exposure adjustment; wherein the serial number is a preset value of the line scan camera, and is used to distinguish different line scan cameras in the system. In this example, the serial number of the line scan camera corresponds to its image storage queue; controlling the line scan camera with a set serial number to collect image data A4, in this example, the line scan camera with the smallest serial number among the line scan cameras that have not completed the exposure adjustment is controlled;

[0301] Step 6715: Determine whether the grayscale value precision adjustment flag of the line scan camera is turned on; if the grayscale value precision adjustment flag is turned on, proceed to step 6716; otherwise, proceed to step 6719; wherein the grayscale value precision adjustment flag can be turned on and off by external input;

[0302] Step 6716: The grayscale value precision adjustment flag is turned on, and the relationship between the overall grayscale value of the image data A4 and the high-precision grayscale value range (X7, X8) is determined; if the overall grayscale value of the image data A4 is less than X7, then the process proceeds to step 6717; if the overall grayscale value of the image data A4 is greater than X8, then the process proceeds to step 6718; otherwise, it indicates that the grayscale value of the image data A4 meets the high-precision grayscale value range, and the grayscale value precision adjustment flag is turned off, and the line scan camera exposure adjustment flag is input, indicating that exposure adjustment has been performed, and then the process proceeds to step 6722;

[0303] Step 6717: if the overall grayscale value of the image data A4 is less than X7, the relationship between the current exposure of the line scan camera and the set upper exposure limit X9 is determined; if the current exposure of the line scan camera is greater than the upper exposure limit X9, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is increased, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;

[0304] Step 6718: if the overall grayscale value of the image data A4 is greater than X8, the relationship between the current exposure of the line scan camera and the set exposure lower limit X10 is determined; if the current exposure of the line scan camera is less than the exposure lower limit X10, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is reduced, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;

[0305] Step 6719: if the grayscale value precise adjustment flag is not turned on, determine the relationship between the overall grayscale value of the image data A4 and the grayscale value adjustment range (X11, X12); if the overall grayscale value of the image data A4 is less than X11, proceed to step 6720; if the overall grayscale value of the image data A4 is greater than X12, proceed to step 6720; otherwise, it means that the grayscale value of the image data A4 meets the grayscale value adjustment range, and the line scan camera exposure adjustment flag is input, and proceed to step 6722;

[0306] Step 6720: if the overall gray value of the image data A4 is less than X11, determine the relationship between the current exposure of the line scan camera and the set upper exposure limit X9; if the current exposure of the line scan camera is greater than the upper exposure limit X9, indicate that it cannot be adjusted, input the line scan camera exposure adjustment flag, and proceed to step 6722; otherwise, increase the line scan camera exposure, input the line scan camera exposure adjustment flag, and proceed to step 6722;

[0307] Step 6721: the overall grayscale value of the image data A4 is greater than X12, and the relationship between the current exposure of the line scan camera and the set exposure lower limit X10 is determined; if the current exposure of the line scan camera is less than the exposure lower limit X10, it is prompted that it cannot be adjusted, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722; otherwise, the line scan camera exposure is reduced, and the line scan camera exposure adjustment flag is input, and the process proceeds to step 6722;

[0308] Step 6722: Obtain the exposure adjustment flags of all line scan cameras and determine whether the exposure adjustment has been completed; if the exposure adjustment has been completed, proceed to step 6723; otherwise, return to step 6714;

[0309] Step 6723: All line scan cameras have completed exposure adjustment, and the dynamic adjustment of grayscale values ​​is ended.

[0310] In step 6701, the line scan camera that needs to be adjusted is determined, and the image of the line scan camera is obtained. The purpose is to adjust the exposure of each line scan camera separately to ensure that the exposure adjustment of the line scan camera is accurate.

[0311] In the light source switching process of step 6702, it is first necessary to determine the switching status of the front light source and the backlight source in the light source module. It should be noted that, usually, only one group of the front light source and the backlight source is turned on; then, the brightness of the light source turned on in the light source module is enhanced, and the grayscale value change of the image data collected at this time is determined. If the overall grayscale value increase of the image is greater than the set threshold X2, it is considered that there is no need to change the light source, otherwise switch the light group from the front light source to the backlight source or from the backlight source to the front light source.

[0312] In step 6704, the image data is segmented, and a detection segment image is set, and the detection segment image is compared with other segment images or previous frame image data. This is because in some coils, only the coils within the set width range need to meet the requirements, avoiding unnecessary detection and ensuring the detection speed.

[0313] In steps 6704-6708, the grayscale value relationship between the current segment image A2 and other segment images and previous image data is determined to avoid the situation where the coil is delivered or the coil of non-single color tone is transported, because the delivery of the coil or the coil of different tones will cause a great change in the grayscale value of the image. By comparing the grayscale value with the previous image, it can be known whether the coil is delivered, avoiding unnecessary detection and adjustment; in addition, by comparing the current segment image A2 with other segment images, it can also deal with the situation where the end of the coil is not flush, ensuring that a quick and accurate judgment can be made when the end of the coil is not flush. It should be noted that even if the light source switching process occurs in step 6702, it will not affect the accuracy of the judgment result of this step, because the grayscale value relationship comparison in this step is mainly to determine the transmission status of the coil and ensure that the coil is still being transmitted.

[0314] In step 6710 and step 6714, new stitched real-time image data A3 and image data A4 are obtained because there is a light source switching process in step 6702 and steps 6711-6712. The light source switching process will affect the image data collected by the line scan camera. Therefore, it is necessary to re-acquire the real-time image data to avoid the influence of the light source switching on the grayscale value of the new image data, so as to ensure the dynamic adjustment of the accurate grayscale value of the line scan camera.

[0315] The high-precision grayscale value range (X7, X8) in step 6716 and step 6719∈the grayscale value adjustment range (X11, X12).

[0316] During the process of dynamic adjustment of grayscale values, an exposure adjustment flag is set, wherein the exposure adjustment flag is input marked after the line scan camera completes the exposure adjustment, and is cleared and reset after the light source module is adjusted, to ensure that during the process of dynamic adjustment of grayscale values, all cameras will perform exposure adjustment, and the light source module adjustment will adaptively re-adjust the exposure of the line scan camera to ensure image quality and reduce unnecessary exposure adjustment. It should be noted that in some other implementations, the exposure adjustment flag of the line scan camera will be cleared and reset after the set time or the roll change, to ensure that the exposure adjustment of the line scan camera can be adapted to different rolls in the first place, to ensure the quality of the captured image. The exposure adjustment flag can also be set according to external input.

[0317] like Fig.16 As shown, Fig.16 The update process of the defective photo wall, the defect processing process in step 68 includes the following steps:

[0318] Step 681: updating the display data of the defect detection interface according to the defect information, including the defect information display area and the defect photo wall;

[0319] Step 682: Complete the defect marking process according to the marking queue and defect information;

[0320] Step 683: Issue a defect alarm based on the defect information.

[0321] like Fig.17 As shown, in step 682, the defect marking process includes the following steps:

[0322] Step 6821: Obtain defect information and a marking queue, where the defect information includes a defect image; the defect image is stitched image data including defects;

[0323] Step 6822: respectively obtain the roll length and width of the defect image to be marked, and determine whether they are 0; if either the roll length or the width is 0, end the step; otherwise, proceed to step 6823; wherein the roll length of the defect image represents the length of the roll material displayed in the defect image, and the width of the defect image represents the width of the roll material displayed in the defect image;

[0324] Step 6823: Generate a white background image with the same length and width according to the roll length and width of the defective image;

[0325] Step 6824: Mark a detection roll length scale at a set position of the white background image; the detection roll length indicates the roll length of the roll corresponding to the collected image data;

[0326] Step 6825: Find the position of the defect point on the white background image according to the position information in the defect information, and mark it to obtain a marked image; the mark includes information such as text, pattern, color, etc.;

[0327] Step 6826: Determine whether the image display area of ​​the defect detection interface displays a marking image; if a marking image is displayed, connect the newly obtained marking image to the bottom of the old marking image; if the real-time marking image is not displayed, directly display the marking image;

[0328] Step 6827: Determine whether the pixel length of the marking image displayed in the image display area is greater than the set control size upper limit Y; if it is greater than the set control size upper limit Y, crop the marking image displayed in the image display area and retain the image with a length of Y1 pixels at the tail of the marking image, where the tail is the side of the marking image close to the real-time detection roll length; in this example, set Y to 40000 and Y1 to 0, that is, clear the marking image;

[0329] Step 6828: Control the marking image displayed in the image display area to slide to the end;

[0330] Step 6829: Release image resources and update volume length data; end step.

[0331] like Fig.18 As shown, in the defect alarm of step 683, it is first necessary to obtain the defect information; then traverse the defect information to obtain the defect point with the highest alarm priority, wherein the alarm priority is set according to the type of the defect point, and different alarm priorities correspond to different alarm light flashing times, alarm light colors, etc.; then take the maximum value of the alarm light flashing times of different colors of the defect point, and determine the maximum value as the alarm time, which includes the red light flashing time, the green light flashing time and the yellow light flashing time in this example; finally, according to the alarm time, control the alarm to alarm, and according to the flashing time of the alarm lights of different colors, control the alarm light to flash, and complete the defect alarm.

[0332] like Fig.19 As shown, the historical volume interface in step 7 includes a defective volume number area, a historical marking image display area, and a historical defect photo wall area; wherein the defective volume number area includes a date display and a defective volume number within the day, and the defective volume number area is displayed in a tree diagram for easy viewing and selection; the historical marking image display area is used to display the marking image corresponding to the defective volume number, and the historical defect photo wall area is used to display the defect screenshots captured by the corresponding defective volume number. The historical volume interface is also provided with operation buttons, including a "view report" button, a "forward" button, a "backward" button, and a "return" button; wherein the "view report" button is used to jump to the defect statistical report interface, and in this example, the "view report" button is set in the defective volume number area; the "forward" button and the "backward" button are both set in the historical marking image display area and the historical defect photo wall area, and are used to control the forward and backward movement of the marking image and the defect picture respectively. The historical volume interface also includes a page number input box for realizing a quick jump of the image displayed in the historical marking image display area. The "View Report" button, "Forward" button, "Back" button and "Return" button correspond to the "View Report" command, "Forward" command, "Back" command and "Return" command respectively. The historical volume interface process includes the following steps:

[0333] Step 71: The operation console reads historical volume information in the database, including historical marking images and historical defect screenshots;

[0334] Step 72: Generate a historical volume tree diagram based on the read historical volume information, and load and display it in the defective volume number area; in this example, the historical volume tree diagram is a three-layer tree diagram, including year-month-day-defective volume number;

[0335] Step 73: Determine whether an input instruction from the user through the historical volume tree diagram is received; if an input instruction is received, load the corresponding historical volume information from the database; otherwise, return to step 73;

[0336] Step 74: loading and displaying the marked image in the corresponding historical volume information in the historical marked image display area, and loading and displaying the defect screenshot in the historical defect photo wall area;

[0337] Step 75: Determine whether an operation instruction is received from the user through the operation button or the history volume tree diagram; if an operation instruction is received, complete the operation process according to the operation instruction; otherwise, return to step 75.

[0338] like Fig. 20 As shown, the defect statistics report interface includes a defect statistics table, a defect bar graph and coil information, wherein the defect statistics table counts the defect types, quantities and respective proportions of the coils corresponding to the defective coil numbers; the defect bar graph is drawn according to the defect statistics table, in this example, the horizontal axis of the defect bar graph is the defect type, and the vertical axis is the defect quantity; the coil information includes product name, coil length, coil number, total number of defects, width, class number and other information, and the coil information is obtained through input from sensors or operating consoles. The defect statistics report interface also includes an "Export PDF File" button and a "Return" button; the "Export PDF File" button is used to print the image displayed on the defect statistics report interface in PDF format and output it; the "Return" button is used to return to the historical roll interface.

[0339] The updating of the display information of the defect detection interface in step 8 includes updating the roll number, roll parameters, clearing the real-time roll defect information display area, and setting the real-time roll length and width to 0; releasing the display image resources includes clearing the image display area and the defect photo wall area. In addition, in this example, it is set to automatically change the roll every other day.

[0340] like Figure 21-30 As shown, the setting interface in step 9 includes a "system parameters" button, a "defect classification" button, a "detection parameters" button and a "return" button; wherein the "system parameters" button, the "detection parameters" button, the "defect classification" button and the "return" button are all jump buttons; the "system parameters" button corresponds to the system configuration interface; the "detection parameters" button corresponds to the detection parameters setting interface; the "defect classification" button corresponds to the defect classification setting interface; the "return" button corresponds to the defect detection interface.

[0341] In this example, the system configuration interface includes the parameter settings of camera number, maximum exposure value, minimum exposure value, adjustment scale, grayscale upper limit, grayscale lower limit, number of cameras, serial port, left edge and right edge, where the camera number indicates the line scan camera object modified by the user; the maximum exposure value indicates the upper limit of exposure that can be adjusted when the grayscale value is dynamically adjusted. The variable is an integer with a value range of -1000Hv, in Hv; the minimum exposure value indicates the lower limit of exposure that can be adjusted when the grayscale value is dynamically adjusted. The variable is an integer with a value range of 0Hv-maximum exposure value, in Hv; the adjustment scale indicates the amount of camera exposure adjusted each time when the grayscale value is dynamically adjusted. The variable is an integer with a value range of 0Hv-100Hv, in Hv; the grayscale upper limit indicates the upper limit of the grayscale value when the dynamic adjustment of the grayscale value is turned on. If the grayscale value of the returned image is greater than this value, the exposure is adjusted. This variable is an integer with a value range of -255. The grayscale lower limit indicates the grayscale lower limit for enabling dynamic grayscale adjustment. If the grayscale value of the returned image is less than this value, the exposure is adjusted. This variable is an integer with a value range of 0-grayscale upper limit. The number of cameras indicates the number of enabled line scan cameras. This variable is an integer with a value range of 1-4. The serial port indicates the port number to which the serial port module is connected. This variable is an integer with a value range of 1-20. The left edge indicates the length of the left non-detection area in the defect detection process. This variable is an integer with a value range of 0mm-200mm, in mm. The right edge indicates the length of the right non-detection area in the defect detection process. This variable is an integer with a value range of 0mm-200mm, in mm.

[0342] The detection parameter setting interface includes the parameter settings of camera number, upper limit of defect number, dynamic dark threshold, dynamic volume threshold, dynamic extremely dark threshold, dynamic extremely bright threshold, normal dark threshold, normal bright threshold, large area dark threshold, mean convolution 1, mean convolution 2, mean convolution 3, and mean convolution 4. The camera number indicates the line scan camera object modified by the user; the upper limit of defect number indicates the upper limit of the number of defects that can be detected by the camera image each time the defect detection is performed. The variable is an integer with a value range of 0-20; the dynamic dark threshold indicates the standard dynamic dark threshold of image detection. The variable is an integer with a value range of 5-150; the dynamic volume threshold indicates the standard dynamic volume threshold of image detection. The variable is an integer with a value range of 5-150; the dynamic extremely dark threshold indicates the standard dynamic extremely dark threshold of image detection. The variable is an integer with a value range of 5-150; the dynamic extremely bright threshold indicates the standard dynamic extremely bright threshold of image detection. The variable is an integer with a value range of 5-150; the normal dark threshold indicates the standard normal dark threshold of image detection. This variable is an integer, and its value range is 5-150; normal bright threshold represents the standard normal bright threshold for image detection. This variable is an integer, and its value range is 5-150; large area dark threshold represents the standard large area dark threshold for image detection. This variable is an integer, and its value range is 5-150; mean convolution 1 represents the mean convolution 1 of image detection. This variable is an integer, and its value range is 5-150; mean convolution 2 represents the mean convolution 2 of image detection. This variable is an integer, and its value range is 5-150; mean convolution 3 represents the mean convolution 3 of image detection. This variable is an integer, and its value range is 5-150; mean convolution 4 represents the mean convolution 4 of image detection. This variable is an integer, and its value range is 5-150.

[0343] The defect classification setting interface includes parameter settings for product name, defect name, upper limit of horizontal width, lower limit of horizontal width, upper limit of vertical length, lower limit of vertical length, upper limit of vertical length / line width, lower limit of vertical length / line width, upper limit of line width / vertical length, lower limit of line width / vertical length, upper limit of area, lower limit of area, upper limit of bright area, lower limit of bright area, upper limit of hole area, lower limit of hole area, upper limit of dark area, lower limit of dark area, priority, marking display, marking font, marking character, green alarm light, yellow alarm light, red alarm light, green light alarm duration, yellow light alarm duration, and red light alarm duration. Among them, product name indicates the product object modified by the user; defect name indicates the specified defect object in the product object modified by the user; upper limit of horizontal width indicates the upper limit of horizontal width of the detected defect point, the variable is integer, and the value range is lower limit of horizontal width - 100; lower limit of horizontal width indicates the lower limit of horizontal width of the detected defect point, the variable is integer, and the value range is 0-upper limit of horizontal width; upper limit of vertical length indicates the upper limit of vertical length of the detected defect point, the variable is integer, and the value range is lower limit of vertical length - 100; lower limit of vertical length indicates the lower limit of vertical length of the detected defect point, the variable is integer. The variable is of type, with a value range of 0-upper limit of vertical length; the upper limit of vertical length / line width indicates the upper limit of vertical length / line width of the detected defect point, and the variable is of integer type, with a value range of vertical length / line width lower limit -100; the lower limit of vertical length / line width indicates the lower limit of vertical length / line width of the detected defect point, and the variable is of integer type, with a value range of 0-upper limit of vertical length / line width; the upper limit of line width / longitudinal length indicates the upper limit of line width / longitudinal length of the detected defect point, and the variable is of integer type, with a value range of line width / longitudinal length lower limit -100; the lower limit of line width / longitudinal length indicates the lower limit of line width / longitudinal length of the detected defect point, and the variable is of The value is an integer, and its value range is 0-line width / vertical length upper limit; the area upper limit indicates the upper limit of the area of ​​the detected defect point. This variable is an integer, and its value range is the area lower limit-100; the area lower limit indicates the lower limit of the area of ​​the detected defect point. This variable is an integer, and its value range is 0-area upper limit; the bright area upper limit indicates the upper limit of the bright area of ​​the detected defect point. This variable is an integer, and its value range is the bright area lower limit-100; the bright area lower limit indicates the lower limit of the bright area of ​​the detected defect point. This variable is an integer, and its value range is 0-bright area upper limit; hole area The upper limit indicates the upper limit of the hole area of ​​the detected defect point. This variable is an integer, and its value range is -100. The lower limit of hole area indicates the lower limit of the hole area of ​​the detected defect point. This variable is an integer, and its value range is 0-the upper limit of hole area. The upper limit of dark area indicates the upper limit of the dark area of ​​the detected defect point. This variable is an integer, and its value range is -100. The lower limit of dark area indicates the lower limit of the dark area of ​​the detected defect point. This variable is an integer, and its value range is 0-the upper limit of dark area. The priority indicates the priority display level of the defect, and 1 is the highest.Defects with high priority can be alarmed and marked first. This variable is an integer with a value range of 0-100; Marking display indicates whether to mark the display after the defect is detected. Check it for marking, and uncheck it for not marking; Marking font indicates the font size, font color, and font style of the marking; Marking character indicates the character to be marked; Alarm green light indicates whether the green light is on after the defect is detected. Check it for on, and uncheck it for off; Alarm yellow light indicates whether the yellow light is on after the defect is detected. Check it for on, and uncheck it for off; Alarm red Light indicates whether the red light is on after a defect is detected. If checked, it is on, and if unchecked, it is not on. The green light alarm duration indicates the duration that the green light is on after a defect is detected. This variable is an integer with a value range of 1ms-100ms, and the unit is ms. The yellow light alarm duration indicates the duration that the yellow light is on after a defect is detected. This variable is an integer with a value range of 1ms-100ms, and the unit is ms. The red light alarm duration indicates the duration that the red light is on after a defect is detected. This variable is an integer with a value range of 1ms-100ms, and the unit is ms.

[0344] The values ​​of the left and right non-detection areas of the image in step 12 are determined according to the detection area slider of the image display area of ​​the defect detection interface.

[0345] The operating console is also provided with an external mechanical button, which is connected to the operating console via a serial communication; in this example, the mechanical button is a detection / pause mechanical button and a roll-changing mechanical button. The button serial control process can be implemented through the mechanical button, including the following steps:

[0346] Step a1: the operating console sends an optocoupler query signal to the serial port connected to the mechanical button at a set time interval through a set timer;

[0347] Step a2: the mechanical button receives the optocoupler query signal and returns the optocoupler query result signal according to the pressing state of the mechanical button;

[0348] Step a3: The console receives the returned optocoupler query result signal, obtains the pressing state of the mechanical button, and obtains the type of the connected mechanical button according to the serial port of the returned signal;

[0349] Step a4: The operating console performs corresponding actions according to the type and pressing status of the mechanical button, and ends the step.

[0350] During the implementation process, an operating console is set up to connect the camera module to obtain image data, and real-time display is performed based on the obtained image data, and defect detection of the coil is completed according to the set algorithm; by setting the grayscale value dynamic adjustment process, the exposure and brightness of the camera module and the light source module are controlled to ensure that the grayscale value of the image collected by the camera module meets the set range; by setting the defect marking process, the position of the defect on the coil can be accurately judged and displayed, which is convenient for viewing historical defects; by real-time splicing and displaying the image of the line scan camera, the line scan camera can collect and display the full-width coil image on the operating console.

[0351] like Fig.31 As shown, a coil detection method based on a line scan camera, which can be used as a detection algorithm in the real-time coil detection process, includes the following steps:

[0352] Step S1: The operating console obtains images captured by all line scan cameras and counts the number of images;

[0353] Step S2: Determine whether the acquired image is a multi-channel image; if it is a multi-channel image, convert it into a grayscale image and proceed to step S3; otherwise, directly proceed to step S3;

[0354] Step S3: Select images in sequence, calculate the image size, and complete the cropping of each group of images and obtain the image grayscale value according to the left and right undetected areas; wherein each group of images represents images collected by different line scan cameras at the same time;

[0355] Step S4: Calculate whether there are periodic stripes based on the full image background evaluation; if there are periodic textures, it is a textured material and needs to be detexturized. After detexturization is completed, proceed to the next step; otherwise, proceed directly to the next step;

[0356] Step S5: according to the gray value of the image, the image clarity adaptive process is completed, the corresponding filtering level is determined, the image filtering is completed, and the total defect area in the image is obtained;

[0357] Step S6: Based on the clustering method, the total defect area is processed with multiple defects in the vicinity, and the defect areas that meet the requirements are connected;

[0358] Step S7: obtaining a defect output priority according to the defect area or the defect connected area area; and sorting the defects according to the defect output priority;

[0359] Step S8: Obtain defect information, and determine whether the defect information meets the set threshold range requirements in order of defect output priority; if the defect information meets the set threshold requirements, put the defect information into the output queue in order;

[0360] Step S9: Determine whether the defect information in the output queue exceeds the set output quantity upper limit of the defect information; if it exceeds the set output quantity upper limit of the defect information, output the set output quantity of defect information according to the defect output priority order, and end the step; otherwise, output all the defect information in the queue, and end the step.

[0361] like Fig.32 As shown, the process of completing image cropping and obtaining grayscale values ​​in step S3 includes the following steps:

[0362] Step S31: Obtain a group of images, and determine whether the number of images in the group of images is greater than or equal to one; if the number of images is one, proceed to step S32; if the number of images is greater than one, otherwise proceed to step S33;

[0363] Step S32: if the group of images contains only one image, then determine the relationship between the sum of the widths of the left cropping area and the right cropping area and the image width, wherein the left cropping area and the right cropping area are obtained by the left and right undetected areas; if the sum of the widths of the left cropping area and the right cropping area is greater than the image width, proceed to step S35; if the sum of the widths of the left cropping area and the right cropping area is less than or equal to the image width, proceed to step S36;

[0364] Step S33: if the number of images included in the group of images is greater than one, determine the relationship between the width of the first image and the width of the left cropping area; if the width of the first image is less than the width of the left cropping area, proceed to step S35; otherwise, proceed to step S34;

[0365] Step S34: Determine the relationship between the width of the last image and the width of the right cropping area; if the width of the last image is smaller than the width of the right cropping area, proceed to step S35; otherwise, proceed to step S36;

[0366] Step S35: if the image cropping area is too large, it is judged that the image detection is abnormal, and the step ends, and the detection algorithm ends;

[0367] Step S36: sequentially obtain one image in the group of images, and determine whether the image is the first image in the group of images; if it is the first image in the group of images, proceed to step S37; if it is not the first image in the group of images, proceed to step S38;

[0368] Step S37: if the image is the first image of the group of images, it is determined whether the group of images has only one image; if there is only one image, the left and right cropping areas of the image are obtained according to the left and right undetected areas, and the image is cropped, and the process proceeds to step S310; if there is not one image, the left cropping area of ​​the image is calculated, and the image is cropped, and the process proceeds to step S310;

[0369] Step S38: if the image is not the first image of the group of images, determine whether the image is the last image of the group of images; if it is the last image of the group of images, proceed to step S39; if it is not the last image of the group of images, directly proceed to step S310;

[0370] Step S39: if the image is the last image of the group of images and not the first image, the right cropping area of ​​the image is calculated, and the image cropping is completed, and the process proceeds to step S310;

[0371] Step S310: Calculate the grayscale value of the obtained image and end the step.

[0372] It should be noted that in step S310, after obtaining the grayscale value of the image, the average grayscale value of the image will also be calculated. If the average grayscale value of the image is higher than the set value Y1, or lower than the set value Y2, the image is considered to be too bright or too dark, the image is abnormal, and the detection algorithm is terminated; in this example, the set values ​​Y1 are 230 and Y2 are 30.

[0373] like Fig.33 As shown, the de-texturing step in step S4 includes:

[0374] Step S41: Obtain the cropped image and calculate the width and height of the image;

[0375] Step S42: extracting a sub-image of a 1 / 2Width*1 / 2Height area in a random area of ​​the image;

[0376] Step S43: setting two mutually perpendicular straight lines L1 and L2 at random positions in the sub-image; in this example, the two straight lines L1 and L2 are also parallel to the width and height edges of the sub-image respectively, and the straight lines L1 and L2 pass through the center point of the sub-image;

[0377] Step S44: after performing bilateral filtering on the sub-image to remove sharp noise and preserve the edge without blurring, edge enhancement is performed, and the quadratic derivative function images of the sub-image in the width direction and the height direction are calculated respectively;

[0378] Step S45: acquiring a straight line region in the quadratic derivative function image according to the quadratic derivative function image of the sub-image in the width direction and the height direction;

[0379] Step S46: extracting the straight line region skeleton in the quadratic derivative image according to the polarity change from bright to dark, and transforming the linear object to obtain stripes; in this example, the stripes are bright areas;

[0380] Step S47: Calculate the Hough transform values ​​(p, theta) of all extracted straight lines; convert rectangular coordinates into polar coordinates through Hough transform to facilitate confirmation of angles and complete position positioning;

[0381] Step S48: merge the stripes within the same straight line region skeleton and at the same angle that are shorter than the set pixel length L3; in this example, L3 is 4 pixels long;

[0382] Step S49: after the stripes are merged, the stripes shorter than the set pixel length L4 are removed; in this example, L4 is 20 pixels long;

[0383] Step S410: Obtain the remaining stripes, and filter out the stripes intersecting the straight line L1 or the straight line L2;

[0384] Step S411: extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L1; extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L2;

[0385] Step S412: Determine whether the stripe extracted in step S411 has an angle with both the straight line L1 and the straight line L2; if no angle is present with either the straight line L1 or the straight line L2, it is considered that the stripe is parallel to the straight line L1 or the straight line L2, and the process proceeds to step S414; if both angles are present, it is considered that the stripe is not parallel to both the straight line L1 and the straight line L2, and the process proceeds to step S413;

[0386] Step S413: according to the angle between the stripes and the straight lines L1 and L2 and the intersection spacing, the projection of the intersection spacing on the stripes is obtained, including the projection length and the projection position. The projection length is the spacing of the periodic stripes.

[0387] Step S414: acquiring periodic information of the stripes, including the projection length and projection position of the intersection point spacing on the stripes, the intersection points of the stripes on the straight line L1 or L2, and the angles between the stripes and the straight lines L1 and L2;

[0388] Step S415: Generate a periodic function based on the periodic line information of the fringes, and expand it through Fourier series extension to obtain the periodic frequency of the fringes;

[0389] Step S416: obtaining a spatial filter according to the first n periodic frequencies of the Fourier series;

[0390] Step S417: Perform convolution calculation on the cropped sub-image obtained in step S41 through a spatial filter to implement image de-texturing operation, and end the step.

[0391] It should be noted that the stripes referred to in this application are periodic stripes, including vertical, horizontal or inclined stripes, squares, etc.

[0392] like Figure 34-36 As shown, the image definition adaptation process in step S5 is specifically implemented by the following method:

[0393] First, for the image obtained in step S4, the center coordinate position of the image is obtained, and a contour line parallel to the X-axis direction is drawn through the center coordinate position, where the X-axis is represented as the width direction of the coil in the image; the grayscale information of the pixel points on the contour line is extracted to obtain the maximum grayscale value Gmax, the minimum grayscale value Gmin and the average grayscale value Gmean; the grayscale level is set to n levels, where the grayscale level higher than the average grayscale value Gmean is divided into n1 levels, and the grayscale level lower than the average grayscale value Gmean is divided into n2 levels, n1+n2=n, in this example n1=n2=n / 2; the grayscale level difference a1 higher than the average grayscale value Gmean, and the grayscale level difference a2 lower than the average grayscale value Gmean are obtained:

[0394] a1=(Gmax-Gmean) / n1

[0395] a2=(Gmean-Gmin) / n2

[0396] The grayscale values ​​in the image are divided according to the above n levels, where the grayscale difference above the average grayscale value Gmean is a1, and the grayscale difference below the average grayscale value Gmean is a2; the pixels on the contour line are divided according to the n-level grayscale value, and the image is cropped in the direction perpendicular to the contour line according to the division position. The number of finally cropped areas is recorded as Nw, where the continuous areas on the contour line that belong to the same grayscale value level are divided into one piece until pixels of different grayscale value levels appear; after completing the image cropping, the two-dimensional array [Nw,n] is obtained according to the position information encoding, with a total of Nw*n image sub-areas;

[0397] Get the size of the cropped sub-image, and calculate the grayscale mean and grayscale variance D(x) of each image, as well as the grayscale co-occurrence matrix of each image; the grayscale co-occurrence matrix GLCM of the cropped sub-image with a grayscale lower than the average grayscale value Gmean is expressed as:

[0398]

[0399] Where n is 1, 2, 3...n2; the gray level co-occurrence matrix GLCM of the cropped sub-image with gray level higher than the average gray value Gmean is expressed as:

[0400]

[0401] Where n″ is 1, 2, 3...n1; p(i,j) = {counter(i = f(x,y), j = f(x,y+1))} / (a*a), which indicates the probability of traversing the entire cropped sub-image and having adjacent grayscale values ​​of (i,j); if the grayscale value of the cropped sub-image is higher than the average grayscale value Gmean, then a = a1; if the grayscale value of the cropped sub-image is lower than the average grayscale value Gmean, then a = a2; f(x,y) indicates the grayscale value of the point (x,y) on the cropped sub-image; counter(i = f(x,y), j = f(x,y+1)), which indicates the number of times the adjacent grayscale value (i,j) appears when traversing the entire cropped sub-image;

[0402] Then the contrast cont of the cropped sub-image is obtained according to the gray-level co-occurrence matrix GLCM, where

[0403]

[0404] Where i=f(x,y), j=f(x,y+1); the contrast of an image mainly reflects the clarity of the image and the depth of the texture grooves. The greater the contrast, the clearer the image, and vice versa, the smaller the contrast, the blurred the image.

[0405] Then the sum of squares of the elements of the gray-level co-occurrence matrix GLCM of the cropped sub-image, i.e., the ASM energy, is calculated and expressed as:

[0406]

[0407] The energy reflects the uniformity of the grayscale distribution of the image; when the image is blurred, the grayscale distribution is more uniform and the energy value is larger; when the image is clear, the energy value is smaller.

[0408] Then the inverse difference Homogenity of the cropped sub-image is calculated, abbreviated as Homo, expressed as:

[0409]

[0410] Homogenity reflects the degree of local change in image texture. When the image is blurred, the grayscale distribution is more uniform and the inverse difference value is larger; when the image is clear, the inverse difference value is smaller.

[0411] Then calculate the correlation Corr of the grayscale value of the cropped sub-image in the row or column direction,

[0412]

[0413]

[0414]

[0415]

[0416]

[0417] where u i and u j respectively represent the average values of the gray-level co-occurrence matrix in the horizontal and vertical directions, and δ i and δ j represent the variance values in the horizontal and vertical directions. The magnitude of the correlation reflects the similarity degree of the overall gray-level values of the cropped sub-images; when the image is blurred, the gray-level changes little, the correlation is good, and the value is large; when the image is clear, the gray-level changes violently, the correlation is poor, and the value is low.

[0418] Finally, calculate the gray-level variance D(x), contrast cont, gray-level energy ASM, inverse difference Homo, and correlation Corr of the cropped sub-images, and obtain the weighted mean Ambiguity,

[0419]

[0420] where χ, ε, η, α, β are set weight values; the higher the weighted mean Ambiguity, the more blurred the image, and the smaller the Gaussian filter kernel size needs to be used; if Ambiguity < A1, select the first-level Gaussian filter; if A1 = < Ambiguity < A2, select the second-level Gaussian filter; if A2 = <ambiguity>If A3, then a third - order Gaussian filter is selected; if A3 = <Ambiguity, then a fourth - order Gaussian filter is selected; in this example, A1, A2, and A3 are all set values. The kernel size of the first - order Gaussian filter is 64*64, the kernel size of the second - order Gaussian filter is 32*32, the kernel size of the third - order Gaussian filter is 16*16, and the kernel size of the fourth - order Gaussian filter is 8*8. Select the corresponding - order Gaussian filter to complete the filtering process of the cropped sub - images until the filtering process of all cropped sub - images is completed.

[0421] As Fig.37 shown, the neighborhood multi - defect processing flow in step S6 includes the following steps:

[0422] Step S61: Obtain the filtered overall image, and filter the image again using the first - to fourth - order Gaussian filters respectively to obtain four re - filtered images;

[0423] Step S62: Obtain the set of pixel points in the ordinary dark area, very dark area, large - area dark area, bright area, and hole - defect area in the image;

[0424] Step S63: Obtain the dark area; in this example, the dark area includes the ordinary dark area, very dark area, and large - area dark area;

[0425] Step S64: Obtain the total defect area; in this example, the total defect area includes the dark area, bright area, and hole - defect area;

[0426] Step S65: Perform a closing operation on the total defect area to connect adjacent areas;

[0427] Step S66: Calculate the connected components of the total defect area and separate all closed and non - connected areas;

[0428] Step S67: Calculate the area size and center - point coordinates of all connected components within the total defect area, and end the step.

[0429] In the step S62, in this example, the pixel points whose grayscale values ​​in the first-level filtered image are less than (the grayscale value of the pixel points at the corresponding position in the third-level filtered image - the normal dark threshold Z1) are considered to be normal dark areas; the pixel points whose grayscale values ​​in the first-level filtered image are less than (the grayscale value of the pixel points at the corresponding position in the third-level filtered image - the very dark threshold Z2) are considered to be very dark areas; the pixel points whose grayscale values ​​in the second-level filtered image are less than (the grayscale value of the pixel points at the corresponding position in the fourth-level filtered image - the large-area dark threshold Z3) are considered to be large-area dark areas; the pixel points whose grayscale values ​​in the first-level filtered image are greater than (the grayscale value of the pixel points at the corresponding position in the third-level filtered image + the normal bright threshold) are considered to be bright areas; the pixel points whose grayscale value range before re-filtering in step S61 is (250, 255) are considered to be hole defect areas.

[0430] like Fig.38 As shown, the defect output priority in step S7 is determined by the size of the connected domain area. In this example, the larger the area of ​​the connected domain, the higher the defect output priority. In step S7, before determining the output priority, the defect connected domain needs to be screened, where the screening condition is that the connected domain area is greater than the set "defect area upper limit threshold".

[0431] In step S8, the defect information includes defect area, length, width and length-to-width ratio of the minimum circumscribed rectangle of the defect, defect line length-to-width ratio, defect dark area ratio, defect bright area ratio, and defect hole area ratio. Wherein defect line width = defect area / defect minimum circumscribed rectangle length; defect line length-to-width ratio = defect line width / defect minimum circumscribed rectangle length; defect dark area ratio = intersection of dark defect area and current defect area / current defect area; defect bright area ratio = intersection of bright defect area and current defect area / current defect area; defect hole area ratio = 1-bright area ratio-dark area ratio. In this example, if the above defect information meets the set threshold range requirements, the defect information is output. The defect information also includes defect type, defect center point coordinates, etc. Defect types include black spots, white spots and holes, among which black spots, white spots and holes are judged by the grayscale values ​​of the pixels. Each type of defect is also divided into three levels: large, medium and small according to the defect area. In this example, the pixels judged as very dark areas in the neighboring multi-defect processing flow of step S6 are considered to be black spots, the pixels judged as bright areas are considered to be white spots, and the pixels judged as hole defect areas are considered to be holes.

[0432] In the present application, the grayscale abnormal areas in the image are extracted, mainly the areas with abnormal grayscale values ​​of the image background are extracted, and different defects are distinguished after morphological feature judgment, so as to realize the recognition and distinction of defect types; the grayscale change information of the horizontal contour line of the image is obtained, and the clarity of the image is adaptively detected in segments, so that the same image with a wider width can obtain a higher filtering effect, and the filtered image is clear and consistent; the shape, contour, and light and dark area position-related feature judgments are performed on different defects to achieve detailed classification, and the connected domain processing of the defects is performed based on the clustering algorithm, so that the defects that meet the conditions can be connected, and multiple defects in adjacent positions are concentrated and output to one position, which reduces the marking output, helps to improve the efficiency of the algorithm, and ensures that smaller but dense defects can also be discovered.

[0433] Embodiment 2:

[0434] like Fig.39 , 40 As shown, this embodiment is obtained based on the improvement of the first embodiment, wherein the defect type in the defect information output in step S8 is obtained by a defect recognition feature algorithm, wherein the defect types include black spots, bubbles, worm spots, crystal spots, and fuzz. In this example, the defect characterized by being completely black is identified as a black spot, and is further identified as large, medium, and small black spots according to the defect area; the defect characterized by two black and white rings is identified as a bubble; the defect characterized by black teeth arrangement is identified as a worm spot; the defect characterized by a black area and a white area adjacent to each other is identified as a crystal spot; the defect characterized by a black line is identified as fuzz. The defect recognition feature algorithm includes the following steps:

[0435] Step S81: Acquire an image and detect dark areas in the image; wherein the dark areas are areas where the grayscale value of the image is lower than a set threshold value Y3;

[0436] Step S82: Determine whether the number of dark areas in the image is one; if the number of dark areas is only one, proceed to step S83; if the number of dark areas is 0 or greater than one, proceed to step S84;

[0437] Step S83: If there is only one dark area, further determine whether the outline of the dark area is approximately a solid circle or an approximately solid rectangle or other shapes; if the outline of the dark area is approximately a circle, determine that the defect is a large black spot, and end the step; if the outline of the dark area is approximately a rectangle, determine that the defect is fluff, and end the step; if the outline of the dark area is other shapes, proceed to step S84;

[0438] Step S84: Detect the bright area in the image; determine whether the number of bright areas and dark areas are both 0, if both are 0, the image is considered flawless; otherwise, proceed to step S85; the bright area is the area where the grayscale value of the image is higher than the set threshold value Y4;

[0439] Step S85: Determine whether the edge of the bright area is surrounded by the dark area; if the edge of the bright area is surrounded by the dark area, the defect is considered to be a bubble and the step ends; if the edge of the bright area is not surrounded by the dark area, proceed to step S86:

[0440] Step S86: if the edge of the bright area is not surrounded by the dark area, then the number of bright areas and dark areas is counted, and the centroid coordinates of all bright areas and dark areas in the image are obtained;

[0441] Step S87: sort the barycentric coordinates of the bright area and the dark area according to the size of the horizontal coordinate, and determine whether the barycentric coordinates can be fitted into a straight line; if the barycentric coordinates can be fitted into a straight line, proceed to step S88; otherwise, proceed to step S89;

[0442] Step S88: If the centroid coordinates can be fitted into a straight line, it is further determined whether the bright area and the dark area appear alternately; if the bright area and the dark area appear alternately, it is determined that the defect is a worm spot, and the step ends; if the bright area and the dark area do not appear alternately, the process proceeds to step S89;

[0443] Step S89: Obtain the total regional skeleton of the bright area and the dark area, and determine whether the shape of the skeleton is in the shape of arrow arrangement; if the regional skeleton is in the shape of arrow arrangement, the defect is considered to be a crystal point, and the step ends; otherwise, proceed to step S810;

[0444] Step S810: the defect is considered to be other, the centroid distance between adjacent regions is obtained, and the regions are aggregated to calculate the aggregated regions and areas; wherein the regions include bright regions and dark regions.

[0445] The dark area in step S81 and the bright area in step S84 are obtained through the neighboring multi-defect processing flow of step S6 in the first embodiment.

[0446] In the process of counting the bright area and the dark area in step S86, the bright area and the dark area are marked with 1 and 0 respectively, and the area of ​​each area and the minimum circumscribed circle of each area are counted.

[0447] The above description is only a specific example of the present invention and does not constitute any limitation to the present invention. It is obvious that for professionals in this field, after understanding the content and principle of the present invention, various modifications and changes in form and details may be made without departing from the principle and structure of the present invention, but these modifications and changes based on the idea of ​​the present invention are still within the scope of protection of the claims of the present invention.< / ambiguity>

Claims

1. A coil material detection method, It is characterized in that The steps include: Step S1: The operating console obtains images captured by all line scan cameras and counts the number of images; Step S2: Determine whether the acquired image is a multi-channel image; if it is a multi-channel image, convert it into a grayscale image and proceed to step S3; otherwise, directly proceed to step S3; Step S3: Select images in sequence, calculate the image size, and complete the cropping of each group of images and obtain the image grayscale value according to the left and right undetected areas; wherein each group of images represents images collected by different line scan cameras at the same time; Step S4: Calculate whether there are periodic stripes based on the full image background evaluation; if there are periodic textures, it is a textured material and needs to be detexturized. After detexturization is completed, proceed to the next step; otherwise, proceed directly to the next step; Step S5: according to the gray value of the image, the image clarity adaptive process is completed, the corresponding filtering level is determined, the image filtering is completed, and the total defect area in the image is obtained; Step S6: Based on the clustering method, the total defect area is processed with multiple defects in the neighborhood, and the defect areas that meet the requirements are connected; Step S7: obtaining a defect output priority according to the defect area or the defect connected area area; and sorting the defects according to the defect output priority; Step S8: Obtain defect information, and determine whether the defect information meets the set threshold range requirements in order of defect output priority; if the defect information meets the set threshold requirements, put the defect information into the output queue in order; Step S9: determining whether the defect information in the output queue exceeds the set output quantity upper limit of the defect information; If the set output quantity of defect information exceeds the upper limit, the set output quantity of defect information is output according to the defect output priority order, and the step ends; otherwise, all defect information in the queue is output, and the step ends; If the defect information meets the set threshold range requirement, the defect information is output, and the defect information includes the defect type and the coordinates of the defect center point.

2. A coil material detection method according to claim 1, It is characterized in that In step S7, the defect output priority is determined by the size of the connected domain area.

3. A coil material detection method according to claim 1, It is characterized in that The process of completing image cropping and obtaining grayscale values ​​in step S3 includes the following steps: Step S31: Obtain a group of images, and determine whether the number of images in the group of images is greater than or equal to one; if the number of images is one, proceed to step S32; if the number of images is greater than one, otherwise proceed to step S33; Step S32: if the group of images contains only one image, then determine the relationship between the sum of the widths of the left cropping area and the right cropping area and the image width, wherein the left cropping area and the right cropping area are obtained by the left and right undetected areas; if the sum of the widths of the left cropping area and the right cropping area is greater than the image width, proceed to step S35; if the sum of the widths of the left cropping area and the right cropping area is less than or equal to the image width, proceed to step S36; Step S33: if the number of images included in the group of images is greater than one, determine the relationship between the width of the first image and the width of the left cropping area; if the width of the first image is less than the width of the left cropping area, proceed to step S35; otherwise, proceed to step S34; Step S34: Determine the relationship between the width of the last image and the width of the right cropping area; if the width of the last image is smaller than the width of the right cropping area, proceed to step S35; Otherwise, proceed to step S36; Step S35: if the image cropping area is too large, it is judged that the image detection is abnormal, and the step ends, and the detection algorithm ends; Step S36: sequentially obtain one image in the group of images, and determine whether the image is the first image in the group of images; if it is the first image in the group of images, proceed to step S37; if it is not the first image in the group of images, proceed to step S38; Step S37: if the image is the first image of the group of images, it is determined whether the group of images has only one image; if there is only one image, the left and right cropping areas of the image are obtained according to the left and right undetected areas, and the image cropping is completed, and the process proceeds to step S310; If it is not an image, the left cropping area of ​​the image is calculated, and the image is cropped, and the process goes to step S310; Step S38: if the image is not the first image of the group of images, determine whether the image is the last image of the group of images; if it is the last image of the group of images, proceed to step S39; if it is not the last image of the group of images, directly proceed to step S310; Step S39: if the image is the last image of the group of images and not the first image, the right cropping area of ​​the image is calculated, and the image cropping is completed, and the process proceeds to step S310; Step S310: Calculate the grayscale value of the obtained image and end the step.

4. A coil material detection method according to claim 3, It is characterized in that In step S310, after obtaining the grayscale value of the image, the average grayscale value of the image is also obtained. If the average grayscale value of the image is higher than the set value Y1, or lower than the set value Y2, the image is considered to be too bright or too dark, the image is abnormal, and the detection algorithm ends.

5. A coil material detection method according to claim 1, It is characterized in that The de-texturing step in step S4 includes: Step S41: Obtain the cropped image and calculate the width and height of the image; Step S42: extracting a sub-image of a 1 / 2Width*1 / 2Height area in a random area of ​​the image; Step S43: setting two mutually perpendicular straight lines L1 and L2 at random positions in the sub-image; Step S44: after performing bilateral filtering on the sub-image to remove sharp noise and preserve the edge without blurring, edge enhancement is performed, and the quadratic derivative function images of the sub-image in the width direction and the height direction are calculated respectively; Step S45: acquiring a straight line region in the quadratic derivative function image according to the quadratic derivative function image of the sub-image in the width direction and the height direction; Step S46: extracting the straight line region skeleton according to the polarity change from light to dark in the quadratic derivative function image, and transforming the linear object to obtain stripes; Step S47: Calculate the Hough transform values ​​(p, theta) of all extracted straight lines; convert rectangular coordinates into polar coordinates through Hough transform to facilitate confirmation of angles and complete position positioning; Step S48: merge the stripes within the same straight line region skeleton and at the same angle that are shorter than the set pixel length L3; in this example, L3 is 4 pixels long; Step S49: after the stripes are merged, the stripes that are shorter than the set pixel length L4 are removed; Step S410: Obtain the remaining stripes, and filter out the stripes intersecting the straight line L1 or the straight line L2; Step S411: extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L1; extracting stripes with repeated intersection spacing and angles based on the intersection points of the stripes and the straight line L2; Step S412: Determine whether the stripe extracted in step S411 has an angle with both the straight line L1 and the straight line L2; if no angle is present with either the straight line L1 or the straight line L2, it is considered that the stripe is parallel to the straight line L1 or the straight line L2, and the process proceeds to step S414; if both angles are present, it is considered that the stripe is not parallel to both the straight line L1 and the straight line L2, and the process proceeds to step S413; Step S413: according to the angle between the stripes and the straight lines L1 and L2 and the intersection spacing, the projection of the intersection spacing on the stripes is obtained, including the projection length and the projection position. The projection length is the spacing of the periodic stripes. Step S414: acquiring periodic information of the stripes, including the projection length and projection position of the intersection point spacing on the stripes, the intersection points of the stripes on the straight line L1 or L2, and the angles between the stripes and the straight lines L1 and L2; Step S415: Generate a periodic function based on the periodic line information of the fringes, and expand it through Fourier series extension to obtain the periodic frequency of the fringes; Step S416: obtaining a spatial filter according to the first n periodic frequencies of the Fourier series; Step S417: Perform convolution calculation on the cropped sub-image obtained in step S41 through a spatial filter to implement image de-texturing operation, and end the step.

6. A coil material detection method according to claim 5, It is characterized in that The two straight lines L1 and L2 are also parallel to the width and height edges of the sub-image respectively, and the straight lines L1 and L2 pass through the center point of the sub-image.

7. A coil material detection method according to claim 1, It is characterized in that In step S7, before determining the output priority, the defective connected domains need to be screened, wherein the screening condition is that the area of ​​the connected domain is greater than the set "defective area upper limit threshold".

8. A coil material detection method according to claim 1, It is characterized in that In step S8, the defect information also includes defect area, length, width and aspect ratio of the minimum circumscribed rectangle of the defect, defect line aspect ratio, defect dark area ratio, defect bright area ratio and defect hole area ratio.

9. A coil material detection method according to claim 8, It is characterized in that The defect line width = defect area / defect minimum circumscribed rectangle length; defect line length-width ratio = defect line width / defect minimum circumscribed rectangle length; defect dark area ratio = intersection of dark defect area and current defect area / current defect area; defect bright area ratio = intersection of bright defect area and current defect area / current defect area; defect hole area ratio = 1-bright area ratio-dark area ratio.

10. A coil material detection method according to claim 1, It is characterized in that The defect types include black dots, white dots and holes, among which black dots, white dots and holes are judged by the grayscale values ​​of the pixels. Each type of defect is also divided into three levels: large, medium and small according to the defect area. The pixels judged as very dark areas in the neighboring multi-defect processing flow of step S6 are considered to be black dots, the pixels judged as bright areas are considered to be white dots, and the pixels judged as hole defect areas are considered to be holes.