Distance acquisition method and device, electronic equipment and storage medium

Obtaining frequency domain characteristic signals through ultrasonic generators and receivers solves the problem of insufficient top space of full-screen electronic devices that affects the anti-accidental touch function, and achieves accurate measurement of the distance between electronic devices and obstacles and the reliability of the anti-accidental touch function.

CN118534467APending Publication Date: 2024-08-23BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310190617.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-23
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

With the development of full-screen electronic devices, the lack of top space affects the realization of the anti-accidental touch function, and the existing distance sensors cannot work effectively.

Method used

Using an ultrasonic generator and an ultrasonic receiver, by transmitting bandpass signals and high-frequency signals in a preset frequency band, the frequency domain characteristic signal of the acoustic wave signal is obtained to characterize the relative motion between the electronic device and the obstacle, and then calculate the distance to achieve prevention. Accidental touch function.

Benefits of technology

Ultrasonic signals can be sent and received without making holes in the display screen, and the distance between electronic devices and obstacles can be accurately obtained, ensuring the reliability of the anti-accidental touch function of full-screen electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118534467A
    Figure CN118534467A
Patent Text Reader

Abstract

The invention relates to a distance acquisition method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a sound wave signal output by the ultrasonic receiver; performing frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal; analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal; the frequency domain characteristic signal is used for representing relative movement between the electronic equipment and an obstacle; and obtaining the distance between the electronic equipment and an obstacle according to the frequency domain characteristic signal. According to the embodiment of the invention, the ultrasonic generator and the ultrasonic receiver can transmit and receive the ultrasonic signals without forming holes in the display screen of the electronic equipment, the frequency domain characteristic signals can be determined, namely, the relative movement between the electronic equipment and the obstacle is determined, and finally the distance between the electronic equipment and the obstacle is obtained. The mistaken touch prevention function of the full-screen electronic equipment can be reliably realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a distance acquisition method and device, an electronic device, and a storage medium. Background Art

[0002] Existing electronic devices usually have an anti-mistaken touch function, which can be used to prevent accidental touches on the display area of ​​the electronic device to cause accidental input. For example, in a call scenario, the user usually touches the display screen of the electronic device to the face, which may cause accidental input if the anti-mistaken touch function is not turned on.

[0003] In order to realize the above-mentioned anti-mistouch function, electronic devices are usually provided with distance sensors, including but not limited to infrared sensors and ultrasonic sensors.

[0004] Taking an ultrasonic sensor as an example, the ultrasonic sensor calculates the signal change by emitting an ultrasonic signal and detecting the echo signal of the ultrasonic signal, and then calculates the distance from the electronic device to the obstacle based on the above change; thereafter, it determines whether the electronic device is close to the user's head based on the above distance, thereby disabling the touch input of the touch screen display during a call.

[0005] However, as electronic devices develop towards full-screen, the screen-to-body ratio is getting higher and higher, which makes it impossible to leave enough space on the top of the electronic device to set up a distance sensor, which may affect the specific implementation of the anti-mistouch function of the electronic device. Summary of the invention

[0006] The present disclosure provides a distance acquisition method and device, an electronic device, and a storage medium to address the deficiencies of related technologies.

[0007] According to a first aspect of an embodiment of the present disclosure, a distance acquisition method is provided, which is applicable to an electronic device, wherein the electronic device includes an ultrasonic generator and an ultrasonic receiver; the method includes:

[0008] Acquire a sound wave signal output by the ultrasonic receiver, wherein the sound wave signal is an echo signal of a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band emitted by the ultrasonic generator;

[0009] Performing frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal;

[0010] Analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal; the frequency domain characteristic signal is used to characterize the relative motion between the electronic device and the obstacle;

[0011] The distance between the electronic device and the obstacle is acquired according to the frequency domain characteristic signal.

[0012] Optionally, performing frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal includes:

[0013] When the frequency of the sound wave signal is outside the target frequency band, performing frequency shift processing on the sound wave signal to obtain a frequency shift signal;

[0014] Downsampling the frequency-shifted signal to obtain a downsampled signal;

[0015] Performing frame-by-frame windowing processing on the down-sampled signal to obtain a sound wave frame sequence including a plurality of frames;

[0016] Perform frequency domain transformation on each sub-frame in the sound wave frame sequence to obtain a frequency domain signal containing frequency domain sub-signals corresponding to each sub-frame.

[0017] Optionally, the frequency domain characteristic signal includes at least one of the following: signal volume, relative spectrum signal, correlation feature and frequency shift parameter.

[0018] Optionally, the frequency domain characteristic signal includes a signal volume, and the signal volume is used to indicate the energy difference between different electronic devices after receiving the sound wave; analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal includes:

[0019] Obtaining the amplitude of each frequency component in the frequency domain signal;

[0020] Obtaining the accumulated value of the root mean square of the amplitude of each frequency component to obtain the signal amplitude corresponding to the frequency domain signal;

[0021] Obtaining a logarithmic value of the signal amplitude to obtain a logarithmic amplitude corresponding to the frequency domain signal;

[0022] The logarithmic amplitude is normalized to obtain a signal volume corresponding to the frequency domain signal.

[0023] Optionally, the frequency domain characteristic signal includes a relative spectrum signal, and the relative spectrum is used to represent the difference in interference fringes of the electronic device when it is close to and far away from an obstacle; analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal includes:

[0024] Acquire energy information corresponding to each frequency component in the frequency domain signal;

[0025] Obtain the relative energy of each frequency component and the base to obtain the relative spectrum signal.

[0026] Optionally, the frequency domain characteristic signal includes a correlation feature, and the correlation feature is used to represent the correlation feature between the ultrasonic generator transmission signal and the ultrasonic receiver reception signal; the frequency domain signal is analyzed and processed to obtain a frequency domain characteristic signal corresponding to the frequency domain signal, including:

[0027] Obtaining a correlation coefficient between the signal transmitted by the ultrasonic generator and the signal received by the ultrasonic receiver;

[0028] Obtaining the autocorrelation coefficient of the frequency domain signal corresponding to the sound wave signal;

[0029] The mutual correlation coefficient and the autocorrelation coefficient are respectively normalized to obtain a frequency domain characteristic signal corresponding to the frequency domain signal.

[0030] Optionally, the frequency domain characteristic signal includes a frequency shift parameter, and the frequency shift parameter is used to indicate two events of the electronic device approaching and moving away; analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal includes:

[0031] Obtaining two frequency components of each sub-frame in the frequency domain signal and the amplitudes of m frequency components around each frequency component of the two frequency components, and obtaining a 2m+2-dimensional feature vector corresponding to each sub-frame;

[0032] Obtain the 2m+2-dimensional feature vectors of L consecutive sub-frames to obtain the frequency shift parameters.

[0033] Optionally, the electronic device further includes a motion state sensor, and the frequency domain characteristic signal further includes motion parameters.

[0034] Optionally, the frequency domain characteristic signal includes motion parameters, and the motion parameters are used to represent parameters of the electronic device in different motion states; the method further includes:

[0035] Acquire sensor data output by the motion state sensor; the sensor data includes acceleration data and angular velocity data;

[0036] Acquire the acceleration change rate according to the acceleration data, and acquire the angular velocity change rate according to the angular velocity data;

[0037] The acceleration change rate and the angular velocity change rate are normalized respectively to obtain the motion parameters, and the motion parameters are used as the frequency domain feature signals.

[0038] Optionally, acquiring the distance between the electronic device and the obstacle according to the frequency domain characteristic signal includes:

[0039] Get the distance recognition model;

[0040] The frequency domain characteristic signal is input into the distance recognition model to obtain the distance between the electronic device and the obstacle.

[0041] Optionally, the distance recognition model is composed of an n-layer convolutional neural network model, an n-layer recurrent neural network and a 1-layer fully connected layer.

[0042] According to a second aspect of an embodiment of the present disclosure, a distance acquisition device is provided, which is applicable to an electronic device, wherein the electronic device includes an ultrasonic generator and an ultrasonic receiver; the device includes:

[0043] An acoustic signal acquisition module, used to acquire the acoustic signal output by the ultrasonic receiver, wherein the acoustic signal is an echo signal of a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band emitted by the ultrasonic generator;

[0044] A frequency domain signal acquisition module, used to perform frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal;

[0045] A frequency domain feature acquisition module, used to analyze and process the frequency domain signal to obtain a frequency domain feature signal corresponding to the frequency domain signal; the frequency domain feature signal is used to characterize the relative motion between the electronic device and the obstacle;

[0046] The distance acquisition module is used to acquire the distance between the electronic device and the obstacle according to the frequency domain characteristic signal.

