A machine vision-based method for detecting the froth layer thickness in a flotation process

CN122948962APending Publication Date: 2026-10-20ZHEJIANG YINGXIN MINING CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611141002.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0005]本发明提供一种基于机器视觉的浮选生产泡沫层厚度检测方法,解决相关技术中污染层单向递增导致通用背景建模失效、液滴遮挡与界面气泡破裂难以区分以及药剂过量工况下界面渐变导致边缘检测信号缺失的技术问题

Benefits of technology

[0041]提出以参考区亮度差定义历史帧污染状态距离的加权时序解耦方法,替代通用背景建模方法中按时间距离赋权的方式,使污染层估计的权重分配与观察窗的实际污染积累状态直接耦合。高斯衰减的尺度参数通过首个清洗周期内参考区亮度变化幅度自动标定,无需针对不同矿种或药剂制度人工调参。同时,界面动态保护区机制利用气泡破裂仅发生在界面附近的物理空间约束,将液滴遮挡候选与气泡破裂动态信号区分开来,保护了界面区域的真实泡沫纹理不被误删。两类干扰的有效分离使检测系统在观察窗持续污染的条件下维持了长期可靠运行的能力;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This invention relates to the field of intelligent detection technology in mineral flotation, and discloses a machine vision-based method for detecting the thickness of the froth layer in flotation production. This method calculates the vertical conversion coefficient frame-by-frame using the known dimensions of the window frame as a reference; defines the contamination state distance using the inner stripes on the left and right sides of the window frame, and obtains and removes the contamination layer estimate using weighted median filtering; after repairing droplet obstruction, it extracts the effective froth feature map sequence; calculates the density gradient profile segmented vertically, corrects the transition zone width, and merges it into full-width interface coordinates; determines the top surface position using the interface as the lower bound, and multiplies it by a coefficient to obtain the initial physical thickness; removes sharp anomalies using the upper bound of liquid level change, and outputs the real-time thickness and trend curve after confidence-coupled filtering. This invention can achieve long-term stable online detection of the flotation froth layer thickness under conditions of continuous contamination and blurred interface in the observation window.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent detection technology in mineral flotation, and more specifically, to a method for detecting the thickness of the froth layer in flotation production based on machine vision. Background Technology

[0002] Flotation is the core process for separating minerals such as fluorite, and the thickness of the froth layer is a direct quantitative indicator for controlling the liquid level. If the thickness is too low, mineral recovery will be insufficient; if it is too high, mineral particles will easily detach from the froth layer and return to the slurry, affecting the concentrate grade. Currently, on-site operations mainly rely on operators' experience and visual judgment, lacking quantitative measurement methods. Training qualified operators is time-consuming and labor-intensive, and the harsh environment exacerbates the personnel shortage.

[0003] Current liquid level detection primarily relies on contact-based solutions such as float sensors and ultrasonic rangefinders. These are prone to measurement errors due to slurry splashing and bubble disturbances, and installation and maintenance require production downtime, limiting industrial usability. While side-view observation windows combined with industrial cameras can circumvent these issues, existing methods fail to address two unique types of interference specific to the observation window: the unidirectional accumulation of fine slurry particles and reagent residues on the inner wall forming a contamination layer, and the obstruction caused by droplets from bursting bubbles. Existing background modeling methods assume statistical stationarity, which cannot accommodate the non-stationary nature of the unidirectionally increasing contamination layer, resulting in ineffective contamination layer separation.

[0004] Furthermore, existing image segmentation methods rely on clear light-dark boundaries to locate the interface. However, under conditions of excessive reagent, the froth-slurry interface degenerates into a gradual transition zone without a clear physical boundary, causing edge detection methods to fail due to signal loss. These issues render existing vision solutions inadequate for meeting the engineering requirements of quantitative control of flotation liquid levels under conditions of contaminated windows and blurred interfaces. Summary of the Invention

[0005] This invention provides a machine vision-based method for detecting the thickness of the foam layer in flotation production, which solves the technical problems in related technologies, such as the failure of general background modeling due to the unidirectional increase of the contamination layer, the difficulty in distinguishing between droplet occlusion and interface bubble rupture, and the lack of edge detection signals due to the gradual change of the interface under the condition of excessive reagent.

[0006] This invention provides a machine vision-based method for detecting the thickness of a foam layer in flotation production, comprising the following steps:

[0007] S1, continuously acquire image sequences from the observation window on the side wall of the slurry pool, and calculate the vertical conversion coefficient frame by frame through gradient detection and rectangular geometric constraints, using the known physical dimensions of the metal window frame as a reference, and output the verified image frame and the corresponding vertical conversion coefficient.

[0008] S2, for the verified image frames, calculate the pollution state distance of each historical frame using the vertical stripes on the left and right inner sides of the window frame as reference areas, assign weighted median weights according to the pollution state distance to obtain the pollution layer estimation map and subtract it from each frame; on the decontaminated image, combine the interface dynamic protection zone to identify and repair droplet occlusion, and extract the effective foam feature map sequence.

[0009] S3 divides the effective foam feature map sequence into vertical columns and calculates the density gradient profile independently in each column. After applying the transition band width correction to the gradient peak position, the gradient peak position is weighted and merged into the full-width interface coordinates. The corrected interface pixel row position, transition band width and comprehensive confidence are output.

[0010] S4. On the effective foam feature map, the texture density is scanned row by row from top to bottom with the interface pixel row position as the search lower bound. The top surface position is determined by adaptive threshold and temporal median. The pixel row distance between the top surface and the interface is multiplied by the vertical conversion coefficient to obtain the initial physical thickness value with confidence label.

[0011] S5, for the time-series signal composed of initial physical thickness values ​​with confidence labels, uses the upper limit of the single-frame liquid level change determined by the equipment physical parameters as the threshold to remove peak anomalies frame by frame, applies confidence-coupled exponential weighted moving average filtering to the remaining signal, and outputs the real-time thickness value and moving average trend curve.

[0012] Furthermore, the step S1, which involves calculating the vertical conversion coefficient frame-by-frame using gradient detection and rectangular geometric constraints, includes:

[0013] The image is calculated by measuring the gray-level difference in the horizontal and vertical directions and taking the magnitude to obtain the edge intensity response of each pixel. Gradient response sets that satisfy the continuity and direction constraints are extracted along the four directions of the image. Candidate lines are fitted from the gradient response sets in each direction using the random sampling consensus algorithm.

[0014] Apply rectangular geometric constraints to the four candidate lines, ensuring that opposite sides are parallel and of equal length and adjacent sides are perpendicular. If the detection of a certain side is discontinuous due to local contamination, the position of that side is inferred from the detection results of the other three sides. Calculate the global brightness mean of the image. If the global brightness mean is lower than the preset exposure lower limit, mark the frame as an unqualified exposure frame and do not pass it to the downstream steps.

[0015] Furthermore, in S2, the pollution state distance of each historical frame is calculated using the vertical strips on the left and right inner sides of the window frame as reference areas, and the weighted median weight is assigned according to the pollution state distance, including:

[0016] A frame buffer queue covering a preset time span is maintained to store historical image frames in a downsampling manner. At the same time, the average brightness values ​​of the left and right reference areas corresponding to the acquisition time are recorded for each historical frame. For each historical frame in the frame buffer queue, the absolute value of the difference between the average brightness value of the reference area recorded in the historical frame and the average brightness value of the reference area measured at the current time is used as the pollution state distance of the historical frame.

[0017] Weights are assigned to each historical frame based on the distance to the contamination state. At each pixel position, the pixel brightness values ​​of each historical frame in the frame buffer queue are sorted in ascending order. The weights of each historical frame are accumulated along the sorting direction. The pixel brightness value corresponding to the first time the accumulated value reaches half of the total weight of all historical frames is used as the weighted median of the corresponding position. The weighted median of all pixel positions constitutes the contamination layer estimation map.

[0018] Furthermore, the specific method for assigning weights to each historical frame based on the distance to the pollution state is as follows:

[0019] The weight calculation follows the Gaussian decay rule. The weight is at its maximum value when the distance between the polluted states is zero, and the weight decreases monotonically according to the Gaussian function as the distance between the polluted states increases.

[0020] The scale parameter of Gaussian attenuation is determined through scene self-calibration. The system continuously records the brightness change of the reference area during the first complete cleaning cycle. The maximum change from the end of cleaning to the beginning of the next cleaning is divided by the preset attenuation scale factor as the scale parameter, so that the weight corresponding to the maximum change in the distance of the contaminated state is attenuated to close to zero.

[0021] Furthermore, in S2, identifying and repairing droplet occlusion in the decontaminated image by combining the interface dynamic protection zone includes:

[0022] On the decontamination image, frame difference analysis is performed within a preset continuous frame window to find newly appearing and then disappearing local bright spot regions within the window; the ratio of the area of ​​the local bright spot region to the area of ​​the minimum circumscribed circle is calculated as a roundness index, and local bright spot regions with a roundness index exceeding a preset first threshold are selected as droplet occlusion candidates.

