CN-114910867-B - Method and device for detecting relative position between devices
Abstract
The application discloses a method and a device for detecting relative positions among devices, wherein the method comprises the steps of acquiring a first microphone of a device B to acquire a first target audio signal, determining a first audio fragment and a second audio fragment according to a first target time and the first target audio signal, wherein the first target time is determined according to a target amplitude in the first target audio signal, searching the first audio fragment and the second audio fragment respectively to acquire a first arrival time and a second arrival time, and determining the relative positions between the device A and the device B according to the first arrival time and the second arrival time. The application also discloses a detection device. The embodiment of the application can determine the relative position between the devices with high precision.
Inventors
- XU QIANG
- LI CHENHE
- He yanshan
- WU WENHAO
- WANG SHUAI
- PENG HONGXING
- LI SHIMING
Assignees
- 华为技术有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20210210
Claims (20)
- 1. A method for detecting a relative position between devices, comprising: Acquiring a first target audio signal acquired by a first microphone of the equipment B, wherein the first target audio signal is acquired according to a first audio signal sent by a first loudspeaker of the equipment A and a second audio signal sent by a second loudspeaker; determining a first audio segment and a second audio segment according to a first target time and the first target audio signal, wherein the first target time is determined according to a target amplitude in the first target audio signal, the first audio segment is a segment related to the first audio signal in the first target audio signal, and the second audio segment is a segment related to the second audio signal in the first target audio signal; Searching the first audio segment and the second audio segment respectively to obtain a first arrival time and a second arrival time, wherein the first arrival time is a time corresponding to a first target peak, the second arrival time is a time corresponding to a second target peak, and the first target peak is a peak with earliest receiving time in peaks with signal amplitude larger than a first preset amplitude in the first audio segment; And determining the relative position between the equipment A and the equipment B according to the first arrival time and the second arrival time.
- 2. The method of claim 1, wherein the determining the first audio segment and the second audio segment from the first target time instant and the first target audio signal comprises: determining the first audio segment from the first target audio signal according to the first target time, the distance between the first speaker and the second speaker, and the sampling frequency of the first microphone; the second audio segment is determined from the first target audio signal based on the first target time, a distance between the first speaker and the second speaker, a sampling frequency of the first microphone, and a time interval during which the first speaker generates the first audio signal and the second speaker generates the second audio signal.
- 3. The method of claim 2, wherein the determining the first audio segment from the first target audio signal based on the first target time, a distance between the first speaker and the second speaker, and a sampling frequency of the first microphone comprises: Determining a first time interval according to the first target time, the distance between the first speaker and the second speaker and the sampling frequency of the first microphone, wherein the starting time of the first time interval is ind_max-2 (D/v) f, the ending time of the first time interval is ind_max+2 (D/v) f, the ind_max is the first target time, D is a first preset distance, D is the distance between the first speaker and the second speaker, v is the sound speed, and f is the sampling frequency of the first microphone; the first audio segment is determined from the first target audio signal according to the first time interval.
- 4. A method according to claim 2 or 3, wherein the determining the second audio segment from the first target audio signal based on the first target time, a distance between the first speaker and the second speaker, a sampling frequency of the first microphone, and a time interval during which the first speaker generates the first audio signal and the second speaker generates the second audio signal, comprises: Determining a second time interval according to the first target moment, the distance between the first loudspeaker and the second loudspeaker, the sampling frequency of the first microphone and the time interval; The starting time of the second time interval is ind_max-2 (D/v) f-T 1 , the ending time is ind_max+2 (D/v) f-T 1 , the ind_max is the first target time, D is a first preset distance, D is a distance between the first loudspeaker and the second loudspeaker, v is a sound velocity, f is a sampling frequency of the first microphone, and T 1 is the time interval; and determining the second audio fragment from the first target audio signal according to the second time interval.
- 5. A method according to claim 2 or 3, wherein said determining the second audio clip from the first target audio signal based on the first target time, the distance between the first speaker and the second speaker, the sampling frequency of the first microphone, and the time interval between the first speaker generating a first audio signal and the second speaker generating a second audio signal, comprises: determining a third time interval and a fourth time interval according to the first target moment, the distance between the first loudspeaker and the second loudspeaker, the sampling frequency of the first microphone and the time interval; The third time interval has a start time of ind_max-2 (D/v) f+t 1 , a finish time of ind_max+t 1 +2 (D/v) f, a start time of ind_max-2 (D/v) f-T 1 , a finish time of ind_max-T 1 +2 (D/v) f, the ind_max is the first target time, D is a first preset distance, D is a distance between the first speaker and the second speaker, v is a sound speed, f is a sampling frequency of the first microphone, and T 1 is the time interval; Determining the second audio segment from a third audio segment and a fourth audio segment, wherein the second audio segment is an audio segment in which the ratio of the maximum signal amplitude to the LOS signal amplitude in the third audio segment and the fourth audio segment is within a preset range, the third audio segment is an audio segment corresponding to the third time interval in the first target audio signal, and the fourth audio segment is an audio segment corresponding to the fourth time interval in the first target audio signal.
- 6. The method of claim 1, wherein the first target audio signal includes a third audio signal and a fourth audio signal, the third audio signal being the first audio signal sent by the first speaker and received by the first microphone, the fourth audio signal being the second audio signal sent by the second speaker and received by the first microphone, the determining a first audio segment and a second audio segment according to the first target time and the first target audio signal comprising: Determining a fifth time interval according to the first target time and a preset time threshold, determining a sixth time interval according to a second target time and the preset time threshold, wherein the first target time is a time determined according to the target amplitude in the third audio signal, the second target time is a time determined according to the target amplitude in the fourth audio signal, the ending time of the fifth time interval is the first target time, the ending time of the sixth time interval is the second target time, and the duration of the fifth time interval and the sixth time interval are both the time threshold; And acquiring the first audio fragment from the third audio signal according to the fifth time interval, and acquiring the second audio fragment from the fourth audio signal according to the sixth time interval.
- 7. The method of claim 6, wherein the preset time threshold is determined based on a first preset distance and a time interval during which the first speaker generates the first audio signal and the second speaker generates the second audio signal.
- 8. The method of claim 1, 2, 3, 6 or 7, wherein said determining the relative position between said device a and said device B from said first arrival time and said second arrival time comprises: constructing a first hyperbola function according to the first arrival time and the second arrival time; a relative position between the device a and the device B is determined from the first hyperbolic function, the distance between the first speaker and the second speaker.
- 9. The method of claim 4, wherein said determining the relative position between said device a and said device B from said first arrival time and said second arrival time comprises: constructing a first hyperbola function according to the first arrival time and the second arrival time; a relative position between the device a and the device B is determined from the first hyperbolic function, the distance between the first speaker and the second speaker.
- 10. The method of claim 5, wherein said determining the relative position between said device a and said device B from said first arrival time and said second arrival time comprises: constructing a first hyperbola function according to the first arrival time and the second arrival time; a relative position between the device a and the device B is determined from the first hyperbolic function, the distance between the first speaker and the second speaker.
- 11. The method of claim 1, 2, 3, 6 or 7, further comprising: Acquiring a third arrival time and a fourth arrival time, wherein the third arrival time is a time corresponding to a third target peak, the fourth arrival time is a time corresponding to a fourth target peak, the third target peak is a peak with earliest signal amplitude in fifth audio fragments, which is larger than a peak with earliest receiving time in a peak with third preset amplitude, the fourth target peak is a peak with earliest signal amplitude in sixth audio fragments, which is larger than a peak with fourth preset amplitude, the fifth audio fragments are fragments, which are related to the first audio signals, in second target audio signals, the sixth audio fragments are fragments, which are related to the second audio signals, in the second target audio signals, and the second target audio signals are obtained by a second microphone of the equipment B according to the first audio signals sent by the first loudspeaker and the second audio signals sent by the second loudspeaker; the determining the relative position between the device a and the device B according to the first arrival time and the second arrival time includes: And determining the relative position between the equipment A and the equipment B according to the first arrival time, the second arrival time, the third arrival time, the fourth arrival time, the distance between the first loudspeaker and the second loudspeaker and the distance between the first microphone and the second microphone.
- 12. The method according to claim 4, wherein the method further comprises: Acquiring a third arrival time and a fourth arrival time, wherein the third arrival time is a time corresponding to a third target peak, the fourth arrival time is a time corresponding to a fourth target peak, the third target peak is a peak with earliest signal amplitude in fifth audio fragments, which is larger than a peak with earliest receiving time in a peak with third preset amplitude, the fourth target peak is a peak with earliest signal amplitude in sixth audio fragments, which is larger than a peak with fourth preset amplitude, the fifth audio fragments are fragments, which are related to the first audio signals, in second target audio signals, the sixth audio fragments are fragments, which are related to the second audio signals, in the second target audio signals, and the second target audio signals are obtained by a second microphone of the equipment B according to the first audio signals sent by the first loudspeaker and the second audio signals sent by the second loudspeaker; the determining the relative position between the device a and the device B according to the first arrival time and the second arrival time includes: And determining the relative position between the equipment A and the equipment B according to the first arrival time, the second arrival time, the third arrival time, the fourth arrival time, the distance between the first loudspeaker and the second loudspeaker and the distance between the first microphone and the second microphone.
- 13. The method of claim 5, wherein the method further comprises: Acquiring a third arrival time and a fourth arrival time, wherein the third arrival time is a time corresponding to a third target peak, the fourth arrival time is a time corresponding to a fourth target peak, the third target peak is a peak with earliest signal amplitude in fifth audio fragments, which is larger than a peak with earliest receiving time in a peak with third preset amplitude, the fourth target peak is a peak with earliest signal amplitude in sixth audio fragments, which is larger than a peak with fourth preset amplitude, the fifth audio fragments are fragments, which are related to the first audio signals, in second target audio signals, the sixth audio fragments are fragments, which are related to the second audio signals, in the second target audio signals, and the second target audio signals are obtained by a second microphone of the equipment B according to the first audio signals sent by the first loudspeaker and the second audio signals sent by the second loudspeaker; the determining the relative position between the device a and the device B according to the first arrival time and the second arrival time includes: And determining the relative position between the equipment A and the equipment B according to the first arrival time, the second arrival time, the third arrival time, the fourth arrival time, the distance between the first loudspeaker and the second loudspeaker and the distance between the first microphone and the second microphone.
- 14. The method of claim 1, 2, 3, 6, 7, 9 or 10, wherein the first microphone of device B is: A microphone having a maximum difference between a distance from the first speaker and a distance from the second speaker among the plurality of microphones of the apparatus B, and the difference being greater than a preset distance, or Among the plurality of microphones of the device B, a microphone having a minimum degree of occlusion by the device B with respect to the first speaker and the second speaker.
- 15. The method of claim 4, wherein the first microphone of device B is: A microphone having a maximum difference between a distance from the first speaker and a distance from the second speaker among the plurality of microphones of the apparatus B, and the difference being greater than a preset distance, or Among the plurality of microphones of the device B, a microphone having a minimum degree of occlusion by the device B with respect to the first speaker and the second speaker.
- 16. The method of claim 5, wherein the first microphone of device B is: A microphone having a maximum difference between a distance from the first speaker and a distance from the second speaker among the plurality of microphones of the apparatus B, and the difference being greater than a preset distance, or Among the plurality of microphones of the device B, a microphone having a minimum degree of occlusion by the device B with respect to the first speaker and the second speaker.
- 17. The method of claim 8, wherein the first microphone of device B is: A microphone having a maximum difference between a distance from the first speaker and a distance from the second speaker among the plurality of microphones of the apparatus B, and the difference being greater than a preset distance, or Among the plurality of microphones of the device B, a microphone having a minimum degree of occlusion by the device B with respect to the first speaker and the second speaker.
- 18. The method of claim 11, wherein the first and second microphones of device B comprise: The two microphones of the plurality of microphones of the device B which are the farthest from each other, or Two microphones of the plurality of microphones of the device B, which have a distance from the first speaker and a distance from the second speaker which differ by more than a preset distance, or Two microphones of the plurality of microphones of the device B, which are least shielded by the device B with respect to the first speaker and the second speaker.
- 19. The method according to claim 12 or 13, wherein the first and second microphones of device B comprise: The two microphones of the plurality of microphones of the device B which are the farthest from each other, or Two microphones of the plurality of microphones of the device B, which have a distance from the first speaker and a distance from the second speaker which differ by more than a preset distance, or Two microphones of the plurality of microphones of the device B, which are least shielded by the device B with respect to the first speaker and the second speaker.
- 20. The method of claim 1,2, 3, 6, 7, 9, 10, 12, 13, 15, 16, 17, or 18, wherein the device a is a projection device and the device B is a projected device, wherein after determining the relative position between the device a and the device B based on the first arrival time and the second arrival time, the method further comprises: And displaying the content displayed on the display interface of the equipment A in a preset area of the display interface of the equipment B, wherein the position of the preset area in the display interface of the equipment B is the same as the position of the equipment A relative to the equipment B.
Description
Method and device for detecting relative position between devices Technical Field The present application relates to the field of positioning, and in particular, to a method and apparatus for detecting a relative position between devices. Background The spatial interaction refers to a man-machine interaction technology and a method based on spatial location awareness (including relative location and angle between people and equipment, absolute location and angle between equipment, etc.), in order to achieve better use experience, spatial awareness needs to be achieved among multiple pieces of equipment of a user, for example, apple corporation uses ultra-wideband (UWB) technology to achieve Airdrop directional sharing function, for example, proximity detection is achieved among the pieces of equipment using WIFI and bluetooth. In one scheme, a plurality of ultrasonic positioning modules are used for sending ultrasonic signals, the ultrasonic signals are reflected after encountering hands of a user, the reflected signals are filtered by a control and processing module and output to a computer host, and information such as the gesture, the position and the like of the hands of the user is generated. But merely by means of reflection, the determination of the relative position between the devices cannot be achieved. Disclosure of Invention The embodiment of the application provides a method and a device for detecting the relative position between devices, which can realize the determination of the relative position between the devices with low cost and high precision under the condition of not adding extra hardware. In a first aspect, an embodiment of the present application provides a method for detecting a relative position between devices, including: The method comprises the steps of obtaining a first target audio signal through a first microphone of a device B, wherein the first target audio signal is obtained according to a first audio signal sent by a first loudspeaker of the device A and a second audio signal sent by a second loudspeaker of the device A, determining a first audio fragment and a second audio fragment according to a first target time and the first target audio signal, wherein the first target time is a time determined according to a target amplitude in the first target audio signal, the first audio fragment is a fragment related to the first audio signal in the first target audio signal, the second audio fragment is a fragment related to the second audio signal in the first target audio signal, searching the first audio fragment and the second audio fragment respectively to obtain a first arrival time and a second arrival time, the first arrival time is a time corresponding to the first target peak, the second arrival time is a time corresponding to the second target peak, the first target peak is a time earliest peak in the first audio fragment, the signal amplitude is larger than the first preset amplitude peak in the first target amplitude, the second target peak is the earliest in the second audio fragment, the second target peak is larger than the first preset amplitude in the first audio signal amplitude, the second target peak is the earliest in the second audio signal amplitude, and the second arrival time is determined between the first arrival time and the device A and the second arrival time is corresponding to the first arrival time. The time interval corresponding to the first audio segment and the time interval corresponding to the second audio segment in the first target audio signal are not overlapped. Optionally, the first speaker of device a may or may not overlap with the time when the second speaker of device a emits the second audio signal at the time when the first audio signal is emitted. The first preset amplitude and the second preset amplitude may be the same or different. Optionally, the first target time is a time determined according to the target amplitude in the first target audio signal, and specifically includes a time corresponding to the highest signal amplitude in the first target audio signal or a time corresponding to the earliest receiving time peak among the peaks when a plurality of peaks with signal amplitudes exceeding the target amplitude exist in the first target audio signal. Alternatively, the target peak may also be an average value, a maximum value, or other value of a plurality of peaks in the first audio signal. The relative position between the equipment A and the equipment B is determined through the audio signals sent by the first loudspeaker and the second loudspeaker of the equipment A, which are acquired by the first microphone of the equipment B, so that the relative position between the equipment A and the equipment B is determined under the condition that no additional hardware is added, the first arrival time and the second arrival time are obtained through searching the audio signals generated by the first loudspeaker and the s