WO2023025175A1 - 用于空间定位的方法及装置 - Google Patents

用于空间定位的方法及装置 Download PDF

Info

Publication number
WO2023025175A1
WO2023025175A1 PCT/CN2022/114388 CN2022114388W WO2023025175A1 WO 2023025175 A1 WO2023025175 A1 WO 2023025175A1 CN 2022114388 W CN2022114388 W CN 2022114388W WO 2023025175 A1 WO2023025175 A1 WO 2023025175A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
coordinate system
points
world coordinate
image
Prior art date
Application number
PCT/CN2022/114388
Other languages
English (en)
French (fr)
Inventor
吕宪伟
Original Assignee
优奈柯恩(北京)科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 优奈柯恩(北京)科技有限公司 filed Critical 优奈柯恩(北京)科技有限公司
Publication of WO2023025175A1 publication Critical patent/WO2023025175A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • G06T7/85Stereo camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • G06T7/593Depth or shape recovery from multiple images from stereo images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • G06T2207/10012Stereo images

Definitions

  • AR Augmented Reality
  • computer technology can be used to apply virtual information to the real world, that is, to superimpose real scenes and virtual images (such as virtual objects, virtual scenes, etc.) under the same screen in real time, so that Human eyes see the mixed image of real scene and virtual image at the same time, so as to achieve the effect of augmented reality.
  • Users can interact with virtual objects in the AR scene through interactive devices to produce desired effects.
  • the user can move the interactive device, and the spatial movement of the interactive device can be converted into the movement of the virtual object in the AR scene, so as to achieve the purpose of controlling the virtual object. Therefore, it is necessary to determine the spatial positioning of the interactive device during the interaction process of the AR scene, and how to accurately determine the spatial positioning of the interactive device has become an urgent problem to be solved.
  • the present disclosure provides a method and device for spatial positioning.
  • a method for spatial positioning is performed by a first device, and the method includes: acquiring a device image of a second device, the device image including the second device The 2D point of the second device and the descriptor corresponding to the 2D point; use the descriptor corresponding to the 3D point on the 3D model of the second device and the descriptor corresponding to the 2D point to compare the 2D point of the second device and the descriptor of the second device Perform feature point matching on the 3D points on the 3D model of the second device to obtain at least three non-collinear first correspondences between the 2D points of the second device and the 3D points of the 3D model of the second device.
  • the 3D model of the second device includes a 3D point and a descriptor corresponding to the 3D point; according to the positioning of the second device in the world coordinate system and the second correspondence between the second device and the 3D model relationship, determine the location of the 3D model of the second device in the world coordinate system; and determine the location of the 3D model of the second device in the world coordinate system and the first corresponding relationship The pose of the first device in the world coordinate system.
  • an electronic device including: at least one processor; and a memory, the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one The processor executes the method for spatial positioning as described above.
  • a non-volatile machine-readable storage medium storing executable instructions that, when executed, cause the machine to perform the above-mentioned method for spatial positioning. method.
  • Fig. 1 shows a schematic diagram of an example of an application scenario of a spatial positioning method according to the present disclosure.
  • Fig. 2 shows a flowchart of an example of a spatial positioning method according to the present disclosure.
  • Fig. 3 shows a schematic diagram of an example of a 3D model of a second device according to the present disclosure.
  • Fig. 5 shows a flow chart of another example of the spatial positioning method according to the present disclosure.
  • Fig. 6 shows a schematic diagram of an example relationship among the second device, the 3D model and the world coordinate system according to the present disclosure.
  • Fig. 7 shows a flowchart of another example of the spatial positioning method according to the present disclosure.
  • Fig. 8 shows a block diagram of an example of a spatial positioning device according to the present disclosure.
  • Fig. 9 shows a block diagram of another example of a spatial positioning device according to the present disclosure.
  • Fig. 10 shows a block diagram of another example of a spatial positioning device according to the present disclosure.
  • Fig. 11 shows a block diagram of an electronic device for implementing a spatial positioning method according to an embodiment of the present disclosure.
  • the term “comprising” and its variants represent open terms meaning “including but not limited to”.
  • the term “based on” means “based at least in part on”.
  • the terms “one embodiment” and “an embodiment” mean “at least one embodiment.”
  • the term “another embodiment” means “at least one other embodiment.”
  • the terms “first”, “second”, etc. may refer to different or the same object. The following may include other definitions, either express or implied. Unless the context clearly indicates otherwise, the definition of a term is consistent throughout the specification.
  • the terminal device performs attitude calculation through the built-in IMU (Inertial Measurement Unit).
  • IMUs generally used in consumer products can only implement 3DOF (degree of freedom) functions, and 3DOF only includes yaw, pitch and roll. Based on this, the terminal device can only perform attitude calculation through three degrees of freedom of yaw, pitch and roll.
  • the three degrees of freedom of yaw, pitch, and roll have certain limitations. If only the IMU is used for 6DOF spatial positioning, the spatial positioning of the terminal device will be inaccurate, which will affect the interaction with virtual objects in the AR scene.
  • a first image of the second device is collected, and the first image may include 2D points of the second device and descriptors corresponding to the 2D points.
  • the descriptors corresponding to the 3D points on the 3D model of the second device and the descriptors corresponding to the 2D points may be used to perform feature point matching on the 2D points of the second device and the 3D points on the 3D model of the second device, so as to obtain at least three A first correspondence between 2D points of a second device that are not collinear and 3D points of a 3D model of the second device.
  • the 3D model of the second device may include a 3D point and a descriptor corresponding to the 3D point. According to the positioning of the second device in the world coordinate system and the second corresponding relationship between the second device and the 3D model, the positioning of the 3D model of the second device in the world coordinate system can be determined.
  • the pose of the first device in the world coordinate system may be determined according to the positioning of the 3D model of the second device in the world coordinate system and the first corresponding relationship.
  • the accuracy of spatial positioning of the first device is improved.
  • the above "first image” may also be referred to as a "device image”.
  • the present disclosure also provides another method for locating the first device.
  • a device image of the second device is collected by the first device, and the device image includes 2D points of the second device and descriptors corresponding to the 2D points.
  • the descriptor corresponding to the 3D point on the 3D model of the second device and the descriptor corresponding to the 2D point to perform feature point matching on the 2D point of the second device and the 3D point on the 3D model of the second device to obtain the second device
  • the first correspondence between the 2D points of the 2D and the 3D points of the 3D model of the second device Calculate the first pose of the first device in the 3D model coordinate system of the second device according to the first correspondence.
  • the descriptors corresponding to the 3D points on the 3D model of the head-mounted device and the descriptors corresponding to the 2D points to perform feature point matching on the 2D points of the head-mounted device and the 3D points on the 3D model of the head-mounted device to obtain A first correspondence between at least three non-collinear 2D points of the head-mounted device and 3D points of the 3D model of the head-mounted device, where the 3D model of the head-mounted device includes 3D points and descriptors corresponding to the 3D points .
  • the pose of the 3D model of the head-mounted device in the world coordinate system is determined. Determine the pose of the first device in the world coordinate system according to the pose of the 3D model of the head-mounted device in the world coordinate system and the first corresponding relationship.
  • Fig. 1 shows a schematic diagram of an example of an application scenario of a spatial positioning method according to the present disclosure.
  • the second device can determine its own spatial location in the global coordinate system, and the spatial location may be a position or a pose.
  • the second device can obtain spatial positioning through SLAM (simultaneous localization and mapping, synchronous positioning and mapping), motion capture system, outside-in tracking technology (outside-in tracking) and other methods.
  • SLAM simultaneous localization and mapping
  • motion capture system outside-in tracking technology
  • outside-in tracking outside-in tracking
  • the second device may include at least one camera and at least one IMU.
  • the second device may include a head-mounted device that may be used to display the virtual object provided by the first device.
  • the second device may include smart glasses, such as AR glasses, virtual reality (virtual reality, VR) glasses, and the like.
  • the execution subject of the spatial positioning method provided in the present disclosure may be the second device, may also be the first device, or may be executed jointly by the second device and the first device.
  • the spatial positioning method can be performed by the mobile phone, which can save the computing power of the AR glasses and reduce the power consumption of the AR glasses.
  • the following description will be made by taking the second device as AR glasses and the first device as a mobile phone as an example.
  • FIG. 2 shows a flowchart of an example 200 of a spatial positioning method according to the present disclosure.
  • the spatial positioning method shown in FIG. 2 may be executed by the first device.
  • a second corresponding relationship between the second device and the 3D model of the second device may be acquired.
  • the 3D model of the second device may be formed by various 3D points, and the 3D model formed by all 3D points may be used to characterize the second device.
  • Fig. 3 shows a schematic diagram of an example of a 3D model of a second device according to the present disclosure.
  • the second device is AR glasses
  • the formed 3D model, as shown in FIG. 3 is used to characterize the AR glasses.
  • the second device can be characterized based on the 3D model, each 3D point on the 3D model is in one-to-one correspondence with each feature point on the second device, and for the one-to-one correspondence between the 3D point and the feature point, the position of the 3D point on the 3D model is the same as The position of the feature point on the second device is the same.
  • the second device is AR glasses
  • a feature point is located in the middle of the nose bridge of the AR glasses
  • a 3D point is located in the middle of the nose bridge of the AR glasses represented by the 3D model.
  • One-to-one correspondence of 3D points One-to-one correspondence of 3D points.
  • the second correspondence can be used to characterize the mapping relationship between the second device and the 3D model. For example, a second corresponding relationship may be formed between the one-to-one corresponding 3D points and the feature points.
  • the determined second correspondence may include a second correspondence between all or part of the feature points on the AR glasses and the 3D points on the 3D model.
  • the 3D model of the second device may correspond to a 3D model coordinate system, and the 3D model coordinate system may be used to determine relative positions of various 3D points on the 3D model.
  • the 3D model coordinate system may be constructed based on the 3D model, and the 3D model coordinate system may be a space Cartesian coordinate system.
  • the 3D model coordinate system can be created with the second device as a reference object, and a fixed position point on the second device (hereinafter referred to as: the first position point) can be used as a position point in the 3D model coordinate system (hereinafter referred to as is: the second position point), and then create a 3D model coordinate system based on the correspondence between the two position points.
  • the coordinate origin in the 3D model coordinate system may be determined as the second location point.
  • a sensor in the second device may be determined as the first location point.
  • the sensor may be a sensor used by the second device to perform SLAM, for example, an IMU, a camera, and the like.
  • other location points on the second device that have a fixed relative location relationship with the sensor may be determined as the first location point.
  • the created 3D model may be pre-stored in the second device, or in the first device, or in another device, server or cloud capable of communicating with the second device and/or the first device.
  • the 3D model of the second device needs to be used, the 3D model can be acquired from a corresponding storage.
  • the step of acquiring the second corresponding relationship between the second device and the 3D model of the second device at 210 may not be a fixed step for executing the method of the present application.
  • the second correspondence may be pre-created, and the created second correspondence may be pre-stored in the second device or in the first device, or may be pre-stored in the In other devices, servers or clouds that are in communication with the second device and/or the first device.
  • the second correspondence can be directly obtained from the corresponding storage.
  • the second correspondence may be created in real time.
  • the feature points on the second device and the 3D points on the 3D model can be determined first, and then the relationship between the feature points on the second device and the 3D points on the 3D model can be established.
  • the corresponding relationship is the second corresponding relationship.
  • both the first image of the second device and the 3D model of the second device are used to represent the same object (that is, the second device), then the 2D points on the second device in the first image can be compared with the 3D 3D point correspondences on the model.
  • the corresponding 2D point and 3D point represent the same location point on the second device.
  • the first device may only take one image, that is, the first image, and may also take continuous shots, and the first image is one frame of images in the continuous multiple frames of images.
  • the first image may be a first frame image, or may be a frame image generated after the first frame image, and at this time, there is a previous frame image before the generation of the first image. For example, if the first image is the fifth frame image, the previous frame image includes the first frame to the fourth frame image, and the fourth frame image is the previous frame image of the first image.
  • the used previous frame image may be a previous frame image of the first image, and may also include multiple consecutive previous frame images, and the multiple previous frame images and the first image may be continuous frame images.
  • the position of the second device in the previous frame image can be determined.
  • each frame image in the previous frame image can determine the corresponding position of the second device.
  • the estimated moving range of the first device may be determined according to the predetermined moving speed of the first device and the position of the second device in previous frame images.
  • the predetermined moving speed of the first device may be acquired by an IMU in the first device.
  • the time interval between image frames may be determined.
  • the moving distance of the first device from the time of the previous frame image to the time of the first image can be obtained by multiplying the predetermined moving speed by the time interval.
  • the moving distance may be equivalent to the distance between the position of the second device in the previous frame image and the position in the first image.
  • the estimated moving range of the first device can be determined.
  • the position of the second device in the previous frame image can be used as a dot, and the moving distance of the first device can be used
  • the range of the circle determined by the radius is the estimated moving range of the first device.
  • a search may be performed within the estimated range of movement in the first image to determine the current location of the 2D point of the second device in the first image. For example, the position of the second device in the previous frame of image and the relative position of the position in the first image may be determined. For example, in the previous frame image, if the second device is located at the middle position, then the relative position of the second device in the previous frame image in the first image is also at the middle position.
  • a search is then performed within the estimated movement range centered on the determined relative position in the first image to determine the current position of the 2D point of the second device in the first image.
  • the estimated range of movement in the first image is smaller than the search range of the entire first image, narrowing the search range, thereby reducing the amount of data processing, thereby improving the 2D determination of the second device from the first image point of efficiency.
  • the estimated moving range of the first device may be determined according to the predetermined moving speed and moving direction of the first device and the position of the second device in previous frame images.
  • the moving direction of the first device may be acquired by an IMU on the first device.
  • the moving direction of the first device is a moving direction in space, and the moving direction of the first device is opposite to the moving direction of the second device on the image collected by the first device. For example, if the first device moves up in space, the second device moves down on the image captured by the first device, for example, the position of the second device in the first image is relative to the position in the previous frame image is moving downward.
  • the relative position of the second device and the first device may be determined according to the position of the second device in the world coordinate system and the position of the first device in the world coordinate system, and the relative position is relative in the world coordinate system.
  • the estimated range of the 2D point of the second device in the first image can be calculated through the relative position of the second device and the first device.
  • the relative distance between the second device and the first device can be determined through the relative positions of the second device and the first device.
  • the shooting orientation of the camera on the first device can be determined.
  • the shooting range of the camera may be determined according to the shooting orientation of the camera and the field of view range of the camera, and the shooting range may be a cone-shaped area with the camera as an apex.
  • the plane shooting range in the plane parallel to the lens plane of the camera to which the position belongs is different.
  • the plane shooting range in the plane where the second device is located can be determined.
  • the position of the second device within the plane shooting range can be determined, and the position of the second device within the plane range and the position centered on the position can be determined.
  • the range determined by the specified distance is determined as the estimated range of the 2D point of the second device in the first image.
  • a search may be performed within the estimated range of the first image to determine the current position of the 2D point of the second device in the first image .
  • the 3D points on the 3D model corresponding to the 2D points on the second device in the first image can be determined by means of feature point matching, and the 2D points and the corresponding 3D points constitute the first correspondence relation.
  • Correspondence between at least three non-collinear 2D points and 3D points may be determined by means of feature point matching.
  • the second device is AR glasses
  • the three non-collinear position points on the AR glasses may be respectively: position points A and B at the bottom of the two frames, and position point C in the middle of the bridge of the nose.
  • the 2D points used to represent the position points of the bottoms of the two frames are respectively A1 and B1
  • the 2D points used to represent the position points in the middle of the bridge of the nose are respectively C1.
  • the 3D points used to represent the position points of the bottoms of the two frames are respectively A2 and B2
  • the 3D points used to represent the position points in the middle of the bridge of the nose are respectively C2.
  • A1 and A2 used to represent the position points of the bottom of the same picture frame can constitute a first correspondence
  • B1 and B2 used to represent different position points of the same picture frame can form another first correspondence relationship
  • using C1 and C2 representing the position point in the middle of the bridge of the nose may form another first corresponding relationship.
  • Fig. 4 shows a schematic diagram of an example of the mapping relationship between 2D points in the first image and 3D points of the 3D model according to the present disclosure.
  • F1 , F2 and F3 are 3D points on the 3D model
  • f1 , f2 and f3 are 2D points of the second device on the first image
  • f1 , f2 and f3 are not collinear.
  • F1 and f1 represent the same location point on the second device, and F1 and f1 are mutually mapped into a first corresponding relationship.
  • F2 and f2 represent the same location point on the second device, and F2 and f2 are mutually mapped into a first corresponding relationship.
  • F3 and f3 represent the same location point on the second device, and F3 and f3 are mutually mapped into a first corresponding relationship.
  • feature point matching may be performed according to feature point descriptors.
  • the descriptor of the 3D point of the 3D model that matches the descriptor can be determined from the descriptors of each 2D point on the second device in the first image, and the two matching descriptors correspond to the 2D point and the 3D point respectively. Match each other, and the 2D points and 3D points that match each other constitute the first corresponding relationship. Two descriptors that are identical or similar can be considered to match each other.
  • the feature point matching manner may include fast-orb, sift, and the like.
  • the location of the second device in the world coordinate system may be a pose, and correspondingly, the determined location of the 3D model in the world coordinate system is a pose.
  • the positioning of the second device in the world coordinate system may also be a position, and correspondingly, the determined positioning of the 3D model in the world coordinate system is a position.
  • a detailed description will be given below in conjunction with FIG. 7 .
  • the second device may calculate the location of the second device in the world coordinate system in real time through data collected by its own sensors (IMU, camera, etc.).
  • the determined pose of the first device may be a 6DOF (degree of freedom) pose, including six degrees of freedom of front and rear, up and down, left and right, pitch, yaw, and roll.
  • the spatial positioning of the first device interacting with the second device is represented by the 6DOF pose, which improves the accuracy of the spatial positioning of the first device.
  • FIG. 5 shows a flowchart of another example 500 of a spatial positioning method according to the present disclosure.
  • the spatial positioning method shown in FIG. 5 may be executed by the first device.
  • a first image of the second device may be collected, where the first image includes a 2D point of the second device and a descriptor corresponding to the 2D point.
  • the second correspondence is a correspondence between the feature points on the second device and the 3D points on the 3D model of the second device, that is, the second correspondence is used to represent the correspondence between the second device and the 3D model.
  • the relationship between the second device, the 3D model, and the world coordinate system can be determined Relationship.
  • FIG. 6 it shows a schematic diagram of an example relationship among the second device, the 3D model and the world coordinate system according to the present disclosure.
  • L1 represents the pose of the second device in the world coordinate system
  • L2 represents the pose of the 3D model in the world coordinate system
  • L2 can be determined from L1 and the known second correspondence.
  • the PnP algorithm may include a P3P algorithm, an EPnP (Efficient PnP) algorithm, an aP3P (Algebraic Solution to the Perspective-Three-Point) algorithm, and the like.
  • the PnP algorithm used in the present disclosure may be a least squares-based PnP algorithm.
  • At least three pairs of 2D points and 3D points conforming to the first correspondence can be obtained.
  • the pose of the first device in the 3D model coordinate system can be calculated.
  • the RANSAC (random sample consensus) algorithm can be used to obtain at least three non-collinear 2D points of the second device in the first image and 3D points of the 3D model of the second device.
  • the first correspondence of determines the interior point.
  • the model is suitable for the plurality of interior points as initial values, and the model's Parameters are calculated from the plurality of interior points.
  • the model is re-evaluated using all the feature points identified as inliers to update the model.
  • the evaluation method may be to use the error rate of the model for evaluation.
  • the above process is an iterative process. After multiple iterations, in each iteration, if there are too few interior points, which is not as good as the model in the previous iteration, the model of this iteration can be discarded. If the model generated by the iteration is better than the model of the previous iteration, the model of this iteration can be retained and the next iteration can be performed.
  • a PnP algorithm may be used to calculate the pose of the first device in the 3D model coordinate system of the second device according to the interior point.
  • FIG. 7 shows a flowchart of another example 700 of a spatial positioning method according to the present disclosure.
  • the spatial positioning method shown in FIG. 7 may be executed by the first device.
  • the position of the second device in the world coordinate system may include three degrees of freedom: front and back, up and down, and left and right.
  • the position of the second device in a Cartesian coordinate system, can be represented by values on the X-axis, Y-axis, and Z-axis.
  • the second device may have a positioning capability, such as GPS, Beidou, etc., and the second device may obtain its own position information in the world coordinate system through positioning.
  • a positioning capability such as GPS, Beidou, etc.
  • the position of the 3D model in the world coordinate system is determined, at 740, according to the first correspondence and the position of the 3D point of the 3D model of the second device conforming to the first correspondence in the world coordinate system, use the PnP algorithm to calculate The pose of the first device in the world coordinate system.
  • the 3D points targeted by the PnP algorithm are all referenced to the world coordinate system, so the obtained pose of the first device is also referenced to the world coordinate system.
  • the PnP algorithm used may be a least squares based PnP algorithm.
  • the positions of all or part of the 3D points in the world coordinate system may be determined.
  • the PnP algorithm calculation is performed on the 3D point with the world coordinate system as a reference, so as to obtain the pose of the first device in the world coordinate system.
  • the RANSAC algorithm may be used to obtain the first data points between the 2D points of the second device and the 3D points of the 3D model of the second device from at least three non-collinear points in the first image.
  • the correspondence determines the interior points. determining the determined interior point as a point to be used when the first correspondence is applied to the PnP algorithm, that is, according to the first correspondence of the determined interior point and the interior point of the 3D points of the 3D model of the second device in The position in the world coordinate system, using the PnP algorithm to calculate the pose of the first device in the world coordinate system.
  • the first device may capture a second image including the specified object.
  • the second image may include a 2D point of a designated object that may be used as a key point, and the relative position of the designated object and the second device is fixed.
  • the aforementioned "second image” may also be referred to as a "specified target image”.
  • the second device may include a head-mounted device, and in this case, the specified object may include a human face.
  • the head-mounted device When the user wears the head-mounted device, the head-mounted device has a fixed relative position to the user's face.
  • the specified object may also include specified organs on the human face, such as eyes, nose, ears, and mouth.
  • the human faces included in the specified object may include general-purpose human faces, and the general-purpose human faces are used to build a 3D face model of the user who uses the head-mounted device. No matter who wears the head-mounted device, this A general-purpose 3D model of human face, which can save the operation of modeling the user's face.
  • the face included in the specified object may include the face of the specified user, and the specified user may be a user using the second device, that is, it is necessary to create a dedicated person for each user wearing a head-mounted device. Face 3D model.
  • a 3D model of a designated object may be pre-built and stored.
  • the stored 3D model may include 3D points and corresponding descriptors.
  • the second device is a head-mounted device
  • the specified object is a human face.
  • the relative position difference between the human face and the head-mounted device is L
  • the 3D model of the human face and the head-mounted device can be determined.
  • the position difference between the 3D models of the wearing device is L1.
  • the 2D points corresponding to the key points on the designated object are detected by means of key point detection, the 2D points corresponding to the key points can be matched with the 3D points of the 3D model of the designated object to establish a matching relationship.
  • the descriptors of the 2D points corresponding to each key point in the second image may be matched with the descriptors of each 3D point on the 3D model of the specified object, and the 2D points and 3D points matched by the descriptors represent the specified For the same key point on the object, the 2D point and the 3D point form a matching relationship.
  • a third corresponding relationship between the 3D model of the specified object and the second image is obtained by combining the matching relationships corresponding to each key point.
  • the second device cannot be photographed or the first image captured by the first device does not include at least three 2D points of the second device that are not collinear, you can The pose of the first device in the world coordinate system is calculated relative to the specified object with a fixed position, which improves the robustness of spatial positioning.
  • keypoint detection is performed on at least three non-collinear 2D points of the specified object in the second image to obtain at least three non-collinear 2D points of the specified object and 3D points of the 3D model of the specified object matching relationship between.
  • the 3D model of the specified object includes 3D points and key points corresponding to the 3D points.
  • the obtained matching relationship is a matching relationship for the key points of the specified object.
  • the PnP algorithm can be used to calculate the pose of the first device in the 3D model coordinate system of the second device based on the first corresponding relationship and the matching relationship, and then based on the first device's position in the second device.
  • the pose in the 3D model coordinate system and the pose of the 3D model of the second device in the world coordinate system are used to obtain the pose of the first device in the world coordinate system.
  • the coordinate system of the 3D model of the specified object can be converted into the 3D model of the second device according to the relative positional relationship between the 3D model of the specified object and the 3D model of the second device.
  • the coordinate system of the model Therefore, the specified object and the 3D model of the second device are unified in the coordinate system of the 3D model of the second device, which is convenient for performing the PnP algorithm.
  • the pose calculated by using the second device and the pose calculated by using the specified object are integrated to obtain a more accurate pose.
  • the first device may be configured with an IMU, and the IMU data may be collected in real time through its own IMU.
  • the first device may use the collected IMU data to calculate the pose of the first device in the world coordinate system (hereinafter referred to as pose a) in real time.
  • the poses of the first device are different at different moments, so the pose a calculated according to the IMU data may be different at different moments.
  • the first device may calculate the current pose a according to the currently collected IMU data when capturing the first image. Then, after the pose of the first device in the world coordinate system (hereinafter referred to as pose b) is determined according to the first image according to the embodiment of the present disclosure, pose a and pose b are fused to obtain the obtained Describe the pose of the first device.
  • the way of fusion may include averaging and the like.
  • the collected IMU data and the pose of the first device in the world coordinate system determined according to the first image may also be used for fusion.
  • the accuracy of the pose of the first device is improved by fusing poses calculated by two different ways.
  • the IMU data is continuous, and the pose determined by the first image is discontinuous.
  • the pose calculated by the IMU data can be fused to obtain a higher Frequency pose to reduce data latency.
  • the spatial positioning device 800 includes an image acquisition unit 810 , a feature point matching unit 820 , a positioning unit 830 and a pose determination unit 840 .
  • the image acquisition unit 810 is configured to acquire a first image of the second device, where the first image includes 2D points of the second device and descriptors corresponding to the 2D points.
  • the feature point matching unit 820 is configured to use the descriptor corresponding to the 3D point on the 3D model of the second device and the descriptor corresponding to the 2D point to characterize the 2D point of the second device and the 3D point on the 3D model of the second device.
  • Point matching to obtain a first correspondence between at least three non-collinear 2D points of the second device and 3D points of the 3D model of the second device, the 3D model of the second device includes 3D points and 3D points corresponding to descriptor.
  • the pose determination unit 840 is configured to determine the pose of the first device in the world coordinate system according to the positioning of the 3D model of the second device in the world coordinate system and the first corresponding relationship.
  • the spatial positioning device 800 further includes a key point matching unit.
  • the image acquisition unit is configured to acquire a second image including a specified object when the first image acquired by the first device does not include at least three non-collinear 2D points of the second device, and the second image includes A 2D point of a designated object that may be used as a key point, and the relative position of the designated object and the second device is fixed.
  • the positioning unit is configured to determine the position of the 3D model of the specified object in the world based on the positioning of the 3D model of the second device in the world coordinate system and the relative positional relationship between the pre-stored 3D model of the specified object and the 3D model of the second device.
  • a key point matching unit configured to perform key point detection on the 2D points of at least three non-collinear specified objects in the second image, to obtain at least three non-collinear 2D points of the specified object and a 3D model of the specified object The matching relationship between the 3D points to obtain the third corresponding relationship between the second image and the 3D model of the specified object.
  • the pose determination unit is configured to determine the pose of the first device in the world coordinate system based on the positioning of the 3D model of the specified object in the world coordinate system and the third corresponding relationship.
  • the spatial positioning device 800 further includes a key point matching unit configured to perform key point detection on at least three 2D points of a specified object that are not collinear in the second image, and obtain at least three A matching relationship between the 2D points of the specified object and the 3D points of the 3D model of the specified object, wherein the 3D model of the specified object includes the 3D points and the key points corresponding to the 3D points.
  • a key point matching unit configured to perform key point detection on at least three 2D points of a specified object that are not collinear in the second image, and obtain at least three A matching relationship between the 2D points of the specified object and the 3D points of the 3D model of the specified object, wherein the 3D model of the specified object includes the 3D points and the key points corresponding to the 3D points.
  • the spatial positioning apparatus 800 further includes a coordinate system conversion unit configured to convert the 3D model of the designated object to The coordinate system of the model is transformed into the coordinate system of the 3D model of the second device.
  • the image acquisition unit is configured to: determine the relative position of the second device and the first device according to the position of the second device in the world coordinate system and the position of the first device in the world coordinate system; The relative position of the second device and the first device, calculating the estimated range of the 2D point of the second device in the first image; and searching within the estimated range in the first image to determine the first image in the first image The current position of the 2D point of the second device.
  • FIG. 9 shows a block diagram of another example of a spatial positioning device 800 according to the present disclosure.
  • the positioning unit 830 may include a first pose determining module 831, and the pose determining module 831 is configured to: determine the pose of the second device according to the pose of the second device in the world coordinate system and the second corresponding relationship The pose of the 3D model in the world coordinate system.
  • the pose determining unit 840 may include a second pose determining module 841 and a third pose determining module 842 .
  • the second pose determination module 841 may be configured to: use a PnP algorithm to calculate the pose of the first device in the 3D model coordinate system of the second device according to the first correspondence.
  • the third pose determining module 842 may be configured to: based on the pose of the first device in the 3D model coordinate system of the second device and the pose of the 3D model of the second device in the world coordinate system, obtain the The pose in the world coordinate system.
  • the pose determining module 831, the second pose determining module 841 and the third pose determining module 842 may be the same module, or may be different modules.
  • the spatial positioning apparatus 800 may further include an inlier point determination unit configured to use a random sampling consensus algorithm to obtain at least three non-collinear 2D points of the second device in the first image determining an inlier in the first corresponding relationship with the 3D point of the 3D model of the second device; and determining the inlier as a point to be used when the first corresponding relationship is applied to the PnP algorithm.
  • an inlier point determination unit configured to use a random sampling consensus algorithm to obtain at least three non-collinear 2D points of the second device in the first image determining an inlier in the first corresponding relationship with the 3D point of the 3D model of the second device; and determining the inlier as a point to be used when the first corresponding relationship is applied to the PnP algorithm.
  • FIG. 10 shows a block diagram of another example of a spatial positioning device 800 according to the present disclosure.
  • the positioning unit 830 may include a position determination module 832, and the position determination module 832 may be configured to: determine the position of the 3D model of the second device according to the position of the second device in the world coordinate system and the second corresponding relationship. The position of the 3D point in the world coordinate system.
  • the device for spatial positioning of the present disclosure may be implemented by hardware, or by software or a combination of hardware and software. Taking software implementation as an example, as a device in a logical sense, it is formed by reading the corresponding computer program instructions in the memory into the memory for operation by the processor of the device where it is located.
  • the means for spatial positioning can be realized by electronic equipment, for example.
  • Fig. 11 shows a block diagram of an electronic device 1100 for implementing a spatial positioning method according to an embodiment of the present disclosure.
  • electronic device 1100 may include at least one processor 1110, memory (for example, non-volatile memory) 1120, memory 1130, and communication interface 1140, and at least one processor 1110, memory 1120, memory 1130, and communication
  • the interfaces 1140 are connected together via a bus 1150 .
  • At least one processor 1110 executes at least one computer-readable instruction (ie, the elements implemented in software described above) stored or encoded in a memory.
  • computer-executable instructions are stored in a memory which, when executed, cause at least one processor 1110 to: acquire a first image of a second device, the first image comprising a 2D point of the second device and a corresponding 2D point of the 2D point Descriptor; use the descriptor corresponding to the 3D point on the 3D model of the second device and the descriptor corresponding to the 2D point to perform feature point matching on the 2D point of the second device and the 3D point on the 3D model of the second device to obtain A first correspondence between at least three non-collinear 2D points of the second device and 3D points of the 3D model of the second device, where the 3D model of the second device includes 3D points and descriptors corresponding to the 3D points; according to the first The location of the second device in the world coordinate system and the second corresponding relationship between the second device and the 3D model, determine the location of the 3D model of the second device in the world coordinate system; and according to the 3D model of the second device in
  • a program product such as a machine-readable medium
  • the machine-readable medium may have instructions (that is, the aforementioned elements implemented in software), which, when executed by a machine, cause the machine to perform various operations and functions described above in conjunction with FIGS. 1-10 in various embodiments of the present disclosure. .
  • a system or device equipped with a readable storage medium may be provided, on which a software program code for realizing the functions of any of the above embodiments is stored, and the computer or processor of the system or device can read output and execute the instructions stored in the readable storage medium.
  • the program code itself read from the readable medium can realize the function of any one of the above-mentioned embodiments, so the machine-readable code and the readable storage medium storing the machine-readable code constitute the present invention. a part of.
  • the computer program code required for the operation of various parts of this disclosure can be written in any one or more programming languages, including object-oriented programming languages, such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB, NET and Python, etc., conventional programming languages such as C language, Visual Basic 2003, Perl, COBOL 2002, PHP and ABAP, dynamic programming languages such as Python, Ruby and Groovy, or other programming languages.
  • the program code may run on the user's computer, or as a stand-alone software package, or partly on the user's computer and partly on a remote computer, or entirely on a remote computer or server.
  • Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tape, non- Volatile memory card and ROM.
  • the program code can be downloaded from a server computer or cloud via a communication network.
  • the execution order of each step is not fixed, and can be determined as required.
  • the device structures described in the above embodiments may be physical structures or logical structures, that is, some units may be realized by the same physical entity, or some units may be realized by multiple physical entities, or may be realized by multiple physical entities. Certain components in individual devices are implemented together.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computer Graphics (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)
  • Image Analysis (AREA)