[0047] Optionally, the frequency domain signal acquisition module includes:

[0048] A frequency-shift signal acquisition submodule, used for performing frequency-shift processing on the sound wave signal to obtain a frequency-shift signal when the frequency of the sound wave signal is outside the target frequency band;

[0049] A down-sampled signal acquisition submodule, used for down-sampling the frequency-shifted signal to obtain a down-sampled signal;

[0050] A frame sequence acquisition submodule is used to perform frame division and windowing processing on the down-sampled signal to obtain a sound wave frame sequence containing a plurality of sub-frames;

[0051] The frequency domain signal acquisition submodule is used to perform frequency domain transformation on each subframe in the sound wave frame sequence to obtain a frequency domain signal containing frequency domain sub-signals corresponding to each subframe.

[0052] Optionally, the frequency domain characteristic signal includes at least one of the following: signal volume, relative spectrum signal, correlation characteristics and frequency shift parameters.

[0053] Optionally, the frequency domain characteristic signal includes a signal volume, and the signal volume is used to indicate the energy difference after different electronic devices receive the sound wave; the frequency domain characteristic acquisition module includes:

[0054] A component amplitude acquisition submodule, used to obtain the amplitude of each frequency component in the frequency domain signal;

[0055] A signal amplitude acquisition submodule is used to obtain the root mean square accumulation value of the amplitude of each frequency component to obtain the signal amplitude corresponding to the frequency domain signal;

[0056] A logarithmic amplitude acquisition submodule, used to obtain the logarithmic value of the signal amplitude, and obtain the logarithmic amplitude corresponding to the frequency domain signal;

[0057] The signal volume acquisition submodule is used to normalize the logarithmic amplitude to obtain the signal volume corresponding to the frequency domain signal.

[0058] Optionally, the frequency domain characteristic signal includes a relative spectrum signal, and the relative spectrum is used to represent the difference in interference fringes of the electronic device when it is close to and far away from an obstacle; and the frequency domain characteristic acquisition module includes:

[0059] An energy information acquisition submodule, used to acquire energy information corresponding to each frequency component in the frequency domain signal;

[0060] The relative spectrum acquisition submodule is used to obtain the relative energy of each frequency component and the base to obtain a relative spectrum signal.

[0061] Optionally, the frequency domain characteristic signal includes a correlation feature, and the correlation feature is used to represent the correlation feature between the ultrasonic generator transmission signal and the ultrasonic receiver reception signal; the frequency domain feature acquisition module includes:

[0062] A mutual correlation coefficient acquisition submodule, used to acquire the mutual correlation coefficient between the transmission signal of the ultrasonic generator and the reception signal of the ultrasonic receiver;

[0063] An autocorrelation coefficient acquisition submodule, used to obtain the autocorrelation coefficient of the frequency domain signal corresponding to the sound wave signal;

[0064] The frequency domain feature acquisition submodule is used to perform normalization processing on the mutual correlation coefficient and the autocorrelation coefficient respectively to obtain a frequency domain feature signal corresponding to the frequency domain signal.

[0065] Optionally, the frequency domain characteristic signal includes a frequency shift parameter, and the frequency shift parameter is used to indicate two events of the electronic device approaching and moving away, and the frequency domain characteristic acquisition module includes:

[0066] A feature vector acquisition submodule, used to acquire two frequency components of each subframe in the frequency domain signal and the amplitudes of m frequency components around each frequency component of the two frequency components, to obtain a 2m+2-dimensional feature vector corresponding to each subframe;

[0067] The frequency shift parameter acquisition submodule is used to obtain the 2m+2-dimensional feature vectors of L consecutive sub-frames to obtain the frequency shift parameters.

[0068] Optionally, the electronic device further includes a motion state sensor, and the frequency domain characteristic signal further includes motion parameters.

[0069] Optionally, the frequency domain characteristic signal includes motion parameters, and the motion parameters are used to represent parameters of the electronic device in different motion states; and the device further includes:

[0070] A sensor data acquisition module, used to acquire sensor data output by the motion state sensor; the sensor data includes acceleration data and angular velocity data;

[0071] An acceleration change rate acquisition module, used to acquire the acceleration change rate according to the acceleration data;

[0072] An angular velocity change rate acquisition module, used for acquiring the angular velocity change rate according to the angular velocity data;

[0073] The frequency domain feature acquisition module is used to normalize the acceleration change rate and the angular velocity change rate respectively to obtain the motion parameters, and the motion parameters are used as the frequency domain feature signals.

[0074] Optionally, the distance acquisition module includes:

[0075] A recognition model acquisition submodule is used to acquire a distance recognition model;

[0076] The distance acquisition submodule is used to input the frequency domain characteristic signal into the distance recognition model to obtain the distance between the electronic device and the obstacle.

[0077] Optionally, the distance recognition model is composed of an n-layer convolutional neural network model, an n-layer recurrent neural network and a 1-layer fully connected layer.

[0078] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0079] The ultrasonic generator is used to transmit a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band;

[0080] The ultrasonic receiver is used to receive a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band and output a sound wave signal;

[0081] Memory and processor;

[0082] The memory is used to store a computer program executable by the processor;

[0083] The processor is used to execute the computer program in the memory to implement the method as described in any one of the first aspects.

[0084] Optionally, the ultrasonic generator includes a signal transmitter, an analog-to-digital converter and a signal exciter; the signal transmitter is a speaker or a receiver;

[0085] The signal exciter is used to generate ultrasonic signals of different frequencies;

[0086] The analog-to-digital converter is used to convert the ultrasonic signal into an analog signal;

[0087] The signal transmitter is used to convert the analog signal into ultrasonic waves and radiate them into the surrounding space.

[0088] Optionally, the ultrasonic receiver includes a signal receiver and an analog-to-digital converter; the signal receiver includes at least one microphone;

[0089] The signal receiver is used to receive ultrasonic waves in the space and convert them into analog signals;

[0090] The analog-to-digital converter is used to convert the analog signal into a digital signal.

[0091] According to a fourth aspect of an embodiment of the present disclosure, a non-transitory computer-readable storage medium is provided, and when an executable computer program in the storage medium is executed by a processor, the method described in any one of the first aspects can be implemented.

[0092] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0093] In the scheme provided by the embodiment of the present disclosure, the sound wave signal output by the ultrasonic receiver can be obtained, and the sound wave signal is the bandpass signal of the preset frequency band emitted by the ultrasonic generator and the echo signal of the high-frequency signal of at least one frequency band; then, the sound wave signal is processed in the frequency domain to obtain the frequency domain signal corresponding to the sound wave signal; thereafter, the frequency domain signal is analyzed and processed to obtain the frequency domain characteristic signal corresponding to the frequency domain signal; the frequency domain characteristic signal is used to characterize the relative motion between the electronic device and the obstacle; finally, the distance between the electronic device and the obstacle is obtained according to the frequency domain characteristic signal. In this way, the ultrasonic generator and the ultrasonic receiver in this embodiment can realize the transmission and reception of ultrasonic signals without opening a hole on the display screen of the electronic device, and the frequency domain characteristic signal can be determined, that is, the relative motion between the electronic device and the obstacle can be determined, and finally the distance between the electronic device and the obstacle can be obtained, and the anti-mistouch function of the full-screen electronic device can be reliably realized.

[0094] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0095] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0096] Figure 1 It is a block diagram of an electronic device according to an exemplary embodiment.

[0097] Figure 2 is a block diagram of an ultrasonic generator according to an exemplary embodiment.

[0098] Figure 3 is a time domain waveform diagram of an ultrasonic signal according to an exemplary embodiment.

[0099] Figure 4 is a frequency domain waveform diagram of an ultrasonic signal according to an exemplary embodiment.

[0100] Figure 5 is a block diagram of an ultrasonic receiver according to an exemplary embodiment.

[0101] Figure 6 It is a block diagram of an analyzer according to an exemplary embodiment.

[0102] Figure 7 The figure is a flow chart of a distance acquisition method according to an exemplary embodiment.

[0103] Figure 8The present invention is a flowchart of obtaining a frequency domain signal according to an exemplary embodiment.

[0104] Fig. 9 The present invention is a flow chart showing a method for obtaining a frequency domain characteristic signal according to an exemplary embodiment.

[0105] Fig.10 The figure is another flow chart of obtaining a frequency domain characteristic signal according to an exemplary embodiment.

[0106] Fig.11 The flowchart of another method for obtaining a frequency domain characteristic signal is shown according to an exemplary embodiment.

[0107] Fig.12 The flowchart of another method for obtaining a frequency domain characteristic signal is shown according to an exemplary embodiment.