[0023] A dynamic interface protection zone is established with the position of the interface pixel row obtained in the previous frame as the center and a preset multiple of the width of the transition band obtained in the previous frame as the vertical span. Droplet occlusion candidates within the dynamic interface protection zone are not processed, while droplet occlusion candidates outside the dynamic interface protection zone are filled and repaired using the average brightness of the corresponding pixels in the previous and next normal frames.

[0024] Furthermore, in S3, dividing the effective foam feature map sequence into vertical columns and independently calculating the density gradient profile within each column, as well as weighting and merging them into full-width interface coordinates, includes:

[0025] The effective horizontal range of each frame's effective bubble feature map is divided into a preset number of vertical segments; within each vertical segment, it is divided into a preset number of horizontal strips along the vertical direction; the mean of the absolute value of the gray level difference between adjacent pixels within each horizontal strip is calculated as the texture density index of the corresponding horizontal strip; the texture density indices of each horizontal strip are arranged from the bottom to the top of the image to obtain the vertical density profile curve of the corresponding vertical segment.

[0026] For each column segment, the first difference of the longitudinal density profile curve is obtained along the longitudinal direction to obtain the density gradient sequence of the corresponding column segment; the ratio of the main peak amplitude of the density gradient sequence of each column segment to the sum of the main peak amplitudes of all column segments is used as the weight to perform weighted median merging on the corrected interface position of each column segment to obtain the full-width interface pixel row position.

[0027] Furthermore, the step S3 step of applying a transition band width correction to the gradient peak position includes:

[0028] Within each column segment, half of the maximum value of the density gradient sequence of the corresponding column segment is used as a reference threshold. The strip intervals in the density gradient sequence that continuously exceed the reference threshold are identified, and the vertical span of the strip interval is used as the width of the transition band of the corresponding column segment.

[0029] Determine whether the difference between the maximum and the second largest value within the strip interval is less than the preset second threshold ratio of the maximum value. If so, determine that the corresponding column segment is a plateau shape, and take the center position of the strip interval as the gradient peak position of the corresponding column segment.

[0030] Otherwise, the position of the maximum value is taken as the gradient peak position of the corresponding column segment; the gradient peak position is offset along the upper direction of the transition band of the corresponding column segment by a preset ratio of the width of the transition band of the corresponding column segment to obtain the corrected interface position of the corresponding column segment.

[0031] Furthermore, determining the top surface position in S4 using an adaptive threshold and the temporal median includes:

[0032] The texture density index is calculated row by row from the top of the effective foam feature map, and the first row where the texture density index exceeds the texture initiation threshold is used as the coordinate of the top candidate row.

[0033] Based on the pixel row position of the interface, the average texture density of a preset number of horizontal strips is taken upwards, and the average texture density of a preset number of horizontal strips is taken downwards. The corresponding sliding mean estimate is updated with a small step size. The texture activation threshold is updated in real time by taking the median value of the above two sliding mean estimates. The temporal median value of the top candidate row coordinates of a preset number of consecutive frames is taken as the top position of the current frame.

[0034] Furthermore, obtaining the initial physical thickness value with confidence level annotation in S4 further includes:

[0035] The confidence level of the top surface is determined by the inter-frame deviation of the top surface position of a consecutive preset number of frames. The confidence level of the top surface decreases monotonically as the inter-frame deviation increases. The smaller value between the overall confidence level and the confidence level of the top surface is taken as the confidence level label of the initial physical thickness value of the current frame.

[0036] When the texture density index of all regions above the pixel row position on the interface exceeds the texture activation threshold, the frame is marked as viewport overflow, and the thickness output of the frame is estimated by taking the product of the maximum visible height of the viewport and the vertical conversion coefficient.

[0037] Furthermore, S5 specifically includes:

[0038] The upper limit of the liquid level change in a single frame is obtained by dividing the maximum flow rate of the liquid level control valve by the effective cross-sectional area of ​​the flotation cell and then multiplying it by the time interval between camera frames. For time-series signals, if the difference in thickness values ​​between adjacent frames exceeds the upper limit of the liquid level change in a single frame, the frame is marked as an abnormal frame and is not used for the time being. Instead, the normal frame thickness values ​​at the start and end positions of the continuous abnormal frame segments are used for linear interpolation.

[0039] Apply an exponentially weighted moving average filter to the remaining signal, and use the product of the base smoothing coefficient and the current frame thickness value plus 1 minus the product of the base smoothing coefficient and the smoothed output value of the previous time step as the smoothed output of the current time step; for frames with confidence labels, replace the base smoothing coefficient with the product of the base smoothing coefficient and the confidence label of the frame.

[0040] The beneficial effects of this invention are as follows:

[0041] A weighted temporal decoupling method is proposed, defining the distance to the historical frame contamination state based on the brightness difference of the reference area. This replaces the time-distance-based weighting method in general background modeling, directly coupling the weight allocation of the contamination layer estimation with the actual contamination accumulation state of the observation window. The scale parameter of Gaussian attenuation is automatically calibrated by the brightness change amplitude of the reference area within the first cleaning cycle, eliminating the need for manual parameter tuning for different mineral types or reagent regimes. Simultaneously, the interface dynamic protection zone mechanism utilizes the physical spatial constraint that bubble bursting only occurs near the interface to distinguish droplet occlusion candidates from the dynamic signal of bubble bursting, protecting the true foam texture of the interface region from accidental deletion. The effective separation of these two types of interference enables the detection system to maintain long-term reliable operation under conditions of continuous contamination of the observation window.

[0042] An interface localization method employing longitudinal bubble density gradient profiles combined with transition zone width correction uses the transition of texture density from the slurry zone to the foam zone as the basis for the localization signal. This transition objectively exists in both clear and blurred interface conditions, fundamentally avoiding the signal loss problem of edge detection methods in blurred interface conditions. The mechanism of independent processing and weighted merging of vertical column segments adapts to the actual situation of lateral interface fluctuations. The overall confidence score is fused by the product of peak significance and temporal consistency. By using confidence score coupled with exponential weighted moving average filtering, the single-frame measurement quality is bound to the temporal filtering behavior, ensuring stable and reliable thickness results even under drastic fluctuations in operating conditions. Attached Figure Description

[0043] Figure 1 This is an overall structural diagram of a machine vision-based flotation production foam layer thickness detection method according to the present invention.

[0044] Figure 2 This is a flowchart of a machine vision-based method for detecting the thickness of a foam layer in flotation production according to the present invention.

[0045] Figure 3 This is a flowchart of a machine vision-based method for detecting the thickness of a foam layer in flotation production according to the present invention.

[0046] Figure 4 This is a time-series comparison chart of thickness measurement over multiple consecutive days, as an application example of the present invention;

[0047] Figure 5 This is a schematic diagram of the physical constraint removal and EWMA filtering effect of the present invention. Detailed Implementation

[0048] The subject matter described herein will now be discussed with reference to exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and implement the subject matter described herein, and changes may be made to the function and arrangement of the elements discussed without departing from the scope of this specification. Various processes or components may be omitted, substituted, or added as needed in the examples. Furthermore, some features described in the examples may be combined in other examples.

[0049] At least one embodiment of the present invention discloses a machine vision-based method for detecting the thickness of foam layers in flotation production, such as... Figure 1As shown, the overall structure of the method includes: a host computer monitoring system ①, an industrial computer ②, a global shutter industrial camera ③, an LED ring light source (with a diffuse reflector) ④, a lens ⑤, an observation window on the side wall of the slurry tank ⑥, a flotation foam layer ⑦, and a level control valve ⑧. The observation window ⑥ is installed on the side wall of the flotation cell, and the flotation foam layer ⑦ and the vertical reference strips on the left and right inner sides of the window frame are visible within its transparent area. The camera ③ aligns its optical axis with the observation window ⑥ through the lens ⑤, and the light source ④ provides uniform illumination to the observation window. The camera transmits the acquired image sequence to the industrial computer ②. The industrial computer ② sequentially executes five processing steps: image acquisition and vertical calibration, contamination decoupling and droplet repair, density gradient interface positioning, top surface detection and thickness conversion, and time-series filtering and trend output. It also uploads the real-time thickness, trend curve, and alarm information to the host computer ①. The level control valve ⑧ adjusts the level of the flotation cell. The steps of each method are as follows: Figures 2 to 3 As shown, it includes:

[0050] S1, continuously acquire image sequences from the observation window on the side wall of the slurry pool, and calculate the vertical conversion coefficient frame by frame through gradient detection and rectangular geometric constraints, using the known physical dimensions of the metal window frame as a reference, and output the verified image frame and the corresponding vertical conversion coefficient.

[0051] In one embodiment of the present invention, an industrial camera equipped with a light source is used to continuously acquire images of the observation window at a fixed frame rate. The core function of the light source is to provide uniform and stable illumination, ensuring that the camera obtains properly exposed foam cross-sections in the dim working environment of the slurry pool. The uniformity of the illuminance distribution is directly related to the quality of subsequent processing. Non-uniform illumination will introduce false gradients in the image. These gradients are unrelated to the foam texture but are sufficient to interfere with density profile calculations. Therefore, the light source should be arranged to ensure that the illuminance distribution in the effective area of ​​the observation window is as uniform as possible.