Abstract

本公开提供了一种用于空间定位的方法及装置。在该方法中,采集第二设备的第一图像,第一图像包括第二设备的2D点和2D点对应的描述子;利用第二设备的3D模型上的3D点对应的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系,第二设备的3D模型包括3D点和3D点对应的描述子;根据第二设备在世界坐标系中的定位以及第二设备与3D模型之间的第二对应关系,确定第二设备的3D模型在世界坐标系中的定位;以及根据第二设备的3D模型在世界坐标系中的定位以及第一对应关系,确定第一设备在世界坐标系中的位姿。

Description

用于空间定位的方法及装置 技术领域
本公开涉及信息技术领域,具体地,涉及用于空间定位的方法及装置。
背景技术
随着计算机和通信等各种技术的快速发展,增强现实(Augmented Reality,AR)等技术也随之迅速发展。具体而言,在AR技术中,可以利用计算机技术来将虚拟信息应用到真实世界,也就是将真实场景和虚拟图像(例如,虚拟物体、虚拟场景等等)实时地叠加在同一画面下,使得人眼同时观看到真实场景和虚拟图像的混合图像,从而达到增强现实的效果。
用户可以通过交互设备与AR场景中的虚拟对象进行交互,以产生期望的效果。例如,用户可以移动交互设备,而交互设备的空间移动可以被转化为AR场景中的虚拟对象的移动,从而达到控制虚拟对象的目的。因此,在AR场景的交互过程中需要确定交互设备的空间定位,如何精确地确定交互设备在空间中的定位成为亟待解决的问题。
发明内容
鉴于上述,本公开提供了一种用于空间定位的方法及装置。
根据本公开的一个方面,提供了一种用于空间定位的方法,所述方法由第一设备执行,所述方法包括:采集第二设备的设备图像,所述设备图像包括所述第二设备的2D点和2D点对应的描述子;利用所述第二设备的3D模型上的3D点对应的描述子和所述2D点对应的描述子对所述第二设备的2D点和所述第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的所述第二设备的2D点与所述第二设备的3D模型的3D点之间的第一对应关系,所述第二设备的3D模型包括3D点和3D点对应的描述子;根据所述第二设备在世界坐标系中的定位以及所述第二设备与所述3D模型之间的第二对应关系,确定所述第二设备的3D模型在所述世界坐标系中的定位;以及根据所述第二设备的3D模型在所述世界坐标系中的定位以及所述第一对应关系,确定所述第一设备在所述世界坐标系中的位姿。
根据本公开的另一方面,还提供一种电子设备,包括:至少一个处理器;以及存储器,所述存储器存储指令,当所述指令被所述至少一个处理器执行时,使得所述至少一个处理器执行如上所述的用于空间定位的方法。
根据本公开的另一方面,还提供一种非易失性机器可读存储介质,其存储有可执行指令,所述指令当被执行时使得所述机器执行如上所述的用于空间定位的方法。
附图说明
通过参照下面的附图,可以实现对于本公开内容的本质和优点的进一步理解。在附图中,类似组件或特征可以具有相同的附图标记。
图1示出了根据本公开的空间定位方法的应用场景的一个示例的示意图。
图2示出了根据本公开的空间定位方法的一个示例的流程图。
图3示出了根据本公开的第二设备的3D模型的一个示例的示意图。
图4示出了根据本公开的第一图像中的2D点与3D模型的3D点之间的映射关系的一个示例的示意图。
图5示出了根据本公开的空间定位方法的另一个示例的流程图。
图6示出了根据本公开的第二设备、3D模型以及世界坐标系三者之间的一个示例的关系示意图。
图7示出了根据本公开的空间定位方法的另一个示例的流程图。
图8示出了根据本公开的空间定位装置的一个示例的方框图。
图9示出了根据本公开的空间定位装置的另一个示例的方框图。
图10示出了根据本公开的空间定位装置的另一个示例的方框图。
图11示出了本公开的实施例的用于实现空间定位方法的电子设备的方框图。
具体实施方式
以下将参考示例实施方式讨论本文描述的主题。应该理解,讨论这些实施方式只是为了使得本领域技术人员能够更好地理解从而实现本文描述的主题,并非是对本公开中所阐述的保护范围、适用性或者示例的限制。可以在不脱离本公开内容的保护范围的情况下,对所讨论的元素的功能和排列进行改变。各个示例可以根据需要,省略、替代或者添加各种过程或组件。另外,相对一些示例所描述的特征在其它例子中也可以进行组合。
如本文中使用的,术语“包括”及其变型表示开放的术语,含义是“包括但不限于”。术语“基于”表示“至少部分地基于”。术语“一个实施例”和“一实施例”表示“至少一个实施例”。术语“另一个实施例”表示“至少一个其他实施例”。术语“第一”、“第二”等可以指代不同的或相同的对象。下面可以包括其他的定义,无论是明确的还是隐含的。除非上下文中明确地指明,否则一个术语的定义在整个说明书中是一致的。
在目前增强现实(Augmented Reality,AR)技术的应用中,可以是终端设备(比如,手机、个人电脑、平板电脑等移动终端)与AR眼镜连接,终端设备可以作为手柄用于控制通过AR眼镜显示的虚拟对象。终端设备在空间中移动,以对AR眼镜中显示的虚拟对象进行相应的操作,例如位置移动、姿态变化、界面切换、选择、取消、进入、退出等等。基于此,终端设备在空间中的定位在AR场景中很重要,直接影响了与AR场景中的虚拟对象的交互。
目前,终端设备通过内置的IMU(Inertial Measurement Unit)来进行姿态解算。一般用于消费类产品的IMU只能实现3DOF(degree of freedom)的功能,3DOF仅包括偏 航、俯仰和侧倾。基于此,终端设备只能通过偏航、俯仰和侧倾三个自由度来进行姿态解算。偏航、俯仰和侧倾三个自由度有一定的局限性,如果仅使用该IMU进行6DOF的空间定位,则导致终端设备的空间定位不准,进而影响与AR场景中的虚拟对象的交互。
鉴于上述,本公开提供了一种用于空间定位的方法及装置。在该方法中,采集第二设备的第一图像,第一图像可以包括第二设备的2D点和2D点对应的描述子。可以利用第二设备的3D模型上的3D点对应的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系。第二设备的3D模型可以包括3D点和3D点对应的描述子。根据第二设备在世界坐标系中的定位以及第二设备与3D模型之间的第二对应关系,可以确定第二设备的3D模型在世界坐标系中的定位。可以根据第二设备的3D模型在世界坐标系中的定位以及第一对应关系,确定第一设备在世界坐标系中的位姿。通过本公开的技术方案,提高了第一设备的空间定位的精确度。例如,上述“第一图像”也可以称之为“设备图像”。
本公开还提供了另一种用于定位第一设备的方法。在该方法中,通过第一设备采集第二设备的设备图像,设备图像包括第二设备的2D点和2D点对应的描述子。利用第二设备的3D模型上的3D点对应的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系。根据第一对应关系计算第一设备在第二设备的3D模型坐标系中的第一位姿。根据第二设备在世界坐标系中的位姿以及第二设备与3D模型之间的第二对应关系,确定第二设备的3D模型在世界坐标系中的位姿。根据第二设备的3D模型在世界坐标系中的位姿以及第一位姿,确定第一设备在世界坐标系中的第二位姿。
本公开还提供了一种用于确定手持设备的位姿的方法,手持设备与头戴式设备通信连接,手持设备被配置为向头戴式设备提供待显示的虚拟对象和控制通过头戴式设备显示的虚拟对象。在该方法中,通过手持设备采集头戴式设备的第一图像,第一图像包括头戴式设备的2D点和2D点对应的描述子。利用头戴式设备的3D模型上的3D点对应的描述子和2D点对应的描述子对头戴式设备的2D点和头戴式设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的头戴式设备的2D点与头戴式设备的3D模型的3D点之间的第一对应关系,头戴式设备的3D模型包括3D点和3D点对应的描述子。根据头戴式设备在世界坐标系中的位姿以及头戴式设备与3D模型之间的第二对应关系,确定头戴式设备的3D模型在世界坐标系中的位姿。根据头戴式设备的3D模型在世界坐标系中的位姿以及第一对应关系,确定第一设备在世界坐标系中的位姿。
图1示出了根据本公开的空间定位方法的应用场景的一个示例的示意图。
如图1所示,空间定位方法的应用场景中至少包括有第二设备和第一设备。第二设备与第一设备之间可以通信连接。
第二设备能够确定自身在全局坐标系中的空间定位,该空间定位可以是位置,还可以是位姿。第二设备可以通过SLAM(simultaneous localization and mapping,同步定位与建图)、动作捕捉系统、外向内追踪技术(outside-in tracking)等方式来获取空间定位。 在第二设备具备SLAM功能时,第二设备可以至少包括一个摄像头和至少一个IMU。在一个示例中,第二设备可以包括头戴式设备,头戴式设备可以用于显示第一设备提供的虚拟对象。例如,第二设备可以包括智能眼镜,比如,AR眼镜、虚拟现实(virtual reality,VR)眼镜等。
可以理解的是,本文中的术语“位置”可以利用空间直角坐标系表示,而本文中的术语“位姿”描述的是物体的位置和姿态,例如用欧拉角、四元数等来表示姿态。
第一设备可以是具有用于采集图像的摄像装置的终端设备,第一设备可以包括手持设备,比如,手机,或个人电脑、平板电脑等。手持设备可以用于控制通过头戴式设备显示的虚拟对象并包括用于采集第一图像的摄像设备。
本公开提供的空间定位方法的执行主体可以是第二设备,还可以是第一设备,也可以是第二设备和第一设备共同来执行。例如,在手机连接AR眼镜的应用场景中,可以由手机来执行空间定位方法,这样可以节省AR眼镜的算力,降低AR眼镜的功耗。下面以第二设备是AR眼镜、第一设备是手机为例进行说明。
图2示出了根据本公开的空间定位方法的一个示例200的流程图。图2所示的空间定位方法可以由第一设备执行。
如图2所示,在210,可以获取第二设备和第二设备的3D模型之间的第二对应关系。
在本公开中,3D模型可以包括3D点和3D点对应的描述子。描述子是各个特征点的描述信息,描述子可以用于区分各个特征点,从而根据各个描述子可以确定对应的特征点。在本公开中,描述子可以是3D描述子,还可以是2D描述子。
第二设备的3D模型可以由各个3D点构成,所有3D点构成的3D模型可以用来表征第二设备。图3示出了根据本公开的第二设备的3D模型的一个示例的示意图。例如,第二设备是AR眼镜,所形成的3D模型如图3所示,用于表征该AR眼镜。
基于3D模型可以表征第二设备,3D模型上的各个3D点与第二设备上的各个特征点一一对应,针对一一对应的3D点和特征点,该3D点在3D模型上的位置与该特征点在第二设备上的位置相同。例如,第二设备是AR眼镜,一个特征点位于AR眼镜的鼻梁正中间,一个3D点位于3D模型所表征的AR眼镜的鼻梁正中间,则AR眼镜上的该特征点与3D模型上的该3D点一一对应。
第二对应关系可以用于表征第二设备与3D模型之间的映射关系。例如,一一对应的3D点和特征点之间可以构成第二对应关系。所确定出的第二对应关系可以包括所有或部分AR眼镜上的特征点与3D模型上的3D点的第二对应关系。
在本公开中,第二设备的3D模型可以对应有3D模型坐标系,3D模型坐标系可以用于确定3D模型上的各个3D点的相对位置。3D模型坐标系可以是基于3D模型构建的,3D模型坐标系可以是空间直角坐标系。
3D模型坐标系可以以第二设备为参照物所创建的,可以将第二设备上的一个固定位置点(以下称为:第一位置点)作为3D模型坐标系中的一个位置点(以下称为:第二位置点),然后基于两个位置点的对应关系来创建3D模型坐标系。在一个示例中,可以将3D模型坐标系中的坐标原点确定为第二位置点。
在一个示例中,可以将第二设备中的传感器确定为第一位置点。传感器可以是第二 设备用于执行SLAM的传感器,例如,IMU、摄像头等。在另一个示例中,可以将第二设备上与传感器有固定相对位置关系的其他位置点确定为第一位置点。
在本公开的一个示例中,第二设备的3D模型可以是预先创建的,预先创建3D模型的设备可以是第二设备以外的其他设备。
在本公开的另一个示例中,第二设备的3D模型可以是由该第二设备创建,第二设备可以实时创建3D模型。第二设备在需要创建3D模型时,可以先在第二设备上确定一个固定位置点作为3D模型坐标系中的一个位置点,例如,可以将第二设备上的摄像头作为3D模型坐标系中的坐标原点。然后,基于所确定的位置点来建立3D模型坐标系中,再利用第二设备上的传感器在3D模型坐标系中创建第二设备的3D模型。
创建完成的3D模型可以预存在第二设备中,也可以预存在第一设备中,还可以预存在能与第二设备和/或第一设备通信联系的其它设备、服务器或云中。在需要使用第二设备的3D模型时,可以从相应的存储中获取该3D模型。
可以理解的,在210获取第二设备和第二设备的3D模型之间的第二对应关系的步骤可以不是执行本申请方法的固定步骤。
在获取第二对应关系的一个示例中,第二对应关系可以是预先创建的,创建完成的第二对应关系可以预存在第二设备中,也可以预存在第一设备中,还可以预存在能与第二设备和/或第一设备通信联系的其它设备、服务器或云中。在该示例中,可以从相应的存储中直接获取第二对应关系。
在获取第二对应关系的另一个示例中,第二对应关系可以是实时创建的。在该示例中,在需要获取第二对应关系时,可以先确定第二设备上的特征点以及3D模型上的3D点,然后建立第二设备上的特征点与3D模型上的3D点之间的对应关系,该对应关系即为第二对应关系。
在220,可以采集第二设备的第一图像。
在本公开中,通过第一设备采集到的第二设备的第一图像中可以包括完整的第二设备,还可以包括第二设备的一部分。第一图像可以包括第二设备的2D点和2D点对应的描述子,第一图像的各个图像点可以用2D点和该2D点对应的描述子来表示,基于此,第一图像中的第二设备可以由多个2D点组成。
在本公开中,第二设备的第一图像与第二设备的3D模型都用于表示同一个物体(即,第二设备),则第一图像中的第二设备上的2D点可以与3D模型上的3D点对应。对应的2D点和3D点表示第二设备上的同一位置点。
在本公开中,第一设备可以仅拍摄一张图像,即第一图像,还可以连续拍摄,第一图像是连续多帧图像中的其中一帧图像。在第一设备进行连续拍摄时,第一图像可以是第一帧图像,还可以是第一帧图像之后所生成的帧图像,此时,在生成第一图像之前存在先前帧图像。例如,第一图像是第五帧图像,则先前帧图像包括第一帧至第四帧图像,第四帧图像是第一图像的前一帧图像。
在本公开的一个示例中,在第一图像不是第一帧图像时,第一图像的先前帧图像与第一图像可以是连续帧图像,各个先前帧图像中也包括有第二设备。连续帧图像可以连续记录第二设备的位置变化,第二设备的位置变化在连续帧图像中连续变化。基于此, 可以根据第一图像的先前帧图像中第二设备的位置在第一图像中进行搜索,以在第一图像中确定第二设备的2D点的当前位置。
在该示例中,所使用的先前帧图像可以是第一图像的前一帧图像,还可以包括多张连续的先前帧图像,该多张先前帧图像与第一图像可以是连续帧图像。可以确定先前帧图像中第二设备的位置。在使用的先前帧图像包括有多帧图像时,先前帧图像中的每帧图像均可以确定出相应的第二设备的位置。下面以一张先前帧图像为例进行说明。
可以根据第一设备的预定移动速度和先前帧图像中第二设备的位置,确定第一设备的预估移动范围。第一设备的预定移动速度可以由第一设备中的IMU来获取。
在通过第一设备的IMU确定第一设备的预定移动速度后,可以确定图像帧之间的时间间隔。将预定移动速度和时间间隔相乘可以得到第一设备从先前帧图像的时刻到第一图像的时刻的移动距离。该移动距离可以等效于第二设备在先前帧图像中的位置与在第一图像中的位置之间的距离。
根据第一设备的移动距离和先前帧图像中第二设备的位置可以确定第一设备的预估移动范围,可以以先前帧图像中第二设备的位置为圆点,以第一设备的移动距离为半径所确定的圆的范围即为第一设备的预估移动范围。
可以在第一图像中的预估移动范围内进行搜索,以在第一图像中确定第二设备的2D点的当前位置。例如,可以确定第二设备在先前帧图像中的位置,以及该位置在第一图像中的相对位置。例如,在先前帧图像中,第二设备位于正中间位置,则先前帧图像中的第二设备在第一图像中的相对位置也是正中间位置。然后在第一图像中以所确定的相对位置为中心的预估移动范围内进行搜索,以在第一图像中确定第二设备的2D点的当前位置。
在该示例中,第一图像中的预估移动范围小于整个第一图像的搜索范围,缩小了搜索的范围,从而减少了数据处理量,进而提高了从第一图像中确定第二设备的2D点的效率。
在一个示例中,可以根据第一设备的预定移动速度、移动方向和先前帧图像中第二设备的位置,确定第一设备的预估移动范围。
在该示例中,第一设备的移动方向可以由第一设备上的IMU来获取。第一设备的移动方向是在空间中移动方向,第一设备的移动方向与第二设备在第一设备采集的图像上的移动方向相反。例如,第一设备在空间中向上移动,则第二设备在第一设备采集的图像上向下移动,比如,第二设备在第一图像中的位置相对于在先前帧图像中的位置来说是向下移动的。
基于第一设备的移动方向,所确定的预估移动范围可以位于先前帧图像中第二设备的位置的与第一设备的移动方向相反的方向上。从而,进一步地减小了预估移动范围,进而进一步地缩小了搜索的范围。
在本公开的另一个示例中,可以根据第二设备在世界坐标系中的位置和第一设备在世界坐标系中的位置,确定第二设备和第一设备的相对位置,该相对位置是相对于世界坐标系来说的。
可以通过第二设备和第一设备的相对位置,计算第二设备的2D点在第一图像中的 预估范围。例如,通过第二设备和第一设备的相对位置可以确定第二设备与第一设备之间的相对距离。根据第一设备的位姿和第一设备上的摄像头的位置,可以确定第一设备上的摄像头的拍摄朝向。根据摄像头的拍摄朝向和摄像头的视场角范围可以确定摄像头的拍摄范围,该拍摄范围可以是以摄像头为顶点的锥形区域范围。在摄像头的拍摄范围内,在与第一设备距离不同的位置处,该位置所属的与摄像头的镜头平面平行的平面内的平面拍摄范围不同,与第一设备距离越远,平面拍摄范围越大。根据第二设备与第一设备之间的相对距离以及摄像头的拍摄范围,可以确定第二设备所在的平面内的平面拍摄范围。可以根据所确定出的平面拍摄范围和第二设备在空间中的位置,确定出第二设备在平面拍摄范围内的位置,可以将第二设备在平面范围内的位置以及以该位置为中心的指定距离所确定的范围确定为第二设备的2D点在第一图像中的预估范围。
在确定出第二设备的2D点在第一图像中的预估范围后,可以在第一图像中的预估范围内进行搜索,以在第一图像中确定第二设备的2D点的当前位置。
通过上述两个示例,通过预估第二设备的2D点在第一图像中的范围,仅需在第一图像中的预估范围内进行搜索,缩小了局部搜索的范围,从而减少了数据处理量,进而提高了从第一图像中确定第二设备的2D点的效率。
回到图2,在230,利用第二设备的3D模型上的3D点的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系。
在本公开中,可以通过特征点匹配的方式来确定第一图像中的第二设备上的各个2D点所对应的3D模型上的3D点,2D点与对应的3D点之间构成第一对应关系。可以通过特征点匹配的方式确定出至少三个不共线的2D点与3D点的之间对应关系。
例如,第二设备为AR眼镜,AR眼镜上的三个不共线的位置点可以分别为:两个镜框的底部的位置点A和B,和鼻梁中间的位置点C。第一图像中的第二设备上的用于表示两个镜框的底部的位置点的2D点分别为A1和B1,用于表示鼻梁中间的位置点的2D点分别为C1。第二设备的3D模型上的用于表示两个镜框的底部的位置点的3D点分别为A2和B2,用于表示鼻梁中间的位置点的3D点分别为C2。则用于表示同一个镜框的底部的位置点的A1和A2可以构成一个第一对应关系,用于表示同一个镜框的都不的位置点的B1和B2可以构成另一个第一对应关系,用于表示鼻梁中间的位置点的C1和C2可以构成再一个第一对应关系。
图4示出了根据本公开的第一图像中的2D点与3D模型的3D点之间的映射关系的一个示例的示意图。如图4所示,F1、F2和F3是3D模型上的3D点,f1、f2和f3是第一图像上的第二设备的2D点,f1、f2和f3三者不共线。F1和f1表征第二设备上的同一个位置点,F1与f1相互映射成第一对应关系。F2和f2表征第二设备上的同一个位置点,F2和f2相互映射成第一对应关系。F3和f3表征第二设备上的同一个位置点,F3和f3相互映射成第一对应关系。
在一个示例中,可以根据特征点的描述子来进行特征点匹配。可以在第一图像中的第二设备上的各个2D点的描述子中确定与该描述子匹配的3D模型的3D点的描述子,相互匹配的两个描述子分别对应的2D点与3D点相互匹配,相互匹配的2D点和3D点构成第一对应关系。相同或相似的两个描述子可以认为是相互匹配的。在另一个示例中, 特征点匹配的方式可以包括fast-orb、sift等。
需要说明的是,上述210与220和230的操作顺序可以不限定。可以按照图2的顺序执行;还可以先执行220和230的操作,再执行210的操作;还可以在执行220和230的操作的同时,执行210的操作。
在240,根据第二设备在世界坐标系中的定位以及第二设备与所述3D模型之间的第二对应关系,确定第二设备的3D模型在世界坐标系中的定位。
在本公开中,第二设备在世界坐标系中的定位可以是位姿,相应地,所确定的3D模型在世界坐标系中的定位是位姿。下面结合附图5进行详细说明。
第二设备在世界坐标系中的定位还可以是位置,相应地,所确定的3D模型在世界坐标系中的定位是位置。下面结合附图7进行详细说明。
可以理解的,第二设备可以通过自身的传感器(IMU、摄像头等)采集的数据实时计算第二设备在世界坐标系中的定位。
在250,根据第二设备的3D模型在世界坐标系中的定位以及第一对应关系,确定第一设备在世界坐标系中的位姿。
所确定出的第一设备的位姿可以是6DOF(degree of freedom)位姿,包括前后、上下、左右、俯仰、偏摆以及翻滚六个自由度。通过6DOF位姿来表示与第二设备交互的第一设备的空间定位,提高了第一设备的空间定位的精确度。
图5示出了根据本公开的空间定位方法的另一个示例500的流程图。图5所示的空间定位方法可以由第一设备执行。
如图5所示,在510,可以采集第二设备的第一图像,第一图像包括第二设备的2D点和2D点对应的描述子。
在520,利用第二设备的3D模型上的3D点对应的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系。
图5中的510和520的操作分别与上述图2中的220和230的操作相似,在此不再描述。
在530,根据第二设备在世界坐标系中的位姿以及第二对应关系,确定第二设备的3D模型在世界坐标系中的位姿。
在本公开中,第二设备可以具备SLAM计算能力,从而第二设备可以通过SLAM方式计算出第二设备的位姿。在一个示例中,第二设备可以实时地通过SLAM方式计算出第二设备的实时位姿,在需要第二设备的位姿信息时,可以直接从第二设备处获取。在另一个示例中,可以通过触发的方式来触发第二设备执行SLAM计算,在不触发时第二设备不执行SLAM计算。
第二对应关系是第二设备上的特征点与第二设备的3D模型上的3D点之间的对应关系,即,第二对应关系用于表示第二设备与3D模型之间的对应关系。在获取到第二设备在世界坐标系中的位姿后,基于第二对应关系以及第二设备在世界坐标系中的位姿,可以确定第二设备、3D模型以及世界坐标系三者之间的关系。如图6所示,示出了根据本公开的第二设备、3D模型以及世界坐标系三者之间的一个示例的关系示意图。如图6所示,L1表示第二设备在世界坐标系中的位姿,L2表示3D模型在世界坐标系中 的位姿,则由L1和已知的第二对应关系,可以确定出L2。
需要说明的是,530的操作可以作为空间定位方法中的一个步骤来执行,即,在每次执行空间定位方法的过程中,执行530的操作。在另一个示例中,530的操作可以由其他设备来执行,例如,当本公开的空间定位方法由第一设备来执行时,530的操作可以由第二设备来执行,第一设备需要3D模型在世界坐标系中的位姿信息时,可以从第二设备获取。当本公开的空间定位方法由第二设备来执行时,530的操作可以由第一设备来执行,第二设备需要3D模型在世界坐标系中的位姿信息时,可以从第一设备获取。此外,530的操作还可以由除第二设备和第一设备以外的其他设备来执行。
在540,使用PnP(perspective-n-point)算法根据第一对应关系计算第一设备在3D模型坐标系中的位姿。
在本公开中,第一对应关系是第一图像中的2D点与3D模型的3D点之间的对应关系。
在本公开中,PnP算法可以包括P3P算法、EPnP(Efficient PnP)算法、aP3P(Algebraic Solution to the Perspective-Three-Point)算法等。在一个示例中,本公开中所使用的PnP算法可以是基于最小二乘法的PnP算法。
在已知第一对应关系的基础上,可以得到符合第一对应关系的至少三对2D点和3D点的点对。通过PnP算法,根据2D点在相机坐标系下的坐标与3D点在3D模型坐标系下的坐标,可以计算出第一设备在3D模型坐标系中的位姿。
在一个示例中,可以使用RANSAC(random sample consensus,随机抽样一致性)算法从第一图像中的至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系确定内点。
在第一对应关系的所有点中随机假设多个内点作为初始值,将该多个内点拟合成一个模型,该模型适用于该作为初始值的多个内点,并且,该模型的参数由该多个内点计算得到。使用模型来测试第一对应关系中的其他特征点,若其他特征点中的一个特征点适用于该模型,则可以确定该特征点是内点,否则,则可以认为该特征点不是内点。通过该方式,可以扩充内点的数量。在测试完所有的特征点后,使用所有被确定为内点的特征点对模型进行重新评估,以对模型进行更新。评估的方式可以是利用模型的错误率来进行评估。上述过程为一次迭代过程,经过多次迭代,在每一次迭代过程中,若内点太少,不如上一次迭代中的模型,则可以舍弃该次迭代的模型。若迭代产生的模型相比于上一次迭代的模型更好,则可以保留该次迭代的模型,并进行下一次迭代。
在确定出内点后,可以使用PnP算法根据内点来计算第一设备在第二设备的3D模型坐标系中的位姿。
通过该示例中的RANSAC算法,可以从第一对应关系中的特征点匹配的所有特征点中筛选出匹配度更高的特征点作为内点。经过RANSAC算法,筛选出的内点不仅特征点匹配度更高,而且用于PnP算法的特征点更少,从而在提高位姿计算精确度的基础上,减少了数据的计算量。
回到图5,在550,基于第一设备在第二设备的3D模型坐标系中的位姿以及第二设备的3D模型在世界坐标系中的位姿,得到第一设备在世界坐标系中的位姿。
在本公开中,3D模型坐标系根据3D模型所构建,3D模型坐标系与3D模型的相 对位置固定。根据第一设备在3D模型坐标系中的位姿和3D模型坐标系与3D模型的相对位置关系,可以确定出第一设备相对于3D模型的位姿。基于第一设备相对于3D模型的位姿和3D模型在世界坐标系中的位姿,可以得到第一设备在世界坐标系中的位姿。
图7示出了根据本公开的空间定位方法的另一个示例700的流程图。图7所示的空间定位方法可以由第一设备执行。
如图7所示,在710,可以采集第二设备的第一图像,第一图像包括第二设备的2D点和2D点对应的描述子。
在720,利用第二设备的3D模型上的3D点对应的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系。
图7中的710和720的操作分别与上述图2中的220和230的操作相似,在此不再描述。
在730,根据第二设备在世界坐标系中的位置以及第二对应关系,确定第二设备的3D模型的3D点在世界坐标系中的位置。
在该示例中,第二设备在世界坐标系中的位置可以包括前后、上下、左右3个自由度。例如,在直角坐标系中,第二设备的位置可以用X轴、Y轴以及Z轴上的值来表示。
在该示例中,第二设备可以具有定位能力,比如,GPS、北斗等,第二设备可以通过定位来获取自身在世界坐标系中的位置信息。
在确定出3D模型在世界坐标系中的位置后,在740,根据第一对应关系和符合第一对应关系的第二设备的3D模型的3D点在世界坐标系中的位置,使用PnP算法计算第一设备在世界坐标系中的位姿。
在该示例中,PnP算法所针对的3D点均以世界坐标系为参照,从而所得到的第一设备的位姿也是以世界坐标系为参照。在一个示例中,使用的PnP算法可以是基于最小二乘法的PnP算法。
在一个示例中,可以针对第一对应关系中的所有或者部分3D点,确定出该所有或者部分3D点在世界坐标系中的位置。针对以世界坐标系为参照的3D点进行PnP算法计算,以得到第一设备在世界坐标系中的位姿。
在一个示例中,在执行740的操作之前,可以使用RANSAC算法从第一图像中的至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系确定内点。将所确定的内点确定为第一对应关系应用于PnP算法时待使用的点,即,根据所确定的内点的第一对应关系和第二设备的3D模型的3D点中的内点在世界坐标系中的位置,使用PnP算法计算第一设备在世界坐标系中的位姿。
在本公开的一个示例中,当第一设备拍摄不到包括第二设备的第一图像时,可以确定第一设备采集到的第一图像中不包括至少三个不共线的第二设备的2D点。此外,第一设备可以拍摄到包括第二设备的第一图像,所拍摄到的第一图像中的第二设备的2D点少于三个,或者第一图像中的第二设备的不少于三个的2D点共线,则可以确定第一设备采集到的第一图像中不包括至少三个不共线的第二设备的2D点。
在第一设备采集到的第一图像中不包括至少三个不共线的第二设备的2D点的情况 下,第一设备可以拍摄包括指定对象的第二图像。第二图像可以包括可作为关键点的指定对象的2D点,指定对象与第二设备的相对位置固定。例如,上述“第二图像”也可以称之为“指定对象图像”。
在一个示例中,第二设备可以包括头戴设备,此时,指定对象可以包括人脸。在用户佩戴头戴设备时,头戴设备与用户的人脸具有固定的相对位置。在另一个示例中,指定对象还可以包括人脸上的指定器官,比如,眼睛、鼻子、耳朵、嘴巴等。
在一个示例中,指定对象所包括的人脸可以包括通用型人脸,利用该通用型人脸建立使用该头戴设备的用户的人脸3D模型,不管是谁佩戴头戴设备,均使用该通用的人脸3D模型,可以节省为用户的脸部建模的操作。在另一个示例中,指定对象所包括的人脸可以包括指定用户的脸部,指定用户可以是使用第二设备的用户,也即,需要为每一位佩戴头戴设备的用户建立专属的人脸3D模型。
在该示例中,可以预先构建指定对象的3D模型,并存储该3D模型。在一个示例中,所存储的3D模型可以包括3D点以及对应的描述子。
由于指定对象与第二设备的相对位置固定,可以基于该相对位置建立预存的指定对象的3D模型与第二设备的3D模型之间的相对位置关系。例如,该第二设备为头戴设备,该指定对象为人脸,在用户佩戴头戴设备时,人脸和头戴设备之间的相对位置差异为L,则可以确定人脸的3D模型和头戴设备的3D模型之间的位置差异为L1。通过计算头戴设备3D模型在世界坐标系中的位置或位姿后,可以通过L1计算得到人脸3D模型在世界坐标系中的位置或位姿。
在第二图像中对至少三个不共线的指定对象的2D点进行关键点检测,以得到至少三个不共线的指定对象的2D点和指定对象的3D模型的3D点之间的匹配关系,以得到指定对象的3D模型与第二图像之间的第三对应关系。
在该示例中,指定对象的关键点可以是指定的。例如,指定对象是人脸时,人脸上指定的关键点可以包括嘴角、鼻尖等位置处的特征点。
在通过关键点检测方式检测出指定对象上的关键点对应的2D点后,可以将关键点对应的2D点与指定对象的3D模型的3D点进行匹配,建立匹配关系。
在一个示例中,可以对第二图像中的各个关键点对应的2D点的描述子与指定对象的3D模型上各个3D点的描述子进行匹配,描述子相匹配的2D点与3D点表征指定对象上的同一关键点,该2D点与该3D点构成匹配关系。
将各个关键点对应的匹配关系结合得到指定对象的3D模型与第二图像之间的第三对应关系。
通过上述示例,在拍摄不到第二设备或者第一设备所采集到的第一图像中不包括至少三个不共线的第二设备的2D点的情况下,可以通过拍摄与第二设备的相对位置固定的指定对象来计算出第一设备在世界坐标系中的位姿,这样提高了空间定位的鲁棒性。
在本公开的另一个示例中,在第一设备采集的第一图像包括有指定对象和第二设备的情况下,第一图像中可以包括可作为关键点的指定对象的2D点。指定对象与第二设备的相对位置固定。
在该示例中,在第二图像中对至少三个不共线的指定对象的2D点进行关键点检测,得到至少三个不共线的指定对象的2D点和指定对象的3D模型的3D点之间的匹配关系。 指定对象的3D模型包括3D点和3D点对应的关键点。所得到的匹配关系是针对指定对象的关键点的匹配关系。
在得到关键点对应的匹配关系后,可以使用PnP算法根据第一对应关系和匹配关系计算第一设备在第二设备的3D模型坐标系中的位姿,再基于第一设备在第二设备的3D模型坐标系中的位姿以及第二设备的3D模型在世界坐标系中的位姿,得到第一设备在所述世界坐标系中的位姿。
在一个示例中,在使用PnP算法之前,可以依据预存的指定对象的3D模型与第二设备的3D模型之间的相对位置关系,将指定对象的3D模型的坐标系转换为第二设备的3D模型的坐标系。从而使得指定对象与第二设备的3D模型统一为在第二设备的3D模型的坐标系中,便于进行PnP算法。
通过上述示例,将利用第二设备计算出的位姿与利用指定对象计算出的位姿进行综合,可以得到更精确的位姿。
在本公开的一个示例中,第一设备可以配置有IMU,通过自身的IMU可以实时采集IMU数据。第一设备可以使用采集的IMU数据实时计算该第一设备在世界坐标系中的位姿(以下称为位姿a)。
第一设备在不同时刻的位姿不同,从而在不同时刻根据IMU数据所计算出的位姿a可以不同。
第一设备在拍摄第一图像时可以根据当前采集的IMU数据计算当前的位姿a。然后,在通过本公开的实施例根据第一图像确定出第一设备在世界坐标系中的位姿(以下称为位姿b),将位姿a和位姿b进行融合处理,以得到所述第一设备的位姿。融合的方式可以包括平均等。
在一个示例中,也可以直接用采集的IMU数据和根据第一图像确定出第一设备在世界坐标系中的位姿进行融合。
在该示例中,通过融合由两种不同方式计算出的位姿,提高了第一设备的位姿的精确度。此外,IMU数据是连续的,由第一图像所确定的位姿是间断的,在本公开提供的方法所得到的位姿的基础上,融合由IMU数据计算得到的位姿,可以得到更高频率的位姿,降低数据延迟。
图8示出了根据本公开的空间定位装置800的一个示例的方框图。空间定位装置800可以应用于第一设备。
如图8所示,空间定位装置800包括图像采集单元810、特征点匹配单元820、定位单元830和位姿确定单元840。
图像采集单元810被配置为采集第二设备的第一图像,第一图像包括第二设备的2D点和2D点对应的描述子。
特征点匹配单元820被配置为利用第二设备的3D模型上的3D点对应的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系,第二设备的3D模型包括3D点和3D点对应的描述子。
定位单元830被配置为根据第二设备在世界坐标系中的定位以及第二设备与3D模型之间的第二对应关系,确定第二设备的3D模型在世界坐标系中的定位。
位姿确定单元840被配置为根据第二设备的3D模型在世界坐标系中的定位以及第一对应关系,确定第一设备在世界坐标系中的位姿。
在一个示例中,空间定位装置800还包括关键点匹配单元。所述图像采集单元,被配置为在第一设备采集到的第一图像中不包括至少三个不共线的第二设备的2D点时,采集包括指定对象的第二图像,第二图像包括可作为关键点的指定对象的2D点,指定对象与第二设备的相对位置固定。定位单元,被配置为基于第二设备的3D模型在世界坐标系中的定位和预存的指定对象的3D模型与第二设备的3D模型之间的相对位置关系,确定指定对象的3D模型在世界坐标系中的定位,其中,指定对象的3D模型包括3D点和3D点对应的关键点。关键点匹配单元,被配置为在第二图像中对至少三个不共线的指定对象的2D点进行关键点检测,得到至少三个不共线的指定对象的2D点和指定对象的3D模型的3D点之间的匹配关系,以得到第二图像和指定对象的3D模型之间的第三对应关系。位姿确定单元,被配置为基于指定对象的3D模型在世界坐标系中的定位和第三对应关系,确定第一设备在世界坐标系中的位姿。
在一个示例中,空间定位装置800还包括关键点匹配单元,关键点匹配单元,被配置为在第二图像中对至少三个不共线的指定对象的2D点进行关键点检测,得到至少三个不共线的指定对象的2D点和指定对象的3D模型的3D点之间的匹配关系,其中,指定对象的3D模型包括3D点和3D点对应的关键点。位姿确定单元被配置为:使用PnP算法根据第一对应关系和匹配关系计算第一设备在第二设备的3D模型坐标系中的位姿;和基于第一设备在第二设备的3D模型坐标系中的位姿以及第二设备的3D模型在世界坐标系中的位姿,得到第一设备在世界坐标系中的位姿。
在一个示例中,空间定位装置800还包括坐标系转换单元,坐标系转换单元被配置为依据预存的指定对象的3D模型与第二设备的3D模型之间的相对位置关系,将指定对象的3D模型的坐标系转换为第二设备的3D模型的坐标系。
在一个示例中,所述图像采集单元被配置为:确定先前帧图像中第二设备的位置;根据第一设备的预定移动速度和先前帧图像中第二设备的位置,确定第一设备的预估移动范围;和在第一图像中的预估移动范围内进行搜索,以在第一图像中确定第二设备的2D点的当前位置。
在一个示例中,所述图像采集单元被配置为:根据第二设备在世界坐标系中的位置和第一设备在世界坐标系中的位置,确定第二设备和第一设备的相对位置;通过第二设备和第一设备的相对位置,计算第二设备的2D点在第一图像中的预估范围;和在第一图像中的预估范围内进行搜索,以在第一图像中确定第二设备的2D点的当前位置。
图9示出了根据本公开的空间定位装置800的另一个示例的方框图。
如图9所示,定位单元830可以包括第一位姿确定模块831,位姿确定模块831被配置为:根据第二设备在世界坐标系中的位姿以及第二对应关系,确定第二设备的3D模型在世界坐标系中的位姿。
位姿确定单元840可以包括第二位姿确定模块841和第三位姿确定模块842。第二位姿确定模块841可以被配置为:使用PnP算法根据第一对应关系计算第一设备在第二设备的3D模型坐标系中的位姿。第三位姿确定模块842可以被配置为:基于第一设备在第二设备的3D模型坐标系中的位姿以及第二设备的3D模型在世界坐标系中的位姿, 得到第一设备在世界坐标系中的位姿。
在该示例中,位姿确定模块831、第二位姿确定模块841和第三位姿确定模块842可以是由同一个模块,还可以是不同模块。
在一个示例中,空间定位装置800还可以包括内点确定单元,内点确定单元,被配置为使用随机抽样一致性算法从第一图像中的至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系中确定内点;以及将内点确定为第一对应关系应用于PnP算法时待使用的点。
图10示出了根据本公开的空间定位装置800的另一个示例的方框图。
如图10所示,定位单元830可以包括位置确定模块832,位置确定模块832可以被配置为:根据第二设备在世界坐标系中的位置以及第二对应关系,确定第二设备的3D模型的3D点在世界坐标系中的位置。
位姿确定单元840可以包括第四位姿确定模块843,第四位姿确定模块843可以被配置为:根据第一对应关系和符合第一对应关系的第二设备的3D模型的3D点在世界坐标系中的位置,使用PnP算法计算第一设备在世界坐标系中的位姿。
以上参照图1到图10,对根据本公开的用于空间定位的方法及装置的实施例进行了描述。
本公开的用于空间定位的装置可以采用硬件实现,也可以采用软件或者硬件和软件的组合来实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的处理器将存储器中对应的计算机程序指令读取到内存中运行形成的。在本公开中,用于空间定位的装置例如可以利用电子设备实现。
图11示出了本公开的实施例的用于实现空间定位方法的电子设备1100的方框图。
如图11所示,电子设备1100可以包括至少一个处理器1110、存储器(例如,非易失性存储器)1120、内存1130和通信接口1140,并且至少一个处理器1110、存储器1120、内存1130和通信接口1140经由总线1150连接在一起。至少一个处理器1110执行在存储器中存储或编码的至少一个计算机可读指令(即,上述以软件形式实现的元素)。
在一个实施例中,在存储器中存储计算机可执行指令,其当执行时使得至少一个处理器1110:采集第二设备的第一图像,第一图像包括第二设备的2D点和2D点对应的描述子;利用第二设备的3D模型上的3D点对应的描述子和2D点对应的描述子对第二设备的2D点和第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的第二设备的2D点与第二设备的3D模型的3D点之间的第一对应关系,第二设备的3D模型包括3D点和3D点对应的描述子;根据第二设备在世界坐标系中的定位以及第二设备与3D模型之间的第二对应关系,确定第二设备的3D模型在世界坐标系中的定位;以及根据第二设备的3D模型在世界坐标系中的定位以及第一对应关系,确定第一设备在世界坐标系中的位姿。
应该理解,在存储器中存储的计算机可执行指令当执行时使得至少一个处理器1110进行本公开的各个实施例中以上结合图1-10描述的各种操作和功能。
根据一个实施例,提供了一种例如机器可读介质的程序产品。机器可读介质可以具有指令(即,上述以软件形式实现的元素),该指令当被机器执行时,使得机器执行本公开的各个实施例中以上结合图1-10描述的各种操作和功能。
可以提供配有可读存储介质的系统或者装置,在该可读存储介质上存储着实现上述实施例中任一实施例的功能的软件程序代码,且使该系统或者装置的计算机或处理器读出并执行存储在该可读存储介质中的指令。
在这种情况下,从可读介质读取的程序代码本身可实现上述实施例中任何一项实施例的功能,因此机器可读代码和存储机器可读代码的可读存储介质构成了本发明的一部分。
本公开各部分操作所需的计算机程序代码可以用任意一种或多种程序语言编写,包括面向对象编程语言,如Java、Scala、Smalltalk、Eiffel、JADE、Emerald、C++、C#、VB、NET以及Python等,常规程序化编程语言如C语言、Visual Basic 2003、Perl、COBOL 2002、PHP以及ABAP,动态编程语言如Python、Ruby和Groovy,或者其他编程语言等。该程序编码可以在用户计算机上运行,或者作为独立的软件包在用户计算机上运行,或者部分在用户计算机上运行另一部分在远程计算机运行,或者全部在远程计算机或服务器上运行。在后一种情况下,远程计算机可以通过任何网络形式与用户计算机连接,比如局域网(LAN)或广域网(WAN),或连接至外部计算机(例如通过因特网),或者在云计算环境中,或者作为服务使用,比如软件即服务(SaaS)。
可读存储介质的实施例包括软盘、硬盘、磁光盘、光盘(如CD-ROM、CD-R、CD-RW、DVD-ROM、DVD-RAM、DVD-RW、DVD-RW)、磁带、非易失性存储卡和ROM。可选择地,可以由通信网络从服务器计算机上或云上下载程序代码。
上述对本公开特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
上述各流程和各系统结构图中不是所有的步骤和单元都是必须的,可以根据实际的需要忽略某些步骤或单元。各步骤的执行顺序不是固定的,可以根据需要进行确定。上述各实施例中描述的装置结构可以是物理结构,也可以是逻辑结构,即,有些单元可能由同一物理实体实现,或者,有些单元可能分由多个物理实体实现,或者,可以由多个独立设备中的某些部件共同实现。
在整个本公开中使用的术语“示例性”意味着“用作示例、实例或例示”,并不意味着比其它实施例“优选”或“具有优势”。出于提供对所描述技术的理解的目的,具体实施方式包括具体细节。然而,可以在没有这些具体细节的情况下实施这些技术。在一些实例中,为了避免对所描述的实施例的概念造成难以理解,公知的结构和装置以框图形式示出。
以上结合附图详细描述了本公开的实施例的可选实施方式,但是,本公开的实施例并不限于上述实施方式中的具体细节,在本公开的实施例的技术构思范围内,可以对本公开的实施例的技术方案进行多种简单变型,这些简单变型均属于本公开的实施例的保护范围。
本公开内容的上述描述被提供来使得本领域任何普通技术人员能够实现或者使用本公开内容。对于本领域普通技术人员来说,对本公开内容进行的各种修改是显而易见 的,并且,也可以在不脱离本公开内容的保护范围的情况下,将本文所定义的一般性原理应用于其它变型。因此,本公开内容并不限于本文所描述的示例和设计,而是与符合本文公开的原理和新颖性特征的最广范围相一致。

