Color sensor signal processing method and system for anti-specular reflection interference

CN122943992APending Publication Date: 2026-10-20GUANGZHOU HEYI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

当镜面反光较强时,放大后的信号容易超过模数转换器的输入极限,导致信号被截断,即超出极限的光强差异被映射为同一数值,高亮区域的细节信息完全丢失

Benefits of technology

[0015]上述颜色传感器抗镜面反光干扰的信号处理方法、系统、计算机设备及存储介质,通过在一个多增益采集主周期内获取每个颜色通道在多个不同增益下的数字信号,能够使传感器信号覆盖更宽的光强动态范围,避免单一增益下因反光过强导致的信号饱和与信息丢失。在此基础上,基于信号幅值与预设的ADC饱和极限的比对结果剔除饱和失效信号,并根据有效信号幅值区间和增益优先级从剩余信号中筛选目标数字信号,能够从多档增益信号中自动选取最适宜用于后续颜色判定的未饱和有效信号,确保参与偏移量计算和颜色判定的信号未发生饱和失真,同时利用增益优先级保留尽可能高的信噪比。通过统计各增益档位下饱和失效信号的数量来确定反光等级并调取对应的反光修正系数,建立了“饱和数量→反光等级→修正系数”的确定性映射关系,使反光干扰强度的判定不依赖主观阈值或经验设定,具有明确的量化依据和可复现性。通过在目标数字信号对应的增益模式下获取未修正的稳态基础漫反射信号,以该信号与无反光标准基准信号的偏差为基础并利用反光修正系数进行量化计算得到镜面反光干扰偏移量,并最终从未修正的稳态基础漫反射信号中扣除该偏移量,能够将混叠在反射信号中的镜面反光干扰成分有效剥离,使最终输出的纯净漫反射信号仅表征物体表面漫反射所反映的真实颜色信息。由于各颜色通道的校正流程和校正参数完全独立,即使各通道对镜面反光的响应存在差异,也能够在各自通道内部独立完成反光干扰的精准校正,从而有效抑制非对称饱和导致的色调偏移,提升颜色传感器对光滑物体的检测准确性和一致性。

✦ 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 application relates to a signal processing method, system, computer device, and storage medium for resisting specular reflection interference in a color sensor. The method includes: acquiring N digital signals for each color channel at N different gains within a multi-gain acquisition master cycle; eliminating saturation failure signals based on a comparison of the amplitude of each digital signal with a preset ADC saturation limit, and selecting target digital signals from the remaining signals according to the effective signal amplitude range and gain priority; counting the number of saturation failure signals, determining the reflection level based on the number, and retrieving the corresponding reflection correction coefficient; calculating the specular reflection interference offset based on the reflection correction coefficient and a non-reflective standard reference signal; subtracting the offset from the target digital signals to obtain a pure diffuse reflection signal, and outputting a color determination result based on the pure diffuse reflection signals of all color channels. This application can effectively suppress specular reflection interference and accurately restore the true color of an object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of sensor detection, and in particular to a signal processing method, system, computer equipment, and storage medium for a color sensor to resist specular reflection interference. Background Technology

[0002] With the development of industrial automation and intelligent manufacturing, color sensors are widely used in product quality inspection, color recognition and sorting. During operation, the color sensor illuminates the surface of the object being measured by emitting a light source and receives the light reflected from the surface. The color information of the object is determined by processing and analyzing the reflected light signal.

[0003] However, when the surface of the object being measured is relatively smooth, specular reflection (i.e., reflection) occurs. In this case, the light received by the sensor not only includes diffuse reflection light that represents the true color of the object, but also direct reflection light from the light source. The intensity of this specular reflection light signal is often much higher than that of the diffuse reflection light signal, causing a sharp increase in the amplitude of the signal received by the sensor.

[0004] In traditional color sensor signal processing schemes, the amplification factor of the signal amplification circuit is fixed. When specular reflection is strong, the amplified signal can easily exceed the input limit of the analog-to-digital converter, causing signal truncation. That is, light intensity differences exceeding the limit are mapped to the same value, and detailed information in the bright areas is completely lost. More seriously, due to the differences in light response characteristics and amplifier gain of each color channel, specular reflection may cause some color channels to saturate first while others remain unsaturated. This results in the calculated RGB ratio deviating significantly from the true value, producing color distortion and hue shift. Summary of the Invention

[0005] Therefore, it is necessary to provide a signal processing method, system, computer equipment, and storage medium for a color sensor that can effectively suppress specular reflection interference and accurately restore the true color of an object, in order to address the above-mentioned technical problems.

[0006] In a first aspect, this application provides a signal processing method for a color sensor to resist specular reflection interference. The method includes: In a multi-gain acquisition master cycle, acquire N digital signals for each color channel at N different gains, where N is a positive integer greater than or equal to 2; Based on the comparison results between the amplitude of each digital signal and the preset ADC saturation limit, saturation failure signals whose amplitude reaches the ADC saturation limit are removed from the N digital signals, and target digital signals are selected from the remaining signals according to the effective signal amplitude range and gain priority. The number of saturation failure signals among the N digital signals is counted, the reflectivity level is determined based on the number, and the corresponding reflectivity correction coefficient is retrieved based on the reflectivity level. In the gain mode corresponding to the target digital signal, the uncorrected steady-state basic diffuse reflection signal is obtained, and the specular reflection interference offset is calculated based on the reflection correction coefficient and the non-reflective standard reference signal. The specular reflection interference offset is subtracted from the uncorrected steady-state basic diffuse reflection signal to obtain the pure diffuse reflection signal, and the color determination result is output based on the pure diffuse reflection signals of all the color channels.

[0007] In one embodiment, the step of removing saturation failure signals whose amplitudes reach the ADC saturation limit from the N digital signals based on the comparison results of the amplitudes of each of the digital signals with a preset ADC saturation limit, and filtering target digital signals from the remaining signals according to the effective signal amplitude range and gain priority, includes: The N digital signals are compared with the preset ADC saturation limit value, and the digital signals that are greater than or equal to the ADC saturation limit value are eliminated. The remaining digital signals are traversed in descending order of gain, and the first digital signal that falls into the effective signal amplitude range is locked as the target digital signal. The effective signal amplitude range is defined by a lower threshold and an upper threshold. When there is no digital signal falling within the effective signal amplitude range: If all N digital signals are saturation failure signals, then an abnormal reflection alarm signal will be output. Otherwise, if there is an unsaturated digital signal with an amplitude higher than the upper limit threshold and lower than the ADC saturation limit, the unsaturated digital signals are traversed in descending order of gain, and the digital signal with the amplitude closest to the upper limit threshold is selected as the target digital signal. If there is no unsaturated digital signal with an amplitude higher than the upper threshold and lower than the ADC saturation limit, then the amplitude of all unsaturated digital signals is lower than the lower threshold. The unsaturated digital signals are traversed in descending order of gain, and the digital signal with the largest amplitude is selected as the target digital signal.

[0008] In one embodiment, retrieving the corresponding reflectivity correction coefficient based on the reflectivity level includes: When the quantity is 0, the reflectivity correction factor is: ; When the quantity is 1, the reflectivity correction factor is: ; When the quantity is 2 or 3, the reflectivity correction factor is: ; When the quantity equals N, the reflectivity correction factor is: ; in, .

[0009] In one embodiment, in the gain mode corresponding to the target digital signal, an uncorrected steady-state base diffuse reflection signal is acquired, and the specular reflection interference offset is calculated based on the reflection correction coefficient and the non-reflective standard reference signal, including: Using a preset integration period as the observation window, a set of multi-point sampling sequences is continuously acquired under the gain mode corresponding to the target digital signal. Calculate the variance of the continuous sampled value sequence; Points in the continuous sampled value sequence whose inter-frame fluctuation difference is greater than a preset fluctuation difference threshold are removed as abrupt sampling points, and points in the continuous sampled value sequence whose inter-frame fluctuation difference is less than or equal to the fluctuation difference threshold are retained as steady-state sampling points. The average value of all the steady-state sampling points is calculated, and the average value is used as the uncorrected steady-state basic diffuse reflection signal. Obtain a non-reflective standard reference signal, and calculate the specular reflection interference offset based on the reflection correction coefficient and the uncorrected steady-state diffuse reflection signal.

[0010] In one embodiment, subtracting the specular reflection interference offset from the uncorrected steady-state basis diffuse reflection signal to obtain the pure diffuse reflection signal includes: Calculate the difference between the uncorrected steady-state basis diffuse reflection signal and the specular reflection interference offset, and define it as the offset difference. Obtain the diffuse reflection retention coefficient and calculate the product of the diffuse reflection retention coefficient and the offset difference to obtain the pure diffuse reflection signal.

