Photoelectric detection method and system capable of resisting ambient light interference, medium and product

The Fourier transform recognizes the frequency characteristics of the ambient light and the inspected workpiece, and sets the bandpass filter parameters based on these characteristics, solving the accuracy and stability of photoelectric detection under ambient light interference, and achieving more efficient anti-interference ability.

CN120043560APending Publication Date: 2025-05-27SHENZHEN HUAYIFENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510086826.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

Existing photoelectric detection methods are difficult to effectively resist ambient light interference in industrial automation production, resulting in poor detection accuracy and stability.

Method used

By periodically collecting the voltage signals of the photoelectric sensor, a time domain signal data set is constructed, and converted into a frequency domain signal data set through Fourier transform to identify the ambient light frequency characteristics and the frequency characteristics of the inspected workpiece. Based on these characteristics, the bandpass filter parameters are determined, the ambient light interference signal is suppressed, and the effective signal of the workpiece being inspected is retained.

Benefits of technology

It significantly improves the accuracy and anti-interference ability of photoelectric detection, can better adapt to changes in different ambient light, is not limited by the light direction, and maintains the stability of the detection signal when the light changes rapidly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120043560A_ABST
    Figure CN120043560A_ABST
Patent Text Reader

Abstract

The invention discloses a photoelectric detection method and system resistant to ambient light interference, a medium and a product, and relates to the field of photoelectric detection.The method comprises the steps that voltage signals of a photoelectric sensor in a preset duration are periodically obtained to construct a time domain signal data set; converting the time domain signal data set into a frequency domain signal data set through Fourier transform; based on the frequency domain signal data set, environment illumination frequency characteristics and detected workpiece frequency characteristics are identified; determining band-pass filter parameters according to the environment illumination frequency characteristics and the detected workpiece frequency characteristics; after the band-pass filter parameters are applied to the band-pass filter, filtering processing is carried out on a target voltage signal collected by a photoelectric sensor, and an effective signal of the detected workpiece is obtained; when the effective signal of the detected workpiece exceeds a preset detection threshold value, determining that the position of the workpiece is normal; and when the effective signal of the detected workpiece is lower than a preset detection threshold value, determining that the workpiece is missing or the position of the workpiece is abnormal. By implementing the method, the accuracy of photoelectric detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of optoelectronic detection, and particularly to an optoelectronic detection method, system, medium and product that are resistant to ambient light interference. Background Art

[0002] In industrial automation production, optoelectronic detection technology is widely used in scenarios such as workpiece positioning and defect detection. Due to the interference of ambient light sources such as natural light and artificial lighting, the accuracy of optoelectronic detection will be affected. Therefore, it is urgent to improve the anti-ambient light interference ability of optoelectronic detection methods.

[0003] Currently, the optoelectronic detection method mainly installs a light shield outside the optoelectronic sensor to weaken the influence of external light sources through physical isolation. At the same time, the signal gain of the optoelectronic sensor is adjusted according to the ambient light intensity (the gain is reduced when the ambient light intensity is strong, and the gain is increased when the ambient light intensity is weak).

[0004] However, in practical applications, the light shield and the gain adjustment method have problems such as poor detection stability and limited adaptability. Since the lighting conditions in the industrial production environment often change, the fixed light shielding structure is difficult to adapt to the interference of light sources in different directions. The gain adjustment method is prone to detection signal fluctuations in scenarios where the light changes rapidly, resulting in inaccurate optoelectronic detection results. Summary of the Invention

[0005] This application provides an optoelectronic detection method, system, medium and product that are resistant to ambient light interference, which is used to improve the accuracy of optoelectronic detection.

[0006] In a first aspect, this application provides an optoelectronic detection method that is resistant to ambient light interference and is applied to an optoelectronic detection system. The method includes: periodically obtaining the voltage signal of an optoelectronic sensor within a preset time period to construct a time-domain signal data set, where the time-domain signal data set includes the correspondence between time points and voltage signals; converting the time-domain signal data set into a frequency-domain signal data set through Fourier transform, where the frequency-domain signal data set includes the correspondence between frequency components and amplitude values; based on the frequency-domain signal data set, identifying the ambient light frequency characteristics and the frequency characteristics of the workpiece to be detected; determining the band-pass filter parameters according to the ambient light frequency characteristics and the frequency characteristics of the workpiece to be detected; after applying the band-pass filter parameters to a band-pass filter, filtering the target voltage signal collected by the optoelectronic sensor to obtain the effective signal of the workpiece to be detected; when the effective signal of the workpiece to be detected exceeds a preset detection threshold, determining that the workpiece position is normal; when the effective signal of the workpiece to be detected is lower than the preset detection threshold, determining that the workpiece is missing or the workpiece position is abnormal.

[0007] By adopting the above technical solution, the optoelectronic detection system periodically collects the voltage signals of the optoelectronic sensor and constructs a time-domain signal data set, and then converts it into a frequency-domain signal data set through Fourier transform to isolate the frequency characteristics of the ambient light and the workpiece to be inspected respectively. Based on the frequency characteristics of the ambient light and the workpiece to be inspected, the optoelectronic detection system determines the parameters of the band-pass filter, so that the band-pass filter can specifically suppress the ambient light interference signal while retaining the effective signal of the workpiece to be inspected. This frequency-domain analysis method can better adapt to the changes of different ambient light, is not limited by the light direction, and can still maintain the stability of the detection signal when the light changes rapidly, significantly improving the accuracy and anti-interference ability of optoelectronic detection.