[0052] A global shutter industrial camera was chosen instead of a rolling shutter camera. In the flotation process, the vibration of the equipment combined with the rapid movement of bubbles, coupled with the different pixel acquisition times of each row of the rolling shutter, can cause lateral distortion and jagged artifacts at the bubble edges. These artifacts directly interfere with texture density calculations. When installing the camera, the optical axis should be aligned with the center of the observation window, ensuring that the window frame and transparent areas are both within the image's field of view. The frame should be located at the image edge, and the foam cross-section should be within the main image area, ensuring sufficient pixel coverage for subsequent frame detection.

[0053] After image acquisition begins, an exposure uniformity check is performed on each frame. The global average brightness of the image is calculated. If the average value is lower than the set exposure lower limit, it indicates that the light source may be blocked, the lamp is aging, or the power supply is abnormal. This frame is marked as an exposure failure and is not passed to downstream steps. A light source abnormality warning is also sent to the host computer. This mechanism is equivalent to intercepting frames with obviously unusable content at the entry point of the image processing chain, preventing subsequent algorithms from performing meaningless calculations on low-quality data. The exposure lower limit is determined as follows: after the system is initially installed and the light source is confirmed to be normal, the global average brightness of several frames under normal lighting is recorded, and 50% of the minimum value is taken as the exposure lower limit.

[0054] In one embodiment of the invention, the metal frame is made of steel and appears in the image as a rectangular border with a fixed width and uniform brightness, exhibiting a clear grayscale jump between it and the internal foam region. The grayscale differences in the horizontal and vertical directions of the current frame image are calculated and their amplitudes are taken to obtain the edge intensity response at each pixel. A continuous gradient response band with uniform width and high intensity appears at the frame edge. Gradient response sets satisfying continuity and directionality constraints are extracted for each of the four directions of the image. The RANSAC algorithm is used to fit the optimal straight line from these sets: in each iteration, two gradient response points are randomly selected to fit a candidate straight line. The number of points whose distance to the candidate straight line is within a set tolerance is counted as the number of interior points. After several iterations, the candidate line with the most interior points is selected as the optimal straight line for that direction. Stray gradient responses caused by the contamination layer are automatically excluded as outliers during the RANSAC process because they do not meet the accuracy requirements of the straight line model.

[0055] Contamination on the inner wall of the acrylic sheet generates interfering gradients, and the absolute magnitude of the gradient alone is insufficient to reliably distinguish between the frame and the contamination. Therefore, a rectangular geometric constraint is added: the four candidate lines must satisfy the conditions of parallel and equal-length opposite sides and perpendicular adjacent sides. When a side is discontinuous due to local contamination occlusion, the position of that side can be deduced by adding the rectangular constraint to the detection results of the other three sides. The fact that the frame is physically a rigid rectangle does not change over time; adding this prior knowledge is equivalent to using physical knowledge to compensate for image uncertainties under contamination conditions, significantly improving reliability for moderate to severe contamination. Simultaneously, the detected inner width and height are compared with the actual dimensions recorded in the configuration file. If the deviation exceeds the allowable range, the frame detection for this frame is marked as a failure, and the result of the previous frame is used instead. Multiple consecutive failures trigger a camera installation anomaly alarm.

[0056] The foam layer thickness is a physical quantity in the vertical direction of the image, and the conversion coefficients required for calibration are also specifically established based on the vertical direction. The specific method is as follows: Take the physical height of the inner edge of the window frame (in millimeters) pre-recorded in the configuration file, divide it by the difference between the pixel row numbers of the upper and lower horizontal edges of the inner edge of the window frame (in pixels), and obtain the dedicated vertical conversion coefficient for the current frame, in millimeters per pixel row. This method avoids the deviation introduced by simply averaging the values ​​when there is a pitch angle deviation between the camera optical axis and the viewing window, resulting in unequal horizontal and vertical conversion coefficients. In actual installation, there is usually a small pitch angle between the camera bracket and the viewing window; the dedicated vertical coefficient scheme is completely unaffected by the horizontal calibration results, making the physical basis for thickness conversion more rigorous.

[0057] Since the vertical conversion coefficient is calculated independently for each frame, slight camera displacement caused by flotation equipment vibration is automatically compensated for in each frame calculation, preventing it from accumulating into system errors over time. The median of conversion coefficients from several adjacent frames is used as a reference (the median is more robust to single-frame anomalies than the mean) to verify the rationality of the current frame's conversion coefficient. Frames deviating from the reference by more than a set percentage are marked as having abnormal conversion coefficients. The image content of this frame is still normally transmitted to S2, but the conversion coefficient itself is replaced by linear interpolation from the preceding and following normal frames to maintain the continuity of the conversion parameter sequence. The default value for the conversion coefficient deviation threshold is ±5% of the reference. It is crucial to clearly distinguish between frames with substandard exposure and frames with abnormal conversion coefficients: the former, where the image content itself is unreliable, is not transmitted downstream; the latter, where the image content is normal but the conversion coefficient needs repair. The processing paths for these two types of low-quality frames differ, and they are also categorized and recorded in the logs. For the first few frames after system startup, before a reference reference is established, the results are directly output based on independent single-frame calculations. Once a sufficient number of buffered frames are reached, the system switches to a verification mode based on historical medians. The vertical conversion coefficients of each frame are output together with the original image frames after quality verification, forming two synchronous data streams for downstream use.

[0058] S2, for the verified image frames, calculate the pollution state distance of each historical frame using the vertical stripes on the left and right inner sides of the window frame as reference areas, assign weighted median weights according to the pollution state distance to obtain the pollution layer estimation map and subtract it from each frame; on the decontaminated image, combine the interface dynamic protection zone to identify and repair droplet occlusion, and extract the effective foam feature map sequence.

[0059] The image sequence output by S1 gradually becomes blurred as the running time increases. Fine particles of slurry and reagent residues form a semi-transparent coating on the inner wall of the acrylic, which is the contamination layer. The pine oil foaming agent used in fluorite flotation forms an oil film-type contamination layer on the acrylic surface, which diffuses light and uniformly reduces the intensity of transmitted light. The mineral dust-type contamination layer, due to the uneven particle size, appears as slight local brightness fluctuations in the image. A common feature of both types is that the brightness changes continuously and slowly at a fixed spatial location, remaining almost unchanged between adjacent frames. This temporal characteristic is the basic basis for distinguishing the contamination layer from the dynamic foam texture. At the same time, when the flotation cell is aerated, the bursting of bubbles sprays slurry droplets onto the inner wall of the observation window. After adhering, these appear as nearly circular bright spots at random locations in the image, which usually evaporate or flow away within a dozen to several dozen frames. This is droplet occlusion. The two types of interference are superimposed on the real foam texture and are difficult to distinguish in a single frame image. Temporal information must be used to separate them.

[0060] In traditional scenarios such as video surveillance, background modeling methods (such as Gaussian mixture model, ViBe pixel sample consensus model, etc.) have been widely used. However, these methods share the common premise that the background has statistical stationarity or regressivity. That is, although the background may be temporarily occluded or have changes in illumination, it will not change continuously in one direction as a whole and will return to its original state after being occluded.

[0061] In one embodiment of the invention, the contamination layer in the flotation observation window is fundamentally different: it is a unidirectionally increasing non-stationary process that, once accumulated, will not recover on its own, and the accumulation rate varies non-linearly with operating conditions (slurry sputtering intensity, reagent type). Directly applying general background modeling methods will face the following dilemmas: if the time window is short, the model cannot keep up with the rapid accumulation shifts; if the window is long, the historical frames contain a large number of samples that differ significantly from the current contamination state, and the statistical results (mean or median) will be systematically lower than the actual contamination layer. Relying solely on time distance to determine the reference value of historical frames cannot adapt to this non-uniform accumulation physical process;

[0062] To continuously monitor the accumulation of contaminants, two vertical strips are established as reference areas adjacent to the inner left and right edges of the window frame. These two areas physically correspond to the inner edges of the side walls of the metal window frame. Regardless of the liquid level, they will not be covered by foam or slurry, making them permanently effective contamination monitoring zones. If the reference areas were placed on the upper or lower inner edges, foam would enter the reference areas when the liquid level rises, rendering them meaningless for monitoring. The left and right strips are designed to avoid this failure mode. During operation, the texture density index (the average absolute value of the grayscale difference between adjacent pixels within the reference area) of the reference area is calculated in real time. Under normal circumstances, this index is close to zero because the frame side walls are only covered by a contaminant layer and do not contain bubble texture. When the index exceeds the reference area anomaly threshold, an anomaly flag is triggered, temporarily freezing the contamination rate estimation based on the reference area, maintaining the current weight parameters unchanged, and continuing to update after the index falls back down. The reference area anomaly threshold is determined by sampling the maximum texture density of the clean window reference area during initial system installation, and taking three times that value as the anomaly judgment boundary.