[0011] In one embodiment, before outputting the color determination result based on the pure diffuse reflection signal, the method further includes: When the pure diffuse reflection signal falls within the effective signal amplitude range, the color determination result is directly output using the pure diffuse reflection signal. When the pure diffuse reflection signal is lower than the lower limit of the effective signal amplitude range, multi-frame sliding mean filtering is started on the color channel where the pure diffuse reflection signal is located, and the color determination result is output with the filtered signal. When the pure diffuse reflection signal reaches the saturation limit of the ADC, the pure diffuse reflection signal is discarded, and the color judgment result is output with the pre-stored factory standard reference color value, and a single frame data anomaly mark is output. In one embodiment, the multi-frame moving average filtering includes: Configure a filter buffer array of length W, where W is a positive integer greater than or equal to 3; Each newly acquired digital signal frame is used as a signal to be enqueued. Calculate the absolute inter-frame difference between the signal to be enqueued and the most recent historical data at the end of the filter buffer array; When the absolute difference between frames is less than or equal to the noise fluctuation threshold, the signal to be enqueued is written into the filter buffer array as a valid frame; when the absolute difference between frames is greater than the noise fluctuation threshold, the signal to be enqueued is discarded, and the filtered output value of the previous frame is used as the smoothed output value of the current frame. After the signal to be enqueued is written into the filter buffer array, if the filter buffer array is not full, the arithmetic mean of all valid frames already stored in the filter buffer array is taken as the smoothed output value; if the filter buffer array is full, the earliest frame data stored at the head of the filter buffer array is removed, the remaining data is shifted forward as a whole, the signal to be enqueued is written to the tail of the filter buffer array, and the arithmetic mean of all frame data in the filter buffer array is taken as the smoothed output value.

[0012] Secondly, this application also provides a signal processing system for a color sensor to resist specular reflection interference. The system includes: The multi-gain signal acquisition module is used to acquire N digital signals of each color channel under N different gains within a multi-gain acquisition main cycle, where N is a positive integer greater than or equal to 2; The target signal filtering module is used to remove saturation failure signals whose amplitude reaches the ADC saturation limit from the N digital signals based on the comparison results of the amplitude of each digital signal with the preset ADC saturation limit, and to filter target digital signals from the remaining signals according to the effective signal amplitude range and gain priority. The correction coefficient determination module is used to count the number of saturation failure signals among the N digital signals, determine the reflectivity level based on the number, and retrieve the corresponding reflectivity correction coefficient based on the reflectivity level. The reflective offset quantization module is used to obtain the uncorrected steady-state basic diffuse reflection signal in the gain mode corresponding to the target digital signal, and calculate the specular reflection interference offset based on the reflective correction coefficient and the non-reflective standard reference signal. The pure signal restoration module is used to subtract the specular reflection interference offset from the uncorrected steady-state basic diffuse reflection signal to obtain a pure diffuse reflection signal, and output a color determination result based on the pure diffuse reflection signals of all the color channels.

[0013] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the aforementioned signal processing method for resisting specular reflection interference in a color sensor.

[0014] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the aforementioned signal processing method for resisting specular reflection interference in a color sensor.

[0015] The aforementioned signal processing method, system, computer equipment, and storage medium for color sensors to resist specular reflection interference acquire digital signals for each color channel at multiple different gains within a single multi-gain acquisition master cycle. This allows the sensor signal to cover a wider dynamic range of light intensity, avoiding signal saturation and information loss caused by excessive reflection under a single gain. Based on this, saturation failure signals are eliminated by comparing the signal amplitude with a preset ADC saturation limit. Target digital signals are then selected from the remaining signals according to the effective signal amplitude range and gain priority. This automatically selects the most suitable unsaturated effective signal for subsequent color determination from multiple gain levels, ensuring that the signals involved in offset calculation and color determination do not experience saturation distortion. Simultaneously, gain priority is used to retain the highest possible signal-to-noise ratio. By statistically analyzing the number of saturation failure signals at each gain level to determine the reflection level and retrieving the corresponding reflection correction coefficient, a deterministic mapping relationship of "saturation quantity → reflection level → correction coefficient" is established. This ensures that the determination of reflection interference intensity does not rely on subjective thresholds or empirical settings, providing clear quantitative evidence and reproducibility. By acquiring the uncorrected steady-state diffuse reflection signal in the gain mode corresponding to the target digital signal, and using the deviation between this signal and the non-reflective standard reference signal as a basis, the specular reflection interference offset is calculated using a reflection correction coefficient. This offset is then subtracted from the uncorrected steady-state diffuse reflection signal, effectively removing the specular reflection interference component aliased in the reflection signal. This ensures that the final output pure diffuse reflection signal only represents the true color information reflected by the diffuse reflection of the object's surface. Since the correction process and parameters for each color channel are completely independent, even if the response to specular reflection differs among channels, accurate correction of reflection interference can be completed independently within each channel. This effectively suppresses hue shift caused by asymmetric saturation, improving the accuracy and consistency of the color sensor in detecting smooth objects. Attached Figure Description

[0016] Figure 1 This is an application environment diagram of a signal processing method for resisting specular reflection interference in a color sensor, as shown in one embodiment. Figure 2This is a flowchart illustrating a signal processing method for resisting specular reflection interference in a color sensor, as shown in one embodiment. Figure 3 This is a flowchart illustrating the process of filtering target digital signals in one embodiment; Figure 4 This is a block diagram of the signal processing system for resisting specular reflection interference in a color sensor, as shown in one embodiment. Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0018] The signal processing method for resisting specular reflection interference in color sensors provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the color sensor collects the light signal reflected from the surface of the object under test. Within a multi-gain acquisition cycle, the main controller acquires N digital signals for each color channel at N different gains. The main controller performs saturation failure signal removal and target signal filtering on the digital signals of each color channel. Based on the filtered target digital signals, it determines the corresponding gain mode and acquires the uncorrected steady-state diffuse reflection signal under this gain mode. Based on the uncorrected steady-state diffuse reflection signal and the reflection correction coefficient, it calculates the specular reflection interference offset. Then, it subtracts this offset from the uncorrected steady-state diffuse reflection signal to obtain the pure diffuse reflection signal for each color channel. Finally, it outputs the color judgment result based on the combined pure diffuse reflection signals of all color channels. The color detection system can be deployed independently or integrated into various terminal devices containing color recognition functions. These terminal devices can be, but are not limited to, industrial inspection equipment, intelligent color detectors, automated sorting equipment, or color recognition modules in smart home devices that integrate color sensing modules.

[0019] Firstly, in the actual operation of a color sensor, specularly reflected light and diffusely reflected light are superimposed and enter the sensor receiver. Since the intensity of specularly reflected light is much higher than that of diffusely reflected light, after being amplified by a fixed gain, it easily exceeds the input range of the analog-to-digital converter, leading to signal saturation and truncation. When signal saturation and truncation occur, the intensity difference exceeding the saturation limit is mapped to the same value, resulting in the complete loss of detail information in the bright areas. Furthermore, the asymmetric saturation of each channel also causes hue shift. Therefore, in one embodiment, such as... Figure 2 As shown, a signal processing method for resisting specular reflection interference in a color sensor is provided, which is then applied to... Figure 1Taking the color sensor in the image as an example, the explanation includes the following steps: S1: Acquire N digital signals for each color channel under N different gains within a multi-gain acquisition master cycle, where N is a positive integer greater than or equal to 2; S2: Based on the comparison results between the amplitude of each digital signal and the preset ADC saturation limit, remove saturation failure signals whose amplitude reaches the ADC saturation limit from N digital signals, and select target digital signals from the remaining signals according to the effective signal amplitude range and gain priority. S3: Count the number of saturation failure signals among N digital signals, determine the reflectivity level based on the number, and retrieve the corresponding reflectivity correction coefficient based on the reflectivity level; S4: In the gain mode corresponding to the target digital signal, obtain the uncorrected steady-state basic diffuse reflection signal, and calculate the specular reflection interference offset based on the reflection correction coefficient and the non-reflective standard reference signal. S5: Subtract the specular reflection interference offset from the uncorrected steady-state diffuse reflection signal to obtain the pure diffuse reflection signal, and output the color determination result based on the pure diffuse reflection signals of all color channels.

[0020] In the specific implementation, each gain level corresponds to a digital signal, which is the digital quantity output by the analog-to-digital converter. For N gain levels, the main controller acquires N digital signals sequentially within a multi-gain acquisition master cycle. The first digital signal corresponds to the highest gain, the Nth digital signal corresponds to the lowest gain, and the gain decreases progressively with each level. The specific value of N can be set according to the actual application scenario. For example, N equals 4, which corresponds to four gain levels. The multiple relationship between the gain levels can be proportionally increasing or non-proportionally distributed. In practical applications, as long as N different gain values ​​can be provided within the same multi-gain acquisition master cycle, this embodiment does not limit the specific multiple relationship of the gain. It should be noted that the multi-gain acquisition master cycle refers to the complete time window required to acquire all N digital signals under different gains. This master cycle is a different time concept from the integration period used when acquiring the uncorrected steady-state basic diffuse reflection signal. The integration period is a short observation window used to continuously sample the signal corresponding to the selected target digital signal in the gain mode to obtain a multi-point sampling sequence, and its duration is much shorter than the multi-gain acquisition master cycle.

[0021] When the main controller processes N digital signals, it sequentially performs operations such as filtering, statistics, and calculation. The data flow between each operation is as follows: first, the filtering operation determines the target digital signal; then, the statistics operation determines the reflectivity level and retrieves the correction coefficient; finally, the calculation operation obtains the uncorrected steady-state basic diffuse reflection signal in the gain mode corresponding to the target digital signal and calculates the offset.