[0108] Fig.13 is a schematic diagram of simulation of a frequency shift parameter according to an exemplary embodiment.

[0109] Fig.14 The flowchart of another method for obtaining a frequency domain characteristic signal is shown according to an exemplary embodiment.

[0110] Fig.15 The figure is a flow chart showing a method of obtaining a distance according to an exemplary embodiment.

[0111] Fig.16 The figure is a block diagram of a distance acquisition method and device according to an exemplary embodiment.

[0112] Fig.17 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0113] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described exemplarily below do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices consistent with some aspects of the present disclosure as detailed in the attached claims. It should be noted that the features in the following embodiments and implementations may be combined with each other without conflict.

[0114] In order to solve the above technical problems, the embodiments of the present disclosure provide a distance acquisition method and device, an electronic device, and a storage medium. The above distance acquisition method can be applied to electronic devices, which may include but are not limited to smart phones, smart watches, smart glasses, automotive devices, and other devices that need to use distance to achieve corresponding functions, wherein the functions related to distance include but are not limited to the function of preventing accidental touches and the function of turning off the screen.

[0115] The inventive concept of the present disclosure is: first, an ultrasonic generator and an ultrasonic receiver are provided. The ultrasonic generator may include a speaker or a microphone, and the ultrasonic receiver may include at least one microphone. Since microphones, speakers or microphones are all commonly used components of electronic devices and there is no need to reserve openings in the display screen of the electronic device, the realization of the full screen will not be affected. Second, the ultrasonic generator can emit an ultrasonic signal and the ultrasonic receiver receives an echo signal of the ultrasonic signal. Considering that there is Doppler efficiency when the electronic device and the obstacle (such as the user's face) move relative to each other, which causes the frequency domain characteristics of the sound wave signal to change, the frequency domain characteristic signal corresponding to the sound wave signal can be obtained in this scenario to determine the relative motion between the electronic device and the obstacle, and finally the distance between the electronic device and the obstacle is obtained, thereby ensuring the reliable implementation of functions including the anti-mistouch function.

[0116] To realize the above-mentioned inventive concept, the functional block diagram of the electronic device disclosed in the present invention is as follows: Figure 1 See Figure 1 The electronic device includes an ultrasonic generator 11, an ultrasonic receiver 12, an analyzer 13 and an identifier 14. The ultrasonic generator 11 is used to transmit a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band. The ultrasonic receiver 12 is used to receive the bandpass signal of the preset frequency band and the high-frequency signal of at least one frequency band and output a sound wave signal. The analyzer 13 is used to obtain a frequency domain characteristic signal corresponding to the sound wave signal; the above-mentioned frequency domain characteristic signal is used to characterize the relative motion between the electronic device and the obstacle. The identifier 14 is used to obtain the distance between the electronic device and the obstacle according to the frequency domain characteristic signal.

[0117] In one embodiment, see Figure 2 The ultrasonic generator 11 includes a signal transmitter 23, an analog-to-digital converter 22 and a signal exciter 21.

[0118] The signal exciter 21 is used to generate ultrasonic signals of different frequencies, such as a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band. In one example, the signal exciter 21 includes an exciter and a filter, and the exciter can generate multiple ultrasonic signals of different frequencies, which can be filtered to generate a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band. It is understandable that the more groups of high-frequency signals there are, the better the robustness of the solution, so technicians can select an appropriate number of high-frequency signals according to specific scenarios.

[0119] The analog-to-digital converter 22 is used to convert the ultrasonic signal into an analog signal. Here, the analog-to-digital converter 22 is a DAC chip.

[0120] The signal transmitter 23 is used to convert the analog signal into ultrasonic waves and radiate them into the surrounding space. The signal transmitter 23 includes a speaker or a receiver or an ultrasonic wave transmitting device. Figure 3 The waveform 31 shown and in the frequency domain are Figure 4 Waveform 41 and waveform 42 are shown.

[0121] See also Figure 3 and Figure 4 , the frequency interval ΔF between any two signals of the bandpass signal 41 and the high-frequency signal 42 of at least one frequency band is greater than or equal to the set frequency. The value range of the set frequency is 500 to 1000 Hz. In one example, the set frequency is 500 Hz. This is because, considering that the existence of intermodulation distortion will cause the voice signal to be modulated to the ultrasonic frequency band, generating characteristics similar to Doppler frequency shift, thereby interfering with the accuracy of the recognition result.

[0122] Assuming that the frequency (base frequency) of the speech signal is f1 and the frequency of the ultrasonic signal is f2, when the volume of the speech signal is too large, that is, when it reaches the nonlinear region of the power amplifier, the power amplifier will produce nonlinear distortion, which is manifested as the modulation of the speech frequency band signal to the ultrasonic frequency band, which is called intermodulation distortion. The signal frequency generated by the intermodulation distortion is f2±f1.

[0123] In the process of implementing the scheme of the present invention, the inventors have confirmed through a large number of experiments that the Doppler frequency shift characteristics generated by modulating the fundamental frequency signal of human voice into the ultrasonic frequency band are highly similar to the Doppler frequency shift characteristics of the scene approaching / moving away from obstacles, which may cause misrecognition and lead to the phenomenon of mistaken black screen in voice message scenes.

[0124] The inventor has confirmed through a large number of experiments that the relative motion between the electronic device and the obstacle is less than or equal to 1m / s. Assuming that the ultrasonic frequency range is 20kHz-30kHz, and the maximum possible frequency shift is calculated based on the maximum ultrasonic frequency of 30kHz:

[0125] Δf_max=(u+v) / (uv)*ff=(340+1) / (340-1)*30000-30000= 177Hz; (1)

[0126] In formula (1), u represents the sound velocity of the ultrasonic wave in the medium, v represents the relative speed between the electronic device and the obstacle, and f represents the maximum frequency of the ultrasonic wave emitted by the ultrasonic generator.

[0127] To ensure that the signal generated by intermodulation distortion does not interfere with the Doppler frequency shift characteristics, it is necessary to satisfy the interval between each group of ultrasonic signals emitted by the ultrasonic generator, that is, the interval between the bandpass signal and the high-frequency signals of each frequency or the interval between any two high-frequency signals of any frequency Δf>Δf_max+f1.

[0128] Considering that the fundamental frequency of male voice is 100-200 Hz and that of female voice is 200-350 Hz, Δf_max+f1=177+350=527 Hz, the set frequency can be set to 500 Hz, that is, the frequency interval between each group of ultrasonic signals (ie, the set frequency) must be greater than or equal to 500 Hz.

[0129] In one embodiment, see Figure 5 The ultrasonic receiver 12 includes a signal receiver 51 and an analog-to-digital converter 52.

[0130] The signal receiver is used for receiving ultrasonic waves in the space and converting them into analog signals; the signal receiver includes at least one microphone.

[0131] The analog-to-digital converter is used to convert the analog signal into a digital signal and send it to the analyzer 13. In one example, the analog-to-digital converter is implemented by an ADC chip.

[0132] In one embodiment, see Figure 6 The analyzer 13 may include a frequency domain signal acquisition module 61 , a frequency domain feature acquisition module 62 and a frequency domain feature synthesis module 63 .

[0133] The frequency domain signal acquisition module 61 is used to perform frequency domain processing on the sound wave signal (received by the ultrasonic receiver) to obtain a frequency domain signal corresponding to the sound wave signal.

[0134] The frequency domain feature acquisition module 62 is used to analyze and process the frequency domain signal to obtain a frequency domain feature signal corresponding to the frequency domain signal; the frequency domain feature signal is used to characterize the relative motion between the electronic device and the obstacle.

[0135] The frequency domain feature synthesis module 63 is used to obtain the distance between the electronic device and the obstacle according to the frequency domain feature signal.

[0136] In one example, the frequency domain signal acquisition module 61 may include a frequency shift unit, a downsampling unit and a frequency domain transformation unit. The frequency domain feature acquisition module 62 may include a signal volume unit, a relative spectrum signal unit, a related feature unit, a frequency shift parameter unit and a motion parameter unit. It should be noted that the specific scheme of the analyzer 13 to obtain the distance can refer to the scheme of the subsequent method embodiment, which will not be described here.

[0137] In one embodiment, the identifier 14 includes a distance recognition model for obtaining the distance between the electronic device and the obstacle based on the frequency domain characteristic signal. The distance recognition model is composed of an n-layer convolutional neural network model (CNN), an n-layer recurrent neural network (RNN) and a 1-layer fully connected layer. The distance recognition model can be pre-stored in the electronic device, and the coefficients of each layer of the neural network model are pre-trained. It is understandable that the above-mentioned distance recognition model can also be implemented using other neural network models or a combination of neural network models. When the distance between the electronic device and the obstacle can be identified based on the frequency domain characteristic signal, the corresponding scheme falls within the protection scope of the present disclosure.

[0138] Based on the electronic device provided in the above embodiment, the embodiment of the present disclosure further provides a distance acquisition method. Figure 7 FIG. 1 is a flow chart showing a distance acquisition method according to an exemplary embodiment. Figure 7 , a distance acquisition method suitable for Figure 1 The electronic device shown in the figure, the method includes steps 71 to 74.

[0139] In step 71, the sound wave signal output by the ultrasonic receiver is obtained.

[0140] In this step, the processor of the electronic device can control the ultrasonic generator to transmit an ultrasonic signal, which includes a bandpass signal of a preset frequency band and an echo signal of a high-frequency signal of at least one frequency band. The value range of the preset frequency band is 20kHz to 30kHz. In one example, the value range of the preset frequency band is 24kHz to 27kHz. The high-frequency signal of at least one frequency band can be 30.5kHz and 33kHz. Under the condition that the frequency interval of the two groups of ultrasonic signals exceeds the set frequency and the more high-frequency signals, the better the robustness, the frequency and / or number of the high-frequency signal can be set, and the corresponding scheme falls within the protection scope of the present disclosure. In one example, the ultrasonic generator can transmit an ultrasonic signal according to a set period, and the ultrasonic signal includes a bandpass signal of a preset frequency band and an echo signal of a high-frequency signal of at least one frequency band. When there is a need to obtain a sound wave signal, the processor can turn on the ultrasonic receiver at the start time of the ultrasonic generator transmitting the ultrasonic signal, and the ultrasonic receiver can receive the above-mentioned sound wave signal. Of course, those skilled in the art can also select a suitable method to transmit ultrasonic signals according to specific scenarios. For example, the ultrasonic receiver can be turned on at any time, and the emission time of the ultrasonic signal can be inquired after receiving the sound wave signal. The scheme of the present disclosure can also be implemented, and the corresponding scheme falls within the protection scope of the present disclosure.

[0141] In this step, the ultrasonic signal will generate an echo signal when encountering an obstacle (such as the user's face). The processor of the electronic device can control the ultrasonic receiver to receive the echo signal and obtain the sound wave signal output by the ultrasonic receiver. It is understandable that the sound wave signal includes a bandpass signal of a preset frequency band and an echo signal of a high-frequency signal of at least one frequency band.

[0142] In step 72, the sound wave signal is processed in the frequency domain to obtain a frequency domain signal corresponding to the sound wave signal.

[0143] In this step, the processor of the electronic device (the processor is Figure 1 The analyzer of the example) can perform frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal, see Figure 8 , including steps 81 to 84.

[0144] In step 81, when the frequency of the sound wave signal is outside the target frequency band, the sound wave signal is subjected to frequency shift processing to obtain a frequency shift signal.

[0145] In this step, the processor can obtain the frequency of the sound wave signal. When the frequency of the sound wave signal is outside the target frequency band, the processor can perform frequency shift processing on the sound wave signal to shift the center frequency of the sound wave signal to zero frequency, and then perform low-pass filtering to extract the frequency shift signal of the required frequency band. shiftThe calculation formula of is shown in formula (2).

[0146]

[0147] W shift =W·e -ib ; (3)

[0148] In equations (2) and (3), b represents the phase value of the frequency-shifted signal, and f 0 Represents the frequency of the sound wave signal, f t represents the frequency of the frequency-shifted signal, e represents a natural constant, i 2 =-1, W represents the amplitude of the sound wave signal, W shift represents the amplitude of the frequency-shifted signal, and r represents a natural number.

[0149] In some examples, considering that 24kHz is an integer multiple of 3kHz, the processor may first use a 24kHz to 27kHz bandpass filter to filter the sound wave signal. Taking the sampling rate of the sound wave signal as 96kHz as an example, a 16-fold down-conversion, i.e., a sampling rate of 6kHz, may be used to reduce 24kHz to 27kHz to 0 to 3kHz, thereby not changing the phase of the sound wave signal.

[0150] In one example, e -ib It can be converted into formula (4) according to Euler's formula.

[0151] e -ib =cos(-b)+isin(-b)=cosb-isinb; (4)

[0152] When the target spectrum is determined, the calculation result of the trigonometric function in formula (4) is periodic, so in this example, the trigonometric function value of a cycle can be stored to form a trigonometric function value table. In subsequent cycles, the trigonometric function value of the corresponding sound wave phase can be obtained by looking up the table to obtain the frequency shift signal. This method can reduce the amount of calculation of the processor and reduce the power consumption of the processor.

[0153] When the frequency of the sound wave signal is within the target frequency band, there is no need for frequency shift processing and the process directly jumps to step 82 .

[0154] In step 82, down-sampling processing is performed on the frequency-shifted signal to obtain a down-sampled signal.

[0155] In this step, the processor of the electronic device can downsample the frequency-shifted signal to obtain a downsampled signal Wdown. The downsampling process can reduce the amount of data, thereby reducing the processor.

[0156] In step 83, the down-sampled signal is subjected to frame-by-frame windowing processing to obtain a sound wave frame sequence including a plurality of frames.

[0157] In this step, the processor of the electronic device can perform frame division and windowing processing on the downsampled signal. Framing can ensure the short-term nature of the processed data, and windowing can reduce spectrum energy leakage. In one example, the window function can include but is not limited to a triangular window, a Hamming window, etc., which can be selected according to the specific scenario and is not limited here.

[0158] In step 84, frequency domain transformation is performed on each sub-frame in the sound wave frame sequence to obtain a frequency domain signal including frequency domain sub-signals corresponding to each sub-frame.

[0159] In this step, the processor of the electronic device can perform frequency domain conversion on the downsampled signal, such as fast Fourier transform (FFT) or discrete cosine transform (DCT), etc., to obtain a sound wave frame sequence F. Taking FFT as an example, assuming that the frequency domain resolution after frequency domain conversion is p (p-point FFT), that is, each frame F contains F(1), F(2), ... F(p) a total of p frequency components, and p is a positive integer.

[0160] In step 73, the frequency domain signal is analyzed and processed to obtain a frequency domain characteristic signal corresponding to the frequency domain signal; the frequency domain characteristic signal is used to characterize the relative motion between the electronic device and the obstacle.

[0161] In this step, the frequency domain characteristic signal includes at least one of the following: signal volume, relative spectrum signal, correlation feature and frequency shift parameter. Among them, the signal volume is used to indicate the energy difference between different electronic devices after receiving the sound wave. The correlation feature is used to indicate the correlation feature between the signal transmitted by the ultrasonic generator and the signal received by the ultrasonic receiver. The frequency shift parameter is used to indicate the two events of the electronic device approaching and moving away. The relative spectrum is used to indicate the difference in interference fringes when the electronic device approaches and moves away from the obstacle.

[0162] In one example, when the frequency domain characteristic signal includes a signal volume, the processor may analyze and process the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal, see Fig. 9 , including steps 91 to 94.

[0163] In step 91, the processor may obtain the amplitude of each frequency component in the frequency domain signal.

[0164] In this step, the amplitude of each frequency component in the frequency domain signal can be calculated by formula (5).

[0165]

[0166] In formula (5), i represents the i-th frequency component, and its value is 1, 2, ..., p; re(i) represents the real part of the i-th frequency component; im(i) represents the imaginary part of the i-th frequency component; F R (i) represents the amplitude of the i-th frequency component.

[0167] In step 92, the processor may obtain the accumulated value of the root mean square of the amplitude of each frequency component to obtain the signal amplitude corresponding to the frequency domain signal. The signal amplitude may be calculated by formula (6).

[0168]

[0169] In formula (6), F pow Indicates the signal amplitude.

[0170] In step 93, the processor may obtain the logarithmic value of the signal amplitude to obtain the logarithmic amplitude corresponding to the frequency domain signal. The logarithmic amplitude may be calculated by formula (7).

[0171]

[0172] In formula (7), F' represents the logarithmic amplitude.

[0173] pow

[0174] In step 94, the processor may normalize the logarithmic amplitude to obtain a signal volume corresponding to the frequency domain signal.

[0175] For example, the processor can use the statistical result of the logarithmic amplitude to normalize the logarithmic amplitude by taking the boundary value to obtain the signal volume corresponding to the above-mentioned frequency domain signal. In other words, the processor can obtain the frequency domain characteristic signal corresponding to the frequency domain signal. In this way, in this example, by obtaining the signal volume, the problem of energy difference when different electronic devices receive ultrasonic signals can be alleviated or eliminated.

[0176] In one example, when the frequency domain characteristic signal includes a relative spectrum signal, the processor may analyze and process the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal, see Fig.10 , including steps 101 to 102.

[0177] In step 101, the processor may obtain energy information corresponding to each frequency component in the frequency domain signal, wherein the energy signal may be determined by the amplitude of the frequency component.

[0178] In this step, the processor may sort the energy information of each frequency component to obtain the maximum value of the energy information, and use the maximum value as the basis of the relative frequency spectrum signal.

[0179] In step 102, the processor can obtain the relative energy of each frequency component and the base to obtain a relative spectrum signal. For example, the processor can use the maximum value as the base of the relative spectrum signal, calculate the energy information of each frequency component and the relative energy of the base, and obtain the relative spectrum signal Frel. The above relative spectrum signal Frel is a proportional value, so its value range is 0 to 1. In this way, by obtaining the relative energy in this step, the difference in the fringe state presented by the interference spectrum of the electronic device when it approaches or moves away from an obstacle can be characterized, which helps to improve the accuracy of subsequent results.

[0180] In one example, when the frequency domain characteristic signal includes relevant features, the processor can analyze and process the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal, see Fig.11 , including steps 111 to 113.

[0181] In step 111, the processor may obtain a cross-correlation coefficient between the ultrasonic generator transmission signal and the ultrasonic receiver reception signal. The cross-correlation coefficient may be calculated using formula (8).

[0182] r xy =F -1 {Y(k)X * (k)}=F -1 {P yx (k)}; (8)

[0183] In formula (8), Y(k) represents the frequency domain signal corresponding to the acoustic wave signal, X(k) represents the frequency domain signal corresponding to the emitted ultrasonic wave, “*” represents the conjugate signal, and P yx (k) represents the cross power spectrum, F -1 {} represents inverse Fourier transform, r xy Represents the mutual correlation coefficient.

[0184] In this step, the cross-correlation coefficient may be normalized by taking boundary values ​​based on the statistical results of the cross-correlation coefficient to obtain the final cross-correlation coefficient.

[0185] It should be noted that in this step, the time delay between the transmitted ultrasonic wave and the received sound wave signal can be obtained by obtaining the mutual correlation coefficient. This is because the time delay is the time taken for the ultrasonic wave to be transmitted between the electronic device and the obstacle. When the distance between the electronic device and the obstacle is different, the ultrasonic wave signal propagation time will be different. In other words, in this step, the distance between the electronic device and the obstacle is calculated by obtaining the mutual correlation coefficient, which is conducive to improving the accuracy of subsequent results.

[0186] In step 112, the processor may obtain the autocorrelation coefficient of the frequency domain signal corresponding to the acoustic wave signal. The mutual correlation coefficient may be calculated by formula (9).

[0187] r yy =F -1 {Y(k)Y * (k)}=F -1 {P yy (k)}; (9)

[0188] In formula (9), Y(k) represents the frequency domain signal corresponding to the sound wave signal, P yy (k) represents the power spectrum, r yy Represents the autocorrelation coefficient.

[0189] In this step, the autocorrelation coefficient may be normalized by taking boundary values ​​based on the statistical result of the autocorrelation coefficient to obtain the final autocorrelation coefficient.

[0190] It should be noted that the autocorrelation coefficient, also known as the serial correlation coefficient, is the cross-correlation between a signal and itself at different time points. It is used to suppress the influence of random noise on the sound wave signal, which is beneficial to improve the accuracy of subsequent results.

[0191] In step 113, the processor may perform normalization processing on the mutual correlation coefficient and the autocorrelation coefficient respectively to obtain a frequency domain characteristic signal corresponding to the frequency domain signal.

[0192] In one example, when the frequency domain characteristic signal includes a frequency shift parameter, the processor may analyze and process the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal, see Fig.12 , including steps 121 to 122.

[0193] In step 121, the processor may obtain two frequency components of each sub-frame in the frequency domain signal and amplitudes of m frequency components around each frequency component of the two frequency components to obtain a 2m+2-dimensional feature vector corresponding to each sub-frame.

[0194] It is understandable that when there is relative motion between the two objects transmitting and receiving ultrasonic waves, the received wave will produce a frequency shift compared with the transmitted wave, that is, when the two objects are close to each other, the frequency of the received ultrasonic wave (that is, the above-mentioned sound wave signal) will increase, and when the two objects are away from each other, the frequency of the above-mentioned sound wave signal will decrease. The frequency of the sound wave signal is shown in formula (10).

[0195]

[0196] In formula (10), f' represents the frequency of the sound wave signal; f represents the frequency of the transmitted ultrasonic wave; u represents the speed of sound in the medium (here, air); v 0 Indicates the moving speed of the ultrasonic receiver relative to the ultrasonic generator. If it is close, it takes a positive sign, and if it is far away, it takes a negative sign; v s It indicates the moving speed of the ultrasonic generator relative to the ultrasonic receiver. If it is close, it takes a negative sign, and if it is far away, it takes a positive sign.

[0197] Considering that the ultrasonic generator and the ultrasonic receiver in the present disclosure are both located in the electronic device, when the electronic device is close to the user's face, such as answering a call, the ultrasonic generator and the ultrasonic receiver are close to each other, and the frequency of the received sound wave signal will move toward the high frequency direction; when the electronic device is far away from the user's face, such as hanging up the phone, the ultrasonic generator and the ultrasonic receiver are far away from each other, and the frequency of the received sound wave signal will move toward the low frequency direction. Based on this analysis content, the processor can extract two parameters fshift_h and fshift_l from the frequency domain signal that characterize the movement of the spectrum toward the high frequency direction and the movement toward the low frequency, which are used to describe the approach event and the distance event.

[0198] In this step, the processor can obtain the highest frequency fh and the lowest frequency fl of the frequency domain signal. For the highest frequency fh, the processor can obtain the highest frequency fh and a preset number m (such as 2 to 10) higher frequency energy signals near the highest frequency and perform weighted fusion to obtain the parameter fshift_h. It is understandable that the weighted fusion process can be equal weight fusion, or the weight ratio can be adjusted according to the specific situation. For example, the higher the frequency, the greater the weight. It is understandable that the larger the frequency shift, the larger the parameter fshift_h. For the lowest frequency fl, the processor can obtain the lowest frequency fl and a preset number m lower frequency energy signals near the lowest frequency and perform weighted fusion to obtain the parameter fshift_l. Among them, the larger the frequency shift, the larger the parameter fshift_l.

[0199] In this step, the processor may normalize each parameter to obtain the final parameter fshift_h and parameter fshift_l.

[0200] It is understandable that the above parameters fshift_h and fshift_l are extracted based on the bandpass signal. In high-volume scenarios such as voice messages, they will be affected by intermodulation distortion, resulting in feature disorder or distortion. In this step, the frequency shift feature of the high-frequency signal can be extracted. Since there is a frequency interval between the high-frequency signal and the bandpass signal, it is not affected by intermodulation distortion. The amplitudes of the two frequency components corresponding to each subframe and the m frequency components around them are calculated, as shown in formula (11).

[0201]

[0202] In formula (11), k represents the kth frequency component, and its value is 1, 2, ..., p; re(k) represents the real part of the kth frequency component; im(k) represents the imaginary part of the kth frequency component; F R (k) represents the amplitude of the kth frequency component.

[0203] In this way, the processor can obtain the amplitudes corresponding to 2m+2 frequency components.

[0204] In step 122, the processor may obtain 2m+2-dimensional feature vectors of L consecutive sub-frames to obtain frequency shift parameters.

[0205] In this step, the processor can form a 2m+2-dimensional feature vector with the corresponding amplitudes of the 2m+2 frequency components of L consecutive sub-frames to obtain a frequency shift parameter for identifying events of approaching or moving away from obstacles. Fig.13 , ellipses 1 and 3 represent the locations of approach events, and ellipses 2 and 4 represent the locations of distance events. That is, when the electronic device approaches an obstacle, the frequency of the received sound wave signal moves toward the high frequency direction (i.e. upward); when the electronic device moves away from the obstacle, the frequency of the received sound wave signal moves toward the low frequency direction (i.e. downward).

[0206] In some embodiments, the electronic device further includes a motion state sensor, which includes but is not limited to a velocity sensor, an acceleration sensor, a gravity meter, a gyroscope, etc. At this time, the frequency domain characteristic signal also includes motion parameters, which are used to represent parameters of the electronic device in different motion states. At this time, the processor can also obtain the motion parameters as the above-mentioned frequency domain characteristic signal, see Fig.14 , including steps 141 to 143.

[0207] In step 141 , the processor may obtain sensor data output by the motion state sensor.

[0208] In this step, the processor may communicate with the motion state sensor to obtain sensor data output by the motion state sensor, where the sensor data includes acceleration data and angular velocity data.

[0209] In step 142, the processor may obtain the acceleration change rate according to the acceleration data, and obtain the angular velocity change rate according to the angular velocity data.

[0210] In this step, the processor may obtain the acceleration change rate Adiff according to the acceleration data, and obtain the angular velocity change rate Gdiff according to the angular velocity data.

[0211] It should be noted that before obtaining the acceleration change rate Adiff and the angular velocity change rate Gdiff, the processor can smooth the acceleration data and angular velocity data respectively to reduce the impact of noise. Taking the acceleration change rate Adiff as an example, the processor can obtain a set of acceleration data. For each acceleration in the acceleration data, the previous acceleration and the next acceleration of the current acceleration can be obtained, and then the average value of these three accelerations can be obtained to replace the current acceleration value. By analogy, all accelerations are replaced to obtain the smoothed acceleration data. Finally, the smoothed acceleration data is used to obtain the acceleration change rate Adiff, that is, the first acceleration and the last acceleration data of a calculation cycle are selected, the difference between the two is calculated, and then divided by the length of the calculation cycle to obtain the acceleration change rate Adiff.

[0212] In step 143, the processor may normalize the acceleration change rate and the angular velocity change rate respectively to obtain the motion parameters, and the motion parameters are used as the frequency domain feature signals.

[0213] In step 74, the distance between the electronic device and the obstacle is obtained according to the frequency domain characteristic signal.

[0214] In this step, the frequency domain characteristic signal may include at least one of a signal volume, a relative spectrum signal, a correlation feature, a frequency shift parameter, and a motion parameter. It is understandable that the more parameters there are, the more accurate the distance obtained. The processor may combine the above at least one parameter into an M-dimensional feature vector. In one example, the processor uses at least two parameters as the frequency domain characteristic signal and combines them into an M-dimensional feature vector. Furthermore, the processor may obtain the distance between the electronic device and the obstacle based on the frequency domain characteristic signal, see Fig.15 , including steps 151 to 152.

[0215] In step 151 , the processor may obtain a distance recognition model.

[0216] In this step, the electronic device pre-stores a trained distance recognition model, which is composed of an n-layer convolutional neural network model, an n-layer recurrent neural network model, and a 1-layer fully connected layer.

[0217] In this step, the processor may obtain the above-mentioned distance recognition model.

[0218] In step 152, the processor may input the frequency domain characteristic signal into the distance recognition model to obtain the distance between the electronic device and the obstacle.

[0219] In one example, the processor may convert the logarithmic magnitude F′ into pow, frequency shift parameters fshift_h and fshift_l, relative spectrum Frel, mutual correlation coefficient rxy, autocorrelation coefficient ryy, acceleration change rate Adiff and angular velocity change rate Gdiff are combined into an M-dimensional feature vector and input into the distance recognition model. The distance recognition model can output the recognition result. For example, in the answering phone scenario, when the user answers the phone, the phone is close to the user's face, and the distance recognition model can output the first distance result; when the phone continues to approach the user's face, the distance recognition model can output the second distance result. When the phone is away from the user's face, the distance recognition model can output the third distance result, and when the phone continues to be away from the user's face, the distance recognition model can output the fourth distance result. It is understandable that the distance recognition model can output the corresponding distance result according to the feature combination, and the above-mentioned first distance result, second distance result, third distance result and fourth distance result are only used for example description. The processor can also control the opening and closing of the anti-misunderstanding function according to the above-mentioned distance result to achieve the effect of improving the anti-mistaken touch function.

[0220] In another example, when the electronic device performs obstacle detection in the screen-off state, when the distance recognition model outputs the distance result and detects that the device is close to an obstacle, the screen anti-mistouch and fingerprint recognition functions are turned off; when the device is far away from the obstacle, the screen anti-mistouch and fingerprint recognition functions can be turned on.

[0221] At this point, the scheme provided by the embodiment of the present disclosure can obtain the sound wave signal output by the ultrasonic receiver, and the sound wave signal is the echo signal of the bandpass signal of the preset frequency band and the high-frequency signal of at least one frequency band emitted by the ultrasonic generator; then, the sound wave signal is processed in the frequency domain to obtain the frequency domain signal corresponding to the sound wave signal; thereafter, the frequency domain signal is analyzed and processed to obtain the frequency domain characteristic signal corresponding to the frequency domain signal; the frequency domain characteristic signal is used to characterize the relative motion between the electronic device and the obstacle; finally, the distance between the electronic device and the obstacle is obtained according to the frequency domain characteristic signal. In this way, the ultrasonic generator and the ultrasonic receiver in this embodiment can realize the transmission and reception of ultrasonic signals without opening a hole on the display screen of the electronic device, and the frequency domain characteristic signal can be determined, that is, the relative motion between the electronic device and the obstacle can be determined, and finally the distance between the electronic device and the obstacle can be obtained, and the anti-mistouch function of the full-screen electronic device can be reliably realized.

[0222] Based on a distance acquisition method provided in an embodiment of the present disclosure, an embodiment of the present disclosure further provides a distance acquisition device, which is applicable to an electronic device, wherein the electronic device includes an ultrasonic generator and an ultrasonic receiver; see Fig.16 , the device comprises:

[0223] The acoustic wave signal acquisition module 161 is used to acquire the acoustic wave signal output by the ultrasonic receiver, wherein the acoustic wave signal is an echo signal of a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band emitted by the ultrasonic generator;

[0224] A frequency domain signal acquisition module 162 is used to perform frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal;

[0225] The frequency domain feature acquisition module 163 is used to analyze and process the frequency domain signal to obtain a frequency domain feature signal corresponding to the frequency domain signal; the frequency domain feature signal is used to characterize the relative motion between the electronic device and the obstacle;

[0226] The distance acquisition module 164 is used to acquire the distance between the electronic device and the obstacle according to the frequency domain characteristic signal.

[0227] In one embodiment, the frequency domain signal acquisition module includes:

[0228] A frequency-shift signal acquisition submodule, used for performing frequency-shift processing on the sound wave signal to obtain a frequency-shift signal when the frequency of the sound wave signal is outside the target frequency band;

[0229] A down-sampled signal acquisition submodule, used for down-sampling the frequency-shifted signal to obtain a down-sampled signal;

[0230] A frame sequence acquisition submodule is used to perform frame division and windowing processing on the down-sampled signal to obtain a sound wave frame sequence containing a plurality of sub-frames;

[0231] The frequency domain signal acquisition submodule is used to perform frequency domain transformation on each subframe in the sound wave frame sequence to obtain a frequency domain signal containing frequency domain sub-signals corresponding to each subframe.

[0232] In one embodiment, the frequency domain characteristic signal includes at least one of the following: signal volume, relative spectrum signal, correlation characteristics and frequency shift parameters.

[0233] In one embodiment, the frequency domain characteristic signal includes a signal volume, and the signal volume is used to indicate the energy difference between different electronic devices after receiving the sound wave; the frequency domain characteristic acquisition module includes:

[0234] A component amplitude acquisition submodule, used to obtain the amplitude of each frequency component in the frequency domain signal;

[0235] A signal amplitude acquisition submodule is used to obtain the root mean square accumulation value of the amplitude of each frequency component to obtain the signal amplitude corresponding to the frequency domain signal;

[0236] A logarithmic amplitude acquisition submodule, used to obtain the logarithmic value of the signal amplitude, and obtain the logarithmic amplitude corresponding to the frequency domain signal;

[0237] The signal volume acquisition submodule is used to normalize the logarithmic amplitude to obtain the signal volume corresponding to the frequency domain signal.

[0238] In one embodiment, the frequency domain characteristic signal includes a relative spectrum signal, and the relative spectrum is used to represent the difference in interference fringes of the electronic device when it is close to and far away from an obstacle; the frequency domain characteristic acquisition module includes:

[0239] An energy information acquisition submodule, used to acquire energy information corresponding to each frequency component in the frequency domain signal;

[0240] The relative spectrum acquisition submodule is used to obtain the relative energy of each frequency component and the base to obtain a relative spectrum signal.

[0241] In one embodiment, the frequency domain characteristic signal includes a correlation feature, and the correlation feature is used to represent the correlation feature between the ultrasonic generator transmission signal and the ultrasonic receiver reception signal; the frequency domain feature acquisition module includes:

[0242] A mutual correlation coefficient acquisition submodule, used to acquire the mutual correlation coefficient between the transmission signal of the ultrasonic generator and the reception signal of the ultrasonic receiver;

[0243] An autocorrelation coefficient acquisition submodule, used to obtain the autocorrelation coefficient of the frequency domain signal corresponding to the sound wave signal;

[0244] The frequency domain feature acquisition submodule is used to perform normalization processing on the mutual correlation coefficient and the autocorrelation coefficient respectively to obtain a frequency domain feature signal corresponding to the frequency domain signal.

[0245] In one embodiment, the frequency domain characteristic signal includes a frequency shift parameter, and the frequency shift parameter is used to indicate two events of the electronic device approaching and moving away, and the frequency domain characteristic acquisition module includes:

[0246] A feature vector acquisition submodule, used to acquire two frequency components of each subframe in the frequency domain signal and the amplitudes of m frequency components around each frequency component of the two frequency components, to obtain a 2m+2-dimensional feature vector corresponding to each subframe;

[0247] The frequency shift parameter acquisition submodule is used to obtain the 2m+2-dimensional feature vectors of L consecutive sub-frames to obtain the frequency shift parameters.

[0248] In one embodiment, the electronic device further includes a motion state sensor, and the frequency domain characteristic signal further includes motion parameters.

[0249] In one embodiment, the frequency domain characteristic signal includes motion parameters, and the motion parameters are used to represent parameters of the electronic device in different motion states; the device also includes:

[0250] A sensor data acquisition module, used to acquire sensor data output by the motion state sensor; the sensor data includes acceleration data and angular velocity data;

[0251] An acceleration change rate acquisition module, used to acquire the acceleration change rate according to the acceleration data;

[0252] An angular velocity change rate acquisition module, used for acquiring the angular velocity change rate according to the angular velocity data;

[0253] The frequency domain feature acquisition module is used to normalize the acceleration change rate and the angular velocity change rate respectively to obtain the motion parameters, and the motion parameters are used as the frequency domain feature signals.

[0254] In one embodiment, the distance acquisition module includes:

[0255] A recognition model acquisition submodule is used to acquire a distance recognition model;

[0256] The distance acquisition submodule is used to input the frequency domain characteristic signal into the distance recognition model to obtain the distance between the electronic device and the obstacle.

[0257] In one embodiment, the distance recognition model is composed of an n-layer convolutional neural network model, an n-layer recurrent neural network and a 1-layer fully connected layer.

[0258] It should be noted that the system embodiment shown in this embodiment matches the content of the above-mentioned method embodiment. You can refer to the content of the above-mentioned method embodiment, which will not be repeated here.

[0259] Fig.17 1 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 1700 may be a smart phone, a computer, a digital broadcast terminal, a tablet device, a medical device, a fitness device, a personal digital assistant, etc., as well as the above-mentioned vehicle-use devices, etc.

[0260] Reference Fig.17 The electronic device 1700 may include one or more of the following components: a processing component 1702 , a memory 1704 , a power component 1706 , a multimedia component 1708 , an audio component 1710 , an input / output (I / O) interface 1712 , a sensor component 1714 , a communication component 1716 , and an image acquisition component 1718 .

[0261] The processing component 1702 generally controls the overall operation of the electronic device 1700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1702 may include one or more processors 1720 to execute computer programs. In addition, the processing component 1702 may include one or more modules to facilitate interaction between the processing component 1702 and other components. For example, the processing component 1702 may include a multimedia module to facilitate interaction between the multimedia component 1708 and the processing component 1702.

[0262] The memory 1704 is configured to store various types of data to support operations on the electronic device 1700. Examples of such data include computer programs for any application or method operating on the electronic device 1700, contact data, phone book data, messages, pictures, videos, etc. The memory 1704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0263] The power supply component 1706 provides power to various components of the electronic device 1700. The power supply component 1706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1700. The power supply component 1706 may include a power supply chip, and the controller may communicate with the power supply chip to control the power supply chip to turn on or off a switch device, so that the battery supplies power to the mainboard circuit or not.

[0264] The multimedia component 1708 includes a screen that provides an output interface between the electronic device 1700 and the target object. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input information from the target object. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0265] The audio component 1710 is configured to output and / or input audio file information. For example, the audio component 1710 includes a microphone (MIC), and when the electronic device 1700 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive external audio file information. The received audio file information can be further stored in the memory 1704 or sent via the communication component 1716. In some embodiments, the audio component 1710 also includes a speaker for outputting audio file information.