[0063] In one embodiment of the present invention, addressing the problem that general background modeling methods cannot adapt to the unidirectional increasing characteristics of pollution, the present invention adopts the pollution state distance as the core idea for measuring the reference value of historical frames. The basic idea is to determine the reference value of historical frames based on the similarity of pollution states, not on the proximity of time. A frame buffer queue covering a relatively long time span is established to store historical image frames in a downsampling manner. Simultaneously, the average brightness of the left and right reference areas corresponding to the acquisition time is recorded for each frame, forming a synchronized historical sequence of image frame and reference area brightness. The default time span of the frame buffer queue is 4 hours, and the downsampling frame interval and the total number of frames should satisfy the requirement of sufficient sampling of pollution states within this time span.

[0064] To illustrate with an example from a flotation site: if a large amount of slurry splashes during a certain period within the past 3 hours, causing a significant accumulation of contamination in the observation window within a short time, then even though the recent frame before the splashing is very close in time, the degree of contamination differs greatly from the current heavily contaminated state, making it less valuable as a reference than some earlier historical frames. Relying solely on the proximity of the time frame for selecting a reference frame will result in a significant lag or jump in contamination layer estimation.

[0065] For each historical frame in the buffer queue, the reference area brightness record value at the corresponding moment is read, and the absolute value of the difference between this value and the measured brightness of the reference area at the current moment is calculated to obtain the pollution state distance of that historical frame. The smaller the distance, the closer the pollution level at the time of acquisition is to the current level, and the more valuable it is for estimating the current pollution layer; therefore, it should be assigned a higher weight. The weight calculation follows the Gaussian decay rule: the weight takes the maximum value of 1 when the pollution state distance is zero, and the weight monotonically decreases according to the Gaussian function as the distance increases. The scale parameter of Gaussian decay is determined through scene self-calibration: the system continuously records the brightness change of the reference area during the first complete cleaning cycle, takes the maximum change from the end of cleaning to the beginning of the next cleaning, divides it by the decay scale factor (default value is 3) to obtain the scale parameter, so that the weight decays to close to zero when the pollution state distance reaches the maximum change of a complete cleaning cycle. The reason for automatically calibrating the scale parameters using the measured change range of the first cleaning cycle instead of taking a globally fixed value is that the contamination accumulation rate varies greatly under different mineral types and different reagent regimes. A fixed value would create a dilemma: the window would be too wide to include too many irrelevant frames during the cleaning period, while it would be too narrow to discard valid frames during the heavily contaminated period. This self-calibration mechanism allows the weight function to automatically adapt to the on-site cleaning cycle and contamination accumulation rate without manual parameter tuning.

[0066] After obtaining the weights, a weighted median is calculated for each pixel position in each frame of the buffer queue to obtain the pollution layer estimation map at the current time. Specifically, at a given pixel position, the pixel brightness values ​​of all historical frames at that position are arranged in ascending order, and the weights of each frame are accumulated along the sorting direction. When the accumulated value first reaches half of the total weight of all frames, the corresponding pixel brightness value is the weighted median for that position. Median calculation is not sensitive to outliers in a single frame (such as local bright spots caused by droplets) and can stably extract the pollution layer signal that changes slowly over time from historical samples; this is the core reason for using the median instead of the mean, as the mean is skewed by bright spots when droplets frequently appear, while the median result is more stable. After the pollution layer estimation map is calculated, spatial smoothing is performed. Neighborhood mean filtering is used to eliminate pixel-level estimation noise, resulting in a smooth spatial distribution in the estimation map. Spatial smoothing is not performed on edge regions (positions near the inner edge of the frame) to avoid the brightness distribution at the frame edge penetrating into adjacent effective areas. Subtract the estimated brightness value of the corresponding position in the contamination layer estimation map from each pixel position in each frame image to obtain the decontamination image sequence, thus completing the separation of the first type of interference components.

[0067] In one embodiment of the present invention, the decontamination result also undergoes a validity self-check: theoretically, the average brightness of the reference area after decontamination should be close to the reference brightness of the clean window reference area recorded during the initial system installation (the reflective brightness of the metal sidewall itself, which is not zero). If it is lower than the reference, it indicates that the contamination layer has been excessively subtracted; if it is higher than the reference, it indicates that the estimation is insufficient. When the difference exceeds a set threshold, the decontamination result of that frame is marked as low quality, the confidence weight of the interface positioning result in downstream S3 is reduced accordingly, and a contamination layer estimation quality alarm is triggered. This self-check provides an end-to-end quality monitoring closed loop for the entire processing flow, enabling upstream processing quality problems to be identified in a timely manner and transmitted downstream, without affecting the final output in an imperceptible state.

[0068] Droplet occlusion identification is performed on a decontaminated image sequence. The characteristic combination of droplets in the image is short-lived appearance, random location, and near-circular bright spots: frame difference analysis is performed on consecutive frames of the decontaminated image (the default frame difference analysis window is 30 frames) to identify newly appearing and subsequently disappearing local bright spot regions within that window; morphological evaluation is performed on these candidate regions, calculating a circularity index (the ratio of the region area to its smallest circumscribed circle area). Candidates with a circularity exceeding the judgment threshold (default value is 0.6) are identified as droplet morphologies. However, relying solely on frame difference and morphological analysis presents an unavoidable ambiguity: when a bubble bursts on the liquid surface, the burst site briefly forms a circular cavity on the liquid surface that disappears within several frames. Its temporal characteristics and local morphology are very similar to those of a droplet, making reliable differentiation impossible based on these two criteria alone. If the bubble burst signal is mistakenly deleted, it will directly destroy the most characteristic dynamic texture of the interface region, affecting the interface localization of S3.

[0069] The key to resolving this confusion is introducing spatial constraints on the flotation physical process: bubble bursting can only occur within a limited vertical height range near the froth-slurry interface, while droplets can appear at any height within the window, including inside the froth layer, the air zone above the top of the froth, and the slurry zone. Based on this physical constraint, a dynamic interface protection zone is established with a certain range above and below the currently available interface position estimate as the center. All candidate bright spots detected within this zone are not treated as droplets but are identified as dynamic signals of interface bubble bursting, which are part of the real froth characteristics. The default value of the longitudinal span of the protection zone is twice the width W of the transition zone (W is output by S3 and obtained through the frame shifting mechanism of the aforementioned single-frame buffer register).

[0070] Candidate bright spots outside the protected area are treated as droplet occlusions and filled and repaired using the average pixel brightness of the corresponding position in the preceding and following normal frames to restore the image content of the occluded area. After droplet recognition and repair are completed, the output image sequence is an effective foam feature map sequence. The real foam texture distribution is completely preserved, and the two main types of interference have been separated, providing clean and reliable input for subsequent S3 interface localization and S4 top surface detection.

[0071] In one embodiment of the present invention, the cold start scenario requires further explanation: when the system first starts, the frame buffer queue is empty, there are no historical images available, and it is impossible to directly establish a contamination layer estimation model. The processing method is divided into three stages for a smooth transition: in the first stage, when the number of frames in the buffer queue is very small (less than 10 frames), the most recently acquired single-frame image is directly used as the contamination layer estimate at the current moment; in the second stage, as the number of frames gradually increases, all frames already in the queue are weighted and the median is calculated with equal weights as the contamination layer estimate; in the third stage, when the buffer queue is full to 50% of its total capacity, the cold start is considered complete, and the system automatically switches to an adaptive weighted mode based on the distance to the contamination state. When the on-site operator manually cleans the observation window, the system should be reset through the operation interface: clear the frame buffer queue, reset the reference area brightness benchmark value to the current measured value, and re-enter the cold start process to ensure that the system quickly adapts to the new clean window state after the cleaning event instead of using the contamination layer model before cleaning.

[0072] S3 divides the effective foam feature map sequence into vertical columns and calculates the density gradient profile independently in each column. After applying the transition band width correction to the gradient peak position, the gradient peak position is weighted and merged into the full-width interface coordinates. The corrected interface pixel row position, transition band width and comprehensive confidence are output.

[0073] Observing the effective foam feature map output by S2 reveals distinct texture difference zones along the vertical direction (corresponding to the physical direction from slurry to foam within the observation window): the lower part of the image corresponds to the slurry area, where the slurry surface is relatively uniform and local texture activity is low; the upper part of the image corresponds to the foam layer, where densely distributed bubbles generate rich local high-frequency textures and high activity; the area between the two is the interface region, where activity transitions from low to high. This vertical texture gradient manifests differently under different operating conditions. Under normal operating conditions, the difference between the slurry and foam areas is obvious, the transition zone is narrow, and the interface is clear; under conditions of excessive reagents, a large number of semi-formed bubbles are mixed into the slurry, and the bubble density gradually increases from the depth of the slurry to the top of the foam layer, making the transition zone wide and degenerating into a gradual transition area. In this case, the method of finding clear edges to locate the interface is no longer feasible because there is no clear physical boundary to find.