[0008] Combined with some embodiments of the first aspect, in some embodiments, the time-domain signal data set is converted into a frequency-domain signal data set through Fourier transform, and the frequency-domain signal data set includes the correspondence between frequency components and amplitude values, specifically including: performing discrete Fourier transform on the time-domain signal data set to obtain initial frequency-domain data; calculating the power spectral density of the initial frequency-domain data; performing normalization processing on the power spectral density to obtain a normalized spectrum; based on the normalized spectrum, establishing the correspondence between the frequency component and the amplitude value to obtain the frequency-domain signal data set.

[0009] By adopting the above technical solution, the optoelectronic detection system performs discrete Fourier transform on the time-domain signal data set, then calculates the power spectral density and performs normalization processing, and finally establishes the correspondence between the frequency component and the amplitude value, realizing the standardized conversion from the time domain to the frequency domain. This processing method can effectively eliminate the influence of sampling noise and random fluctuations, making the frequency-domain characteristics clearer and more reliable, providing an accurate data basis for subsequent feature recognition and parameter setting, and improving the reliability and consistency of the frequency-domain analysis results.

[0010] Combined with some embodiments of the first aspect, in some embodiments, based on the frequency-domain signal data set, the frequency characteristics of the ambient light and the workpiece to be inspected are identified, specifically including: identifying the main frequency components with amplitude values greater than a preset amplitude threshold in the frequency-domain signal data set; separating the frequency characteristics of the ambient light and the secondary frequency components from the main frequency components according to the preset ambient light frequency range; in the secondary frequency components, determining the frequency characteristics of the workpiece to be inspected based on the correspondence between the movement speed of the workpiece to be inspected and the optoelectronic detection frequency.

[0011] By adopting the above technical solutions, the optoelectronic detection system identifies the main frequency components based on a preset amplitude threshold, then separates the environmental light frequency characteristics and the secondary frequency components according to the preset environmental light frequency range, and finally determines the frequency characteristics of the workpiece to be inspected based on the corresponding relationship between the moving speed of the workpiece to be inspected and the optoelectronic detection frequency. This way of screening layer by layer can accurately distinguish the environmental light interference and the signals of the workpiece to be inspected, avoiding the confusion of signal characteristics. In particular, by establishing the corresponding relationship between the moving speed of the workpiece to be inspected and the optoelectronic detection frequency, the identification of the frequency characteristics of the workpiece to be inspected becomes more targeted and accurate.

[0012] Combined with some embodiments of the first aspect, in some embodiments, determining the band-pass filter parameters according to the environmental light frequency characteristics and the frequency characteristics of the workpiece to be inspected specifically includes: determining the passband of the band-pass filter based on the frequency characteristics of the workpiece to be inspected; determining the stopband of the band-pass filter based on the environmental light frequency characteristics; and setting the band-pass filter parameters according to the passband and the stopband.

[0013] By adopting the above technical solutions, the optoelectronic detection system determines the passband and stopband of the band-pass filter based on the frequency characteristics of the workpiece to be inspected and the environmental light frequency characteristics, realizing the precise setting of the band-pass filter parameters. This method of parameter setting based on actual frequency characteristics enables the band-pass filter to accurately retain the frequency band where the signals of the workpiece to be inspected are located, while effectively suppressing the frequency band where the environmental light interference is located. Compared with the traditional filtering method with fixed parameters, it can be flexibly adjusted according to the frequency characteristics under different working conditions, better adapting to the changes in environmental light and the detection conditions of the workpiece to be inspected.

[0014] Combined with some embodiments of the first aspect, in some embodiments, after applying the band-pass filter parameters to the band-pass filter and filtering the target voltage signal collected by the optoelectronic sensor to obtain the effective signal of the workpiece to be inspected, the method further includes: performing noise reduction processing on the effective signal of the workpiece to be inspected to obtain the characteristic signal of the workpiece to be inspected; and performing amplitude normalization processing on the characteristic signal of the workpiece to be inspected to obtain the normalized characteristic signal of the workpiece to be inspected.

[0015] By adopting the above technical solutions, after obtaining the effective signal of the workpiece to be inspected, the optoelectronic detection system further performs noise reduction processing and amplitude normalization processing, significantly improving the quality and comparability of the signals of the workpiece to be inspected, thereby improving the accuracy and reliability of the detection results.

[0016] In some embodiments in combination with some embodiments of the first aspect, after the step of performing amplitude normalization processing on the feature signal of the workpiece to be inspected to obtain a normalized feature signal of the workpiece to be inspected, the method further includes: determining a reference detection threshold based on the mean value of the normalized feature signal of the workpiece to be inspected; after obtaining the ambient light intensity, calculating an ambient light compensation value according to a preset ambient light compensation coefficient; and performing weighted summation on the ambient light compensation value and the reference detection threshold to obtain the preset detection threshold.