[0266] The I / O interface 1712 provides an interface between the processing component 1702 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc.

[0267] The sensor component 1714 includes one or more sensors for providing various aspects of status assessment for the electronic device 1700. For example, the sensor component 1714 can detect the open / closed state of the electronic device 1700, the relative positioning of components, such as the display screen and keypad of the electronic device 1700, and the sensor component 1714 can also detect the position change of the electronic device 1700 or a component, the presence or absence of contact between the target object and the electronic device 1700, the orientation or acceleration / deceleration of the electronic device 1700, and the temperature change of the electronic device 1700. In this example, the sensor component 1714 may include a magnetic sensor, a gyroscope, and a magnetic field sensor, wherein the magnetic field sensor includes at least one of the following: a Hall sensor, a thin film magnetoresistive sensor, and a magnetic liquid acceleration sensor.

[0268] The communication component 1716 is configured to facilitate wired or wireless communication between the electronic device 1700 and other devices. The electronic device 1700 can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 1716 receives broadcast information or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0269] In an exemplary embodiment, the electronic device 1700 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.

[0270] In an exemplary embodiment, there is also provided an electronic device, comprising:

[0271] Memory and processor;

[0272] The memory is used to store a computer program executable by the processor;

[0273] The processor is used to execute the computer program in the memory to implement the above method.