[0074] In this scenario, image edge-based segmentation methods (Canny, Sobel edge detection, or image gradient-based semantic segmentation networks) have fundamental limitations: these methods rely on local gray-level transitions as signal sources and depend on clear light-dark boundaries for stable output. However, the flotation interface, under conditions of excessive reagents, essentially lacks such boundaries, rendering edge detection methods equivalent to signal loss. Even under conditions with clear interfaces, while deep learning-based semantic segmentation can learn interface features through a large number of labeled samples, the color, size, and density of froth at the flotation site vary greatly depending on the mineral type, reagents, and water quality. Relocation across mines requires re-labeling and retraining, limiting its engineering applicability.

[0075] In one embodiment of the present invention, the density gradient method does not depend on the visual clarity of the interface, but on the constant transition from low to high in the vertical texture density distribution. This transition objectively exists in both clear and blurry interfaces, the only difference being the width of the transition band. It can serve as a robust interface positioning signal and does not require re-labeling and training for different mineral types. It can be adapted by adjusting a small amount of the initial threshold.

[0076] The complete interface localization process is organized as follows: independent processing of vertical segments → weighted merging of each segment. First, the effective horizontal range of the image is divided into several vertical segments (default is 4 segments, each segment having 1 / 4 the width of the effective transparent area). Each segment independently executes the following complete processing flow: within this segment, it is divided into several horizontal strips along the vertical direction, with each strip having a default height of 10 pixels. For each strip, a local texture density index (the average absolute value of the grayscale difference between adjacent pixels within the strip) is calculated. The index for the foam area strip is higher than that for the slurry area strip because the bubble boundaries cause significant grayscale jumps between adjacent pixels, while the slurry surface has a uniform texture with minimal grayscale variation. The texture density indices of each strip are arranged from bottom to top of the image to obtain the vertical density profile curve for that segment. This index is relatively insensitive to local lighting changes because it measures local relative differences rather than absolute brightness. When the light source slightly attenuates, causing the entire image to darken, the grayscale difference between adjacent pixels is only slightly affected by the absolute value of brightness, giving the interface localization built-in robustness against light source aging.

[0077] Within each segment, the first-order difference along the longitudinal direction of the longitudinal density profile curve is obtained to obtain the density gradient sequence for that segment. The position with the largest gradient value in the sequence corresponds to the steepest rise in the density profile, i.e., the center of the region with the most dramatic texture transition within that segment, which is the initial estimate of the interface position for that segment. However, under conditions of excessive drug use, the transition zone of the density profile exhibits a plateau shape, and the gradient sequence may not have a significant main peak but rather a continuous high-value region with similar amplitudes. For this plateau shape, half of the maximum value of the gradient sequence is used as a reference threshold to identify the strip intervals in the gradient sequence that continuously exceed this threshold. The longitudinal span of these intervals is the transition band width Wi of that segment. When there are multiple local maxima within this interval, and the difference between the maximum and the second largest value is less than 20% of the maximum value, it is determined to be a plateau shape. In this case, the position of the maximum value is not taken, but the center position of the continuous interval is taken as the peak estimate, thereby reducing inter-frame jitter. In non-plateau shapes, the position of the maximum gradient value is directly taken.

[0078] After obtaining the gradient peak position and transition band width Wi for each segment, a transition band width correction is performed on each segment: a smaller Wi indicates a clear interface for that segment, and the correction amount approaches zero, with the gradient peak position directly used as the interface coordinate for that segment; a larger Wi indicates a blurred interface for that segment, and the interface coordinates are shifted upwards along the transition band based on the gradient peak, with the shift amount being a fixed proportion of Wi. The default value of the proportional parameter is 0.3, calibrated as follows: under the condition that the observation window is clean and the interface is clear, several sets of comparison data between the interface position judged visually by the operator and the density gradient peak position are recorded, and regression is performed based on the average deviation of the two under different W values. The density gradient is chosen instead of the density profile itself as the positioning signal because the density profile has absolute values ​​in both the slurry and foam zones, and direct thresholding would require frequent threshold adjustments depending on the operating conditions; the density gradient represents the rate of change, and the position of the maximum value is independent of the absolute density level, does not change with the overall rise and fall of bubble density, and has better adaptability to changes in operating conditions;

[0079] The corrected interface positions of each segment are merged into the full-frame interface coordinates of the current frame using a weighted median. The weight of each segment is the ratio of the amplitude of the main peak of the density gradient in that segment to the sum of the amplitudes of the main peaks of all segments. The higher the amplitude of the main peak, the clearer the texture transition and the more reliable the positioning of that segment, and the higher the weight. If a segment's main peak is not prominent and its amplitude is much lower than other segments due to droplet interference, its weight automatically approaches zero, which is equivalent to excluding the positioning result of that segment from the weighted median, thus achieving adaptive suppression of lateral local interference. The full-frame transition band width W is also taken as the weighted median of each segment Wi (with the same weight), and is output together with the full-frame interface position. The local interface position estimation of each segment can also be used to evaluate the lateral tilt of the interface. If the dispersion exceeds a preset threshold, it indicates that the interface has a significant tilt, which can be used as an auxiliary working condition parameter output.

[0080] In one embodiment of the present invention, the reliability of interface localization needs to be quantified by a confidence score. The present invention considers both single-frame peak significance and temporal consistency. The full-frame density gradient sequence used for confidence calculation is obtained by recalculating a longitudinal density profile without segmentation of the entire effective horizontal range of the image after interface localization is completed, and calculating the first-order difference, independent of the segmented localization process. The calculation method for single-frame peak significance is as follows: take the maximum gradient value and the second largest gradient value in the full-frame density gradient sequence, divide the difference between the two by the maximum gradient value to obtain the peak significance score, which is between 0 and 1. The more prominent the main peak, the higher the score. The calculation method for temporal consistency is as follows: take the absolute value of the difference between the interface pixel row position of the current frame and the median value of the interface position of the previous few frames (the default value is the previous 5 frames), divide it by the upper limit of the reasonable change of liquid level in a single frame (calculated from the physical parameters of the flotation cell equipment described in S5), subtract this ratio from 1 and truncate it to not less than zero to obtain the temporal consistency score. When within the physical reasonable range, the score is close to 1; when outside the range, the score decreases until it reaches zero. The overall confidence score is the product of the peak significance score and the temporal consistency score. Any deviation in either score will cause the overall confidence score to decrease simultaneously. It reflects two layers of information: whether the current frame is clearly segmented and whether it is consistent with recent history.

[0081] When multiple candidate peaks appear in the density gradient profile, physical position constraints are introduced to assist in the judgment: the reasonable position range of the foam-slurry interface in the image is pre-set according to the actual installed liquid level control range. Multiple candidates are checked one by one to see if they fall within the reasonable range. After filtering out unreasonable candidates, the one with the largest gradient value among the remaining candidates is selected, and after correction for the transition band width, it is taken as the final interface positioning result. Multi-peak situations are most common in two types of operating conditions in production: one is that large droplets remaining in the observation window form local textures and generate secondary peaks; the other is that coarse and fine foam layers exist simultaneously in the flotation cell (double-layer foam, commonly seen in reagent ratio imbalances). The secondary peaks of the first type have small amplitudes and random positions, which can be judged by temporal consistency (peaks that appear stably in similar positions for multiple consecutive frames are more likely to be the real interface); the two peaks of the second type may have similar amplitudes. The peak with a position within the reasonable liquid level range and a stable temporal sequence is selected first, and this operating condition is marked as a double-layer foam abnormality, prompting the operator. The corrected interface position, transition band width W, and overall confidence level c are used as inputs to S4 and S5, and participate in subsequent top surface detection and thickness calculation.

[0082] S4. On the effective foam feature map, the texture density is scanned row by row from top to bottom with the interface pixel row position as the search lower bound. The top surface position is determined by adaptive threshold and temporal median. The pixel row distance between the top surface and the interface is multiplied by the vertical conversion coefficient to obtain the initial physical thickness value with confidence label.

[0083] In one embodiment of the present invention, top surface detection is performed on the effective foam feature map; the top surface of the foam is the contact boundary between the foam layer and the air region above it. The area above the top surface in the image has uniform brightness and no bubble texture, while the area immediately below the top surface is the bubble texture region of the foam layer. Using the interface pixel row coordinates corrected by S3 as the search lower bound, top surface detection is specifically performed in the vertical range above the interface position to avoid misjudging the texture of the slurry area as the top surface, while significantly reducing unnecessary computational overhead.

[0084] The specific method for top-face detection is to scan line by line from the top of the image (or the known upper boundary of the viewing window) downwards, calculating the texture density index for each line (consistent with the mean absolute value of the gray-level difference between adjacent pixels in S3). From top to bottom, the position where the texture density index first exceeds the texture initiation threshold is the coordinate of the candidate top-face row. The texture initiation threshold is set during the initial system calibration phase: image regions clearly located in the slurry zone and image regions clearly located in the foam zone are sampled separately, and the median value of the mean texture density of the two is used as the initial setting;