[0022] Based on the above, by acquiring digital signals of each color channel at multiple different gains within a single multi-gain acquisition master cycle and performing saturation-based filtering, the sensor can adapt to specular reflection conditions of varying intensities, avoiding information loss and color distortion caused by signal saturation under a single gain. Simultaneously, by classifying the number of saturation failure signals, a reflection correction coefficient is determined to quantify the offset. Finally, the uncorrected steady-state diffuse reflection signal is acquired in the gain mode corresponding to the target digital signal. Interference components are then subtracted from this signal to restore the pure diffuse reflection signal, effectively suppressing the interference of specular reflection on color detection and improving the accuracy and consistency of the color sensor in detecting smooth objects.

[0023] When selecting a target signal from multiple gain signals, specific judgment criteria and selection logic are needed to ensure the accuracy and reliability of the target signal selection. Traditional methods typically rely solely on signal saturation for simple selection, lacking unified processing logic for situations where signals at different gain levels do not fall within the effective range. This results in an inability to adaptively select the optimal signal under extreme conditions such as near-saturation or weak signals, affecting the accuracy of subsequent color determination. Therefore, in one embodiment, based on the comparison between the amplitude of each digital signal and a preset ADC saturation limit, saturation failure signals whose amplitudes reach the ADC saturation limit are removed from N digital signals. Then, the target digital signal is selected from the remaining signals according to the effective signal amplitude range and gain priority, including: Compare each of the N digital signals with the preset ADC saturation limit value, and discard the digital signals that are greater than or equal to the ADC saturation limit value. The remaining digital signals are traversed in descending order of gain, and the first digital signal that falls into the effective signal amplitude range is locked as the target digital signal. The effective signal amplitude range is defined by the lower threshold and the upper threshold. When there is no digital signal falling within the effective signal amplitude range: If all N digital signals are saturation failure signals, then output a reflection abnormality alarm signal; Otherwise, if there is an unsaturated digital signal with an amplitude higher than the upper limit threshold but lower than the ADC saturation limit, then the unsaturated digital signals are traversed in order of gain from high to low, and the digital signal with the amplitude closest to the upper limit threshold is selected as the target digital signal. If there is no unsaturated digital signal with an amplitude higher than the upper threshold and lower than the ADC saturation limit, then the amplitude of all unsaturated digital signals is lower than the lower threshold. The unsaturated digital signals are traversed in descending order of gain, and the digital signal with the largest amplitude is selected as the target digital signal.

[0024] Specifically, the preset ADC saturation limit is a fixed value pre-stored in the main controller's non-volatile memory. This value physically represents the digital quantity corresponding to the largest input signal that the analog-to-digital converter (ADC) can correctly quantize. Taking a 12-bit ADC as an example, its digital output range is 0 to 4095. When the input signal amplitude exceeds the ADC's full-scale input range, the digital output is clamped at 4095, failing to reflect the actual amplitude of the excess portion; this is the saturation cutoff phenomenon. Therefore, the preset ADC saturation limit is set to 4095 in this example. When the ADC has other bit widths (e.g., a 10-bit ADC with an output range of 0 to 1023, or a 16-bit ADC with an output range of 0 to 65535), the preset ADC saturation limit is set accordingly to the corresponding maximum digital quantity.

[0025] In the process of comparing N digital signals with a preset ADC saturation limit, each digital signal is judged independently. If a digital signal is greater than or equal to the preset ADC saturation limit, it is marked as a saturation failure signal; if it is less than the preset ADC saturation limit, it is marked as an unsaturated valid signal. After all N digital signals have been compared, all the digital signals marked as unsaturated valid signals constitute the remaining set of digital signals.

[0026] When traversing the remaining digital signals in descending order of gain, since the gain values ​​for each level are known in advance, the main controller examines each remaining digital signal sequentially in descending order of gain value. For each signal examined, it is determined whether the signal's amplitude falls within the valid signal amplitude range. This valid signal amplitude range is defined by a lower threshold and an upper threshold. The lower threshold is the minimum amplitude required to ensure a sufficient signal-to-noise ratio, and the upper threshold is the maximum amplitude required to ensure the signal is within the linear operating range of the analog-to-digital converter. The first digital signal to fall within this range is identified as the target digital signal, and subsequent remaining signals are no longer examined.

[0027] When no digital signal falls within the effective signal amplitude range, it indicates that all unsaturated signals are outside the range. In this case, three scenarios are handled: First, if all N digital signals are saturated failure signals, it means that even at the lowest gain, the signal is still saturated, resulting in extremely high specular reflection intensity. The main controller outputs a reflection anomaly alarm signal. This alarm signal can be a preset encoded value used to notify the host computer that the current detection condition is outside the normal range. Second, if there are unsaturated digital signals with amplitudes higher than the upper threshold but lower than the ADC saturation limit, it indicates that the signal is near saturation. In this case, all unsaturated digital signals are iterated in descending order of gain, and the digital signal with the amplitude closest to the upper threshold is selected as the target digital signal. "Amplitude closest to the upper threshold" means calculating the absolute value of the difference between each unsaturated digital signal and the upper threshold, and selecting the digital signal with the smallest absolute value. In the third case, if there is no unsaturated digital signal with an amplitude higher than the upper threshold and lower than the ADC saturation limit, then the amplitude of all unsaturated digital signals is lower than the lower threshold, and the overall signal amplitude is weak. In this case, all unsaturated digital signals are traversed in order of gain from high to low, and the digital signal with the largest amplitude is selected as the target digital signal.

[0028] In this embodiment, by comparing N digital signals with preset ADC saturation limits to eliminate saturation failure signals, all signals entering the screening stage are valid signals that have not saturated. Then, the remaining signals are traversed in descending order of gain, and the first signal that falls within the valid signal amplitude range defined by the lower and upper thresholds is locked as the target signal. This ensures that the selected target signal has the highest possible signal-to-noise ratio (high gain priority) and is within the linear operating range of the analog-to-digital converter. When all signals do not fall within the valid range, a three-layer fallback logic is used to progressively process the signal: "alarm if fully saturated, take the closest upper threshold if near saturation, and take the signal with the largest amplitude if weak signal". This allows the method to adapt to different detection conditions with different reflectivity and surface reflectivity, ensuring the integrity and reliability of the target signal screening.

[0029] In the signal screening process, the lower and upper thresholds of the effective signal amplitude range directly determine which signals are considered "usable signals," and their calibration accuracy directly affects the accuracy of the screening results. In traditional methods, the determination of the lower and upper thresholds often relies on manual experience or fixed ratios, lacking a systematic calibration process corresponding to the actual sensor noise level and linear operating range. This leads to differences in thresholds between different devices, affecting the consistency of detection results. Therefore, in one embodiment, the calibration method for the lower and upper thresholds includes: Using a standard matte neutral color chart, the brightness of the light source is adjusted from low to high. A target ADC converter is used to perform analog-to-digital conversion on the reflected signal of the standard matte neutral color chart under the gradient light source to obtain multiple sets of noise-free digital signals. Gradually reduce the light source intensity, record the critical value at which the digital signal begins to exhibit random jumps, and raise the critical value by 5% as the lower limit threshold. Gradually increase the light source intensity and record the critical digital value at which the digital signal begins to show nonlinear deviation. Lower the critical digital value by 10% to 15% as the upper limit threshold.

[0030] Specifically, a standard matte neutral color chart is a standardized color chart with a diffuse reflection treatment. Its surface roughness is precisely controlled to ensure uniform diffuse reflection of incident light without specular reflection. A neutral color chart refers to a color chart with a neutral gray color and uniform reflectivity across the visible light spectrum. After placing the standard matte neutral color chart at the detection position of the color sensor, the illumination intensity of the light source is gradually increased starting from the lowest brightness. At each brightness gradient, a target ADC converter is used to perform analog-to-digital conversion on the reflected signal, acquiring multiple sets of digital signals. Because the color chart surface is matte, the acquired signals are all pure diffuse reflection signals, without specular reflection components. The lower threshold is a signal-to-noise ratio threshold defined based on the noise floor of the current device's ADC converter, while the upper threshold is determined based on the nonlinear inflection point of the current device's ADC converter. Since the nonlinear inflection points of different ADC converters are completely different, the linear offset critical point must be determined based on the analog-to-digital conversion results.

[0031] As the light source intensity is gradually reduced, when the intensity decreases to a certain level, the signal amplitude gradually approaches the noise floor of the ADC converter. The digital signal begins to exhibit significant random jumps, meaning that under the same light source brightness conditions, irregular numerical fluctuations appear between consecutively acquired digital signals. The method for determining these random jumps is as follows: Multiple sets of digital signals are acquired at each brightness gradient, and the standard deviation of these signals is calculated. When the standard deviation exceeds a preset noise tolerance threshold, the signal is considered to have begun to exhibit random jumps, and the corresponding digital signal value is recorded as a critical value. This critical value is multiplied by 1.05 (with a 5% upward adjustment) to obtain the lower threshold. The 5% upward adjustment is to provide sufficient noise margin for the signal, preventing the valid signal from being mistakenly identified as noise and rejected during normal detection.