[0017] By adopting the above technical solution, the optoelectronic detection system determines a reference detection threshold based on the mean value of the normalized feature signal of the workpiece to be inspected, calculates an ambient light compensation value in combination with the ambient light intensity and the preset ambient light compensation coefficient, and finally performs weighted summation on the ambient light compensation value and the reference detection threshold to obtain the preset detection threshold. This dynamic threshold determination method takes into account the statistical characteristics of the normalized feature signal of the workpiece to be inspected itself and the real-time influence of the ambient light, enabling the preset detection threshold to be adaptively adjusted according to the actual working conditions, overcoming the defect that a fixed threshold is prone to misjudgment, and significantly improving the accuracy and adaptability of detection and judgment.

[0018] In some embodiments in combination with some embodiments of the first aspect, after the step of applying the band-pass filter parameters to the band-pass filter and performing filtering processing on the target voltage signal collected by the optoelectronic sensor to obtain a valid signal of the workpiece to be inspected, the method further includes: calculating a matching degree between the frequency feature of the workpiece to be inspected and the frequency feature templates in the workpiece feature database, where the workpiece feature database includes different frequency feature templates corresponding to different types of workpieces; and when the matching degree is lower than a preset matching degree threshold, determining that the workpiece to be inspected is an abnormal workpiece.

[0019] By adopting the above technical solution, the optoelectronic detection system calculates the matching degree between the detected frequency feature of the workpiece to be inspected and the frequency feature templates stored in the workpiece feature database, and determines whether the workpiece to be inspected is an abnormal workpiece based on the preset matching degree threshold, realizing intelligent identification and abnormal detection of the workpiece type. The workpiece feature database contains frequency feature templates corresponding to different types of workpieces. This detection method based on template matching can not only judge the presence and position of the workpiece, but also identify whether the type of the workpiece meets the expectation, so as to timely detect abnormal workpieces and avoid quality problems caused by wrong workpieces mixing into the production line. Second, an optoelectronic detection system is provided in an embodiment of the present application. The optoelectronic detection system includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the optoelectronic detection system to execute the method described in the first aspect and any possible implementation manner in the first aspect.

[0020] In a third aspect, an embodiment of the present application provides a computer program product including instructions. When the computer program product runs on an optoelectronic detection system, the optoelectronic detection system is caused to execute the method described in the first aspect and any possible implementation manner in the first aspect.

[0021] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium including instructions. When the instructions run on an optoelectronic detection system, the optoelectronic detection system is caused to execute the method described in the first aspect and any possible implementation manner in the first aspect.

[0022] It can be understood that the optoelectronic detection system provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the method provided in the embodiment of the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, and will not be elaborated here.

[0023] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By adopting the above technical solution, the optoelectronic detection system periodically collects the voltage signals of the optoelectronic sensors and constructs a time-domain signal dataset, and then converts it into a frequency-domain signal dataset through Fourier transform to separate the frequency characteristics of the ambient light and the workpiece to be detected respectively. Based on the frequency characteristics of the ambient light and the workpiece to be detected, the optoelectronic detection system determines the parameters of the band-pass filter, so that the band-pass filter can specifically suppress the ambient light interference signal while retaining the effective signal of the workpiece to be detected. This frequency-domain analysis method can better adapt to the changes of different ambient lights compared with the traditional light-shielding cover and gain adjustment methods, is not limited by the light direction, and can still maintain the stability of the detection signal when the light changes rapidly, significantly improving the accuracy and anti-interference ability of optoelectronic detection.

[0024] 2. By adopting the above technical solution, the optoelectronic detection system determines a reference detection threshold based on the mean value of the standardized characteristic signals of the workpiece to be detected, calculates the ambient light compensation value in combination with the ambient light intensity and a preset ambient light compensation coefficient, and finally performs weighted summation of the ambient light compensation value and the reference detection threshold to obtain a preset detection threshold. This dynamic threshold determination method takes into account the statistical characteristics of the standardized characteristic signals of the workpiece to be detected itself and the real-time influence of the ambient light, enabling the preset detection threshold to be adaptively adjusted according to the actual working conditions, overcoming the defect that a fixed threshold is prone to misjudgment, and significantly improving the accuracy and adaptability of detection and judgment.

[0025] 3. By adopting the above technical solution, the optoelectronic detection system calculates the matching degree between the detected frequency characteristics of the workpiece to be inspected and the frequency characteristic templates stored in the workpiece characteristic database, and judges whether the workpiece to be inspected is an abnormal workpiece based on a preset matching degree threshold, realizing the intelligent identification of the workpiece type and abnormal detection. The workpiece characteristic database contains frequency characteristic templates corresponding to different types of workpieces. This detection method based on template matching can not only judge the presence and position of the workpiece, but also identify whether the type of the workpiece meets the expectation, so that abnormal workpieces can be found in time, avoiding quality problems caused by incorrect workpieces mixing into the production line. Brief Description of the Drawings

[0026] Figure 1 is a schematic flow chart of an optoelectronic detection method for anti-environmental light interference in an embodiment of the present application; Figure 2 is another schematic flow chart of an optoelectronic detection method for anti-environmental light interference in an embodiment of the present application; Figure 3 is a schematic structural diagram of an entity device of an optoelectronic detection system in an embodiment of the present application. Detailed Embodiments

[0027] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the specification of the present application, the singular forms "a", "an", "the above", "the" and "this" are also intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term " / and / " used in the present application refers to any or all possible combinations including one or more of the listed items.

[0028] Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and cannot be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise stated, the meaning of "a plurality" is two or more.

[0029] The method provided in this embodiment is described in the following scenario.