Claims (15)

  1. 一种用于空间定位的方法,所述方法由第一设备执行,所述方法包括:
    采集第二设备的设备图像,所述设备图像包括所述第二设备的2D点和2D点对应的描述子;
    利用所述第二设备的3D模型上的3D点对应的描述子和所述2D点对应的描述子对所述第二设备的2D点和所述第二设备的3D模型上的3D点进行特征点匹配,以得到至少三个不共线的所述第二设备的2D点与所述第二设备的3D模型的3D点之间的第一对应关系,所述第二设备的3D模型包括3D点和3D点对应的描述子;
    根据所述第二设备在世界坐标系中的定位以及所述第二设备与所述3D模型之间的第二对应关系,确定所述第二设备的3D模型在所述世界坐标系中的定位;以及
    根据所述第二设备的3D模型在所述世界坐标系中的定位以及所述第一对应关系,确定所述第一设备在所述世界坐标系中的位姿。
  2. 如权利要求1所述的方法,其中,所述第二设备在世界坐标系中的定位包括位姿,
    根据所述第二设备在世界坐标系中的定位以及所述第二对应关系,确定所述第二设备的3D模型在所述世界坐标系中的定位包括:
    根据所述第二设备在世界坐标系中的位姿以及所述第二对应关系,确定所述第二设备的3D模型在所述世界坐标系中的位姿;以及
    根据所述第二设备的3D模型在所述世界坐标系中的定位以及所述第一对应关系,确定所述第一设备在所述世界坐标系中的位姿包括:
    使用PnP算法根据所述第一对应关系计算所述第一设备在所述第二设备的3D模型坐标系中的位姿;和
    基于所述第一设备在所述第二设备的3D模型坐标系中的位姿以及所述第二设备的3D模型在所述世界坐标系中的位姿,得到所述第一设备在所述世界坐标系中的位姿。
  3. 如权利要求1所述的方法,其中,所述第二设备在世界坐标系中的定位包括位置,
    根据所述第二设备在世界坐标系中的定位以及所述第二对应关系,确定所述第二设备的3D模型在所述世界坐标系中的定位包括:
    根据所述第二设备在世界坐标系中的位置以及所述第二对应关系,确定所述第二设备的3D模型的3D点在所述世界坐标系中的位置;以及
    根据所述第二设备的3D模型在所述世界坐标系中的定位以及所述第一对应关系,确定所述第一设备在所述世界坐标系中的位姿包括:
    根据所述第一对应关系和符合所述第一对应关系的所述第二设备的3D模型的3D点在所述世界坐标系中的位置,使用PnP算法计算所述第一设备在所述世界坐标系中的位姿。
  4. 如权利要求1至3中任一项所述的方法,其中,所述第二设备包括头戴式设备,所述头戴式设备用于显示所述第一设备提供的虚拟对象,所述第一设备包括手持设备,所述手持设备用于控制通过头戴式设备显示的虚拟对象并包括用于采集设备图像的摄像设备。
  5. 如权利要求1至4中任一项所述的方法,还包括:
    在所述第一设备采集到的设备图像中不包括至少三个不共线的所述第二设备的2D点时,采集包括指定对象的指定对象图像,所述指定对象图像包括可作为关键点的所述指定对象的2D点,所述指定对象与所述第二设备的相对位置固定;
    基于所述第二设备的3D模型在所述世界坐标系中的定位和预存的所述指定对象的3D模型与所述第二设备的3D模型之间的相对位置关系,确定所述指定对象的3D模型在所述世界坐标系中的定位,其中,所述指定对象的3D模型包括3D点和3D点对应的关键点;
    在所述指定对象图像中对至少三个不共线的所述指定对象的2D点进行关键点检测,得到至少三个不共线的所述指定对象的2D点和所述指定对象的3D模型的3D点之间的匹配关系,以得到所述指定对象图像和所述指定对象的3D模型之间的第三对应关系;
    基于所述指定对象的3D模型在所述世界坐标系中的定位和所述第三对应关系,确定所述第一设备在所述世界坐标系中的位姿。
  6. 如权利要求1至4中任一项所述的方法,其中,所述设备图像还包括有指定对象,所述设备图像还包括可作为关键点的所述指定对象的2D点,所述指定对象与所述第二设备的相对位置固定,所述方法还包括:
    在所述指定对象图像中对至少三个不共线的所述指定对象的2D点进行关键点检测,得到至少三个不共线的所述指定对象的2D点和指定对象的3D模型的3D点之间的匹配关系,其中,所述指定对象的3D模型包括所述3D点和3D点对应的关键点;以及
    根据所述第二设备的3D模型在所述世界坐标系中的定位以及所述第一对应关系,确定所述第一设备在所述世界坐标系中的位姿包括:
    使用PnP算法根据所述第一对应关系和所述匹配关系计算所述第一设备在所述第二设备的3D模型坐标系中的位姿;和
    基于所述第一设备在所述第二设备的3D模型坐标系中的位姿以及所述第二设备的3D模型在所述世界坐标系中的位姿,得到所述第一设备在所述世界坐标系中的位姿。
  7. 如权利要求6所述的方法,其中,在所述使用PnP算法根据所述第一对应关系和所述匹配关系计算所述第一设备在所述第二设备的3D模型坐标系中的位姿之前,所述方法还包括:
    依据预存的所述指定对象的3D模型与所述第二设备的3D模型之间的相对位置关系,将所述指定对象的3D模型的坐标系转换为所述第二设备的3D模型的坐标系。
  8. 如权利要求6或7所述的方法,其中,在所述第二设备包括头戴式设备时,所述指定对象包括人脸。
  9. 如权利要求1至8中任一项所述的方法,其中,采集所述第二设备的设备图像包括:
    确定先前帧图像中所述第二设备的位置;
    根据所述第一设备的预定移动速度和所述先前帧图像中所述第二设备的位置,确定所述第一设备的预估移动范围;和
    在所述设备图像中的所述预估移动范围内进行搜索,以在所述设备图像中确定所述第二设备的2D点的当前位置。
  10. 如权利要求9所述的方法,其中,所述根据所述第一设备的预定移动速度和所述先前帧图像中所述第二设备的位置,确定所述第一设备的预估移动范围,包括:
    根据第一设备的惯性测量单元获取的预定移动速度和移动方向,以及所述先前帧图像中所述第二设备的位置,确定所述第一设备的预估移动范围。
  11. 如权利要求1至8中任一项所述的方法,其中,采集所述第二设备的设备图像包括:
    根据所述第二设备在世界坐标系中的位置和所述第一设备在所述世界坐标系中的位置,确定所述第二设备和所述第一设备的相对位置;
    通过所述第二设备和所述第一设备的相对位置,计算所述第二设备的2D点在所述设备图像中的预估范围;和
    在所述设备图像中的所述预估范围内进行搜索,以在所述设备图像中确定所述第二设备的2D点的当前位置。
  12. 如权利要求1至11所述的方法,其中,在使用PnP算法之前,所述方法还包括:
    使用随机抽样一致性算法从所述设备图像中的至少三个不共线的所述第二设备的2D点与所述第二设备的3D模型的3D点之间的第一对应关系中确定内点;以及
    将所述内点确定为所述第一对应关系应用于PnP算法时待使用的点。
  13. 如权利要求1至12所述的方法,其中,所述根据所述第二设备在世界坐标系中的定位以及所述第二设备与所述3D模型之间的第二对应关系,确定所述第二设备的3D模型在所述世界坐标系中的定位,包括:
    通过所述第二设备采集的数据实时计算所述第二设备在世界坐标系中的定位,
    获取预先建立的所述第二设备与所述3D模型之间的第二对应关系,
    确定所述第二设备的3D模型在所述世界坐标系中的定位。
  14. 一种电子设备,包括:至少一个处理器,以及与所述至少一个处理器耦合的存储器,所述存储器存储指令,当所述指令被所述至少一个处理器执行时,使得所述至少一个处理器执行如权利要求1到13中任一所述的方法。
  15. 一种非易失性计算机可读存储介质,其存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-13中任一所述的方法。