[0032] As the light source intensity is gradually increased, when the intensity reaches a certain level, the analog-to-digital converter's response transitions from the linear region to the nonlinear region. The growth of the digital signal is no longer linearly proportional to the light intensity, and signal distortion begins to intensify. The digital signal value at the moment when nonlinear shift begins is recorded as the critical digital value. This critical digital value is multiplied by 0.85 to 0.90 (with a 10% to 15% margin) to determine the upper limit threshold. The purpose of this 10% to 15% margin is to provide a safety margin for the signal, preventing distortion caused by reflection fluctuations during detection that could lead to the signal entering the nonlinear region. The specific margin can be selected within this range based on the actual application scenario. For scenarios with significant reflection fluctuations, a larger margin (e.g., 15%) can be chosen to obtain a greater safety margin.

[0033] The above calibration process is performed once before shipment. After calibration, the lower and upper threshold values ​​are stored in the non-volatile memory of the main controller and can be directly retrieved during actual testing without repeated calibration. In this embodiment, by using a standard matte neutral color chart to adjust the light source brightness from low to high and using a target ADC converter to perform analog-to-digital conversion on the reflected signal to acquire multiple sets of noise-free digital signals, the calibration process is performed under conditions that exclude specular reflection interference, ensuring the purity and repeatability of the calibration reference. By gradually reducing the light source intensity and recording the critical value at which the digital signal begins to exhibit random jumps, the critical value is raised by 5% as the lower threshold value, ensuring that the lower threshold value accurately corresponds to the background noise boundary of the ADC converter and leaves a noise margin. By gradually increasing the light source intensity and recording the critical digital value at which the digital signal begins to exhibit nonlinear shifts, the critical digital value is lowered by 10% to 15% as the upper threshold value, ensuring that the upper threshold value accurately corresponds to the nonlinear boundary of the analog-to-digital converter and leaves a reflective fluctuation margin. Thus, the calibration of the effective signal amplitude range has a clear quantitative basis, physical meaning, and repeatability.

[0034] When counting the number of saturation failure signals, if all N digital signals need to be re-traversed and compared with the preset saturation limit value each time, it will increase the computational overhead and processing time of the main controller. Especially in high-speed continuous detection scenarios, repeated comparison operations will reduce the real-time performance of signal processing. To address this, in one embodiment, the method further includes: setting an M-bit saturation flag register, where M equals N, and each bit of the saturation flag register corresponds one-to-one with a digital signal; when the digital signal is greater than or equal to the ADC saturation limit value, the corresponding saturation flag is set to a first logic value; when the digital signal is less than the ADC saturation limit value, the corresponding saturation flag is set to a second logic value; and the number of saturation failure signals is counted by reading the M-bit saturation flag register.

[0035] Specifically, M equals N, meaning the number of bits in the saturation flag register is equal to the number of amplification modes. Each bit in the saturation flag register corresponds one-to-one with a digital signal at a gain level: the first bit corresponds to the digital signal at the first gain level (highest gain), the second bit corresponds to the digital signal at the second gain level, and so on, with the Mth bit corresponding to the digital signal at the Mth gain level (lowest gain). This correspondence is determined during system initialization and remains fixed.

[0036] After each digital signal is compared with the preset ADC saturation limit, the main controller immediately updates the corresponding saturation flag bit based on the comparison result. If the digital signal is greater than or equal to the preset ADC saturation limit, the corresponding saturation flag bit is set to the first logic value (e.g., logic "1", indicating that the signal is a saturation failure signal); if the digital signal is less than the preset ADC saturation limit, the corresponding saturation flag bit is set to the second logic value (e.g., logic "0", indicating that the signal is an unsaturated valid signal). The first and second logic values ​​are two mutually exclusive logic states. In practical applications, the opposite assignment method can also be used, as long as the saturation and unsaturation states can be clearly distinguished.

[0037] When it is necessary to count the number of saturation failure signals, the main controller directly reads the value of the entire M-bit saturation flag register and counts the flag bits that are the first logic value (i.e., logic "1"). The count value is the total number of saturation failure signals. Since the flag bit update is performed immediately after each digital signal is compared with the ADC saturation limit value, the complete saturation state information of all digital signals in the current acquisition cycle is obtained when reading the register.

[0038] In this embodiment, by setting an M-bit saturation flag register and assigning each bit to a digital signal, the comparison result is immediately stored in the corresponding flag bit in the form of a first logic value or a second logic value after the digital signal is compared with the preset ADC saturation limit value. This allows the recording of the saturation state and the comparison process to be completed synchronously. By directly reading the M-bit saturation flag register and counting the number of first logic values, the number of saturation failure signals is counted, avoiding the need to repeatedly compare all digital signals again. This reduces the computational overhead of the main controller and improves the real-time performance and efficiency of signal processing.

[0039] When retrieving the reflection correction coefficient based on the reflection level, it is necessary to establish a quantitative mapping relationship between the number of saturation failure signals and the reflection correction coefficient. Traditional methods often rely on subjective experience or a single threshold to determine the reflection level, lacking a systematic grading standard associated with the saturation state of multiple gain signals. Therefore, in one embodiment, retrieving the corresponding reflection correction coefficient based on the reflection level includes: When the quantity is 0, the reflection correction factor is: ; When the quantity is 1, the reflection correction factor is: ; When the quantity is 2 or 3, the reflection correction factor is: ; When the quantity equals N, the reflection correction factor is: ; in, .

[0040] Specifically, after the main controller counts the number of saturation failure signals, it retrieves the corresponding reflection correction coefficient from a pre-stored correction coefficient table based on the different values ​​of this number. When the number of saturation failure signals is 0, the digital signals at all gain levels are not saturated, the specular reflection intensity is the weakest or there is no specular reflection, and in this case, the minimum reflection correction coefficient is retrieved. When the number of saturation failure signals is 1, only the highest gain setting is saturated while other gain settings are not saturated, indicating that there is a certain degree of specular reflection, but the intensity is limited. In this case, the second smallest reflection correction coefficient is used. When the number of saturation failure signals is 2 or 3, multiple gain levels become saturated, resulting in significant specular reflection interference and a large signal offset. In this case, a larger reflection correction coefficient should be applied. When the number of saturation failure signals equals N, all gain levels become saturated. Even at the lowest gain, the signal still overflows, resulting in extremely high specular reflection intensity. At this point, the maximum reflection correction factor should be selected. .

[0041] All four reflectivity correction factors are positive numbers less than 1, and they monotonically increase with the increase of reflectivity level (the number of saturation failure signals increases). The specific values ​​of all correction factors are determined by standard reflectivity sample testing during the factory calibration stage and are permanently stored in the non-volatile memory of the main controller.

[0042] In this embodiment, the number of saturation failure signals among N digital signals is statistically analyzed and used as a quantitative indicator of reflectivity. A higher number indicates more gain levels are saturated, resulting in stronger specular reflection. By establishing a definite mapping relationship of "number of saturation failure signals → reflectivity level → reflectivity correction coefficient," the retrieval of the reflectivity correction coefficient has a clear quantitative basis, and the four coefficients satisfy... It is monotonically positively correlated with reflectivity intensity, ensuring the objectivity, repeatability, and solidifiable logical structure of reflectivity classification and correction coefficient retrieval.

[0043] When calculating the specular reflection interference offset, a preset integration period is used as the observation window. Under the gain mode corresponding to the target digital signal, the uncorrected steady-state basic diffuse reflection signal is obtained, and the specular reflection interference offset is calculated based on the reflection correction coefficient and the non-reflective standard reference signal. Specifically, in one embodiment, under the gain mode corresponding to the target digital signal, obtaining the uncorrected steady-state basic diffuse reflection signal and calculating the specular reflection interference offset based on the reflection correction coefficient and the non-reflective standard reference signal includes: Using a preset integration period as the observation window, a set of multi-point sampling sequences is continuously acquired under the gain mode corresponding to the target digital signal. Calculate the variance of a continuous sequence of sampled values; Points in the continuous sampled value sequence whose inter-frame fluctuation difference is greater than a preset fluctuation difference threshold are removed as abrupt sampling points, and points in the continuous sampled value sequence whose inter-frame fluctuation difference is less than or equal to the fluctuation difference threshold are retained as steady-state sampling points. The average value of all steady-state sampling points is calculated and used as the uncorrected steady-state basic diffuse reflection signal. Obtain the non-reflective standard reference signal, and calculate the specular reflection interference offset based on the reflection correction coefficient and the uncorrected steady-state diffuse reflection signal.

[0044] Specifically, the integration period is a short observation window used to continuously sample the signal in the gain mode corresponding to the selected target digital signal to obtain a multi-point sampling sequence. Its duration is much shorter than the main multi-gain acquisition period. After the main controller selects the target digital signal, it obtains the gain mode information corresponding to the target digital signal, and then uses the preset integration period as the observation window to continuously acquire a set of multi-point sampling sequences in this gain mode, thus obtaining a continuous sample value sequence.