[0030] On a precision industrial production line, a row of metal workpieces move orderly along the conveyor belt. The fluorescent lights in the workshop and the natural light passing through the windows make the entire environment well-lit but not very stable. An optoelectronic sensor is set at the detection point of the conveyor belt, and the optoelectronic sensor continuously emits a light beam to monitor each passing metal workpiece. When a processed metal workpiece passes by, the light beam is reflected or blocked, and the optical signal received by the optoelectronic sensor changes. At this time, the optoelectronic detection system quickly acquires a series of electrical signals through the optoelectronic sensor, and analyzes the frequency characteristics of the ambient light (such as the 50Hz flicker of the fluorescent light) and the frequency characteristics when the metal workpiece passes through through Fourier transform. The optoelectronic detection system sets precise filtering parameters accordingly to filter out the interference of the ambient light and only retain the effective signal of the metal workpiece. If the intensity of the effective signal is normal, it indicates that the workpiece position is correct; if the intensity of the effective signal is abnormal, an alarm is immediately given to prompt that there may be a missing workpiece or a deviation in position, ensuring the stability of the product quality on the production line. This intelligent detection method enables the production line to maintain efficient and accurate quality monitoring even in an environment with unstable lighting.

[0031] The following describes the process of the method provided in this embodiment. Please refer to Figure 1 , which is a schematic flowchart of a method for optoelectronic detection against ambient light interference in an embodiment of the present application.

[0032] S101. Periodically obtain the voltage signals of the optoelectronic sensor within a preset duration to construct a time-domain signal dataset, where the time-domain signal dataset includes the correspondence between time points and voltage signals; Among them, the optoelectronic sensor is a sensor device that converts an optical signal into an electrical signal; the preset duration is a preset sampling duration, for example, it can be 100 seconds, 200 seconds, etc.; periodically obtaining means obtaining at fixed time intervals within the preset duration; the voltage signal refers to the voltage value output by the optoelectronic sensor; the time-domain signal dataset refers to a dataset that records voltage signals in chronological order, such as a dataset in the form of [{t1, v1}, {t2, v2}...{tn, vn}].

[0033] Specifically, the optoelectronic detection system controls the optoelectronic sensor to continuously collect voltage signals at a fixed sampling frequency (such as 1kHz) within a preset duration (such as 200ms), and pairs and stores the sampling time points and the corresponding voltage signals to form a time-domain signal dataset.

[0034] S102. Convert the time-domain signal dataset into a frequency-domain signal dataset through Fourier transform, where the frequency-domain signal dataset includes the correspondence between frequency components and amplitude values; Among them, the Fourier transform refers to a mathematical transformation method for converting a time-domain signal into a frequency-domain signal; the frequency-domain signal dataset refers to a set of amplitude distribution characteristics of a voltage signal on different frequency components; the frequency component refers to a component with a specific frequency in the voltage signal; the amplitude value refers to the intensity magnitude corresponding to the frequency component.

[0035] Specifically, the optoelectronic detection system performs Fourier transform processing on the acquired time-domain signal dataset, converting the voltage fluctuations in the time dimension into an amplitude distribution in the frequency dimension, thereby obtaining the frequency-domain signal dataset.

[0036] Optionally, generally, the time-domain signal dataset is converted into a frequency-domain signal dataset through Fourier transform. The correspondence between the frequency components and the amplitude values in the frequency-domain signal dataset can be achieved in the following manner (not limited herein): performing a discrete Fourier transform on the time-domain signal dataset to obtain the initial frequency-domain data; calculating the power spectral density of the initial frequency-domain data; normalizing the power spectral density to obtain a standardized spectrum; and based on the standardized spectrum, establishing the correspondence between the frequency component and the amplitude value to obtain the frequency-domain signal dataset.

[0037] Assume that the sampling frequency is 1 kHz (1 sampling per millisecond) and the preset duration is 200 milliseconds. Then, the optoelectronic sensor has a total of 200 samplings. The voltage signal output by the optoelectronic sensor is a sine wave, i.e., V(t) = 5sin(2π·50t), where t is the time (in seconds), the frequency is 50 Hz, and the maximum voltage is 5 volts. According to the above settings, the time-domain signal dataset is: The optoelectronic detection system converts the time-domain signal dataset into a frequency-domain signal dataset through Fourier transform to analyze the frequency components contained in the voltage signal and simultaneously display the amplitude values of each frequency component. For the above example where the voltage signal is a sine wave, the frequency-domain signal dataset will highlight the presence of the fundamental frequency of 50 Hz. The frequency-domain signal dataset is: Frequency component (f / Hz) Amplitude value 0 0 50 1000 (main frequency component) 100 0 150 0 …… …… S103. Based on the frequency-domain signal dataset, identify the environmental light frequency characteristics and the frequency characteristics of the workpiece to be inspected; Among them, the environmental light frequency characteristics refer to the characteristic distribution of the environmental light source (such as fluorescent lamps, LED lights, etc.) in the frequency domain; the frequency characteristics of the workpiece to be inspected refer to the characteristic distribution generated in the frequency domain when the workpiece to be inspected moves on the conveyor belt; the frequency characteristics include characteristic parameters such as the main frequency and the bandwidth.