PCT/CN2022/114388 2021-08-25 2022-08-24 用于空间定位的方法及装置 WO2023025175A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110980667.2A CN113658278A (zh) 2021-08-25 2021-08-25 用于空间定位的方法及装置
CN202110980667.2 2021-08-25

Publications (1)

Publication Number Publication Date
WO2023025175A1 true WO2023025175A1 (zh) 2023-03-02

Family

ID=78492824

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/114388 WO2023025175A1 (zh) 2021-08-25 2022-08-24 用于空间定位的方法及装置

Country Status (2)

Country Link
CN (1) CN113658278A (zh)
WO (1) WO2023025175A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113658278A (zh) * 2021-08-25 2021-11-16 优奈柯恩(北京)科技有限公司 用于空间定位的方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103793705A (zh) * 2014-03-11 2014-05-14 哈尔滨工业大学 基于迭代随机抽样一致性算法和局部掌纹描述符的非接触掌纹认证方法
CN109214980A (zh) * 2017-07-04 2019-01-15 百度在线网络技术(北京)有限公司 一种三维姿态估计方法、装置、设备和计算机存储介质
CN110298877A (zh) * 2018-03-21 2019-10-01 北京猎户星空科技有限公司 一种物体三维位姿的确定方法、装置及电子设备
CN110555880A (zh) * 2019-08-26 2019-12-10 桂林电子科技大学 一种焦距未知的p6p相机位姿估计方法
US20210142508A1 (en) * 2018-02-03 2021-05-13 The Johns Hopkins University Calibration system and method to align a 3d virtual scene and a 3d real world for a stereoscopic head-mounted display
CN113658278A (zh) * 2021-08-25 2021-11-16 优奈柯恩(北京)科技有限公司 用于空间定位的方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103793705A (zh) * 2014-03-11 2014-05-14 哈尔滨工业大学 基于迭代随机抽样一致性算法和局部掌纹描述符的非接触掌纹认证方法
CN109214980A (zh) * 2017-07-04 2019-01-15 百度在线网络技术(北京)有限公司 一种三维姿态估计方法、装置、设备和计算机存储介质
US20210142508A1 (en) * 2018-02-03 2021-05-13 The Johns Hopkins University Calibration system and method to align a 3d virtual scene and a 3d real world for a stereoscopic head-mounted display
CN110298877A (zh) * 2018-03-21 2019-10-01 北京猎户星空科技有限公司 一种物体三维位姿的确定方法、装置及电子设备
CN110555880A (zh) * 2019-08-26 2019-12-10 桂林电子科技大学 一种焦距未知的p6p相机位姿估计方法
CN113658278A (zh) * 2021-08-25 2021-11-16 优奈柯恩(北京)科技有限公司 用于空间定位的方法及装置