[0045] The main controller calculates the variance of the continuous sampled value sequence. Variance is a statistical measure of the dispersion of a set of data. It is calculated as follows: first, the arithmetic mean of the sampled value sequence is calculated; then, the square of the difference between each sampled value and the mean is calculated; finally, all squared differences are summed and divided by the number of samples. A larger variance indicates more drastic fluctuations in the signal within the integration period; a smaller variance indicates a more stable signal.

[0046] The main controller also removes points in the continuous sampled value sequence where the inter-frame fluctuation difference is greater than a preset fluctuation difference threshold as abrupt sampling points. The inter-frame fluctuation difference refers to the absolute value of the difference between two adjacent sampling points. The fluctuation difference threshold is a preset positive number used to distinguish between abrupt and steady-state sampling points. When the inter-frame fluctuation difference between two adjacent sampling points is greater than the fluctuation difference threshold, it indicates the presence of non-steady-state components (possibly affected by pulse interference) in these sampling points, and they are removed. Points in the continuous sampled value sequence where the inter-frame fluctuation difference is less than or equal to the fluctuation difference threshold are retained as steady-state sampling points, and the average value of all steady-state sampling points is calculated. This average value is used as the uncorrected steady-state baseline diffuse reflection signal. .

[0047] The main controller acquires a non-reflective standard reference signal. (This value is a baseline value collected and stored using a standard matte color chart under conditions of no specular reflection during factory calibration), based on the reflection correction factor. and the uncorrected steady-state basis diffuse reflection signal According to the formula Calculate the offset of specular reflection interference In this formula, This represents the deviation of the currently measured uncorrected steady-state baseline diffuse reflection signal from a non-reflective reference value, which includes spurious increments introduced by specular reflection; this deviation is multiplied by a reflection correction factor. Then, the quantized value of the specular reflection interference offset is obtained. When the calculated value is... When less than 0, force to Set to 0 to avoid overcorrection caused by negative offsets due to noise.

[0048] In this embodiment, by continuously acquiring multi-point sampling sequences in the gain mode corresponding to the target digital signal with a preset integration period as the observation window, the sampling data can reflect the fluctuation characteristics of the signal within a short time window. The variance is calculated to quantify the degree of signal fluctuation, providing a basis for the identification of subsequent abrupt sampling points. By removing abrupt sampling points where the inter-frame fluctuation difference is greater than the fluctuation difference threshold and retaining steady-state sampling points, the stable diffuse reflection component is separated from the mixed signal. The average value of all steady-state sampling points is calculated as the uncorrected steady-state basic diffuse reflection signal, giving the signal a clear physical meaning and mathematical definition. The specular reflection interference offset is quantified by multiplying the difference between this signal and the non-reflective standard reference signal by a reflection correction coefficient, giving the offset calculation a clear mathematical expression. The larger the difference between the uncorrected steady-state basic diffuse reflection signal and the ideal reference value, the stronger the specular reflection. By using boundary processing that forces the offset to 0 when it is less than 0, overcorrection caused by negative offset due to noise is avoided.

[0049] When subtracting specular reflection interference offset from an uncorrected steady-state diffuse reflection signal to obtain a pure diffuse reflection signal, an appropriate coefficient needs to be introduced to compensate for the inherent losses in the signal link. If the signal after offset subtraction is directly used as the final result, the signal amplitude will be lower than the ideal value due to amplitude attenuation during optical path transmission and circuit amplification. Therefore, in one embodiment, subtracting specular reflection interference offset from an uncorrected steady-state diffuse reflection signal to obtain a pure diffuse reflection signal includes: Calculate the difference between the uncorrected steady-state basis diffuse reflection signal and the specular reflection interference offset, and define it as the offset difference. Obtain the diffuse reflection retention coefficient and calculate the product of the diffuse reflection retention coefficient and the offset difference to obtain the pure diffuse reflection signal.

[0050] Specifically, the main controller calculates the uncorrected steady-state basis diffuse reflection signal. The difference between the offset ΔD and the specular reflection interference (i.e. This difference represents the intermediate value obtained by subtracting the specular reflection interference offset from the basic diffuse reflection signal, which has removed the spurious increments introduced by specular reflection.

[0051] The main controller obtains the diffuse reflection retention coefficient. Calculate the product of the diffuse reflection retention coefficient and the difference in offset, according to the formula. Obtain pure diffuse reflection signal Diffuse reflection retention coefficient It is a positive number less than 1, used to compensate for inherent losses in the signal link, restoring the signal after deducting the offset to an amplitude level comparable to the standard reference signal. The value of is in the range of 0.85 to 0.95. This range is an empirical range obtained through experimental calibration. Values ​​within this range can effectively compensate for link loss without introducing new deviations. The specific values ​​are determined and stored during factory calibration and used directly as fixed parameters in actual testing.

[0052] In this embodiment, by calculating the difference between the uncorrected steady-state diffuse reflection signal and the offset, and then compensating for the difference using a diffuse reflection retention coefficient, the restored pure diffuse reflection signal can accurately reflect the true diffuse reflection intensity of the object's surface; by first using... minus To eliminate the false increments introduced by specular reflection, multiply by To compensate for the inherent loss of the signal link, the two correction steps are made independent of each other and have a clear sequence, thus ensuring the integrity and accuracy of the pure diffuse reflection signal reconstruction.

[0053] Diffuse reflection retention coefficient It is a key parameter in the process of restoring pure diffuse reflection signals, and its value directly affects the final color determination accuracy. In traditional methods, The values ​​of η largely rely on empirical estimations or theoretical calculations, lacking a systematic calibration process corresponding to the actual signal link characteristics, resulting in significant dispersion of η values ​​between different devices. Therefore, in one embodiment, the calibration method for the diffuse reflection retention coefficient η includes: Place the matte standard color chart, adjust it to a state without specular reflection, and collect the steady-state baseline signal. ; In the absence of specular reflection, the offset of specular reflection interference. A pure diffuse reflection signal is equal to a non-reflective standard reference signal. ; according to Derivation ; It is an ideal value, an ideal value under ideal no-reflection conditions; however, in reality, reflection still exists, therefore the steady-state fundamental signal... It contains a small amount of stray light and a weak residual reflection; therefore Greater than The correction formula is as follows: Matte finish with no specular reflection: but: The correction result must be strictly equal to the standard reference. By combining the results, we obtain: Deformation solution coefficients: To further eliminate random noise, multiple frames of steady-state fundamental signals can be continuously acquired. Calculate the average value Then substitute the above formula to calculate. In obtaining the theory Afterwards, a small safety margin can be added based on cross-validation under all operating conditions. It can take a fixed value within a certain range, but will not exceed that range.

[0054] Specifically, the color sensor is aligned with a matte standard color chart, and the angle and position between the sensor and the chart are adjusted to ensure that all light received by the sensor comes from diffuse reflection from the surface of the color chart without any specular reflection. In this specular-free state, the main controller acquires signals according to the normal detection procedure to obtain a steady-state baseline signal. It should be noted that, This is the ideal reference value under ideal, reflection-free conditions, while the actual steady-state baseline signal acquired... It will still contain trace amounts of stray light and weak residual reflections, therefore Usually greater than .

[0055] In this embodiment, by placing a matte standard color chart and adjusting it to a state without specular reflection, a steady-state baseline signal is acquired under the reference condition of eliminating specular reflection interference, so that the calibration process is carried out in a pure diffuse reflection environment; by utilizing the constraint relationship in the state without specular reflection, the following is derived: The consensus on the standardization makes The calibration has a clear physical meaning; it is calculated by continuously acquiring multiple frames of steady-state basic signals, taking the average value, and then... This eliminates the influence of random noise in a single sampling, ensuring... Stability and repeatability of calibration values.

[0056] The value of the reflection correction factor directly affects the calculation accuracy of the specular reflection interference offset. In traditional methods, the correction factors corresponding to different reflection levels are mostly set empirically, lacking quantitative calibration basis corresponding to actual reflection sample measurement data, resulting in inaccurate correction factor values ​​and insufficient consistency between different devices. Therefore, in one embodiment, the calibration method for the reflection correction factor includes: For each reflectivity level, a gradient reflectivity sample corresponding to the reflectivity level is placed, and the number of multiple sets of basic diffuse reflection signals and saturation failure signals are continuously collected under the same light source brightness and the same color chart conditions. Under the condition that no reflective standard reference signal is known, according to Inverse calculation to find the reflection correction factor corresponding to this reflection level .

[0057] Specifically, the gradient reflectivity template is a set of standard templates with different surface smoothness and varying specular reflectivity. In this embodiment, the four reflectivity levels correspond to four gradient reflectivity templates: the first level corresponds to the weak reflectivity template, which has a relatively large surface roughness and the lowest specular reflectivity; the fourth level corresponds to the extremely strong reflectivity template, which has a mirror-like surface and the highest specular reflectivity.

[0058] After placing a sample of a certain reflectivity level at the detection position of the color sensor, and maintaining a constant light source brightness, multiple data acquisitions are performed continuously according to the normal detection procedure. During each acquisition, the main controller acquires N digital signals at different gains and records the basic diffuse reflection signal. The value of the data was calculated, and the number of saturation failure signals was counted. The average of all collected results was taken to eliminate the influence of random noise.

[0059] For each reflectivity level of the sample, its actual specular reflection interference offset. It can be obtained through independent measurement (for example, first measuring the signal value in the non-reflective state, then measuring the signal value in the reflective state, and the difference between the two is the signal value). ). (The known) and measurements and pre-stored Substitute into the formula This allows you to calculate the reflection correction factor corresponding to the reflection level. Perform the above calibration process on each of the four reflection levels to obtain the results. , , , Four correction factor values. After calibration, all reflectivity correction factors are permanently stored in the non-volatile memory of the main controller.