[0038] Specifically, the optoelectronic detection system performs feature recognition based on the frequency-domain signal dataset. First, it identifies the main frequency components with larger amplitude values, and then separates these main frequency components into ambient light frequency features and other frequency features according to the pre-established ambient light frequency range database (such as power frequency light sources 50Hz / 60Hz, etc.). For the remaining frequency components, the optoelectronic detection system identifies the frequency features of the workpiece to be inspected according to the corresponding relationship between the movement speed of the workpiece to be inspected on the conveyor belt and the detection frequency, so as to realize the feature separation of ambient light interference and the effective signal of the workpiece to be inspected.

[0039] Optionally, generally, based on this frequency-domain signal dataset, the identification of ambient light frequency features and the frequency features of the workpiece to be inspected can be achieved in the following ways, which are not limited herein: In the frequency-domain signal dataset, identify the main frequency components with amplitude values greater than the preset amplitude threshold; According to the preset ambient light frequency range, separate the ambient light frequency features and secondary frequency components from the main frequency components; In the secondary frequency components, based on the corresponding relationship between the movement speed of the workpiece to be inspected and the optoelectronic detection frequency, determine the frequency features of the workpiece to be inspected.

[0040] Assume that the ambient light frequency is 10Hz (caused by LED flashing), and the marked frequency of the workpiece to be inspected is 50Hz (determined by the mark on the conveyor belt). The preset amplitude threshold is generally set to a certain multiple of the average amplitude of the voltage signal, such as 5 times the average amplitude. In the frequency-domain signal dataset, the optoelectronic detection system identifies the frequency components with amplitude values greater than the preset amplitude threshold. For example, the following frequency components: f = 10Hz, amplitude = 300; f = 50Hz, amplitude = 1500; f = 100Hz, amplitude = 100... According to the preset ambient light frequency range (such as 10Hz ± 2Hz), the optoelectronic detection system identifies the 10Hz frequency component as the main ambient light frequency feature with an amplitude of 300. Among the remaining frequency components, the optoelectronic detection system identifies the 50Hz frequency component as the frequency feature of the workpiece to be inspected with an amplitude of 1500, indicating that the mark on the conveyor belt is detected by the optoelectronic sensor at a frequency of 50Hz.

[0041] S104. Determine the band-pass filter parameters according to the ambient light frequency feature and the frequency feature of the workpiece to be inspected; Among them, a band-pass filter is a filter device used to selectively pass signals in a specific frequency band while suppressing signals in other frequency bands; band-pass filter parameters refer to a set of parameters used to set the characteristics of the band-pass filter, including center frequency, bandwidth, roll-off slope, etc.; environmental light frequency characteristics refer to the characteristic distribution of environmental light in the frequency domain, such as the 50Hz / 60Hz characteristics of power frequency light sources; the frequency characteristics of the workpiece to be inspected refer to the characteristic frequency distribution generated by the movement of the workpiece to be inspected.

[0042] Specifically, after the optoelectronic detection system obtains the environmental light frequency characteristics and the frequency characteristics of the workpiece to be inspected, the band-pass filter is used to separate the effective signal of the workpiece to be inspected. The optoelectronic detection system first determines the passband range of the band-pass filter based on the frequency characteristics of the workpiece to be inspected, such as the bandwidth of ±20% of the workpiece movement frequency, and then sets the stopband range based on the environmental light frequency characteristics to ensure effective attenuation of interference sources such as power frequency and high-frequency lighting. Finally, considering the transition characteristics of the passband and the stopband, the order, type (such as Butterworth, Chebyshev, etc.) and specific parameters of the band-pass filter are set.

[0043] Optionally, generally, according to the environmental light frequency characteristics and the frequency characteristics of the workpiece to be inspected, determining the band-pass filter parameters can be achieved in the following ways, which are not limited here: based on the frequency characteristics of the workpiece to be inspected, determine the passband of the band-pass filter; based on the environmental light frequency characteristics, determine the stopband of the band-pass filter; according to the passband and the stopband, set the band-pass filter parameters.

[0044] S105. After applying the band-pass filter parameters to the band-pass filter, filter the target voltage signal collected by the optoelectronic sensor to obtain the effective signal of the workpiece to be inspected; Among them, the target voltage signal refers to the output signal of the optoelectronic sensor that needs to be detected in real time; the filtering process refers to the process of using a band-pass filter to perform frequency-selective filtering on the target voltage signal; the effective signal of the workpiece to be inspected refers to the characteristic signal of the workpiece to be inspected retained after filtering.

[0045] Specifically, after the optoelectronic detection system completes the setting of the band-pass filter parameters, it starts to process the target voltage signal collected in real time. The optoelectronic detection system applies the designed band-pass filter to the signal processing module. When the optoelectronic sensor collects the target voltage signal, it performs real-time filtering through the band-pass filter. During the filtering process, the environmental light interference frequency is significantly attenuated, while the characteristic frequency of the workpiece to be inspected is retained, and finally the effective signal of the workpiece to be inspected is output.

[0046] S106. When the effective signal of the workpiece to be inspected exceeds the preset detection threshold, determine that the workpiece position is normal; Among them, the preset detection threshold is the voltage reference value for judging the state of the workpiece to be detected; the normal workpiece position means that the workpiece to be detected is within the expected detection position range.