Also Published As

Publication number Publication date
CN113658278A (zh) 2021-11-16

Similar Documents

Publication Publication Date Title
JP7249390B2 (ja) 単眼カメラを用いたリアルタイム3d捕捉およびライブフィードバックのための方法およびシステム
US20210177124A1 (en) Information processing apparatus, information processing method, and computer-readable storage medium
CN104781849B (zh) 单眼视觉同时定位与建图(slam)的快速初始化
TWI678099B (zh) 視頻處理方法、裝置和儲存介質
EP3332285B1 (en) Gaze direction mapping
US20240085211A1 (en) System, methods, device and apparatuses for preforming simultaneous localization and mapping
JP4852764B2 (ja) 動き計測装置、動き計測システム、車載機器、動き計測方法、動き計測プログラム、およびコンピュータ読み取り可能な記録媒体
US20200273180A1 (en) Deformable object tracking
JP2021527877A (ja) 3次元人体姿勢情報の検出方法および装置、電子機器、記憶媒体
US10825197B2 (en) Three dimensional position estimation mechanism
WO2015026645A1 (en) Automatic calibration of scene camera for optical see-through head mounted display
WO2023071964A1 (zh) 数据处理方法, 装置, 电子设备及计算机可读存储介质
CN109461208A (zh) 三维地图处理方法、装置、介质和计算设备
WO2022174594A1 (zh) 基于多相机的裸手追踪显示方法、装置及系统
WO2023071790A1 (zh) 目标对象的姿态检测方法、装置、设备及存储介质
US11403781B2 (en) Methods and systems for intra-capture camera calibration
WO2023025175A1 (zh) 用于空间定位的方法及装置
WO2022105745A1 (zh) 用于在图像跟踪过程中确定跟踪对象的位姿的方法及装置
Afif et al. Orientation control for indoor virtual landmarks based on hybrid-based markerless augmented reality
CN107993247A (zh) 追踪定位方法、系统、介质和计算设备
WO2022000757A1 (zh) 一种基于ar的机器人物联网交互方法、装置及介质
Cordea et al. 3-D head pose recovery for interactive virtual reality avatars
Li et al. A low-cost head and eye tracking system for realistic eye movements in virtual avatars
WO2023185241A1 (zh) 数据处理方法、装置、设备以及介质
HoonKwon et al. Multiple RGB-D camera-based user intent position and object estimation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22860521

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022860521

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2022860521

Country of ref document: EP

Effective date: 20240325