[0085] The threshold has an adaptive update mechanism: based on the interface position confirmed by S3, the average texture density is calculated for a region three strip heights above (clearly belonging to the foam area) and the average texture density is calculated for a region three strip heights below (clearly belonging to the slurry area). The sliding mean estimates are updated with small steps each frame. The texture activation threshold is updated in real-time using the median of these two sliding means, ensuring that the threshold always adjusts to the changes in foam texture characteristics under the current conditions. When bubbles become finer, the overall texture density in the foam area increases, and the threshold increases accordingly; when bubbles become larger, the threshold decreases accordingly. The threshold always remains between the texture density distributions of the slurry and foam areas, and the entire adaptive process requires no manual intervention.

[0086] During flotation, bubbles near the top surface continuously burst, creating brief voids that cause the scanning algorithm to detect a temporarily lower top surface position. This fluctuation in top surface position caused by bubble bursting is the main source of noise in single-frame detection results. Bubble bursting is part of the normal flotation process, and the top surface is constantly changing, making it impossible to eliminate directly. To suppress this brief fluctuation, the median of the top surface detection results for several consecutive frames is taken. The time window length needs to be determined based on the flotation cell's aeration frequency and the typical duration of bubble bursting, ensuring that the number of frames within the window is sufficient to dilute the abnormal frames caused by bursting to a minority. The default time window length corresponds to 1.5 frames. Median processing is insensitive to single-frame outliers, effectively smoothing out the jitter caused by bubble bursting while preserving the slow movement trend of the true top surface position. For cases of real rapid movement (operator significantly opening the aeration valve), the top surface position shifts in the same direction for multiple consecutive frames; median calculation does not smooth such real changes and does not introduce significant response lag.

[0087] In certain extreme conditions, when the foam layer thickness increases significantly, the top surface may rise above the visible area of ​​the observation window. In this case, scanning the entire image from the top down will detect high texture density, and no transition point from the background area to the texture area can be found. To address this window overflow condition, the following processing is adopted: when the texture density of all areas above the interface exceeds the trigger threshold, the top surface detection of this frame is marked as window overflow, and the output thickness value is the product of the maximum visible height of the observation window and the current conversion coefficient (i.e., the maximum physical height within the visible range) as the lower bound estimate. At the same time, a prompt is sent to the operation interface that the foam layer exceeds the detection range, reminding the operator to pay attention to the liquid level height.

[0088] In one embodiment of the present invention, the pixel row coordinates of the top surface are subtracted from the pixel row coordinates of the interface after correction in S3 to obtain a positive pixel row distance (the interface is located below the top surface in the image, corresponding to a larger row number, and the difference is positive). This distance corresponds to the complete span of the foam layer from the top surface to the bottom interface in the vertical direction of the image. This pixel row distance is multiplied by the vertical conversion factor (millimeters per pixel row) of the current frame output in S1 to obtain the initial physical thickness value of the foam layer in the current frame, in millimeters. This step is possible on the premise that the conversion factor of S1 is the measured value of the current frame rather than the factory fixed value, which can compensate for vibration and installation drift; and that the interface position in S3 and the effective image in S2 are both high-reliability outputs that have undergone quality self-checking.

[0089] The reliability of thickness measurements is jointly determined by interface confidence and top surface confidence. Interface confidence is the overall confidence level *c* output by S3; top surface confidence is assessed by the temporal stability of the top surface position: high confidence occurs when the top surface position falls within a range very close to the top surface position of the previous frame for several consecutive frames, and decreases when there are jumps exceeding this range between consecutive frames. The default value for the jump judgment threshold is 5 pixels. The overall confidence level of the thickness measurement for this frame is the smaller value between the interface confidence and the top surface confidence, ensuring that the thickness of this frame is marked as high confidence only when both interface positioning and top surface detection are reliable.

[0090] In one embodiment of the present invention, the overall confidence score uses a continuous score from 0 to 1. When the overall confidence score is below a set lower limit, the frame is considered a low-confidence frame, and the effective smoothing coefficient will be compressed in the EWMA recursion of S5; when it is above a set upper limit, it is considered a high-confidence frame, and EWMA responds with a normal value; the intermediate interval has a linear transition, making the influence of confidence score on EWMA behavior smooth and continuous, avoiding output instability caused by score jumps near the threshold. The default value for the low-confidence threshold is 0.4, and the default value for the high-confidence threshold is 0.8. The initial thickness values ​​of each frame with confidence labels are output and fed into S5 for subsequent temporal filtering processing.

[0091] S5, for the time series signal composed of initial physical thickness values ​​with confidence labels, uses the upper limit of the single-frame liquid level change determined by the equipment physical parameters as the threshold to remove peak anomalies frame by frame, applies confidence-coupled exponential weighted moving average filtering to the remaining signal, and outputs the real-time thickness value and moving average trend curve.

[0092] In one embodiment of the present invention, the time-series thickness signal actually contains three superimposed components: a trend component resulting from the slow change of the actual foam layer thickness with flotation conditions (time scale on the order of minutes); periodic micro-oscillations of the liquid surface caused by aeration (time scale on the order of seconds); and measurement spike noise caused by bubble bursting (time scale on the order of frames, duration extremely short). The three components have significantly different time scales, providing a basis for separation of time-series filtering based on physical constraints: physical constraints are used to identify and eliminate the third type of spike noise, EWMA filtering is used to smooth the second type of oscillation, and the first type of true trend is preserved. The three components work in a progressive manner, each performing its own function.

[0093] The actual rate of change of the flotation cell level is constrained by both the aeration flow rate and the slurry flow rate. The maximum reasonable rate of change is an engineering quantity determined by the physical structure of the equipment and can be directly calculated and determined during installation without requiring any operational data. The specific calculation process is as follows: the maximum rate of change of the level equals the maximum flow rate of the level control valve (cubic meters per second, obtained from the valve nameplate) divided by the effective cross-sectional area of ​​the flotation cell (square meters, obtained from the flotation cell equipment documentation), yielding the maximum rate of change of the level (millimeters per second). This rate is then multiplied by the inter-frame time interval of the camera (the frame interval equals the reciprocal of the frame rate, in seconds) to obtain the physical upper limit of the reasonable change in level between two adjacent frames, i.e., the upper limit of the change per frame, in millimeters per frame. Even if the operator actively and significantly opens the control valve, the actual rate of change of the level will not exceed this physical upper limit. This is a physical limit determined by the valve's maximum flow rate and is unrelated to operational behavior. Therefore, once the threshold is determined during installation, it does not need to be adjusted during operation. During the initial use of the system, it is recommended that operators cooperate in performing threshold verification: manually adjust the liquid level control valve at the maximum rate, while recording the system thickness timing output, to confirm that the thickness change under the maximum rate adjustment does not trigger the abnormal frame flag; if it does, it indicates that the physical threshold estimate is too small (the equipment file parameters do not match the actual value), and needs to be corrected.

[0094] The upper limit of the single-frame change is used as the threshold for judging abnormal frames. The initial thickness time-series signal is checked frame by frame: if the difference in thickness values ​​between adjacent frames exceeds the threshold, the frame is marked as an abnormal frame, and its thickness value is temporarily not used. The top surface detection deviation caused by bubble rupture can cause thickness jumps of several millimeters to more than ten millimeters within a single frame, far exceeding the upper limit of physical constraints. Therefore, the judgment threshold can effectively identify and isolate such noisy frames. For consecutive abnormal frame segments, the thickness values ​​of normal frames at the start and end positions of the segment are linearly interpolated to replace them, ensuring the continuity of the time-series signal. If the duration of an abnormal frame segment exceeds the preset maximum interpolation duration, the thickness output of that segment is marked as missing data. Instead of interpolation, a data missing prompt is displayed on the interface, waiting for subsequent normal frames to resume normal measurement. The default value for the maximum interpolation duration is 3 seconds.

[0095] In one embodiment of the present invention, after abnormal frame rejection and interpolation, an exponentially weighted moving average (EWMA) filter is applied to the time-series signal to generate a smooth real-time thickness output sequence. The EWMA calculation process involves multiplying the smoothing coefficient λ by the current frame measurement value, adding 1 to the sum of the products of λ and the previous output value, and using this as the smoothed output value for the current moment. A larger λ results in a higher weighting for recent measurements, leading to a faster output response but weaker smoothing of residual oscillations; a smaller λ results in a more stable output but a slower response to changes in operating conditions. The smoothing coefficient of the EWMA is adaptively set according to the stability of the flotation conditions: the standard deviation of the initial thickness value within a short time window is used as a proxy indicator of the stability of the operating conditions. When the standard deviation is below the lower stability limit, λ is appropriately reduced to make the output more stable; when it exceeds the upper stability limit, λ is appropriately increased to make the output quickly track changes. The two stability thresholds and the corresponding λ adjustment range are calibrated during installation based on the typical fluctuation range of the actual operating conditions. The adjustment of λ follows a single-step gradual principle; each update only makes a small adjustment to λ instead of directly jumping to the target value, avoiding discontinuities in the EWMA output caused by sudden changes in λ.

