Method for removing bubble interference of discharge spark image of liquid phase plasma
By grayscale and histogram processing of the liquid plasma discharge spark image, peak information is extracted and equalized, which solves the problem of bubble interference and improves the accuracy and efficiency of image recognition.
Patent Information
- Application Number
- CN202410697589.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-09-27
AI Technical Summary
During the liquid-phase plasma discharge process, due to the electrode reaction and liquid fluctuation under high-voltage conditions, the bubbles generated interfere and blur the spark image, affecting the accuracy of image recognition.
By grayscale and histogram processing of the spark image, peak point information is extracted, a peak detection algorithm is used to determine the grayscale value of the bubble area, and the grayscale area is equalized to remove bubble interference. Specific steps include weighted average method, local peak detection of gray histogram, single peak and double peak discrimination, and selecting the optimal gray threshold for histogram equalization.
It effectively removes the interference of bubbles on the spark image, improves the accuracy and efficiency of image processing, and can select the optimal threshold according to the different shapes of the spark image during the micro-arc oxidation process, remove the bubble part, and retain the effective target spark point.
Smart Images

Figure CN118710508A
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing and relates to a method for removing bubble interference from a liquid plasma discharge spark image. Background Art
[0002] Liquid phase plasma discharge is a processing technology that uses electrodes to generate plasma discharge in a liquid medium, such as micro-arc oxidation technology. Sparks will be generated during the liquid phase plasma discharge process. The spark quantity information after identifying these discharge spark images through machine vision technology can be used for intelligent industrial process control. However, in the discharge reaction under liquid phase conditions, due to the electrode reaction under high pressure conditions and liquid fluctuations, more bubbles will be generated in the liquid. Under the flashing conditions of a large number of plasma discharge sparks that are generated and extinguished quickly and randomly, the bubbles refract the light, making the collected spark image like a layer of mist. These bubbles will cause interference and blurring of the collected image. This has a great impact on effective image recognition, such as the extraction of spark quantity features, so a method is needed to remove the interference of bubbles on the spark image. Summary of the invention
[0003] The object of the present invention is to provide a method for removing bubble interference in a liquid phase plasma discharge spark image. The method can effectively remove bubbles in a liquid phase plasma discharge spark image.
[0004] The technical solution adopted by the present invention is a method for removing bubble interference in a liquid plasma discharge spark image, which specifically comprises the following steps:
[0005] Step 1, grayscale the spark image;
[0006] Step 2, converting the spark grayscale image into a grayscale histogram;
[0007] Step 3, extract all peak point information from the spark grayscale histogram;
[0008] Step 4: for the dynamically changing grayscale histogram, a peak detection algorithm is used to obtain the grayscale value r(k) reflecting the bubble area;
[0009] Step 5: Perform grayscale area equalization on the spark mapping area [r(k), 255].
[0010] The present invention is also characterized in that:
[0011] The specific process of step 1 is:
[0012] Calculate the weighted average of the three components of R, G, and B, and use the weighted average as the grayscale value of the grayscale image. The expression is as follows:
[0013] V gray =(aR+bG+cB) / 3 (1)
[0014] Where V gay is the gray value of the grayscale image, a, b, c are the weights of R, G, B respectively; R, G, B represent the red, green and blue color channels of the image respectively; the weighted average method is selected to process the grayscale of the spark image, and the conversion formula is:
[0015] I(x,y)=0.3*I_R(x,y)+0.59*I_G(x,y)+0.11*I_B(x,y) (2)
[0016] Where I(x,y) represents the grayscale value at the coordinate (x,y), I_R(x,y), I_G(x,y), and I_B(x,y) represent the brightness values of the red, green, and blue channels at the coordinate (x,y), respectively.
[0017] The specific process of step 2 is:
[0018] Count the number of pixels at each gray level in the image, and then plot the number of pixels at each gray level into a histogram, with the horizontal axis representing the gray level and the vertical axis representing the number of pixels at the corresponding gray level.
[0019] The specific process of step 3 is:
[0020] Step 3.1, the grayscale histogram is regarded as a time series, where each grayscale value corresponds to a time point, and the grayscale histogram data is converted into h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i;
[0021] Step 3.2, set a sliding window size w, which is used to select the grayscale histogram data sequence h = [h0,h1,...,h 255 ], moving in the middle and performing local peak detection in each window.
[0022] The specific process of step 3.2 is as follows:
[0023] Step 3.2.1, treat the grayscale histogram as time series data h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i;
[0024] Step 3.2.2, set the initial window size w = 1, and compare h at each position i. i Is it a local peak? If h i If it is greater than other values in the window, it is marked as a peak;
[0025] Step 3.2.3, the window size w is a dynamically changing value. The maximum window size is set by the max_lag parameter. Local peak detection is performed for each window size from 1 to max_lag.
[0026] Step 3.2.4, repeat steps 3.2.2 to 3.2.3 until the window covers all data;
[0027] Step 3.2.5, use the AMP D algorithm to obtain all peak information in the grayscale histogram.
[0028] The specific process of step 4 is:
[0029] Step 4.1, according to the peak point distribution diagram obtained in step 3, determine whether there is a single significant peak in the grayscale histogram through a single peak detection algorithm, and determine the corresponding grayscale value position according to the pixel peak information;
[0030] Step 4.2, according to the peak point distribution diagram obtained in step 3, determine whether there are two significant peaks in the grayscale histogram through a double peak detection algorithm, and determine the corresponding grayscale value position according to the pixel peak information;
[0031] Step 4.3: The peak data obtained from step 4.1 and step 4.2 are used to calculate the optimal r(k) value through the peak detection algorithm according to the spark grayscale images at different stages.
[0032] The specific process of step 4.1 is:
[0033] Step 4.1.1, perform gradient calculation on the grayscale histogram data array h = [h0, h1, ..., h255], and use discrete differential to calculate the gradient of each point, that is, gradient[i] = h[i+1]-h[i], and obtain the data change trend graph based on the characteristics of the data change;
[0034] Step 4.1.2, by analyzing the positive and negative changes of the gradient array gradient, determine whether there is a single peak in the data, identify the position where the gradient changes from positive to negative, and determine the corresponding peak. The specific judgment condition is: if gradient[i-1]>0 and gradient[i]≤0, then iis apeak. Through extreme judgment, determine the position i of the single peak;
[0035] Step 4.1.3: When the existence of a single peak is confirmed, the peak will be marked using the flag is_single_peak and the peak position variable peak_position.
[0036] The specific process of step 4.2 is:
[0037] Step 4.2.1, perform a global search on the grayscale histogram data, find all extreme points in the data, and save them in the list peak_positions;
[0038] Step 4.2.2, using the detected peak position, the double peak discrimination algorithm is used for processing, and the length of the peak_positions list is checked. If the length is 2, there is a double peak. The two most significant peaks are determined by comparing the peak heights and positions. The gray value position corresponding to the double peak is obtained by data comparison, and the flag is_double_peak and the two peak position variables peak1_position and peak2_position are used;
[0039] Step 4.2.3, when the existence of double peaks is confirmed, the two peaks peak1_gray_value and peak2_gray_value will be marked, the grayscale value and number of pixels corresponding to each peak will be recorded, peak comparison, grayscale value comparison and number comparison will be performed, and the grayscale value and number corresponding to the peak with higher grayscale value will be output, peak1_gray_value=i, peak1_count=h[i] and peak2_gray_value=j; peak2_count=h[j].
[0040] The specific process of step 4.3 is:
[0041] Single peak case: If is_single_peak is true, calculate r(k), r(k) = h[peak_position].
[0042] Double peak case: If is_double_peak is true, calculate the values of r1(k) and r2(k) of the two peaks respectively, and output r(k) with a higher grayscale value, r1(k) = h[peak1_position]; r2(k) = h[peak2_position]; r(k) = max(r1(k), r2(k)), and output the final r(k) value.
[0043] The specific process of step 5 is:
[0044] The calculated value of r(k) is used as the start and end is set to 255 for histogram equalization. The histogram equalization conversion formula is as follows:
[0045]
[0046]
[0047] F(q)=start+(end-start)×CDF(q) (5)
[0048] Among them, PDF(q) (Probability Density Function) is the probability of occurrence of different gray values, q represents a gray level on the histogram, n q represents the number of pixels counted at gray level q, N represents the total number of pixels in the input image, CDF(q) (Cumulative Distribution Function) represents the proportion of all pixels in the original image whose values are less than or equal to q, start represents the minimum gray level in a certain interval, i is the statistical variable from start to q, and F(q) represents the new gray value obtained after histogram equalization of the original gray value q.
[0049] The beneficial effect of the present invention is that the present invention analyzes and processes the grayscale histogram of the discharge spark image at different stages in the micro-arc oxidation process. In view of the characteristics of the discharge spark image in the micro-arc oxidation process, a method for determining the optimal grayscale threshold r(k) according to the morphology (single peak or double peak) of the grayscale histogram is proposed to achieve effective removal of bubbles. The spark images at different stages in the micro-arc oxidation process are distinguished and analyzed by using the single peak or double peak morphology of the grayscale histogram. According to the morphological changes of the grayscale histogram, the present invention proposes a method for selecting the grayscale threshold r(k) based on the characteristics of the grayscale histogram. When the grayscale histogram presents a double peak morphology, the grayscale value of the rear peak is selected as the threshold r(k) to remove the bubble part. As the reaction degree further increases, the grayscale histogram gradually changes to a single peak morphology. At this time, the maximum peak part of the grayscale histogram is selected as the threshold r(k) to remove the background area and retain the effective target spark point. The invention is characterized in that it can select the optimal grayscale threshold r(k) according to the different forms of micro-arc oxidation spark images, thereby effectively removing the bubble part, improving the accuracy and efficiency of image processing, and providing an effective method for analyzing and processing spark images in the micro-arc oxidation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of a method for removing bubble interference of liquid plasma discharge spark image according to the present invention;
[0051] Figure 2(a) to Figure 2(b) It is an image after the spark image is grayed in the method for removing bubble interference in the spark image of liquid plasma discharge of the present invention;
[0052] Figure 3(a) to Figure 3(b) It is a spark image grayscale histogram of the method for removing bubble interference of liquid plasma discharge spark image of the present invention;
[0053] Figure 4(a) to Figure 4(b) It is a grayscale histogram processed by the AMPD algorithm in the method for removing bubble interference of liquid plasma discharge spark image of the present invention;
[0054] Figure 5(a) to Figure 5(b) It is a grayscale histogram of the r(k) value output by the peak detection algorithm in the method for removing bubble interference from liquid plasma discharge spark images of the present invention;
[0055] Figure 6(a) to Figure 6(b) It is the grayscale histogram of the image before segment equalization in the method for removing bubble interference of liquid plasma discharge spark image of the present invention;
[0056] Figure 7(a) to Figure 7(b) It is a grayscale histogram after image segment equalization in the method for removing bubble interference of liquid plasma discharge spark image of the present invention;
[0057] Figure 8(a) to Figure 8(b) It is a spark degree image after segmentation equalization in the method for removing bubble interference in liquid phase plasma discharge spark image of the present invention. DETAILED DESCRIPTION
[0058] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0059] Example 1
[0060] The method for removing bubble interference of liquid plasma discharge spark image of the present invention is as follows: Figure 1 As shown, the following steps are included:
[0061] Step 1, weighted average method: Calculate the weighted average of the three components of R, G, and B, and use the weighted average as the grayscale value of the grayscale image. The expression is as follows:
[0062] V gray =(aR+bG+cB) / 3 (1)
[0063] Where V gay is the grayscale value of the grayscale image, and a, b, and c are the weights of R, G, and B respectively. R, G, and B represent the three color channels of the image, namely red, green, and blue. Combined with experimental research, the best grayscale image is obtained when a, b, and c are 0.30, 0.59, and 0.11 respectively. The weighted average method is selected to process the grayscale of the spark image, and the conversion formula is:
[0064] I(x,y)=0.3*I_R(x,y)+0.59*I_G(x,y)+0.11*I_B(x,y) (2)
[0065] Where I(x,y) represents the grayscale value at the coordinate (x,y). I_R(x,y), I_G(x,y), and I_B(x,y) represent the brightness values of the red, green, and blue channels at the coordinate (x,y), respectively.
[0066] Step 2: Count the number of pixels at each grayscale level (usually 0-255) in the image. Then plot the number of pixels at each grayscale level into a histogram, with the horizontal axis representing the grayscale level and the vertical axis representing the number of pixels at the corresponding grayscale level. In the grayscale histogram, sparks are usually reflected as high grayscale values, that is, the part close to 255 (white); while the grayscale value of bubbles is lower than that of sparks and is distributed in a lower grayscale value range. The pixel ratio of bubbles can be expressed as a single-peak or double-peak uncertain state in the histogram.
[0067] Step 3: Based on the grayscale histogram obtained in step 2, the AMPD (Automatic Multiscale-based Peak Detection) algorithm is used to process the grayscale histogram.
[0068] Step 3.1, grayscale histogram data representation: The grayscale histogram is regarded as a time series, where each grayscale value corresponds to a time point, and the grayscale histogram data is converted to h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i.
[0069] Step 3.2, sliding window setting: Set a sliding window size w for the grayscale histogram data sequence h = [h0,h1,...,h 255 ], and perform local peak detection in each window. The specific steps are as follows:
[0070] The grayscale histogram is regarded as time series data h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i.
[0071] Set the initial window size w = 1. At each position i (from w to 255-w), compare h i Is it a local peak? i If it is greater than other values in the window, it is marked as a peak.
[0072] The window size w is a dynamically changing value. The maximum window size is set by the max_lag parameter. max_lag is set to 20, and local peak detection is performed for each window size from 1 to max_lag. Repeat the above steps until the window covers all data.
[0073] Finally, the AMPD (Automatic Multiscale-based Peak Detection) algorithm is used to obtain all peak information in the grayscale histogram.
[0074] Step 4: Detect the histogram type and calculate the peak value based on the peak point distribution diagram
[0075] Step 5, after calculating the gray value r(k) representing the bubble part, perform gray value equalization on the target gray area [r(k), 255]. Set the calculated r(k) value as the start and end as 255 for histogram equalization. The histogram equalization conversion formula is as follows:
[0076]
[0077]
[0078] F(q)=start+(end-start)×CDF(q) (5)
[0079] Among them, PDF(q) (Probability Density Function) is the probability of occurrence of different gray values, q represents a gray level on the histogram, n q represents the number of pixels counted at gray level q, N represents the total number of pixels in the input image, CDF(q) (Cumulative Distribution Function) represents the proportion of all pixels in the original image whose values are less than or equal to q, start represents the minimum gray level in a certain interval, i is the statistical variable from start to q, and F(q) represents the new gray value obtained after histogram equalization of the original gray value q.
[0080] Example 2
[0081] Based on Example 1, the specific process of step 4 is as follows:
[0082] Step 4.1, single peak detection: According to the peak point distribution diagram obtained in step 3, determine whether there is a single significant peak in the grayscale histogram through a single peak detection algorithm, and determine the corresponding grayscale value position according to the pixel peak information.
[0083] Step 4.1.1, gradient calculation: perform gradient calculation on the grayscale histogram data array h = [h0, h1, ..., h255]. Use discrete differentials (such as first-order differences) to calculate the gradient of each point, that is, gradient[i] = h[i+1]-h[i]. According to the characteristics of data changes, obtain a data change trend graph.
[0084] Step 4.1.2, extreme value judgment based on gradient: By analyzing the positive and negative changes of the gradient array gradient, determine whether there is a single peak in the data. Identify the position where the gradient changes from positive to negative and determine the corresponding peak. The specific judgment condition is: if gradient[i-1]>0 and gradient[i]≤0, then iis apeak. Determine the position i of the single peak through extreme judgment.
[0085] Step 4.1.3, Marking and Output: When a single peak is confirmed to exist, the program will mark the peak. Use the flag is_single_peak and the peak position variable peak_position. For example, is_single_peak=True;peak_position=i. Output the gray value of the peak and the number of pixels corresponding to it, peak_gray_value=i;peak_count=h[i].
[0086] Step 4.2, double peak detection: According to the peak point distribution diagram obtained in step 3, determine whether there are two significant peaks in the grayscale histogram through a double peak detection algorithm, and determine the corresponding grayscale value position according to the pixel peak information.
[0087] Step 4.2.1, peak search: Perform a global search on the grayscale histogram data, find all extreme points in the data, and save them in the list peak_positions.
[0088] Step 4.2.2, double peak discrimination: Use the double peak discrimination algorithm to process the detected peak position. Check the length of the peak_positions list. If the length is 2, there is a double peak. Determine the two most significant peaks by comparing the height and position of the peaks. Obtain the gray value position corresponding to the double peak by data comparison. Use the flag is_double_peak and two peak position variables peak1_position and peak2_position. For example, is_double_peak=True; peak1_position=i; peak2_position=j.
[0089] Step 4.2.3, Marking and Output: When the existence of double peaks is confirmed, the program will mark the two peaks peak1_gray_value and peak2_gray_value. Record the grayscale value and the number of pixels corresponding to each peak, and perform peak comparison, grayscale value comparison and quantity comparison. Output the grayscale value and quantity corresponding to the peak with higher grayscale value. peak1_gray_value=i;peak1_count=h[i] and peak2_gray_value=j;peak2_count=h[j].
[0090] Step 4.3, calculate the optimal r(k) value: Based on the peak data obtained in step 4.1 and step 4.2, the optimal r(k) value is calculated by the peak detection algorithm according to the spark grayscale images at different stages.
[0091] Single peak case: If is_single_peak is true, calculate r(k). r(k) = h[peak_position].
[0092] Double peak case: If is_double_peak is true, calculate the values of r1(k) and r2(k) of the two peaks respectively, and select the optimal value r(k) according to a specific rule (high gray value). For example, r1(k) = h[peak1_position]; r2(k) = h[peak2_position]; r(k) = max(r1(k), r2(k)). Output the final r(k) value.
[0093] Example 3
[0094] Simulation verification:
[0095] Step 1: Use the grayscale conversion formula (1) in Matlab to grayscale the spark image.
[0096] Specifically, a color image file is read from a storage medium. It is divided into the early stage of spark discharge and the early stage of micro-arc discharge. The color image is composed of multiple pixels, and each pixel contains the brightness values of three color channels: red, green, and blue (RGB). The read color image is converted into a grayscale image. The brightness value of each pixel of the grayscale image is obtained by weighted summation of the brightness values of the red, green, and blue channels of the original color image, where I(x, y) represents the grayscale value at the coordinate (x, y). I_R(x, y), I_G(x, y), and I_B(x, y) represent the brightness values of the red, green, and blue channels at the coordinate (x, y), respectively. The final output grayscale spark images are shown in Figure 2(a) and Figure 2(b). Figure 2(a) is a grayscale spark image in the early stage of spark discharge; Figure 2(b) is a grayscale spark image in the early stage of micro-arc discharge.
[0097] Step 2: Count the grayscaled Figure 2(a) , 2(b) The number of pixels at each gray level (0-255) in the image. The gray value information at the early stage of spark discharge is:
[0098] Gray value = [01234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 5152535455565758596061626364656667686970717273747576 7778798081828384858687888990919293949596979899100101 102103104105106107108109110111112113114115116117118119120 121122123124125126127128129130131132133134135136137138 139140141142143144145146147148149150151152153154155156 157158159160161162163164165166167168169170171172173174 175176177178179180181182183184185186187188189190191192 193194195196197198199200201202203204205206207208209210 211212213214215216217218219220221222223224225226227228 229230231232233234235236237238239240241242243244245246247248249250251252253254255】
[0099] Corresponding number of pixels = [433811052253161888777611650889810592227842587344166593880726019411958412211919488486039100933220818 147004213135946081313152215899439515971910315392028127704 727679592660961585226615135843435624659425904278483053522080 195571948315238215642051713468189751476013419142321182411678 116819241889795248137756968576539636355925688506345294678 40583727361836453336342334203103300728472729265925682577 24062392235523652303214821552136200219171818184717771645 1635167116531554153415401567147214851402139014581364133712541325125112121168116211991152113110921151112110951062998 109710319621006983925966965853901875906860806838844816794 815775728750742759680755752710720707692652724669624626 605642582640605623647619570607549595561507560514572534529527544535527496458500528446441480419442438433451409 386394366372392336340365312321339297278268266267252243 242228237213201227209230177207224224199208198204221188 18018018519818618517117617615916415916217614513712412410071584045】
[0100] The gray value information in the early stage of micro-arc discharge is:
[0101] Gray value = [01234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 5152535455565758596061626364656667686970717273747576 7778798081828384858687888990919293949596979899100101 102103104105106107108109110111112113114115116117118119120 121122123124125126127128129130131132133134135136137138 139140141142143144145146147148149150151152153154155156 157158159160161162163164165166167168169170171172173174 175176177178179180181182183184185186187188189190191192 193194195196197198199200201202203204205206207208209210 211212213214215216217218219220221222223224225226227228 229230231232233234235236237238239240241242243244245246247248249250251252253254255】
[0102] Corresponding number of pixels = [15020994841711591567131653643956701913207768029577194942079140823218294315050118211714181552904 253295497946615251196149346937348745966435769461456437322212 549546161034074462696293232765453768132224911498574358666162 75369848899028051474960861075735647911557712203672512137796 123213134264138968992051533321246901257301066547512598377 740064997961178464154135435280388424488335186377422971223429 27096194571729916961135491276612872983412389899386648082 7168720256755733567451044855412339944119354233283086293330022810296926832745259822652239210219281975163116391561 1481151114861541143210861119113011221039105610261032994969 9181033971897839780732806777720657664659615657639607638 584539628530554532523533462466513442424425409459399420 407410437394385366388326356348342315362339350313333277 345349295311324328303279311300267311287281253281267293 258254272276268292293287293297306278305303271325264307 2993092833002862883373303864026219311062121012139689879978588156667776826847075734962739】
[0103] Specifically, the number of pixels at each grayscale level is plotted into a histogram, as shown in Figure 3(a) and Figure 3(b). Figure 3(a) is a grayscale histogram in the early stage of spark discharge, and Figure 3(b) is a grayscale histogram in the early stage of micro-arc discharge; the horizontal axis represents the grayscale level, and the vertical axis represents the number of pixels at the corresponding grayscale level. In the grayscale histogram, sparks are usually reflected as high grayscale values, that is, the part close to 255 (white); while the grayscale value of bubbles is lower than that of sparks and is distributed in a lower grayscale value range. The number of pixels of bubbles appears as a single peak or double peak in the histogram.
[0104] Step 3: Based on the grayscale histogram obtained in step 2, the AMPD (Automatic Multiscale-based Peak Detection) algorithm is used to process the grayscale histogram.
[0105] Step 3.1, grayscale histogram data representation:
[0106] The grayscale histogram is regarded as a time series, where each grayscale value corresponds to a time point, and the grayscale histogram data is converted into h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i.
[0107] Step 3.2, sliding window settings:
[0108] Set a sliding window size w to be used in the grayscale histogram data sequence h = [h0,h1,...,h 255 ], and perform local peak detection in each window. The specific steps are as follows:
[0109] The grayscale histogram is regarded as time series data h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i.
[0110] Set the initial window size w = 1. At each position i (from w to 255-w), compare h i Is it a local peak? i If it is greater than other values in the window, it is marked as a peak.
[0111] The window size w is a dynamically changing value. The maximum window size is set by the max_lag parameter. max_lag is set to 20, and local peak detection is performed for each window size from 1 to max_lag. Repeat the above steps until the window covers all data.
[0112] Finally, the AMP D (Automatic Multiscale-based Peak Detection) algorithm is used to obtain all the peak information in the grayscale histogram, where the grayscale value information in the early stage of spark discharge is: Grayscale value = [35812172022252730323538414649525558656872748286899498103105108112117121126129132135137141144147149151 154158161163165168171173176178182188191193196199202205208213218221223226229232237241244247]
[0113] Pixels = = [22531888789810166593194884220818213135221589159719127704959266615146594305352156418975142321168195245688 46783645342325772365215518471671156714851458132511991151 10971006966901906844815750759755720724626642640647607595 560572544528480442451394392365339267237227230224208221198176164176】
[0114] The gray value information in the early stage of micro-arc discharge is:
[0115] Gray value = [3710121517202326283134374043464853565961646668717479818490929799105110112114120122125127131134136 140146150153156159161164167170172174177181183187189191 194198201204208210214217221223226228230232235243246250253]
[0116] Pixels = [2484156753641320729577408235011852904549796149359664643736161062932813224985790280107573122036137796138968 15333212573098377611784488337742270961287212389720257334119 30022969274519751639151115411130105610321033806664657638 6285545335134254594204373883563623503333493283113112812932762933063053253073093003371213997777707】
[0117] The peak point distribution diagrams are drawn according to the grayscale value and the number of pixels as shown in Figure 4(a) and Figure 4(b). Figure 4(a) is the grayscale histogram after the AMPD algorithm is processed in the early stage of spark discharge; Figure 4(b) is the grayscale histogram after the AMPD algorithm is processed in the early stage of micro-arc discharge.
[0118] Step 4: Detect the histogram type and calculate the peak value based on the peak point distribution diagram
[0119] Step 4.1, single peak detection: Based on the peak point distribution diagram obtained in step 3, determine whether there is a single significant peak in the grayscale histogram through a single peak detection algorithm, and determine the corresponding grayscale value position based on the pixel peak information.
[0120] Step 4.1.1, gradient calculation: perform gradient calculation on the grayscale histogram data array h = [h0, h1, ..., h255] in the early stage of spark discharge. Use discrete differentials (such as first-order differences) to calculate the gradient of each point, that is, gradient[i] = h[i+1]-h[i]. According to the characteristics of data changes, the data change trend is obtained.
[0121] Step 4.1.2, extreme value judgment based on gradient: By analyzing the positive and negative changes of the gradient array gradient, determine whether there is a single peak in the data. Identify the position where the gradient changes from positive to negative and determine the corresponding peak. If gradient[i-1]>0 and gradient[i]≤0, then iis apeak.
[0122] Step 4.1.3, Marking and Output: When a single peak is confirmed to exist, the program will mark the peak. Use the flag is_single_peak and the peak position variable peak_position. is_single_peak=True;peak_position=25. Output the gray value of the peak and the number of pixels corresponding to it, peak_gray_value=25;peak_count=h
[25] =220818.
[0123] Step 4.2, double peak detection: According to the peak point distribution diagram obtained in step 3, if it does not meet the single peak characteristics, the double peak detection algorithm is used to determine whether there are two significant peaks in the grayscale histogram, and the corresponding grayscale value position is determined according to the pixel peak information.
[0124] Step 4.2.1, peak search: perform a global search on the grayscale histogram data in the early stage of micro-arc discharge, find all extreme points in the data, and save them in the list peak_positions.
[0125] Step 4.2.2, double peak discrimination: Use the double peak discrimination algorithm to process the detected peak position. Check the length of the peak_positions list. If the length is 2, there is a double peak. Determine the two most significant peaks by comparing the height and position of the peaks. Obtain the gray value position corresponding to the double peak by data comparison. Use the flag is_double_peak and two peak position variables peak1_position and peak2_position, is_double_peak=True; peak1_position=37; peak2_position=66.
[0126] Step 4.2.3: Marking and output: When the existence of double peaks is confirmed, the program will mark the two peaks peak1_count and peak2_count. Record the gray value and number of pixels corresponding to each peak, and perform peak comparison, gray value comparison and number comparison. Output the gray value and number corresponding to the peak with higher gray value. peak1_gray_value=37;peak1_count=59664 and peak2_gray_value=66;peak2_count=138968.
[0127] Step 4.3, calculate the optimal r(k) value: Based on the peak data obtained in step 4.1 and step 4.2, the optimal r(k) value is calculated by the peak detection algorithm according to the spark grayscale images at different stages.
[0128] Single peak case: If is_single_peak is true, calculate r(k) value. r(k) = 25. As shown in Figure 5(a), Figure 5(a) shows the r(k) value output by the peak detection algorithm in the early stage of spark discharge.
[0129] Double peak case: If is_double_peak is true, calculate the r(k) values of the two peaks respectively, and select the optimal value according to a specific rule (high gray value). For example, r1(k) = 37; r2(k) = 66; r(k) = max(r1(k), r2(k)). Output the final r(k) = 66 value. As shown in Figure 5(b). Figure 5(b) The r(k) value output by the peak detection algorithm in the early stage of bit line micro-arc discharge.
[0130] Step 5, after calculating the grayscale value r(k) representing the bubble part at different stages, the grayscale value of the target grayscale area [r(k), 255] is equalized. The calculated r(k) value is used as the start and the end is set to 255 for histogram equalization. The grayscale histogram before equalization is shown in the figure Figure 6(a) , 6(b) Figure 6(a) is the grayscale histogram before equalization in the early stage of spark discharge. Figure 6(b) is the grayscale histogram before equalization in the early stage of micro-arc discharge.
[0131] In the case of single peak value r(k)=25, the grayscale value of the target grayscale area [25, 255] is equalized. The grayscale histogram after equalization is shown in Figure 7(a). The final equalized spark image is shown in Figure 8(a). Figure 7(a) is the grayscale histogram after equalization in the early stage of spark discharge; Figure 8(a) is the spark image after equalization in the early stage of spark discharge.
[0132] In the case of double peaks, r(k) = 66, the grayscale value of the target grayscale area [66, 255] is equalized. The grayscale histogram after equalization is shown in Figure 7(b). The final equalized spark image is shown in Figure 8(b). Figure 7(b) is the grayscale histogram after equalization in the early stage of micro-arc discharge; Figure 8(b) is the spark image after equalization in the early stage of micro-arc discharge.
[0133] Conclusion: The simulation eliminates bubbles in the spark images at the early stage of spark discharge and the early stage of micro-arc discharge. The processed images are as follows: Figure 8(a) , 8(b) As shown in the figure, the influence of bubbles on the number of sparks is effectively eliminated, which proves the correctness of this method.
Claims
1. A method for removing bubble interference from a liquid plasma discharge spark image, characterized in that: The specific steps include: Step 1, grayscale the spark image; Step 2, converting the spark grayscale image into a grayscale histogram; Step 3, extract all peak point information from the spark grayscale histogram; Step 4: for the dynamically changing grayscale histogram, a peak detection algorithm is used to obtain the grayscale value r(k) reflecting the bubble area; Step 5: Perform grayscale area equalization on the spark mapping area [r(k), 255].
2. The method for removing bubble interference from liquid plasma discharge spark images according to claim 1, characterized in that: The specific process of step 1 is as follows: Calculate the weighted average of the three components of R, G, and B, and use the weighted average as the grayscale value of the grayscale image. The expression is as follows: V gray =(aR+bG+cB) / 3 (1) Where V gay is the grayscale value of the grayscale image, a, b, c are the weights of R, G, B respectively; R, G, and B represent the red, green, and blue color channels of the image respectively; the weighted average method is selected to process the grayscale of the spark image, and the conversion formula is: I(x,y)=0.3*I_R(x,y)+0.59*I_G(x,y)+0.11*I_B(x,y) (2) Where I(x,y) represents the grayscale value at the coordinate (x,y), I_R(x,y), I_G(x,y), and I_B(x,y) represent the brightness values of the red, green, and blue channels at the coordinate (x,y), respectively.
3. The method for removing bubble interference from liquid plasma discharge spark images according to claim 2, characterized in that: The specific process of step 2 is as follows: Count the number of pixels at each gray level in the image, and then plot the number of pixels at each gray level into a histogram, with the horizontal axis representing the gray level and the vertical axis representing the number of pixels at the corresponding gray level.
4. The method for removing bubble interference from liquid plasma discharge spark images according to claim 3, characterized in that: The specific process of step 3 is as follows: Step 3.1, the grayscale histogram is regarded as a time series, where each grayscale value corresponds to a time point, and the grayscale histogram data is converted into h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i; Step 3.2, set a sliding window size w, which is used to select the grayscale histogram data sequence h = [h0,h1,...,h 255 ], moving in the middle and performing local peak detection in each window.
5. The method for removing bubble interference from liquid plasma discharge spark images according to claim 4, characterized in that: The specific process of step 3.2 is as follows: Step 3.2.1, treat the grayscale histogram as time series data h = [h0,h1,...,h 255 ], where h i Indicates the number of pixels with gray value i; Step 3.2.2, set the initial window size w = 1, and compare h at each position i. i Is it a local peak? If h i If it is greater than other values in the window, it is marked as a peak; Step 3.2.3, the window size w is a dynamically changing value. The maximum window size is set by the max_lag parameter. Local peak detection is performed for each window size from 1 to max_lag. Step 3.2.4, repeat steps 3.2.2 to 3.2.3 until the window covers all data; Step 3.2.5, use the AMP D algorithm to obtain all peak information in the grayscale histogram.
6. The method for removing bubble interference from liquid plasma discharge spark images according to claim 5, characterized in that: The specific process of step 4 is as follows: Step 4.1, according to the peak point distribution diagram obtained in step 3, determine whether there is a single significant peak in the grayscale histogram through a single peak detection algorithm, and determine the corresponding grayscale value position according to the pixel peak information; Step 4.2: According to the peak point distribution diagram obtained in step 3, determine whether there are two significant peaks in the grayscale histogram by using a double peak detection algorithm, and determine the corresponding grayscale value position according to the pixel peak information; Step 4.3: The peak data obtained from step 4.1 and step 4.2 are used to calculate the optimal r(k) value through the peak detection algorithm according to the spark grayscale images at different stages.
7. The method for removing bubble interference from liquid plasma discharge spark images according to claim 6, characterized in that: The specific process of step 4.1 is as follows: Step 4.1.1, perform gradient calculation on the grayscale histogram data array h = [h0, h1, ..., h255], and use discrete differential to calculate the gradient of each point, that is, gradient[i] = h[i+1]-h[i], and obtain the data change trend graph based on the characteristics of the data change; Step 4.1.2, by analyzing the positive and negative changes of the gradient array gradient, determine whether there is a single peak in the data, identify the position where the gradient changes from positive to negative, and determine the corresponding peak. The specific judgment condition is: if gradient[i-1]>0 and gradient[i]≤0, then iis apeak; through extreme judgment, determine the position i of the single peak; Step 4.1.3: When the existence of a single peak is confirmed, the peak will be marked using the flag is_single_peak and the peak position variable peak_position.
8. The method for removing bubble interference from liquid plasma discharge spark images according to claim 7, characterized in that: The specific process of step 4.2 is as follows: Step 4.2.1, perform a global search on the grayscale histogram data, find all extreme points in the data, and save them in the list peak_positions; Step 4.2.2, using the detected peak position, the double peak discrimination algorithm is used for processing, and the length of the peak_positions list is checked. If the length is 2, there is a double peak. The two most significant peaks are determined by comparing the peak heights and positions. The gray value position corresponding to the double peak is obtained by data comparison, and the flag is_double_peak and the two peak position variables peak1_position and peak2_position are used; Step 4.2.3, when the existence of double peaks is confirmed, the two peaks peak1_gray_value and peak2_gray_value will be marked, the grayscale value and number of pixels corresponding to each peak will be recorded, peak comparison, grayscale value comparison and number comparison will be performed, and the grayscale value and number corresponding to the peak with higher grayscale value will be output, peak1_gray_value=i, peak1_count=h[i] and peak2_gray_value=j; peak2_count=h[j].
9. The method for removing bubble interference from liquid plasma discharge spark images according to claim 8, characterized in that: The specific process of step 4.3 is as follows: Single peak case: If is_single_peak is true, calculate the r(k) value, r(k) = h[peak_position]; double peak case: If is_double_peak is true, calculate the values of r1(k) and r2(k) of the two peaks respectively, and output the r(k) with the higher gray value, r1(k) = h[peak1_position]; r2(k) = h[peak2_position]; r(k) = max(r1(k), r2(k)), and output the final r(k) value.
10. The method for removing bubble interference from liquid plasma discharge spark images according to claim 9, characterized in that: The specific process of step 5 is as follows: The calculated value of r(k) is used as the start and end is set to 255 for histogram equalization. The histogram equalization conversion formula is as follows: F(q)=start+(end-start)×CDF(q) (5) Among them, q represents a gray level on the histogram, n q It represents the number of pixels counted at gray level q, N represents the total number of pixels in the input image, and start represents the minimum gray level in a certain interval.