[0047] Specifically, after obtaining the effective signal of the workpiece to be detected, the optoelectronic detection system judges the state of the workpiece to be detected by comparing it with the preset detection threshold. When the effective signal of the workpiece to be detected exceeds the preset detection threshold (such as 80% of the nominal voltage), it indicates that there is a workpiece to be detected at the detection position and the position is correct, and the optoelectronic detection system determines that the workpiece position is normal.

[0048] S107. When the effective signal of the workpiece to be detected is lower than the preset detection threshold, it is determined that the workpiece is missing or the workpiece position is abnormal.

[0049] Among them, the missing workpiece means that there is no workpiece to be detected within the detection position range; the abnormal workpiece position means that the workpiece to be detected deviates from the expected detection position range or the posture of the workpiece to be detected is incorrect.

[0050] Specifically, when the effective signal of the workpiece to be detected is lower than the preset detection threshold, there may be situations such as the missing workpiece to be detected, the workpiece to be detected deviating from the detection position range, or the abnormal posture of the workpiece to be detected. The optoelectronic detection system will trigger an abnormal signal prompt.

[0051] By adopting the above technical solution, the optoelectronic detection system periodically collects the voltage signals of the optoelectronic sensors and constructs a time-domain signal data set, and then converts it into a frequency-domain signal data set through Fourier transform to separate the frequency characteristics of the ambient light and the workpiece to be detected. Based on the frequency characteristics of the ambient light and the workpiece to be detected, the optoelectronic detection system determines the parameters of the band-pass filter, so that the band-pass filter can specifically suppress the ambient light interference signal while retaining the effective signal of the workpiece to be detected. This frequency-domain analysis method can better adapt to the changes of different ambient lights compared with the traditional light-shielding cover and gain adjustment methods, is not limited by the light direction, and can still maintain the stability of the detection signal when the light changes rapidly, significantly improving the accuracy and anti-interference ability of optoelectronic detection.

[0052] The following further describes the more specific process of the method provided in this embodiment. Please refer to Figure 2 , which is another process schematic diagram of the optoelectronic detection method for anti-ambient light interference in the embodiment of the present application.

[0053] After step S105, the following steps can be executed, or not, which is not limited herein.

[0054] S201. Perform noise reduction processing on the effective signal of the workpiece to be detected to obtain the characteristic signal of the workpiece to be detected; Among them, noise reduction processing refers to the process of removing residual random noise and interference in the effective signal of the workpiece to be inspected through digital signal processing algorithms; the characteristic signal of the workpiece to be inspected refers to the signal of the workpiece to be inspected that is smoother and more stable after noise reduction; noise includes random fluctuation components such as thermal noise, quantization noise, and electromagnetic interference.

[0055] Specifically, after the optoelectronic detection system obtains the effective signal of the workpiece to be inspected, it is necessary to further improve the signal quality. First, the optoelectronic detection system performs median filtering on the effective signal of the workpiece to be inspected to remove sudden pulse noise. Then, the optoelectronic detection system applies wavelet transform to perform multi-scale decomposition on the effective signal of the workpiece to be inspected, and uses an adaptive threshold for soft threshold denoising in different frequency bands. Finally, the optoelectronic detection system uses a Kalman filter to smooth the effective signal of the workpiece to be inspected and suppress high-frequency random fluctuations. Through this multi-stage noise reduction processing, the characteristic signal of the workpiece to be inspected is obtained, making the characteristic signal of the workpiece to be inspected clearer and more reliable.

[0056] S202. Perform amplitude normalization processing on the characteristic signal of the workpiece to be inspected to obtain a standardized characteristic signal of the workpiece to be inspected; among them, amplitude normalization processing refers to the mathematical transformation process of mapping the amplitude of the characteristic signal of the workpiece to be inspected to a standard range (usually 0-1); the standardized characteristic signal of the workpiece to be inspected refers to the standardized signal after amplitude normalization processing.

[0057] Specifically, after the optoelectronic detection system obtains the characteristic signal of the workpiece to be inspected after noise reduction, it is necessary to eliminate the amplitude differences caused by factors such as detection distance and light intensity. First, the optoelectronic detection system determines the maximum and minimum values of the characteristic signal of the workpiece to be inspected and establishes an amplitude mapping relationship; then, the optoelectronic detection system performs a linear transformation on the characteristic signal of the workpiece to be inspected to compress or expand the amplitude range of the entire waveform to the 0-1 interval; finally, the optoelectronic detection system performs a smooth transition process on the transformed characteristic signal of the workpiece to be inspected to avoid sudden changes during the normalization process; ultimately, the optoelectronic detection system obtains a standardized characteristic signal of the workpiece to be inspected.

[0058] S203. Determine a reference detection threshold based on the mean value of the standardized characteristic signal of the workpiece to be inspected; Among them, the mean value refers to the average amplitude level of the standardized characteristic signal of the workpiece to be inspected within a certain time window; the reference detection threshold is the basic reference value for workpiece detection judgment.

[0059] Specifically, first, the optoelectronic detection system collects the standardized characteristic signals of the workpiece to be inspected for multiple cycles under stable working conditions. Then, the optoelectronic detection system calculates the time average value of these standardized characteristic signals of the workpiece to be inspected to obtain a reference level reflecting the normal state of the workpiece. Finally, the optoelectronic detection system combines the fluctuation range of the standardized characteristic signal of the workpiece to be inspected and multiplies the mean value by a safety factor (such as 0.8) as the reference detection threshold.