[0060] In this embodiment, by placing gradient reflectance samples corresponding to each reflectance level, the calibration process covers all actual working conditions from weak to extremely strong reflectance. By continuously collecting multiple sets of basic diffuse reflection signals and saturation failure signals under the same light source brightness and color chart conditions, the calibration data is acquired under identical external conditions, eliminating interference from light source fluctuations and color chart differences. Furthermore, by using a standard reflectance reference signal without prior knowledge, the calibration data is based on… By inversely solving for the correction coefficients corresponding to each reflectivity level, the calibration of Kc has a clear mathematical basis, i.e., the true offset is known. and measured values Kc is then calculated in reverse, thus ensuring the physical meaning and quantitative accuracy of the reflectivity correction coefficients at each level.

[0061] Before outputting the color determination result based on the pure diffuse reflection signal, the validity of the signal needs to be verified. The reliability and applicable processing methods differ depending on the signal's amplitude range. A normal signal can be output directly, a weak signal requires filtering and noise reduction, and a saturated signal needs to be discarded and a backup value activated. Traditional methods often employ a uniform processing logic, failing to adopt differentiated processing strategies for different signal quality conditions, thus affecting the reliability of the output result. Therefore, in one embodiment, before outputting the color determination result based on the pure diffuse reflection signal, the following steps are also included: When the pure diffuse reflection signal falls within the effective signal amplitude range, the color determination result is directly output based on the pure diffuse reflection signal. When the pure diffuse reflection signal is lower than the lower limit of the effective signal amplitude range, multi-frame sliding mean filtering is started on the color channel where the pure diffuse reflection signal is located, and the color judgment result is output with the filtered signal. When the pure diffuse reflection signal reaches the saturation limit, the pure diffuse reflection signal is discarded, and the color judgment result is output with the pre-stored factory standard reference color value, and a single frame data anomaly mark is output.

[0062] The multi-frame moving average filtering includes: Configure a filter buffer array of length W, where W is a positive integer greater than or equal to 3; Each newly acquired digital signal frame is used as a signal to be enqueued. Calculate the absolute inter-frame difference between the signal to be enqueued and the most recent frame of historical data at the end of the filter buffer array; When the absolute difference between frames is less than or equal to the noise fluctuation threshold, the signal to be enqueued is written into the filter buffer array as a valid frame; when the absolute difference between frames is greater than the noise fluctuation threshold, the signal to be enqueued is discarded, and the filtered output value of the previous frame is used as the smoothed output value of the current frame. After the signal to be enqueued is written into the filter buffer array, if the filter buffer array is not full, the arithmetic mean of all valid frames already stored in the filter buffer array is taken as the smoothed output value; if the filter buffer array is full, the earliest frame data stored at the head of the filter buffer array is removed, the remaining data is shifted forward as a whole, the signal to be enqueued is written to the tail of the filter buffer array, and the arithmetic mean of all frame data in the filter buffer array is taken as the smoothed output value.

