Method and apparatus for retrieving 3D map
A 3D map retrieval method is provided. The method for retrieving a 3D map includes: obtaining binary data of S 3D map descriptors; performing stage-i retrieval in the binary data of the S 3D map descriptors based on binary data of a retrieval descriptor, to obtain P 3D map descriptors through screening; performing stage-m decompression on compressed data of the P 3D map descriptors to obtain reconstructed data of the P 3D map descriptors; and performing stage-j retrieval in the reconstructed data of the P 3D map descriptors based on partial data or all data of the retrieval descriptor, to obtain Q 3D map descriptors.
1 . A method for retrieving a three-dimensional (3D) map, applied to an apparatus that comprises at least one processor, wherein the method comprises:
extracting, by the at least one processor, binary data of S 3D map descriptors from compressed data of the S 3D map descriptors, wherein the S 3D map descriptors correspond to a plurality of 3D map points of the 3D map;
performing, by the at least one processor, stage-i retrieval in the binary data of the S 3D map descriptors based on binary data of a retrieval descriptor, to obtain P 3D map descriptors, wherein the retrieval descriptor is a feature that corresponds to a real environment and that is extracted from visual information collected by a sensor of an electronic device;
performing, by the at least one processor, stage-m decompression on compressed data of the P 3D map descriptors to obtain reconstructed data of the P 3D map descriptors, wherein a decompression process of the compressed data of the P 3D map descriptors comprises at least the stage-m decompression;
performing, by the at least one processor, stage-j retrieval in the reconstructed data of the P 3D map descriptors based on partial data or all data of the retrieval descriptor, to obtain Q 3D map descriptors, wherein S, P, Q, i, j, and m are positive integers, 0<Q<P, 0<P<T, 0<S≤T, T represents a total quantity of 3D map descriptors in the 3D map, j=i+1, 1≤i<L, 1<j≤L, L represents a total quantity of retrieval stages of the 3D map or a retrieval stage quantity threshold, and L is a positive integer greater than 1;
wherein N 3D map descriptors in the Q 3D map descriptors are used for positioning, 3D map points corresponding to the N 3D map descriptors match a 3D map point corresponding to the retrieval descriptor, N is a positive integer, and 0<N≤Q; and the method further comprises:
performing, by the at least one processor, positioning based on the 3D map points corresponding to the N 3D map descriptors, to obtain pose information of the electronic device; and
displaying, by the apparatus, based on the pose information, a user interface including a navigation indicator.
2 . The method according to claim 1 , wherein the S 3D map descriptors are S representative 3D map descriptors, the S representative 3D map descriptors each corresponds to at least one data set, each data set of the at least one data set comprises at least one 3D map descriptor, and the performing stage-i retrieval in the binary data of the S 3D map descriptors based on the binary data of the retrieval descriptor, to obtain the P 3D map descriptors comprises:
performing, by the at least one processor, the stage-i retrieval in binary data of the S representative 3D map descriptors based on the binary data of the retrieval descriptor, to obtain at least one representative 3D map descriptor; and
using, by the at least one processor, 3D map descriptors in a data set corresponding to each of the at least one representative 3D map descriptor as the P 3D map descriptors.
3 . The method according to claim 1 , wherein a retrieval manner used for the stage-i retrieval is a retrieval manner based on a first distance, and a retrieval manner used for the stage-j retrieval is a retrieval manner based on a second distance.
4 . The method according to claim 1 , wherein the method further comprises:
receiving, by the at least one processor, the retrieval descriptor, and performing, by the at least one processor, binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor;
receiving, by the at least one processor, the visual information, extracting, by the at least one processor, the retrieval descriptor from the visual information, and performing, by the at least one processor, binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor; or
in response to a visual information collection operation entered by a user, triggering, by the at least one processor, the sensor to perform visual information collection on the real environment to obtain the visual information, extracting, by the at least one processor, the retrieval descriptor from the visual information, and performing, by the at least one processor, binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor.
5 . The method according to claim 1 , wherein when N<Q, the method further comprises:
performing, by the at least one processor, stage-k decompression on compressed data of the Q 3D map descriptors to obtain reconstructed data of the Q 3D map descriptors; and
performing, by the at least one processor, stage-r retrieval in the reconstructed data of the Q 3D map descriptors based on partial data or all data of the retrieval descriptor, to obtain the N 3D map descriptors, wherein
N<Q<P, and the decompression process of the compressed data of the P 3D map descriptors comprises the stage-m decompression and the stage-k decompression, wherein r and k are positive integers, m<k, and j<r≤L.
6 . The method according to claim 5 , wherein the compressed data of the P 3D map descriptors comprises binary data and quantized data of each of the P 3D map descriptors;
the performing stage-m decompression on the compressed data of the P 3D map descriptors to obtain the reconstructed data of the P 3D map descriptors comprises:
performing, by the at least one processor, dequantization on the quantized data of each of the P 3D map descriptors to obtain P pieces of dequantized data, wherein the P pieces of dequantized data are used as the reconstructed data of the P 3D map descriptors; and
the performing stage-k decompression on the compressed data of the Q 3D map descriptors to obtain the reconstructed data of the Q 3D map descriptors comprises:
performing, by the at least one processor, dequantization on quantized data of each of the Q 3D map descriptors to obtain Q pieces of dequantized data; and
obtaining, by the at least one processor, reconstructed data of each of the Q 3D map descriptors based on the Q pieces of dequantized data and binary data of each of the Q 3D map descriptors.
7 . The method according to claim 1 , wherein when N=Q, the compressed data of the P 3D map descriptors comprises binary data and quantized data of each of the P 3D map descriptors, and the performing stage-m decompression on the compressed data of the P 3D map descriptors to obtain the reconstructed data of the P 3D map descriptors comprises:
performing, by the at least one processor, dequantization on the quantized data of each of the P 3D map descriptors to obtain P pieces of dequantized data; and
obtaining, by the at least one processor, reconstructed data of each of the P 3D map descriptors based on the P pieces of dequantized data and the binary data of each of the P 3D map descriptors.
8 . An apparatus for retrieving a three-dimensional (3D) map, wherein the apparatus comprises:
at least one processor; and
one or more memories coupled to the at least one processor and storing programming instructions for execution by the at least one processor to cause the apparatus to:
extract binary data of S 3D map descriptors from compressed data of the S 3D map descriptors, wherein the S 3D map descriptors correspond to a plurality of 3D map points of the 3D map;
perform stage-i retrieval in the binary data of the S 3D map descriptors based on binary data of a retrieval descriptor, to obtain P 3D map descriptors, wherein the retrieval descriptor is a feature that corresponds to a real environment and that is extracted from visual information collected by a sensor of an electronic device;
perform stage-m decompression on compressed data of the P 3D map descriptors to obtain reconstructed data of the P 3D map descriptors, wherein a decompression process of the compressed data of the P 3D map descriptors comprises at least the stage-m decompression;
perform stage-j retrieval in the reconstructed data of the P 3D map descriptors based on partial data or all data of the retrieval descriptor, to obtain Q 3D map descriptors, wherein S, P, Q, i, j, and m are positive integers, 0<Q<P, 0<P<T, 0<S≤T, T represents a total quantity of 3D map descriptors in the 3D map, j=i+1, 1≤i<L, 1<j≤L, L represents a total quantity of retrieval stages of the 3D map or a retrieval stage quantity threshold, and L is a positive integer greater than 1;
wherein N 3D map descriptors in the Q 3D map descriptors are used for positioning, 3D map points corresponding to the N 3D map descriptors match a 3D map point corresponding to the retrieval descriptor, N is a positive integer, and 0<N≤Q; and the at least one processor further executes the instructions to:
perform positioning based on the 3D map points corresponding to the N 3D map descriptors, to obtain pose information of the electronic device; and
display, based on the pose information, a user interface including a navigation indicator.
9 . The apparatus according to claim 8 , wherein the at least one processor further executes the instructions to:
receive the retrieval descriptor, and perform binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor;
receive the visual information, extract the retrieval descriptor from the visual information, and perform binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor; or
in response to a visual information collection operation entered by a user, trigger the sensor to perform visual information collection on the real environment to obtain the visual information, extract the retrieval descriptor from the visual information, and perform binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor.
10 . The apparatus according to claim 8 , wherein the S 3D map descriptors are S representative 3D map descriptors, the S representative 3D map descriptors each corresponds to at least one data set, each data set of the at least one data set comprises at least one 3D map descriptor, and the at least one processor further executes the instructions to:
perform stage-i retrieval in binary data of the S representative 3D map descriptors based on the binary data of the retrieval descriptor, to obtain at least one representative 3D map descriptor; and
use 3D map descriptors in a data set corresponding to each of the at least one representative 3D map descriptor as the P 3D map descriptors.
11 . The apparatus according to claim 8 , wherein a retrieval manner used for the stage-i retrieval is a retrieval manner based on a first distance, and a retrieval manner used for the stage-j retrieval is a retrieval manner based on a second distance.
12 . The apparatus according to claim 8 , wherein when N=Q, the compressed data of the P 3D map descriptors comprises binary data and quantized data of each of the P 3D map descriptors, and the at least one processor further executes the instructions to:
perform dequantization on the quantized data of each of the P 3D map descriptors to obtain P pieces of dequantized data; and
obtain reconstructed data of each of the P 3D map descriptors based on the P pieces of dequantized data and the binary data of each of the P 3D map descriptors.
13 . The apparatus according to claim 8 , wherein when N<Q, the at least one processor further executes the instructions to:
perform stage-k decompression on compressed data of the Q 3D map descriptors to obtain reconstructed data of the Q 3D map descriptors; and
perform stage-r retrieval in the reconstructed data of the Q 3D map descriptors based on partial data or all data of the retrieval descriptor, to obtain the N 3D map descriptors, wherein
N<Q<P, and the decompression process of the compressed data of the P 3D map descriptors comprises the stage-m decompression and the stage-k decompression, wherein r and k are positive integers, m<k, and j<r≤L.
14 . The apparatus according to claim 13 , wherein the compressed data of the P 3D map descriptors comprises binary data and quantized data of each of the P 3D map descriptors, and the at least one processor further executes the instructions to:
perform dequantization on the quantized data of each of the P 3D map descriptors to obtain P pieces of dequantized data, wherein the P pieces of dequantized data are used as the reconstructed data of the P 3D map descriptors;
perform dequantization on quantized data of each of the Q 3D map descriptors to obtain Q pieces of dequantized data; and
obtain reconstructed data of each of the Q 3D map descriptors based on the Q pieces of dequantized data and binary data of each of the Q 3D map descriptors.
15 . A non-transitory computer-readable storage medium storing computer instructions, wherein when the computer instructions are executed on a computer, cause the computer to perform the operations of:
extracting binary data of S 3D map descriptors from compressed data of the S 3D map descriptors, wherein the S 3D map descriptors correspond to a plurality of 3D map points of a 3D map;
performing stage-i retrieval in the binary data of the S 3D map descriptors based on binary data of a retrieval descriptor, to obtain P 3D map descriptors, wherein the retrieval descriptor is a feature that corresponds to a real environment and that is extracted from visual information collected by a sensor of an electronic device;
performing stage-m decompression on compressed data of the P 3D map descriptors to obtain reconstructed data of the P 3D map descriptors, wherein a decompression process of the compressed data of the P 3D map descriptors comprises at least the stage-m decompression;
performing stage-j retrieval in the reconstructed data of the P 3D map descriptors based on partial data or all data of the retrieval descriptor, to obtain Q 3D map descriptors, wherein S, P, Q, i, j, and m are positive integers, 0<Q<P, 0<P<T, 0<S≤T, T represents a total quantity of 3D map descriptors in the 3D map, j=i+1, 1≤i<L, 1<j≤L, L represents a total quantity of retrieval stages of the 3D map or a retrieval stage quantity threshold, and L is a positive integer greater than 1;
wherein N 3D map descriptors in the Q 3D map descriptors are used for positioning, 3D map points corresponding to the N 3D map descriptors match a 3D map point corresponding to the retrieval descriptor, N is a positive integer, and 0<N≤Q; and the computer is further caused to perform the operations of:
performing positioning based on the 3D map points corresponding to the N 3D map descriptors, to obtain pose information of the electronic device; and
displaying, by the apparatus, based on the pose information, a user interface including a navigation indicator.
16 . The non-transitory computer-readable storage medium according to claim 15 , wherein a retrieval manner used for the stage-i retrieval is a retrieval manner based on a first distance, and a retrieval manner used for the stage-j retrieval is a retrieval manner based on a second distance.
17 . The non-transitory computer-readable storage medium according to claim 15 , wherein the computer is further caused to perform the operations of:
receiving the retrieval descriptor, and performing binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor;
receiving the visual information, extracting the retrieval descriptor from the visual information, and performing binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor; or
in response to a visual information collection operation entered by a user, triggering the sensor to perform visual information collection on the real environment to obtain the visual information, extracting the retrieval descriptor from the visual information, and performing binarization on the retrieval descriptor to obtain the binary data of the retrieval descriptor.