[0096] like Figure 5 As shown, with the frame sequence during the period of fluctuating operating conditions as the horizontal axis, the processing effects of S5 physical constraint removal and EWMA filtering are illustrated. The scatter points in the figure represent the initial physical thickness values ​​of each frame output by S4, showing that factors such as bubble rupture introduce significant spikes at the single-frame level; the solid curve represents the real-time thickness output obtained after removing abnormal frames using S5 based on the upper limit of the single-frame liquid level change, followed by EWMA filtering; from... Figure 5 It is evident that the physical bounds effectively isolate spike noise that exceeds the reasonable range of variation. EWMA suppresses frame-level oscillations while preserving the true slow change trend, ensuring that the output curve meets the engineering stability requirements for flotation liquid level control.

[0097] For frames labeled with confidence level c, the effective smoothing coefficient in the EWMA recursion is adjusted from the original λ to the product of λ and the overall confidence level c of the current frame. The weight of the historical output value is correspondingly changed to 1 minus this product, and the sum of the two is kept to 1 to ensure the long-term stability of the EWMA recursion. When the overall confidence level approaches zero, the contribution of the current frame is compressed to near zero, and the output maintains the historical value without updating; when the overall confidence level equals 1, it degenerates into a standard EWMA normal response. The core intention of this design is that the effective smoothing coefficient of low-confidence frames is automatically compressed, which is equivalent to the system automatically and conservatively favoring historical values ​​during unreliable periods, rather than including low-quality measurement values ​​with normal weights in the update. Under the condition that the S3 confidence level is generally low (the interface is highly blurred and lasts for a long time), EWMA automatically degenerates into a mode that relies more on temporal historical values, and the output remains stable without violently jittering due to the frequent occurrence of low-quality frames.

[0098] Frames marked as S4 as window overflows are not included in the normal EWMA recursion for their lower bound estimates. The thickness of the overflow frame is an estimate of the upper limit of the visible range, not the actual measured value. Including it in the recursion would artificially skew the EWMA output. The handling is the same as for missing frames; the current frame's EWMA output remains unchanged from the previous timeframe. Window overflow frames are also not included in the 20-minute moving average calculation. Simultaneously, the system triggers a separate alarm for the foam layer exceeding the visible range, displayed separately from the ordinary over-limit alarm. This separate alarm has higher priority than the ordinary over-limit alarm, reminding operators to pay attention to abnormal liquid level height rather than simply excessive thickness, preventing operators from taking incorrect adjustment actions due to confusion between the two types of alarms.

[0099] While outputting real-time thickness, a fixed 20-minute sliding window is used to calculate the arithmetic mean of all real-time thickness values ​​within the window (excluding marked abnormal frames and frames with missing data), resulting in a 20-minute moving average thickness value, which is recorded as the data point for the trend curve. The trend curve, with time on the horizontal axis and the 20-minute average thickness on the vertical axis, is continuously updated on the touchscreen monitoring interface, providing operators with intuitive information for judging operating conditions. Each time an operator intervenes to adjust (adjusting the aeration volume or the opening of the liquid level control valve), the trend curve reflects the change in the 20-minute average thickness before and after the adjustment, helping the operator evaluate the adjustment effect and determine whether further intervention is needed. An over-limit warning is triggered when the real-time thickness value exceeds the operator's preset upper limit threshold or falls below the lower limit threshold. An operating condition fluctuation warning is triggered when the standard deviation of the real-time thickness value exceeds the preset fluctuation alarm threshold within a short time window, reminding the operator that the flotation conditions may be abnormal and the aeration system and reagent dosing need to be checked. The over-limit threshold and fluctuation alarm threshold are preset by the operator according to the mine's flotation process specifications and can be dynamically adjusted during actual operation based on concentrate grade and recovery rate feedback. All alarm information, along with real-time thickness values, is transmitted to the host computer monitoring system via industrial Ethernet, allowing operators to remotely monitor the system from the control room. This system works in conjunction with existing liquid level control valves to achieve quantitative closed-loop management of the flotation station.

[0100] In one embodiment of the present invention, an application example is provided, which was actually deployed and verified in a flotation station of a fluorite ore beneficiation plant. The slurry feed rate of the flotation cell is stable, but due to the diurnal fluctuations in the properties of the raw fluorite ore, the thickness of the froth layer varies significantly at different production periods. The flotation reagent on site is mainly pine oil, and the oil film accumulation rate on the inner wall of the acrylic is more obvious than that of general minerals, which is a typical condition for contamination of the observation window. In terms of system hardware configuration, a global shutter industrial camera is used to continuously acquire images at a fixed frame rate. The light source is an LED ring light source with a diffuse reflector. The computing hardware is an industrial-grade embedded industrial control computer, and the single frame processing time can stably meet the real-time requirements. During installation, based on the maximum flow rate of the flotation cell liquid level control valve, the effective cross-sectional area of ​​the flotation cell, and the camera frame rate, the upper limit of the single frame change is calculated according to the process described in S5. The operator cooperates to verify the maximum rate adjustment, and after confirming that the threshold is reasonable, it is written into the configuration file.

[0101] The acrylic panel of the observation window was not manually cleaned after installation. The system ran continuously for several days, covering the complete contamination evolution process from clean window to light contamination, moderate contamination, and heavy contamination. During this period, it also experienced various production conditions such as increased reagent dosage, decreased aeration, and drastic fluctuations in operating conditions. The method for obtaining manual visual reference values ​​was as follows: at each recording moment, the operator observed the position of the slurry-foam interface and the top surface of the foam on the millimeter scale of the window frame through the side of the observation window, and read the actual physical distance between the two as the manual reference value. The reading process was independent of the system calculation to ensure the objectivity of the reference value.

[0102] like Figure 4 As shown, the time-series comparison results of thickness measurements over multiple days in the above application example are presented. The horizontal axis represents the running time, and the vertical axis represents the foam layer thickness. The vertical background partitions from left to right correspond to four stages: clean window, light contamination, moderate contamination, and heavy contamination. The thick solid line curve represents the reference value obtained by manual visual inspection, the thin solid line curve represents the output thickness after the present invention has undergone time-series decoupling in S2 and physical constraint filtering in S5, and the dashed line curve represents the control group measurement value obtained by directly performing S3 to S4 on the original image without S2 processing.

[0103] To compare and demonstrate the effectiveness of this method in eliminating pollution interference, the data from the control group mentioned above were recorded simultaneously. This control group data is only used for comparison and is not part of the normal processing flow of this method. Figure 4 It is evident that as the contamination level of the observation window increases, the output of the control group begins to show significant deviation in the moderate contamination stage, and the deviation further expands in the heavy contamination stage. The contamination layer artifact produces a grayscale response similar to a foam texture in the image without S2 processing, which is misjudged by S3-S4 as an increase in foam thickness. At the most severe time, the deviation reaches more than 1 times the actual thickness, which fully illustrates the fundamental limitation of image analysis without interference separation under the condition of heavy contamination window.

[0104] The thickness output by this method maintained good consistency with the manually observed reference value throughout the entire testing cycle, covering a variety of conditions from clean to heavily contaminated, and from normal flotation to drastic fluctuations in operating conditions. The deviation between the output thickness and the visually observed reference value was generally within a range comparable to the accuracy of manual visual inspection, meeting the engineering requirements for thickness measurement accuracy in flotation liquid level control. During periods of drastic fluctuations in operating conditions, the physical constraint threshold of S5 effectively intercepted the spike noise caused by bubble bursting (such as...). Figure 5 As shown in the figure, the confidence-adaptive EWMA automatically favors historical values ​​when the confidence level briefly drops in S3, and the output curve remains stable. This series of results verifies the effectiveness of this method in long-term stable detection under contaminated window conditions, and also verifies the robustness of the "physical constraint + confidence coupling" filtering mechanism under complex working conditions.

[0105] The embodiments of the present invention have been described above. However, the embodiments are not limited to the specific implementation methods described above. The specific implementation methods described above are merely illustrative and not restrictive. Those skilled in the art can make more equivalent embodiments under the guidance of the present embodiments, and all of them are within the protection scope of the present embodiments.

Claims

1. A machine vision-based method for detecting the thickness of a foam layer in flotation production, characterized in that, Includes the following steps: S1, continuously acquire image sequences from the observation window on the side wall of the slurry pool, and calculate the vertical conversion coefficient frame by frame through gradient detection and rectangular geometric constraints, using the known physical dimensions of the metal window frame as a reference, and output the verified image frame and the corresponding vertical conversion coefficient. S2, for the verified image frames, calculate the pollution state distance of each historical frame using the vertical stripes on the left and right inner sides of the window frame as reference areas, assign weighted median weights according to the pollution state distance to obtain the pollution layer estimation map and subtract it from each frame; on the decontaminated image, combine the interface dynamic protection zone to identify and repair droplet occlusion, and extract the effective foam feature map sequence. S3 divides the effective foam feature map sequence into vertical columns and calculates the density gradient profile independently in each column. After applying the transition band width correction to the gradient peak position, the gradient peak position is weighted and merged into the full-width interface coordinates. The corrected interface pixel row position, transition band width and comprehensive confidence are output. S4. On the effective foam feature map, the texture density is scanned row by row from top to bottom with the interface pixel row position as the search lower bound. The top surface position is determined by adaptive threshold and temporal median. The pixel row distance between the top surface and the interface is multiplied by the vertical conversion coefficient to obtain the initial physical thickness value with confidence label. S5, for the time-series signal composed of initial physical thickness values ​​with confidence labels, uses the upper limit of the single-frame liquid level change determined by the equipment physical parameters as the threshold to remove peak anomalies frame by frame, applies confidence-coupled exponential weighted moving average filtering to the remaining signal, and outputs the real-time thickness value and moving average trend curve.