[0063] Specifically, before outputting the color determination result, the main controller first processes the pure diffuse reflection signal. Perform boundary checks. When When it falls within the effective signal amplitude range (i.e. This indicates that the signal has both a sufficient signal-to-noise ratio and is within the linear operating range of the analog-to-digital converter, and the signal quality meets the requirements for direct output. The main controller directly outputs the signal. As the final color determination signal output. When When the amplitude is below the lower limit of the effective signal amplitude range (i.e. This indicates that the signal amplitude is too low, the signal-to-noise ratio is insufficient, and single-frame data is easily affected by random noise, causing fluctuations. In this case, the main controller initiates multi-frame sliding mean filtering on the color channel containing the pure diffuse reflection signal, replacing the original single-frame signal with the filtered signal for output. When the saturation limit is reached (i.e.) This indicates that the corrected signal is still in a saturated state, which may be due to the failure of correction caused by extreme reflection or other abnormal conditions. At this time, the main controller abandons the calculation result of the current frame and uses the standard reference color value stored in the factory as the output to ensure that the device will not stop due to the lack of valid data. At the same time, it outputs a single frame data abnormality mark to prompt the host computer that there is an abnormality in the current frame data.

[0064] In multi-frame moving average filtering, the filter buffer array is a one-dimensional register array used to buffer W consecutive frames of valid digital signals. W is a positive integer greater than or equal to 3; in practical applications, W can take the value 5 or 7. After acquiring a new frame of digital signal in each detection cycle, this signal is prepared as a queue signal to enter the filter buffer array.

[0065] The main controller calculates the absolute difference between the signal to be enqueued and the most recent historical data frame at the end of the filter buffer array. This absolute difference refers to the absolute value of the difference between the value of the signal to be enqueued and the value of the last frame in the buffer array, i.e. ,in The value of the signal to be enqueued. This is the value of the most recent frame of historical data at the end of the filter cache array.

[0066] The noise fluctuation threshold is a pre-calibrated and stored fixed value, which physically represents the maximum allowable fluctuation amplitude of a normal signal between two adjacent frames. When the absolute difference between frames... When the noise fluctuation threshold is less than or equal to the current frame, it indicates that the change between the current frame and historical frames is within the normal range, the current frame is a valid signal, and the signal to be enqueued is written into the filter buffer array as a valid frame. When the value exceeds the noise fluctuation threshold, it indicates that an abnormal jump has occurred in the current frame, which may be caused by material shaking, instantaneous stray light or other interference. The signal to be enqueued is discarded, and the filtered output value of the previous frame is used as the smoothed output value of the current frame.

[0067] After the signal to be enqueued is written into the filter buffer array, the smoothed output value is calculated based on the array's fill status. When the filter buffer array is not full (i.e., the number of valid frames in the array is less than W), the arithmetic mean of all valid frames already stored in the filter buffer array is taken as the smoothed output value. When the filter buffer array is full (i.e., the number of valid frames in the array equals W), the earliest frame data stored at the beginning of the array is removed, the remaining data is shifted forward, and the signal to be enqueued is written to the end of the array, always ensuring that the array contains the most recent W frames of valid data. Then, the arithmetic mean of all W frames in the array is taken as the smoothed output value.

[0068] In this embodiment, by performing boundary verification on the pure diffuse reflection signal and triggering differentiated processing for three working conditions based on the verification results (i.e., direct output when the signal falls into the effective range to ensure real-time performance, multi-frame sliding average filtering to suppress noise when the signal is below the lower threshold, and outputting with a reference color value and marking anomalies when the signal reaches the saturation limit to ensure uninterrupted operation of the device), the output end has fault tolerance capability for various signal quality conditions. In multi-frame sliding average filtering, a filter buffer array is configured to buffer W consecutive effective signals, and abnormal jump frames are identified and discarded by comparing the absolute difference between frames with the noise fluctuation threshold, avoiding instantaneous interference from contaminating the filtering results. By averaging the stored frames when the buffer is not full and averaging the old frames after moving the new frames according to the sliding window mechanism when the buffer is full, the filter can output a smooth signal in both the initial startup stage and the normal operation stage, achieving effective noise reduction and effective suppression of abnormal jumps in weak signal scenarios.

[0069] Color sensors typically include three independent color channels: a red channel (R), a green channel (G), and a blue channel (B). In actual detection, due to the different reflectivities of red, green, and blue light from specular reflection (different wavelengths of light have different reflection characteristics on smooth surfaces), specular reflection may cause some channels to saturate prematurely while others remain unsaturated, resulting in asymmetric saturation. If the signals from the three channels are mixed or share the same set of correction parameters, it is impossible to effectively correct the varying degrees of reflection interference in each channel, leading to hue shifts (such as a purplish or bluish tint) in the synthesized RGB color data. Therefore, in one embodiment, the color sensor includes a red channel, a green channel, and a blue channel. Each step is performed independently for the red, green, and blue channels to obtain a pure diffuse reflection signal for the red channel. Green channel pure diffuse reflection signal and the pure diffuse reflection signal of the blue channel ,Will , and The synthesized RGB color data is compared with the preset standard color threshold range, and the color determination result is output.

[0070] Specifically, each color channel is equipped with an independent sensor element and signal processing link, and the three channels synchronously acquire the reflected light signal of the object under test. For the red channel, the main controller executes the aforementioned process, starting from the N digital signals of the red channel, and sequentially performs saturation failure signal removal, target signal screening, impulse interference judgment, steady-state component extraction, offset calculation, and pure signal restoration, finally obtaining the pure diffuse reflection signal of the red channel. Similarly, the green channel independently executes all steps to obtain... The blue channel executes all steps independently to obtain... .

[0071] The processing flow of the three channels is independent and does not interfere with each other. Each channel uses its own independently calibrated parameter set. For example, the red channel uses preset saturation limit values, effective signal amplitude ranges, and reflection correction coefficients specific to red channels, and the same applies to the green and blue channels. The parameter sets of the three channels are independently calibrated at the factory and stored in different address areas of the main controller's non-volatile memory.

[0072] After all three channels have completed their respective pure diffuse reflection signal calculations, the main controller will... , and Synthesize a complete RGB color data triplet Each component in this triplet has had specular reflection interference removed, representing only the diffuse reflection intensity of the corresponding color channel. The main controller compares this RGB data with preset standard color threshold ranges (e.g., preset red threshold range, green threshold range, etc.) to determine whether the color of the object under test falls within the target range, and finally outputs a judgment result of whether the color is qualified or unqualified.

[0073] In this embodiment, by independently performing all steps such as saturation failure signal removal, target signal screening, pulse interference determination, offset quantization, and clean signal restoration on the red, green, and blue channels respectively, the specular reflection interference of each channel is independently identified and corrected within that channel, and the channels do not interfere with each other; by obtaining the respective... , and The pure diffuse reflection signals from the three channels are synthesized into RGB color data, so that each component in the synthesized RGB triplet represents only the diffuse reflection intensity of the corresponding channel, thus eliminating the asymmetric interference components introduced by specular reflection in each channel. The color judgment result is output after comparison with the preset standard color threshold range, so that the final color judgment is based on the corrected asymmetric color bias data, thereby effectively solving the hue shift problem caused by the premature saturation of a single channel.

[0074] Because the photoelectric response characteristics and amplifier gain of the red, green, and blue channels differ, the interference from specular reflection on the three channels may also vary. The red channel may have the strongest response and saturate first, while the blue channel may have the weakest response and saturate later. If the three channels share the same set of reflection correction coefficients, accurate correction may not be possible for channels with significantly different response characteristics, leading to under-correction or over-correction of some channels. Therefore, in one embodiment, the red, green, and blue channels are each independently calibrated and stored with a set of reflection correction coefficients. Each set of reflection correction coefficients contains multiple reflection correction coefficient values ​​that correspond one-to-one with all reflection levels, and the number of coefficients in each set is the same as the total number of reflection levels.

[0075] Specifically, taking four reflectivity levels as an example, the red channel uses a separate reflectivity correction coefficient calibration method described above. It employs a dedicated sensor and signal link for the red channel to collect the number of basic diffuse reflection signals and saturation failure signals under each reflectivity sample level. These signals are then substituted into the formula to solve for a set of reflectivity correction coefficients for the red channel. ,in The red channel correction factor corresponding to the first level of reflectivity. The red channel correction factor corresponds to the second level of reflectivity, and so on. The green channel is calibrated independently using the same method to obtain a set of reflectivity correction factors for the green channel. The same calibration method was applied independently to the blue channel, resulting in a set of reflection correction coefficients for the blue channel. .

[0076] The three sets of correction coefficients are stored in different address areas of the main controller's non-volatile memory, each corresponding to a different memory address. Each set of correction coefficients contains the same number of coefficients as the total number of reflectivity levels, which is four. During actual testing, when processing the red channel signal, the main controller retrieves the correction coefficients from the red channel based on the number of saturation failure signals in the red channel. Retrieve the corresponding coefficient values ​​from the middle; the same applies to the green and blue channels.

[0077] In this embodiment, a set of reflection correction coefficients is independently calibrated for each of the red, green, and blue channels. This ensures that each channel's correction coefficient is determined based on its own signal link and response characteristics, without sharing coefficients. By storing each set of correction coefficients independently at different memory addresses, each channel can independently retrieve its corresponding correction coefficients during actual testing. Furthermore, by ensuring that the number of coefficients in each set is the same as the total number of reflection levels, it is guaranteed that each channel has corresponding correction coefficients available at different reflection levels. Through independent calibration and retrieval of the three channels, the correction of each channel at different reflection levels is based on its own response characteristics. This accurately compensates for the different levels of reflection interference caused by differences in photoelectric response between channels, avoiding under-correction or over-correction problems caused by shared coefficients.

[0078] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0079] Secondly, based on the same inventive concept, this application also provides a system for implementing the signal processing method for resisting specular reflection interference in a color sensor as described above. The solution provided by this system is similar to the solution described in the above method; therefore, the specific limitations in one or more system embodiments provided below can be found in the limitations of the signal processing method for resisting specular reflection interference in a color sensor described above, and will not be repeated here.

[0080] In one embodiment, such as Figure 4 As shown, the system includes: a multi-gain signal acquisition module, a target signal filtering module, a pulse interference determination module, a reflective offset quantization module, and a clean signal restoration module. Among them: The multi-gain signal acquisition module is used to acquire N digital signals of each color channel under N different gains within one multi-gain acquisition main cycle, where N is a positive integer greater than or equal to 2; The target signal filtering module is used to remove saturation failure signals whose amplitudes reach the ADC saturation limit from N digital signals based on the comparison results of the amplitude of each digital signal with the preset ADC saturation limit, and to filter target digital signals from the remaining signals according to the effective signal amplitude range and gain priority. The correction coefficient determination module is used to count the number of saturation failure signals among N digital signals, determine the reflectivity level based on the number, and retrieve the corresponding reflectivity correction coefficient based on the reflectivity level. The reflective offset quantization module is used to obtain the uncorrected steady-state basic diffuse reflection signal in the gain mode corresponding to the target digital signal, and calculate the specular reflection interference offset based on the reflective correction coefficient and the non-reflective standard reference signal. The pure signal restoration module is used to subtract the specular reflection interference offset from the uncorrected steady-state basic diffuse reflection signal to obtain the pure diffuse reflection signal, and output the color determination result based on the pure diffuse reflection signals of all color channels.

[0081] In one embodiment, the target signal filtering module includes a target signal filtering unit. This unit compares each of the N digital signals with a preset ADC saturation limit, discarding digital signals that are greater than or equal to the ADC saturation limit. The target signal filtering unit also iterates through the remaining digital signals in descending order of gain, locking the first digital signal falling within the effective signal amplitude range as the target digital signal. The effective signal amplitude range is defined by a lower threshold and an upper threshold. The target signal filtering unit also handles situations where no digital signal falls within the effective signal amplitude range: If all N digital signals are saturation failure signals, then output a reflection abnormality alarm signal; Otherwise, if there is an unsaturated digital signal with an amplitude higher than the upper limit threshold and lower than the ADC saturation limit, the unsaturated digital signals are traversed in order of gain from high to low, and the digital signal with the amplitude closest to the upper limit threshold is selected as the target digital signal. If there is no unsaturated digital signal with an amplitude higher than the upper threshold and lower than the ADC saturation limit, then the amplitude of all unsaturated digital signals is lower than the lower threshold. The unsaturated digital signals are traversed in descending order of gain, and the digital signal with the largest amplitude is selected as the target digital signal.

[0082] In one embodiment, the reflective offset quantization module includes a correction coefficient retrieval unit. The reflective offset quantization module is used to retrieve, when the quantity is 0, a correction coefficient retrieval unit. As a reflection correction factor; when the quantity is 1, retrieve As a reflection correction factor; when the quantity is 2 or 3, retrieve As a reflection correction factor; when the quantity equals N, retrieve As a reflection correction factor; where... .

[0083] In one embodiment, the reflective offset quantization module includes an offset quantization unit. The offset quantization unit continuously acquires a set of multi-point sampling sequences using a preset integration period as the observation window, under the condition of the gain mode corresponding to the target digital signal. The offset quantization unit calculates the variance of the continuous sampled value sequence. It also removes points in the continuous sampled value sequence where the inter-frame fluctuation difference is greater than a preset fluctuation difference threshold as abrupt sampling points, retains points where the inter-frame fluctuation difference is less than or equal to the fluctuation difference threshold as steady-state sampling points, and calculates the average value of all steady-state sampling points, using this average value as the uncorrected steady-state base diffuse reflection signal. Finally, the offset quantization unit acquires a non-reflective standard reference signal and calculates the specular reflection interference offset based on the reflective correction coefficient and the uncorrected steady-state base diffuse reflection signal.

[0084] In one embodiment, the clean signal restoration module includes a clean signal restoration unit. The clean signal restoration unit calculates the difference between the uncorrected steady-state base diffuse reflection signal and the specular reflection interference offset, defining it as the offset difference. The clean signal restoration unit also obtains the diffuse reflection retention coefficient and calculates the product of the diffuse reflection retention coefficient and the offset difference to obtain the clean diffuse reflection signal.

[0085] In one embodiment, the pure signal restoration module includes an output decision unit. This output decision unit is used to: 1) directly output the color determination result based on the pure diffuse reflection signal when the pure diffuse reflection signal falls within the effective signal amplitude range; 2) initiate multi-frame sliding average filtering on the color channel containing the pure diffuse reflection signal when the pure diffuse reflection signal is below the lower limit of the effective signal amplitude range, and output the color determination result based on the filtered signal; 3) discard the pure diffuse reflection signal when the pure diffuse reflection signal reaches the ADC saturation limit, output the color determination result based on the pre-stored factory standard reference color value, and output a single-frame data anomaly marker.