[0060] S204. After obtaining the ambient light intensity, calculate the ambient light compensation value according to a preset ambient light compensation coefficient. Here, the ambient light intensity refers to the illumination level of the detection site by the photoelectric sensor, usually measured in lux (lux). The preset ambient light compensation coefficient refers to the correction parameter under different ambient light intensities. The ambient light compensation value refers to the correction amount calculated based on the real-time ambient light intensity.

[0061] Specifically, first, the photoelectric detection system collects the ambient light intensity in real time through the light sensor. Then, the photoelectric detection system queries the pre-established ambient light compensation coefficient table, which determines the compensation coefficients under different ambient light intensities based on a large amount of experimental data. Finally, the photoelectric detection system multiplies the ambient light intensity by the corresponding preset ambient light compensation coefficient to calculate the current ambient light compensation value.

[0062] S205. Perform a weighted sum of the ambient light compensation value and the reference detection threshold to obtain the preset detection threshold. Here, the weighted sum refers to the calculation process of linearly combining the ambient light compensation value and the reference detection threshold according to a certain weight. The preset detection threshold refers to the dynamic threshold finally used for workpiece state judgment. The weight refers to the importance coefficient of the ambient light compensation value and the reference detection threshold in the combined calculation. The linear combination refers to the mathematical operation of adding the ambient light compensation value and the reference detection threshold proportionally.

[0063] Specifically, first, the photoelectric detection system sets the weight coefficients of the ambient light compensation value and the reference detection threshold. Usually, the weight of the reference detection threshold is larger (such as 0.8), and the weight of the ambient light compensation value is smaller (such as 0.2). Then, the photoelectric detection system multiplies the ambient light compensation value and the reference detection threshold by their corresponding weights respectively, and adds the two weighted results to obtain the dynamic detection threshold considering the influence of environmental factors, that is, the preset detection threshold.

[0064] S206. Calculate the matching degree between the frequency characteristics of the workpiece to be detected and the frequency characteristic templates in the workpiece characteristic database, where the workpiece characteristic database includes different frequency characteristic templates corresponding to different types of workpieces. Here, the workpiece characteristic database refers to the data set storing the frequency characteristics of various standard workpieces. The frequency characteristic template is used to represent the standard frequency domain characteristic parameter set of different types of workpieces. The matching degree calculation refers to calculating the similarity degree of two feature vectors through mathematical methods.

[0065] Specifically, first, the optoelectronic detection system retrieves the target frequency feature template corresponding to the current workpiece type to be inspected from the workpiece feature database. The target frequency feature template contains the frequency domain feature parameter set of the workpiece to be inspected collected under standard conditions. Then, the optoelectronic detection system uses algorithms such as cosine similarity or Euclidean distance to calculate the matching degree between the feature vector of the frequency feature of the workpiece to be inspected and the target frequency feature template.

[0066] S207. When the matching degree is lower than the preset matching degree threshold, it is determined that the workpiece to be inspected is an abnormal workpiece.

[0067] Among them, the preset matching degree threshold refers to the standard boundary for determining whether the workpiece to be inspected is an abnormal workpiece; an abnormal workpiece refers to a workpiece that has a significant difference from the standard workpiece.

[0068] Specifically, after calculating the matching degree, the optoelectronic detection system needs to determine whether the workpiece to be inspected meets the specification requirements. The optoelectronic detection system compares the matching degree with the preset matching degree threshold (such as 0.85). When the matching degree is lower than the preset matching degree threshold, it indicates that there is a large deviation between the frequency feature of the workpiece to be inspected and the standard frequency feature template, which may be problems such as incorrect workpiece type, workpiece defect, or abnormal workpiece posture. The optoelectronic detection system determines the workpiece to be inspected as an abnormal workpiece.

[0069] The optoelectronic detection system in the embodiment of the present invention application will be described from the perspective of hardware processing. Please refer to Figure 3 , which is a schematic structural diagram of an entity device of the optoelectronic detection system in the embodiment of the present application.

[0070] It should be noted that Figure 3 The structure of the optoelectronic detection system shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.

[0071] As Figure 3 shown, the optoelectronic detection system includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage section 308 into the random access memory (RAM) 303, such as executing the method described in the above embodiments. In the RAM 303, various programs and data required for system operation are also stored. The CPU 301, ROM 302, and RAM 303 are connected to each other through a bus 304. The input / output (I / O) interface 305 is also connected to the bus 304.

[0072] The following components are connected to the I / O interface 305: an input section 306 including an audio input device, a push button switch, etc.; an output section 307 including a liquid crystal display (LCD), an audio output device, an indicator light, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. The drive 310 is also connected to the I / O interface 305 as required. A removable medium 311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is installed on the drive 310 as required so that a computer program read from it can be installed into the storage section 308 as required.

[0073] Specifically, according to an embodiment of the present invention, the processes described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 309, and / or installed from the removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, various functions defined in the present invention are executed.

[0074] It should be noted that specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, apparatus, or device.

[0075] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. Among them, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the block may occur in a different order than that marked in the accompanying drawings.

[0076] Specifically, the optoelectronic detection system of this embodiment includes a processor and a memory. A computer program is stored on the memory. When the computer program is executed by the processor, it implements the optoelectronic detection method for anti-environmental light interference provided in the above-mentioned embodiment.