[0274] In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as a memory 1704 including instructions, and the above executable computer program can be executed by a processor. The readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0275] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0276] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A distance acquisition method, characterized in that: Applicable to electronic equipment, the electronic equipment includes an ultrasonic generator and an ultrasonic receiver; the method includes: Acquire the sound wave signal output by the ultrasonic receiver, wherein the sound wave signal is a bandpass signal of a preset frequency band and an echo signal of a high-frequency signal of at least one frequency band emitted by the ultrasonic generator; Performing frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal; Analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal; the frequency domain characteristic signal is used to characterize the relative motion between the electronic device and the obstacle; The distance between the electronic device and the obstacle is acquired according to the frequency domain characteristic signal.

2. The method according to claim 1, characterized in that Performing frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal includes: When the frequency of the sound wave signal is outside the target frequency band, performing frequency shift processing on the sound wave signal to obtain a frequency shift signal; Downsampling the frequency-shifted signal to obtain a downsampled signal; Performing frame-by-frame windowing processing on the down-sampled signal to obtain a sound wave frame sequence including a plurality of frames; Perform frequency domain transformation on each sub-frame in the sound wave frame sequence to obtain a frequency domain signal containing frequency domain sub-signals corresponding to each sub-frame.

3. The method according to claim 1, characterized in that: The frequency domain characteristic signal includes at least one of the following: signal volume, relative spectrum signal, correlation characteristics and frequency shift parameters.