2. The method for detecting the thickness of a flotation foam layer based on machine vision according to claim 1, characterized in that, The step S1, which calculates the vertical conversion coefficient frame-by-frame using gradient detection and rectangular geometric constraints, includes: The image is calculated by measuring the gray-level difference in the horizontal and vertical directions and taking the magnitude to obtain the edge intensity response of each pixel. Gradient response sets that satisfy the continuity and direction constraints are extracted along the four directions of the image. Candidate lines are fitted from the gradient response sets in each direction using the random sampling consensus algorithm. Apply rectangular geometric constraints to the four candidate lines, ensuring that opposite sides are parallel and of equal length and adjacent sides are perpendicular. If the detection of a certain side is discontinuous due to local contamination, the position of that side is inferred from the detection results of the other three sides. Calculate the global brightness mean of the image. If the global brightness mean is lower than the preset exposure lower limit, mark the frame as an unqualified exposure frame and do not pass it to the downstream steps.

3. The method for detecting the thickness of a flotation foam layer in flotation production based on machine vision according to claim 1, characterized in that, In step S2, the pollution state distance of each historical frame is calculated using the vertical strips on the left and right inner sides of the window frame as reference areas. The weighted median weight is assigned according to the pollution state distance, including: A frame buffer queue covering a preset time span is maintained to store historical image frames in a downsampling manner. At the same time, the average brightness values ​​of the left and right reference areas corresponding to the acquisition time are recorded for each historical frame. For each historical frame in the frame buffer queue, the absolute value of the difference between the average brightness value of the reference area recorded in the historical frame and the average brightness value of the reference area measured at the current time is used as the pollution state distance of the historical frame. Weights are assigned to each historical frame based on the distance to the contamination state. At each pixel position, the pixel brightness values ​​of each historical frame in the frame buffer queue are sorted in ascending order. The weights of each historical frame are accumulated along the sorting direction. The pixel brightness value corresponding to the first time the accumulated value reaches half of the total weight of all historical frames is used as the weighted median of the corresponding position. The weighted median of all pixel positions constitutes the contamination layer estimation map.

4. The method for detecting the thickness of the foam layer in flotation production based on machine vision according to claim 3, characterized in that, The specific method for assigning weights to each historical frame based on the distance of the pollution state is as follows: The weight calculation follows the Gaussian decay rule. The weight is at its maximum value when the distance between the polluted states is zero, and the weight decreases monotonically according to the Gaussian function as the distance between the polluted states increases. The scale parameter of Gaussian attenuation is determined through scene self-calibration. The system continuously records the brightness change of the reference area during the first complete cleaning cycle. The maximum change from the end of cleaning to the beginning of the next cleaning is divided by the preset attenuation scale factor as the scale parameter, so that the weight corresponding to the maximum change in the distance of the contaminated state is attenuated to close to zero.

5. The method for detecting the thickness of a flotation production foam layer based on machine vision according to claim 4, characterized in that, S2, which involves identifying and repairing droplet occlusion on the decontamination image using a dynamic interface protection zone, includes: On the decontamination image, frame difference analysis is performed within a preset continuous frame window to find newly appearing and then disappearing local bright spot regions within the window; the ratio of the area of ​​the local bright spot region to the area of ​​the minimum circumscribed circle is calculated as a roundness index, and local bright spot regions with roundness index exceeding a preset first threshold are selected as droplet occlusion candidates. A dynamic interface protection zone is established with the position of the interface pixel row obtained in the previous frame as the center and a preset multiple of the width of the transition band obtained in the previous frame as the vertical span. Droplet occlusion candidates within the dynamic interface protection zone are not processed, while droplet occlusion candidates outside the dynamic interface protection zone are filled and repaired using the average brightness of the corresponding pixels in the previous and next normal frames.

6. The method for detecting the thickness of a flotation foam layer in flotation production based on machine vision according to claim 1, characterized in that, In step S3, the effective foam feature map sequence is divided into vertical columns, and the density gradient profile is independently calculated within each column. The weighted merging of these columns into full-width interface coordinates includes: The effective horizontal range of each frame's effective bubble feature map is divided into a preset number of vertical segments; within each vertical segment, it is divided into a preset number of horizontal strips along the vertical direction; the mean of the absolute value of the gray level difference between adjacent pixels within each horizontal strip is calculated as the texture density index of the corresponding horizontal strip; the texture density indices of each horizontal strip are arranged from the bottom to the top of the image to obtain the vertical density profile curve of the corresponding vertical segment. For each column segment, the first difference of the longitudinal density profile curve is obtained along the longitudinal direction to obtain the density gradient sequence of the corresponding column segment; the ratio of the main peak amplitude of the density gradient sequence of each column segment to the sum of the main peak amplitudes of all column segments is used as the weight to perform weighted median merging on the corrected interface position of each column segment to obtain the full-width interface pixel row position.

7. The method for detecting the thickness of a flotation foam layer in flotation production based on machine vision according to claim 6, characterized in that, The step S3 involves applying a transition band width correction to the gradient peak position, including: Within each column segment, half of the maximum value of the density gradient sequence of the corresponding column segment is used as a reference threshold. The strip intervals in the density gradient sequence that continuously exceed the reference threshold are identified, and the vertical span of the strip interval is used as the width of the transition band of the corresponding column segment. Determine whether the difference between the maximum and the second largest value within the strip interval is less than the preset second threshold ratio of the maximum value. If so, determine that the corresponding column segment is a plateau shape, and take the center position of the strip interval as the gradient peak position of the corresponding column segment. Otherwise, the position of the maximum value is taken as the gradient peak position of the corresponding column segment; the gradient peak position is offset along the upper direction of the transition band of the corresponding column segment by a preset ratio of the width of the transition band of the corresponding column segment to obtain the corrected interface position of the corresponding column segment.

8. The method for detecting the thickness of a flotation foam layer in flotation production based on machine vision according to claim 1, characterized in that, The process of determining the top surface position using an adaptive threshold and the temporal median in S4 includes: The texture density index is calculated row by row from the top of the effective foam feature map, and the first row where the texture density index exceeds the texture initiation threshold is used as the coordinate of the top candidate row. Based on the pixel row position of the interface, the average texture density of a preset number of horizontal strips is taken upwards, and the average texture density of a preset number of horizontal strips is taken downwards. The corresponding sliding mean estimate is updated with a small step size. The texture activation threshold is updated in real time by taking the median value of the above two sliding mean estimates. The temporal median value of the top candidate row coordinates of a preset number of consecutive frames is taken as the top position of the current frame.

9. The method for detecting the thickness of a flotation production foam layer based on machine vision according to claim 8, characterized in that, The initial physical thickness value with confidence level annotation obtained in S4 further includes: The confidence level of the top surface is determined by the inter-frame deviation of the top surface position of a consecutive preset number of frames. The confidence level of the top surface decreases monotonically as the inter-frame deviation increases. The smaller value between the overall confidence level and the confidence level of the top surface is taken as the confidence level label of the initial physical thickness value of the current frame. When the texture density index of all regions above the pixel row position on the interface exceeds the texture activation threshold, the frame is marked as viewport overflow, and the thickness output of the frame is estimated by taking the product of the maximum visible height of the viewport and the vertical conversion coefficient.

10. The method for detecting the thickness of a flotation foam layer in flotation production based on machine vision according to claim 1, characterized in that, S5 specifically includes: The upper limit of the liquid level change in a single frame is obtained by dividing the maximum flow rate of the liquid level control valve by the effective cross-sectional area of ​​the flotation cell and then multiplying it by the time interval between camera frames. For time-series signals, if the difference in thickness values ​​between adjacent frames exceeds the upper limit of the liquid level change in a single frame, the frame is marked as an abnormal frame and is not used for the time being. Instead, the normal frame thickness values ​​at the start and end positions of the continuous abnormal frame segments are used for linear interpolation. Apply an exponentially weighted moving average filter to the remaining signal, and use the product of the base smoothing coefficient and the current frame thickness value plus 1 minus the product of the base smoothing coefficient and the smoothed output value of the previous time step as the smoothed output of the current time step; for frames with confidence labels, replace the base smoothing coefficient with the product of the base smoothing coefficient and the confidence label of the frame.