[0077] On the other hand, the present invention also provides a computer-readable storage medium. This storage medium may be included in the optoelectronic detection system described in the above-mentioned embodiment; or it may exist separately and not be assembled into the optoelectronic detection system. The above storage medium carries one or more computer programs. When the above one or more computer programs are executed by a processor of the optoelectronic detection system, the optoelectronic detection system is enabled to implement the optoelectronic detection method for anti-environmental light interference provided in the above-mentioned embodiment.

[0078] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the various embodiments of the present application.

[0079] As used in the above embodiments, depending on the context, the term "when..." can be interpreted to mean "if...", or "after...", or "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if detecting (the stated condition or event)" can be interpreted to mean "if determining...", or "in response to determining...", or "when detecting (the stated condition or event)", or "in response to detecting (the stated condition or event)".

[0080] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by relevant hardware instructed by a computer program. This program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The foregoing storage media include: various media that can store program codes, such as ROM or random access memory RAM, magnetic disks, or optical discs.

Claims

1. A photoelectric detection method resistant to ambient light interference, characterized in that: Applied to a photoelectric detection system, the method comprises: Periodically acquiring a voltage signal of a photoelectric sensor within a preset time length to construct a time domain signal data set, wherein the time domain signal data set includes a corresponding relationship between a time point and a voltage signal; Converting the time domain signal data set into a frequency domain signal data set by Fourier transform, wherein the frequency domain signal data set includes a correspondence between frequency components and amplitude values; Based on the frequency domain signal data set, identifying the frequency characteristics of the ambient light and the frequency characteristics of the inspected workpiece; Determining bandpass filter parameters according to the ambient light frequency characteristics and the inspected workpiece frequency characteristics; After applying the bandpass filter parameters to the bandpass filter, filtering the target voltage signal collected by the photoelectric sensor to obtain a valid signal of the inspected workpiece; When the effective signal of the inspected workpiece exceeds a preset detection threshold, determining that the position of the workpiece is normal; When the effective signal of the inspected workpiece is lower than the preset detection threshold, it is determined that the workpiece is missing or the position of the workpiece is abnormal.

2. The method according to claim 1, characterized in that The converting of the time domain signal data set into a frequency domain signal data set by Fourier transform, wherein the frequency domain signal data set includes a correspondence between frequency components and amplitude values, specifically includes: Performing discrete Fourier transform on the time domain signal data set to obtain initial frequency domain data; Calculating the power spectral density of the initial frequency domain data; Normalizing the power spectrum density to obtain a standardized spectrum; Based on the standardized frequency spectrum, a corresponding relationship between the frequency components and the amplitude values ​​is established to obtain the frequency domain signal data set.

3. The method according to claim 1, characterized in that The identifying of the ambient light frequency characteristics and the frequency characteristics of the inspected workpiece based on the frequency domain signal data set specifically includes: In the frequency domain signal data set, identifying a main frequency component having an amplitude value greater than a preset amplitude threshold; Separating the ambient light frequency characteristics and the secondary frequency components from the primary frequency components according to a preset ambient light frequency range; In the secondary frequency component, the frequency characteristic of the inspected workpiece is determined based on the corresponding relationship between the movement speed of the inspected workpiece and the photoelectric detection frequency.

4. The method according to claim 1, characterized in that Determining the bandpass filter parameters according to the ambient light frequency characteristics and the detected workpiece frequency characteristics specifically includes: Determining the passband of the bandpass filter based on the frequency characteristics of the inspected workpiece; Determining a suppression band of the bandpass filter based on the ambient light frequency characteristics; The bandpass filter parameters are set according to the passband and the rejection band.

5. The method according to claim 1, characterized in that: After the step of applying the bandpass filter parameters to the bandpass filter and filtering the target voltage signal collected by the photoelectric sensor to obtain a valid signal of the inspected workpiece, the method further includes: Performing noise reduction processing on the effective signal of the inspected workpiece to obtain a characteristic signal of the inspected workpiece; Amplitude normalization processing is performed on the detected workpiece characteristic signal to obtain a standardized detected workpiece characteristic signal.

6. The method according to claim 5, characterized in that After the step of performing amplitude normalization processing on the characteristic signal of the inspected workpiece to obtain a standardized characteristic signal of the inspected workpiece, the method further comprises: Determining a reference detection threshold based on the mean value of the standardized characteristic signal of the inspected workpiece; After obtaining the ambient light intensity, the ambient light compensation value is calculated according to the preset ambient light compensation coefficient; The ambient light compensation value and the reference detection threshold are weightedly summed to obtain the preset detection threshold.

7. The method according to claim 1, characterized in that After the step of applying the bandpass filter parameters to the bandpass filter and filtering the target voltage signal collected by the photoelectric sensor to obtain a valid signal of the inspected workpiece, the method further includes: Calculating the matching degree between the frequency feature of the inspected workpiece and the frequency feature template in the workpiece feature database, wherein the workpiece feature database includes different frequency feature templates corresponding to different types of workpieces; When the matching degree is lower than a preset matching degree threshold, the inspected workpiece is determined to be an abnormal workpiece.

8. A photoelectric detection system, characterized in that: The photoelectric detection system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the photoelectric detection system to execute the method described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on a photoelectric detection system, the photoelectric detection system is caused to execute the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that When the computer program product is run on a photoelectric detection system, the photoelectric detection system is caused to perform the method according to any one of claims 1 to 7.