4. The method according to claim 1, characterized in that The frequency domain characteristic signal includes a signal volume, and the signal volume is used to indicate the energy difference between different electronic devices after receiving the sound wave; Analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal includes: Obtaining the amplitude of each frequency component in the frequency domain signal; Obtaining the accumulated value of the root mean square of the amplitude of each frequency component to obtain the signal amplitude corresponding to the frequency domain signal; Obtaining a logarithmic value of the signal amplitude to obtain a logarithmic amplitude corresponding to the frequency domain signal; The logarithmic amplitude is normalized to obtain a signal volume corresponding to the frequency domain signal.

5. The method according to claim 1, characterized in that The frequency domain characteristic signal includes a relative spectrum signal, and the relative spectrum is used to represent the difference in interference fringes of the electronic device when it is close to and far away from an obstacle; analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal, including: Acquire energy information corresponding to each frequency component in the frequency domain signal; Obtain the relative energy of each frequency component and the base to obtain the relative spectrum signal.

6. The method according to claim 1, characterized in that The frequency domain characteristic signal includes a correlation feature, and the correlation feature is used to represent the correlation feature between the signal transmitted by the ultrasonic generator and the signal received by the ultrasonic receiver; Analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal includes: Obtaining a correlation coefficient between the signal transmitted by the ultrasonic generator and the signal received by the ultrasonic receiver; Obtaining the autocorrelation coefficient of the frequency domain signal corresponding to the sound wave signal; The mutual correlation coefficient and the autocorrelation coefficient are respectively normalized to obtain a frequency domain characteristic signal corresponding to the frequency domain signal.