[0086] In addition, the output decision unit includes a sliding filter subunit. This subunit configures a filter buffer array of length W, where W is a positive integer greater than or equal to 3. The sliding filter subunit uses each newly acquired digital signal as the enqueue signal. It calculates the absolute difference between the enqueue signal and the most recent historical data at the end of the filter buffer array. When the absolute difference is less than or equal to a noise fluctuation threshold, the sliding filter subunit writes the enqueue signal as a valid frame into the filter buffer array; when the absolute difference is greater than the noise fluctuation threshold, it discards the enqueue signal and uses the filtered output value of the previous frame as the smoothed output value for the current frame. The sliding filter subunit is used to take the arithmetic mean of all valid frames stored in the filter buffer array as a smooth output value when the filter buffer array is not full after the signal to be enqueued is written into the filter buffer array; when the filter buffer array is full, the earliest frame data stored at the head of the filter buffer array is removed, the remaining data is shifted forward as a whole, the signal to be enqueued is written to the tail of the filter buffer array, and the arithmetic mean of all frame data in the filter buffer array is taken as a smooth output value.

[0087] The various modules in the aforementioned signal processing system for resisting specular reflection interference in the color sensor can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0088] In one embodiment, a computer device is provided, which may be a color recognition control unit in an industrial color sensor, an intelligent color detector, or an automated sorting device, and its internal structure diagram may be as follows: Figure 5As shown, the computer device includes a processor and a memory connected via a system bus. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. When the computer program is executed by the processor, it implements a signal processing method for resisting specular reflection interference in a color sensor, as provided in the above embodiments.

[0089] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0090] Thirdly, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the methods described in the above method embodiments.

[0091] Fourthly, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of any of the methods described in the above method embodiments.

[0092] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0093] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0094] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A signal processing method for a color sensor to resist specular reflection interference, characterized in that, The method includes: In a multi-gain acquisition master cycle, acquire N digital signals for each color channel at N different gains, where N is a positive integer greater than or equal to 2; Based on the comparison results between the amplitude of each digital signal and the preset ADC saturation limit, saturation failure signals whose amplitude reaches the ADC saturation limit are removed from the N digital signals, and target digital signals are selected from the remaining signals according to the effective signal amplitude range and gain priority. The number of saturation failure signals among the N digital signals is counted, the reflectivity level is determined based on the number, and the corresponding reflectivity correction coefficient is retrieved based on the reflectivity level. In the gain mode corresponding to the target digital signal, the uncorrected steady-state basic diffuse reflection signal is obtained, and the specular reflection interference offset is calculated based on the reflection correction coefficient and the non-reflective standard reference signal. The specular reflection interference offset is subtracted from the uncorrected steady-state basic diffuse reflection signal to obtain the pure diffuse reflection signal, and the color determination result is output based on the pure diffuse reflection signals of all the color channels.

2. The method according to claim 1, characterized in that, The process of comparing the amplitude of each digital signal with a preset ADC saturation limit, removing saturation failure signals whose amplitudes reach the ADC saturation limit from the N digital signals, and filtering target digital signals from the remaining signals according to the effective signal amplitude range and gain priority includes: The N digital signals are compared with the preset ADC saturation limit value, and the digital signals that are greater than or equal to the ADC saturation limit value are eliminated. The remaining digital signals are traversed in descending order of gain, and the first digital signal that falls into the effective signal amplitude range is locked as the target digital signal. The effective signal amplitude range is defined by a lower threshold and an upper threshold. When there is no digital signal falling within the effective signal amplitude range: If all N digital signals are saturation failure signals, then an abnormal reflection alarm signal will be output. Otherwise, if there is an unsaturated digital signal with an amplitude higher than the upper limit threshold and lower than the ADC saturation limit, the unsaturated digital signals are traversed in descending order of gain, and the digital signal with the amplitude closest to the upper limit threshold is selected as the target digital signal. If there is no unsaturated digital signal with an amplitude higher than the upper threshold and lower than the ADC saturation limit, then the amplitude of all unsaturated digital signals is lower than the lower threshold. The unsaturated digital signals are traversed in descending order of gain, and the digital signal with the largest amplitude is selected as the target digital signal.

3. The method according to claim 1, characterized in that, The step of retrieving the corresponding reflectivity correction coefficient based on the reflectivity level includes: When the quantity is 0, the reflectivity correction factor is: ; When the quantity is 1, the reflectivity correction factor is: ; When the quantity is 2 or 3, the reflectivity correction factor is: ; When the quantity equals N, the reflectivity correction factor is: ; in, .

4. The method according to claim 1, characterized in that, In the gain mode corresponding to the target digital signal, the uncorrected steady-state basic diffuse reflection signal is acquired, and the specular reflection interference offset is calculated based on the reflection correction coefficient and the non-reflective standard reference signal, including: Using a preset integration period as the observation window, a set of multi-point sampling sequences is continuously acquired under the gain mode corresponding to the target digital signal. Calculate the variance of the continuous sampled value sequence; Points in the continuous sampled value sequence whose inter-frame fluctuation difference is greater than a preset fluctuation difference threshold are removed as abrupt sampling points, and points in the continuous sampled value sequence whose inter-frame fluctuation difference is less than or equal to the fluctuation difference threshold are retained as steady-state sampling points. The average value of all the steady-state sampling points is calculated, and the average value is used as the uncorrected steady-state basic diffuse reflection signal. Obtain a non-reflective standard reference signal, and calculate the specular reflection interference offset based on the reflection correction coefficient and the uncorrected steady-state diffuse reflection signal.

5. The method according to claim 4, characterized in that, The step of subtracting the specular reflection interference offset from the uncorrected steady-state diffuse reflection signal to obtain the pure diffuse reflection signal includes: Calculate the difference between the uncorrected steady-state basis diffuse reflection signal and the specular reflection interference offset, and define it as the offset difference. Obtain the diffuse reflection retention coefficient and calculate the product of the diffuse reflection retention coefficient and the offset difference to obtain the pure diffuse reflection signal.

6. The method according to claim 1, characterized in that, Before outputting the color determination result based on the pure diffuse reflection signal, the method further includes: When the pure diffuse reflection signal falls within the effective signal amplitude range, the color determination result is directly output using the pure diffuse reflection signal. When the pure diffuse reflection signal is lower than the lower limit of the effective signal amplitude range, multi-frame sliding mean filtering is started on the color channel where the pure diffuse reflection signal is located, and the color determination result is output with the filtered signal. When the pure diffuse reflection signal reaches the saturation limit of the ADC, the pure diffuse reflection signal is discarded, and the color determination result is output with the pre-stored factory standard reference color value, and a single frame data anomaly mark is output.

7. The method according to claim 6, characterized in that, The multi-frame moving mean filtering includes: Configure a filter buffer array of length W, where W is a positive integer greater than or equal to 3; Each newly acquired digital signal frame is used as a signal to be enqueued. Calculate the absolute inter-frame difference between the signal to be enqueued and the most recent historical data at the end of the filter buffer array; When the absolute difference between frames is less than or equal to the noise fluctuation threshold, the signal to be enqueued is written into the filter buffer array as a valid frame; when the absolute difference between frames is greater than the noise fluctuation threshold, the signal to be enqueued is discarded, and the filtered output value of the previous frame is used as the smoothed output value of the current frame. After the signal to be enqueued is written into the filter buffer array, if the filter buffer array is not full, the arithmetic mean of all valid frames already stored in the filter buffer array is taken as the smoothed output value; if the filter buffer array is full, the earliest frame data stored at the head of the filter buffer array is removed, the remaining data is shifted forward as a whole, the signal to be enqueued is written to the tail of the filter buffer array, and the arithmetic mean of all frame data in the filter buffer array is taken as the smoothed output value.

8. A signal processing system for a color sensor to resist specular reflection interference, characterized in that, The system includes: The multi-gain signal acquisition module is used to acquire N digital signals of each color channel under N different gains within a multi-gain acquisition main cycle, where N is a positive integer greater than or equal to 2; The target signal filtering module is used to remove saturation failure signals whose amplitude reaches the ADC saturation limit from the N digital signals based on the comparison results of the amplitude of each digital signal with the preset ADC saturation limit, and to filter target digital signals from the remaining signals according to the effective signal amplitude range and gain priority. The correction coefficient determination module is used to count the number of saturation failure signals among the N digital signals, determine the reflectivity level based on the number, and retrieve the corresponding reflectivity correction coefficient based on the reflectivity level. The reflective offset quantization module is used to obtain the uncorrected steady-state basic diffuse reflection signal in the gain mode corresponding to the target digital signal, and calculate the specular reflection interference offset based on the reflective correction coefficient and the non-reflective standard reference signal. The pure signal restoration module is used to subtract the specular reflection interference offset from the uncorrected steady-state basic diffuse reflection signal to obtain a pure diffuse reflection signal, and output a color determination result based on the pure diffuse reflection signals of all the color channels.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the signal processing method for resisting specular reflection interference of the color sensor as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the signal processing method for resisting specular reflection interference of the color sensor as described in any one of claims 1 to 7.