7. The method according to claim 3, characterized in that The frequency domain characteristic signal includes a frequency shift parameter, and the frequency shift parameter is used to indicate two events of the electronic device approaching and moving away; analyzing and processing the frequency domain signal to obtain a frequency domain characteristic signal corresponding to the frequency domain signal, including: Obtaining two frequency components of each sub-frame in the frequency domain signal and the amplitudes of m frequency components around each frequency component of the two frequency components, and obtaining a 2m+2-dimensional feature vector corresponding to each sub-frame; Obtain the 2m+2-dimensional feature vectors of L consecutive sub-frames to obtain the frequency shift parameters.

8. The method according to claim 3, characterized in that The electronic device further includes a motion state sensor, and the frequency domain characteristic signal further includes motion parameters.

9. The method according to claim 8, characterized in that The frequency domain characteristic signal includes motion parameters, and the motion parameters are used to represent parameters of the electronic device in different motion states; the method further includes: Acquire sensor data output by the motion state sensor; the sensor data includes acceleration data and angular velocity data; Acquire the acceleration change rate according to the acceleration data, and acquire the angular velocity change rate according to the angular velocity data; The acceleration change rate and the angular velocity change rate are normalized respectively to obtain the motion parameters, and the motion parameters are used as the frequency domain feature signals.

10. The method according to claim 1, characterized in that Acquiring the distance between the electronic device and the obstacle according to the frequency domain characteristic signal includes: Get the distance recognition model; The frequency domain characteristic signal is input into the distance recognition model to obtain the distance between the electronic device and the obstacle.

11. The method according to claim 10, characterized in that The distance recognition model is composed of an n-layer convolutional neural network model, an n-layer recurrent neural network and a 1-layer fully connected layer.

12. A distance acquisition device, characterized in that: Applicable to electronic equipment, the electronic equipment comprises an ultrasonic generator and an ultrasonic receiver; the device comprises: An acoustic signal acquisition module, used to acquire the acoustic signal output by the ultrasonic receiver, wherein the acoustic signal is an echo signal of a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band emitted by the ultrasonic generator; A frequency domain signal acquisition module, used to perform frequency domain processing on the sound wave signal to obtain a frequency domain signal corresponding to the sound wave signal; A frequency domain feature acquisition module, used to analyze and process the frequency domain signal to obtain a frequency domain feature signal corresponding to the frequency domain signal; the frequency domain feature signal is used to characterize the relative motion between the electronic device and the obstacle; The distance acquisition module is used to acquire the distance between the electronic device and the obstacle according to the frequency domain characteristic signal.

13. The device according to claim 12, characterized in that The frequency domain signal acquisition module includes: A frequency-shift signal acquisition submodule, used for performing frequency-shift processing on the sound wave signal to obtain a frequency-shift signal when the frequency of the sound wave signal is outside the target frequency band; A down-sampled signal acquisition submodule, used for down-sampling the frequency-shifted signal to obtain a down-sampled signal; A frame sequence acquisition submodule is used to perform frame division and windowing processing on the down-sampled signal to obtain a sound wave frame sequence containing a plurality of sub-frames; The frequency domain signal acquisition submodule is used to perform frequency domain transformation on each subframe in the sound wave frame sequence to obtain a frequency domain signal containing frequency domain sub-signals corresponding to each subframe.

14. The device according to claim 12, characterized in that The frequency domain characteristic signal includes at least one of the following: signal volume, relative spectrum signal, correlation characteristics and frequency shift parameters.

15. The device according to claim 14, characterized in that The frequency domain characteristic signal includes a signal volume, and the signal volume is used to indicate the energy difference between different electronic devices after receiving the sound wave; the frequency domain characteristic acquisition module includes: A component amplitude acquisition submodule, used to obtain the amplitude of each frequency component in the frequency domain signal; A signal amplitude acquisition submodule is used to obtain the root mean square accumulation value of the amplitude of each frequency component to obtain the signal amplitude corresponding to the frequency domain signal; A logarithmic amplitude acquisition submodule, used to obtain the logarithmic value of the signal amplitude, and obtain the logarithmic amplitude corresponding to the frequency domain signal; The signal volume acquisition submodule is used to normalize the logarithmic amplitude to obtain the signal volume corresponding to the frequency domain signal.

16. The device according to claim 14, characterized in that The frequency domain characteristic signal includes a relative spectrum signal, and the relative spectrum is used to represent the difference in interference fringes of the electronic device when it is close to and far away from an obstacle; the frequency domain characteristic acquisition module includes: An energy information acquisition submodule, used to acquire energy information corresponding to each frequency component in the frequency domain signal; The relative spectrum acquisition submodule is used to obtain the relative energy of each frequency component and the base to obtain a relative spectrum signal.

17. The device according to claim 14, characterized in that The frequency domain characteristic signal includes a correlation feature, and the correlation feature is used to represent the correlation feature between the ultrasonic generator transmission signal and the ultrasonic receiver reception signal; the frequency domain feature acquisition module includes: A mutual correlation coefficient acquisition submodule, used to acquire the mutual correlation coefficient between the transmission signal of the ultrasonic generator and the reception signal of the ultrasonic receiver; An autocorrelation coefficient acquisition submodule, used to obtain the autocorrelation coefficient of the frequency domain signal corresponding to the sound wave signal; The frequency domain feature acquisition submodule is used to perform normalization processing on the mutual correlation coefficient and the autocorrelation coefficient respectively to obtain a frequency domain feature signal corresponding to the frequency domain signal.

18. The device according to claim 14, characterized in that The frequency domain characteristic signal includes a frequency shift parameter, and the frequency shift parameter is used to indicate two events of the electronic device approaching and moving away. The frequency domain characteristic acquisition module includes: A feature vector acquisition submodule, used to acquire two frequency components of each subframe in the frequency domain signal and the amplitudes of m frequency components around each frequency component of the two frequency components, to obtain a 2m+2-dimensional feature vector corresponding to each subframe; The frequency shift parameter acquisition submodule is used to obtain the 2m+2-dimensional feature vectors of L consecutive sub-frames to obtain the frequency shift parameters.

19. The device according to claim 14, characterized in that The electronic device further includes a motion state sensor, and the frequency domain characteristic signal further includes motion parameters.

20. The device according to claim 18, characterized in that The frequency domain characteristic signal includes motion parameters, and the motion parameters are used to represent parameters of the electronic device in different motion states; the device also includes: A sensor data acquisition module, used to acquire sensor data output by the motion state sensor; the sensor data includes acceleration data and angular velocity data; An acceleration change rate acquisition module, used to acquire the acceleration change rate according to the acceleration data; An angular velocity change rate acquisition module, used for acquiring the angular velocity change rate according to the angular velocity data; The frequency domain feature acquisition module is used to normalize the acceleration change rate and the angular velocity change rate respectively to obtain the motion parameters, and the motion parameters are used as the frequency domain feature signals.

21. The device according to claim 12, characterized in that The distance acquisition module comprises: A recognition model acquisition submodule is used to acquire a distance recognition model; The distance acquisition submodule is used to input the frequency domain characteristic signal into the distance recognition model to obtain the distance between the electronic device and the obstacle.

22. The device according to claim 21, characterized in that The distance recognition model is composed of an n-layer convolutional neural network model, an n-layer recurrent neural network and a 1-layer fully connected layer.

23. An electronic device, characterized in that: include: The ultrasonic generator is used to transmit a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band; The ultrasonic receiver is used to receive a bandpass signal of a preset frequency band and a high-frequency signal of at least one frequency band and output a sound wave signal; Memory and processor; The memory is used to store a computer program executable by the processor; The processor is used to execute the computer program in the memory to implement the method according to any one of claims 1 to 11.

24. The electronic device according to claim 23, characterized in that: The ultrasonic generator includes a signal transmitter, an analog-to-digital converter and a signal exciter; the signal transmitter is a speaker or a receiver; The signal exciter is used to generate ultrasonic signals of different frequencies; The analog-to-digital converter is used to convert the ultrasonic signal into an analog signal; The signal transmitter is used to convert the analog signal into ultrasonic waves and radiate them into the surrounding space.

25. The electronic device according to claim 23, characterized in that: The ultrasonic receiver includes a signal receiver and an analog-to-digital converter; the signal receiver includes at least one microphone; The signal receiver is used to receive ultrasonic waves in the space and convert them into analog signals; The analog-to-digital converter is used to convert the analog signal into a digital signal.

26. A non-transitory computer-readable storage medium, characterized in that: When the executable computer program in the storage medium is executed by a processor, the method according to any one of claims 1 to 11 can be implemented.