Optical tracker pose determination method, device, equipment, medium and program
By excluding the light-emitting units that cannot be photographed in the optical tracker, the amount of calculation is reduced, and the pose estimation algorithm is used to determine the pose, which solves the problem of large amount of calculation for the positioning of the optical tracker and improves efficiency and resource utilization.
Patent Information
- Application Number
- CN202310167213.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2024-08-23
AI Technical Summary
Due to the large number of light-emitting units in optical trackers, the positioning calculation of pose information is large, which affects the efficiency of positioning and computing resources.
By excluding target light-emitting units that cannot be captured by the camera, the number of identification lists of light-emitting units is reduced, and the pose estimation algorithm is used to determine the pose of the optical tracker based on the available light-emitting unit information.
The time and computing resources required for the positioning of the optical tracker are reduced, and the positioning efficiency is improved.
Smart Images

Figure CN118533144A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of virtual reality technology, and in particular to a method, device, equipment, medium and program for determining the position and posture of an optical tracker. Background Art
[0002] Extended Reality (XR) refers to the combination of reality and virtuality through computers to create a virtual environment that allows human-computer interaction, bringing the experiencer an "immersive feeling" of seamless transition between the virtual world and the real world. XR devices usually use trackers worn on the user's hands and / or feet to track the posture information of human movement. The posture information includes position information and posture information. The positioning accuracy and real-time performance of the tracker are key indicators of tracker positioning.
[0003] Commonly used trackers include ultrasonic, electromagnetic, and optical types. Optical trackers have the advantages of high precision and low latency, making them the preferred solution for positioning. The optical tracker has several light-emitting units for positioning, which are distributed in different positions of the optical tracker. When the XR device tracks the posture of human body movement, the camera of the head-mounted XR device collects the spot image of the light-emitting unit, and brute-force matches the number N and coordinates of the captured light spots with the possible ID list composed of the identification (identity, ID) of all the light-emitting units of the optical tracker to obtain the posture of the optical tracker.
[0004] However, due to the large number of light-emitting units used for positioning on the optical tracker, the positioning calculation amount of the optical tracker's posture information is large. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, device, medium and program for determining the posture of an optical tracker. By excluding a part of the target light-emitting units that cannot be captured by the camera from the light-emitting units of the optical tracker, the number of identification lists formed by the identification of the light-emitting units is reduced. A posture estimation is performed once for each identification list, thereby reducing the number of calculations for the posture estimation and reducing the time and computing resources required for the positioning of the optical tracker.
[0006] In a first aspect, an embodiment of the present application provides a method for determining a position and posture of an optical tracker, comprising:
[0007] Control the camera to collect light spot images of multiple light-emitting units on the optical tracker;
[0008] Acquire first posture information of the optical tracker according to data of an inertial sensor in the optical tracker;
[0009] Determine, according to the first posture information and the light spot image, a target light-emitting unit that cannot be captured by the camera;
[0010] Excluding the target light-emitting unit from the light-emitting units of the optical tracker to obtain available light-emitting units;
[0011] The pose information of the optical tracker is determined according to the light spot image and the information of the available light-emitting units by using a pose estimation algorithm.
[0012] In some embodiments, determining the target light-emitting unit that cannot be captured by the camera according to the first posture information of the optical tracker and the light spot image includes:
[0013] Acquire pixel coordinates of the light spot in the light spot image according to the light spot image;
[0014] According to the first posture information of the optical tracker, the pixel coordinates of the light spot in the light spot image, the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system and the internal parameters of the camera, the target light-emitting unit that cannot be captured by the camera is determined.
[0015] In some embodiments, determining the target light-emitting unit that cannot be captured by the camera according to the first posture information of the optical tracker, the pixel coordinates of the light spot in the light spot image, the three-dimensional coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, and the internal parameters of the camera includes:
[0016] Determine a first ray in a camera coordinate system according to pixel coordinates of N light spots in the light spot image and the camera intrinsic parameter, where the first ray is a ray from the center of the camera to the center point of the optical tracker, and N is greater than or equal to 3;
[0017] According to the first posture information, converting the first ray into the tracker coordinate system;
[0018] Determine, according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, a target ray corresponding to each light-emitting unit on the optical tracker, wherein the target ray is a ray formed by each light-emitting unit and a center point of the light-emitting unit of the optical tracker;
[0019] Determine information about angles between the target rays corresponding to each light-emitting unit and the first ray according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target rays corresponding to each light-emitting unit;
[0020] The target light-emitting unit that cannot be photographed by the camera is determined according to the information of the angle.
[0021] In some embodiments, the first ray in the camera coordinate system according to the pixel coordinates of the N light spots in the light spot image and the camera intrinsic parameters includes:
[0022] Determine the pixel coordinates of the center points of the N light spots according to the pixel coordinates of the N light spots;
[0023] The first ray in the camera coordinate system is determined according to the pixel coordinates of the center points of the N light spots and the intrinsic parameters of the camera.
[0024] In some embodiments, determining the first ray in the camera coordinate system according to the pixel coordinates of the center points of the N light spots and the intrinsic parameters of the camera includes:
[0025] The coordinate value l of the first ray in the normalized coordinate system of the camera is determined by the following formula: c :
[0026] l c =-K -1 P img
[0027] Among them, K is the internal parameter of the camera, P img are the pixel coordinates of the center points of the N light spots.
[0028] In some embodiments, converting the first ray to a tracker coordinate system according to the first posture information to obtain coordinates of the first ray in the tracker coordinate system includes:
[0029] The coordinate l of the first ray in the tracker coordinate system is calculated by the following formula I :
[0030] l I =R c -1 l c
[0031] Among them, R c is the first posture information, l c is the coordinate of the first ray in the camera coordinate system.
[0032] In some embodiments, determining the target ray corresponding to each light-emitting unit on the optical tracker according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system includes:
[0033] Determine the coordinates of the center point of the light-emitting unit of the optical tracker according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system;
[0034] The target rays corresponding to the light-emitting units are calculated according to the coordinates of the light-emitting units in the tracker coordinate system and the coordinates of the center points of the light-emitting units of the optical tracker.
[0035] In some embodiments, determining the coordinates of the center point of the light-emitting unit of the optical tracker according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system includes:
[0036] The coordinates of the center point of the light-emitting unit of the optical tracker are calculated by the following formula:
[0037]
[0038] Among them, p i is the coordinate of the i-th light-emitting unit on the optical tracker, and n is the number of light-emitting units on the optical tracker.
[0039] In some embodiments, determining the pixel coordinates of the center points of the N light spots according to the pixel coordinates of the N light spots includes:
[0040] According to the pixel coordinates of the N light spots, an average value of the pixel coordinates of the N light spots is calculated, and the average value is determined as the pixel coordinate of the center point of the N light spots.
[0041] In some embodiments, the information of the angle is a cosine value of the angle, and the information of determining the angle between the target ray corresponding to each light-emitting unit and the first ray according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target ray corresponding to each light-emitting unit includes:
[0042] The cosine of the angle is calculated by the following formula:
[0043]
[0044] Among them, l I is the coordinate of the first ray in the tracer coordinate system, l i is the coordinate of the target ray corresponding to the i-th light-emitting unit on the optical tracker in the tracker coordinate system;
[0045] The step of determining the target light-emitting unit that cannot be photographed by the camera according to the information of the angle includes:
[0046] When the cosine value of the angle corresponding to the i-th light-emitting unit is less than 0, it is determined that the i-th light-emitting unit is a target light-emitting unit that cannot be photographed by the camera.
[0047] In some embodiments, the information of the angle is the angle of the angle, and the information of determining the angle between the target ray corresponding to each light-emitting unit and the first ray according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target ray corresponding to each light-emitting unit includes:
[0048] The cosine of the angle is calculated by the following formula:
[0049]
[0050] Among them, l I is the coordinate of the first ray in the tracer coordinate system, l i is the coordinate of the target ray corresponding to the i-th light-emitting unit on the optical tracker in the tracker coordinate system;
[0051] Determine the angle of the included angle according to the cosine value of the included angle;
[0052] The step of determining the target light-emitting unit that cannot be photographed by the camera according to the information of the angle includes:
[0053] When the angle corresponding to the i-th light-emitting unit is greater than 90 degrees, it is determined that the i-th light-emitting unit is a target light-emitting unit that cannot be photographed by the camera.
[0054] In some embodiments, the using a pose estimation algorithm to determine the pose information of the optical tracker according to the light spot image and the information of the available light-emitting units includes:
[0055] Determine a target light spot used by the pose estimation algorithm from the light spot image;
[0056] Generate a plurality of identification lists according to the number of the target light spots and the identifications of the available light-emitting units, wherein the number of identifications included in the identification lists is the same as the number of the target light spots;
[0057] Using the pose estimation algorithm, the coordinates of the light-emitting units in each identification list in the tracker coordinate system and the pixel coordinates of the target light spot are used in turn to calculate the candidate pose information corresponding to each identification list;
[0058] The pose information of the optical tracker is determined from the candidate pose information corresponding to the multiple identification lists.
[0059] On the other hand, an embodiment of the present application provides a device for determining a position and posture of an optical tracker, the device comprising:
[0060] An image acquisition module, used to control the camera to acquire light spot images of multiple light-emitting units on the optical tracker;
[0061] An acquisition module, configured to acquire first posture information of the optical tracker according to data of an inertial sensor in the optical tracker;
[0062] a screening module, configured to determine, according to the first posture information of the optical tracker and the light spot image, a target light-emitting unit that cannot be captured by the camera;
[0063] The screening module is further used to exclude the target light-emitting unit from the light-emitting units of the optical tracker to obtain available light-emitting units;
[0064] The posture determination module is used to determine the posture information of the optical tracker according to the light spot image and the information of the available light-emitting units by using a posture estimation algorithm.
[0065] On the other hand, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute any of the methods described above.
[0066] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program enables a computer to execute any of the methods described above.
[0067] On the other hand, an embodiment of the present application provides a computer program product, including a computer program, which implements any of the methods described above when executed by a processor.
[0068] The present application provides a method, device, equipment, medium and program for determining the pose of an optical tracker, the method comprising: controlling a camera to collect spot images of multiple light-emitting units on an optical tracker; obtaining first pose information of the optical tracker based on data from an inertial sensor in the optical tracker, and determining target light-emitting units that cannot be captured by the camera based on the first pose information and the spot image; excluding target light-emitting units from the light-emitting units of the optical tracker to obtain available light-emitting units; and determining the pose information of the optical tracker based on the spot image and information of available light-emitting units using a pose estimation algorithm. By excluding a portion of target light-emitting units that cannot be captured by the camera from the light-emitting units of the optical tracker, the number of identification lists formed by the identification of the light-emitting units is reduced, and a pose estimation is performed once for each identification list, thereby reducing the number of pose estimation calculations and reducing the time and computing resources required for positioning the optical tracker. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0070] Figure 1 is a flow chart of a method for determining the position and posture of an optical tracker provided in Embodiment 1 of the present application;
[0071] Figure 2 A schematic diagram of a light spot in a light spot image;
[0072] Figure 3 A flowchart of a method for determining a target light-emitting unit provided in Embodiment 2 of the present application;
[0073] Figure 4 A schematic diagram of the structure of a device for determining the position and posture of an optical tracker provided in Embodiment 3 of the present application;
[0074] Figure 5 A structural schematic diagram of an electronic device provided in Example 4 of the present application. DETAILED DESCRIPTION
[0075] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0076] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0077] In order to facilitate understanding of the embodiments of the present application, before describing each embodiment of the present application, some concepts involved in all embodiments of the present application are first appropriately explained, as follows:
[0078] XR is also a general term for multiple technologies such as Virtual Reality (VR), Augmented Reality (AR) and Mixed Reality (MR).
[0079] 1) Virtual Reality (VR for short), a technology for creating and experiencing a virtual world, determines the generation of a virtual environment, is a multi-source information (the virtual reality mentioned in this article includes at least visual perception, and can also include auditory perception, tactile perception, motion perception, and even taste perception, olfactory perception, etc.), realizes the simulation of the fusion and interactive three-dimensional dynamic vision and entity behavior of the virtual environment, immerses the user in a simulated virtual reality environment, and realizes the application in various virtual environments such as maps, games, videos, education, medical treatment, simulation, collaborative training, sales, assisted manufacturing, maintenance and repair.
[0080] 2) Virtual reality devices (VR devices), terminals for realizing virtual reality effects, can usually be provided in the form of glasses, head mount displays (Head Mount Display, referred to as HMD), contact lenses, for realizing visual perception and other forms of perception. Of course, the form of virtual reality devices is not limited to this, and can be further miniaturized or enlarged according to actual needs.
[0081] Optionally, the virtual reality devices described in the embodiments of the present application may include but are not limited to the following types:
[0082] 2.1) PC-based virtual reality (PCVR) devices use the PC to perform relevant calculations and data output for virtual reality functions. External PC-based virtual reality devices use the data output by the PC to achieve virtual reality effects.
[0083] 2.2) Mobile virtual reality devices support the configuration of mobile terminals (such as smart phones) in various ways (such as head-mounted displays with dedicated card slots). Through wired or wireless connection with the mobile terminal, the mobile terminal performs relevant calculations of virtual reality functions and outputs data to the mobile virtual reality device, such as watching virtual reality videos through the mobile terminal's APP.
[0084] 2.3) All-in-one virtual reality devices have a processor for performing relevant calculations of virtual functions, and thus have independent virtual reality input and output functions. They do not need to be connected to a PC or mobile terminal and have a high degree of freedom in use.
[0085] 3) Mixed Reality (MR): refers to the combination of the real and virtual worlds to create a new environment and visualization, where physical entities and digital objects coexist and can interact in real time to simulate real objects. It is a mixture of reality, augmented reality, augmented virtuality and virtual reality technologies. MR is a synthesis of virtual reality (VR) and augmented reality (AR). Mixed reality (MR) is an extension of virtual reality (VR) technology. By presenting virtual scenes in real scenes, the realism of user experience can be increased. The MR field involves computer vision, which is a science that studies how to make machines "see". Furthermore, it refers to machine vision such as cameras and computers replacing human eyes to identify, track and measure targets, and further perform image processing, using computers to process images that are more suitable for human eye observation or transmission to instruments for detection.
[0086] That is, MR is a simulated scenery that integrates computer-created sensory input (e.g., virtual objects) with sensory input from a physical scenery or its representation. In some MR scenery, the computer-created sensory input can adapt to changes in sensory input from the physical scenery. In addition, some electronic systems used to present MR scenery can monitor the orientation and / or position relative to the physical scenery so that virtual objects can interact with real objects (i.e., physical elements from the physical scenery or their representations). For example, the system can monitor movement so that virtual plants appear to be stationary relative to physical buildings.
[0087] After introducing some concepts involved in the embodiments of the present application, a method for determining the position and posture of an optical tracker provided in the embodiments of the present application will be specifically described below in conjunction with the accompanying drawings. The same content will refer to the description of the previous embodiments and will not be repeated.
[0088] Figure 1 : is a flowchart of a method for determining the position and posture of an optical tracker provided in the first embodiment of the present application. The method for determining the position and posture can be performed by a device for determining the position and posture. The device can be composed of hardware and / or software and can be integrated into an electronic device. In the embodiment of the present application, the electronic device is an XR device such as a VR device, an AR device, or an MR device. It can also be a mobile phone, a computer, or other device. This embodiment is described by taking an XR device as an example. Figure 1 As shown, the method for determining the position and posture of the optical tracker includes the following steps.
[0089] S101, controlling the camera to collect light spot images of multiple light-emitting units on the optical tracker.
[0090] The camera is a camera on the head-mounted XR device, and the optical tracker is worn on the human body's limbs, including but not limited to the wrists, ankles, arms, calves, waist and other parts. The optical tracker can be a handle of the XR device, which is integrated with multiple light-emitting units on the basis of a traditional handle, or the optical sensor is a bracelet worn on the wrist, which is provided with multiple light-emitting units. The optical tracker and the head-mounted VR device are connected in communication.
[0091] The optical tracker is provided with a plurality of light-emitting units, including but not limited to light-emitting diodes (LEDs), and the plurality of light-emitting units are distributed inside the housing of the optical tracker according to a preset rule. In this embodiment, the preset rule can be adaptively set according to the shape of the optical tracker, and no specific limitation is made here.
[0092] The shape of the optical tracker can be annular, semi-annular, rectangular or other irregular shapes. Taking the annular optical tracker as an example, a plurality of light emitting units can be arranged on the annular optical tracker at the same interval.
[0093] When a user uses a head-mounted XR device, the head-mounted XR device establishes a communication connection with the optical tracker, and the communication connection can be a wireless communication connection or a wired communication connection. The wireless communication connection can use a 2.4G network transmission protocol or a low-power Bluetooth protocol.
[0094] The head-mounted XR device can send a lighting control instruction to the optical tracker through a communication connection to control multiple light-emitting units in the optical tracker to light up at the same time, so that the camera of the head-mounted XR device can capture light spot images of multiple light-emitting units.
[0095] Optionally, after the head-mounted XR device sends a lighting control instruction to the optical tracker, it may also send an image acquisition instruction to the camera, so that the camera captures the spot image of multiple light-emitting units on the optical tracker according to the image acquisition instruction.
[0096] Taking into account a large number of light-emitting units deployed on the optical tracker, in order to facilitate determination of the position information of the optical tracker based on the light-emitting units corresponding to the light spots in the light spot image, this embodiment may pre-configure identification (identity, ID) for multiple light-emitting units on the optical tracker, so as to determine the identity of the light-emitting unit based on the identification of the light-emitting unit.
[0097] In this embodiment, the identifiers are configured for multiple light-emitting units on the optical tracker, which can uniquely identify the identity of the light-emitting units. The identifiers can be numbers or serial numbers, etc.
[0098] For example, it is assumed that 16 light-emitting units are deployed at different positions of the optical tracker, and these 16 light-emitting units are identified as serial numbers: 0~15.
[0099] S102: Acquire first posture information of the optical tracker according to data of an inertial sensor in the optical tracker.
[0100] The first posture information of the optical tracker is used to indicate the orientation or rotation angle of the optical tracker. The first posture information may be represented by a rotation matrix or a quaternion.
[0101] Exemplarily, the first posture information of the optical tracker is obtained according to the data of the inertial measurement unit (IMU) of the optical tracker. The optical tracker is provided with an IMU, and after the IMU measures the data, the IMU data is sent to the head-mounted XR device, and the XR device determines the first posture information of the optical tracker according to the data of the IMU.
[0102] IMU is a very common inertial measurement sensor used to measure the three-axis attitude angle and acceleration of an object. The sensor data measured by IMU can be called inertial data, which can include three-axis acceleration (acceleration) and three-axis orientation (orientation) data calculated inside the sensor.
[0103] S103. Determine the target light-emitting unit that cannot be captured by the camera according to the first posture information and the light spot image of the optical tracker.
[0104] The positions of the optical tracker and the camera are constantly changing with the movement of the human body. It is difficult for the camera to capture all the optical units on the optical tracker. For example, for a ring-shaped optical tracker, when the user's palm is facing downward, the camera can only capture the light-emitting units on the back of the hand, but not the light-emitting units on the palm.
[0105] Exemplarily, pixel coordinates of the light spot in the light spot image are obtained based on the light spot image, and target light-emitting units that cannot be captured by the camera are determined based on the first posture information of the optical tracker, the pixel coordinates of the light spot in the light spot image, the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, and the internal parameters of the camera.
[0106] The spot image includes a plurality of spots. By analyzing and processing the spot image, the pixel coordinates of each spot in the spot image can be determined, and the number of spots in the spot image can also be determined.
[0107] The light spot in the light spot image has a certain size and occupies a certain area. When a light spot covers multiple pixels, the pixel coordinates of the light spot may be the coordinates of the center point of the light spot. The coordinates of the center point of the light spot can be calculated through the coordinates of the multiple pixels covered by the light spot.
[0108] Optionally, the image coordinates of the light spot in the light spot image can also be obtained, and the target light emitting unit that cannot be captured by the camera can be determined according to the first posture information of the optical tracker, the image coordinates of the light spot in the light spot image, the coordinates of each light emitting unit on the optical tracker in the tracker coordinate system, and the internal parameters of the camera. The image coordinates and pixel coordinates of the light spot can be converted to each other.
[0109] The tracker coordinate system specifically refers to the optical tracker coordinate system. Since the structure of the optical tracker is fixed, after multiple light-emitting units are deployed on the optical tracker, the coordinates of each light-emitting unit in the optical tracker coordinate system are also determined accordingly, and the coordinates of each light-emitting unit in the tracker coordinate system are 3D coordinates. After the optical tracker determines the coordinates of each light-emitting unit in its own coordinate system, the optical tracker can send the coordinates of each light-emitting unit in its own coordinate system to the head-mounted XR device through a communication connection, so that the head-mounted XR device can determine the position information of the optical tracker based on the coordinates of the light-emitting unit in the optical tracker coordinate system.
[0110] Camera intrinsic parameters are parameters related to the camera's own characteristics, such as the camera's focal length, pixel size, etc. Different types of cameras have different camera intrinsic parameters, including but not limited to: pinhole cameras, and fisheye cameras.
[0111] Taking a pinhole camera as an example, the internal parameters of the pinhole camera include: f x 、f y 、c x 、c y , k1, k2, p1 and p2. Among them, f x 、f y represents the focal length of the camera, c x 、c y represents the position of the optical center, k1 and k2 represent radial distortion parameters, and p1 and p2 represent tangential distortion parameters.
[0112] In one implementation, the first ray in the camera coordinate system can be determined based on the pixel coordinates of the light spot in the light spot image and the internal parameters of the camera. The first ray is a ray from the center of the camera to the center point of the optical tracker. According to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, the target ray corresponding to each light-emitting unit on the optical tracker is determined. The target ray is a ray formed by each light-emitting unit and the second center point of the plurality of light-emitting units on the optical tracker; according to the first posture information, the first ray and the second ray are converted to the same coordinate system, and the angle formed by the first ray and the second ray corresponding to each light-emitting unit is calculated in the same coordinate system. According to the angle information, it is determined whether each light-emitting unit is a target light-emitting unit that cannot be captured by the camera.
[0113] S104. Exclude the target light-emitting unit from the light-emitting units of the optical tracker to obtain available light-emitting units.
[0114] Assume that there are 16 light-emitting units with IDs 0-15, and the IDs of the target light-emitting units that cannot be captured by the camera determined in step S103 are: 0, 1, 2, 3, 4, 14, 15, respectively. There are 7 target light-emitting units in total, and the remaining 9 light-emitting units are available light-emitting units.
[0115] S105. Using a posture estimation algorithm, determine the posture information of the optical tracker according to the light spot image and information of available light-emitting units.
[0116] In the embodiment of the present application, the pose estimation algorithm may be a perspective-n-point (PnP) algorithm. The value of n is greater than or equal to 3, and for example, the value of n is 3 or 5, and accordingly, the PnP algorithm is a P3P algorithm or a P5P algorithm.
[0117] In one implementation, the target light spot used by the pose estimation algorithm is determined from the light spot image; multiple identification lists are generated based on the number of target light spots and the identifications of available light-emitting units, and the number of identifications included in the identification list is the same as the number of target light spots; using the pose estimation algorithm, the coordinates of the light-emitting units in each identification list in the tracker coordinate system and the pixel coordinates of the target light spot are used in turn to calculate the candidate pose information corresponding to each identification list; and the pose information of the optical tracker is determined from the candidate pose information corresponding to the multiple identification lists.
[0118] The spot image includes multiple spots, and all or part of the spots in the spot image can be used for pose estimation. When part of the spots in the spot image is used for pose estimation, the target spot used by the pose estimation algorithm is determined from the spot image.
[0119] For example, when the pose estimation algorithm is the P3P algorithm, the P3P algorithm calculates the pose information of the optical tracker based on 3 points, but the number of spots in the spot image actually collected may be greater than 3. When the number of spots in the spot image is greater than 3, 3 spots are selected from the spot image as target spots. The P5P algorithm calculates the pose information of the optical tracker based on 5 points. Similarly, when the pose estimation algorithm is the P5P algorithm, when the number of spots in the spot image is greater than 5, 5 spot images are selected from the spot image.
[0120] Optionally, the target light spot used by the pose estimation algorithm can be determined from the light spot image according to the position and / or quality of the light spot. The quality of the light spot includes the size of the light spot, the roundness of the light spot, etc.
[0121] For example, a light spot in the middle position is selected from the light spot image as the target light spot, or a light spot with better quality is selected from the light spot image as the target light spot.
[0122] Figure 2 is a schematic diagram of the light spot in the light spot image, such as Figure 2 As shown, the spot image includes 7 spots, and 3 or 5 spots with the largest areas can be selected as target spots.
[0123] After determining the target light spot, the data of the target light spot is obtained, and multiple identification lists are generated according to the number of target light spots and the identifications of the available light-emitting units. Assuming that the number of target light spots is 5, an identification list with 5 identifications is generated according to the identifications of the available light-emitting units. The number of generated identification lists is: A n m , where m represents the number of target spots and n represents the number of available spots.
[0124] Taking the above example, there are 16 light-emitting units with IDs 0-15, and the IDs of the target light-emitting units are 0, 1, 2, 3, 4, 14, and 15, respectively. There are 7 target light-emitting units, and the IDs of the remaining 9 available light-emitting units are 5, 6, 7, 8, 9, 10, 11, 12, and 13, respectively. Assuming that the number of target light spots is 5, a total of A is generated. 5 9 identifier lists. The generated identifier lists include: [5,6,7,8,9], [5,6,9,10,12], [6,7,9,10,12], and so on.
[0125] After generating the identification list, it is necessary to use all identification lists to perform PNP calculations to find the most suitable pose information as the pose information of the optical tracker. Specifically, using the pose estimation algorithm, the coordinates of the light-emitting unit in each identification list in the tracker coordinate system and the pixel coordinates of the target light spot are used in turn to calculate the candidate pose information corresponding to each identification list. Using the PnP algorithm to estimate pose information is a mature method, and the detailed calculation process will not be repeated here.
[0126] In this embodiment, if there are multiple small identification lists, it is necessary to perform PnP calculations as many times as necessary. One PnP calculation is also called a PnP match. The PnP calculation requires a certain amount of time and computing resources. When the number of identification lists is large, the time and computing resource costs required for positioning the optical tracker are too high.
[0127] In the prior art, the number of identification lists is associated with the number of light-emitting units on the optical tracker. The larger the number of light-emitting units of the optical tracker, the more identification lists there are. In this embodiment, by excluding a portion of target light-emitting units that cannot be photographed by the camera from the light-emitting units of the optical tracker, the number of identification lists is reduced, thereby reducing the number of PnP calculations and reducing the time and computing resources required for positioning the optical tracker.
[0128] Taking the optical tracker including 16 light-emitting units and the identification list including the identification of 5 light-emitting units as an example, the prior art will generate A1 5 List of 6 logos, A1 required 5 6 times of PnP calculation, and by using the method of this embodiment, after excluding the 7 light-emitting units that cannot be photographed by the camera, the number of generated identification lists is A 5 9, thus greatly reducing the number of PnP calculations.
[0129] A candidate pose information is obtained according to each identification list. Among the multiple candidate pose information corresponding to the multiple identification lists, only one candidate pose information is the pose information of the optical tracker. Therefore, it is necessary to determine the pose information of the optical tracker from the multiple candidate pose information corresponding to the multiple identification lists.
[0130] Exemplarily, based on the first posture information of the optical tracker, the posture information of the optical tracker is determined from multiple candidate posture information corresponding to multiple identification lists.
[0131] The method of this embodiment controls the camera to collect spot images of multiple light-emitting units on the optical tracker; obtains the first posture information of the optical tracker based on the data of the inertial sensor in the optical tracker, and determines the target light-emitting units that cannot be photographed by the camera based on the first posture information and the spot image; excludes the target light-emitting units from the light-emitting units of the optical tracker to obtain available light-emitting units; and uses the pose estimation algorithm to determine the pose information of the optical tracker based on the spot image and the information of the available light-emitting units. By excluding a part of the target light-emitting units that cannot be photographed by the camera from the light-emitting units of the optical tracker, the number of identification lists formed by the identification of the light-emitting units is reduced, and a pose estimation is performed once for each identification list, thereby reducing the number of pose estimation calculations and reducing the time and computing resources required for positioning the optical tracker.
[0132] On the basis of the first embodiment, the second embodiment of the present invention provides a method for determining a target light-emitting unit, which is used to explain in detail an implementation method of step S103 in the first embodiment. Figure 3 This is a flow chart of a method for determining a target light-emitting unit provided in Embodiment 2 of the present application, such as Figure 3 As shown, the method provided in this embodiment includes the following steps.
[0133] S201 . Obtain pixel coordinates of a light spot in the light spot image according to the light spot image.
[0134] S202. Determine a first ray in the camera coordinate system according to the pixel coordinates of the N light spots in the light spot image and the camera intrinsic parameters. The first ray is a ray from the center of the camera to the center point of the optical tracker.
[0135] The spot image includes N spots, where N is greater than or equal to 3. When N is less than 3, the spot image is re-photographed.
[0136] In this embodiment, the first ray is a ray from the center of the camera to the center point of the optical tracker. The camera coordinate system is a coordinate system established with the center of the camera as the origin. Therefore, determining the first ray in the camera coordinate system is to determine the coordinates of the center point of the optical tracker in the camera coordinate system. It can be understood that the coordinates of the center point of the optical tracker are not known and cannot be directly detected. They need to be estimated based on the pixel coordinates of the N spots in the spot image and the camera intrinsic parameters.
[0137] Exemplarily, the pixel coordinates of the center points of the N light spots are determined according to the pixel coordinates of the N light spots, and the first ray in the camera coordinate system is determined according to the pixel coordinates of the center points of the N light spots and the intrinsic parameters of the camera.
[0138] Optionally, according to the pixel coordinates of the N light spots, the average value of the pixel coordinates of the N light spots is calculated, and the average value is determined as the pixel coordinate of the center point of the N light spots. Assume that the coordinates of the N light spots in the image are [x i ,y i ], 1≤i≤N, then the center point P of the N light spots img The pixel coordinates are [x, y] and are calculated using the following formula (1).
[0139]
[0140] The calculation formula for the pixel coordinates of the center points of the N light spots is not limited to formula (1), and formula (1) may be deformed, for example, formula (1) may be multiplied by a preset factor.
[0141] It can be understood that the pixel coordinates of the center points of the N light spots can also be determined by other methods.
[0142] In one implementation, the coordinate value l of the first ray in the normalized camera coordinate system is determined by the following formula (2): c :
[0143] l c =-K -1 P img (2)
[0144] Among them, K is the intrinsic parameter of the camera, P img is the pixel coordinate of the center point of the N light spots.
[0145] The coordinate value calculated by formula (2) is the coordinate value of the first ray in the camera normalized coordinate system, and the camera normalized coordinate system is a coordinate system obtained by normalizing the camera coordinate system. In this embodiment, the coordinate value of the first ray in the camera normalized coordinate system can be calculated, and the coordinate value of the first ray in the camera coordinate system can also be calculated. The directions of the first rays obtained by using these two coordinate systems are the same, but the modulus values are different. In this embodiment, the information of the angle between the first ray and the target ray is calculated in the subsequent steps. Therefore, the modulus value of the first ray will not affect the final calculation result, so any one of the two coordinate systems can be used.
[0146] S203. According to the first posture information, convert the first ray into a tracker coordinate system.
[0147] Exemplarily, the coordinate l of the first ray in the tracker coordinate system is calculated by the following formula (3): I :
[0148] l I =R c -1 l c(3)
[0149] Among them, R c is the first posture information of the optical tracker, l c is the coordinate of the first ray in the camera coordinate system.
[0150] S204. Determine the target ray corresponding to each light-emitting unit on the optical tracker according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, where the target ray is a ray formed by each light-emitting unit and the center point of the light-emitting unit on the optical tracker.
[0151] Exemplarily, the coordinates of the center points of the light-emitting units of the optical tracker are determined based on the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system; the target rays corresponding to each light-emitting unit are calculated based on the coordinates of each light-emitting unit in the tracker coordinate system and the coordinates of the center points of the light-emitting units of the optical tracker.
[0152] Optionally, the coordinates of the center point of the light-emitting unit of the optical tracker are calculated by the following formula (4):
[0153]
[0154] Among them, p i is the coordinate of the i-th light-emitting unit on the optical tracker, and n is the number of light-emitting units on the optical tracker.
[0155] The coordinates of the target rays corresponding to each light-emitting unit are the differences between the coordinates of each light-emitting unit in the tracker coordinate system and the coordinates of the center point of the light-emitting unit of the optical tracker.
[0156] S205. Determine information about the angle between the target ray corresponding to each light-emitting unit and the first ray according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target ray corresponding to each light-emitting unit.
[0157] The information of the angle between the target ray and the first ray may be the cosine value of the angle or the angle of the angle. When the information of the angle is the cosine value of the angle, the cosine value of the angle is calculated by the following formula (5):
[0158]
[0159] Among them, l I is the coordinate of the first ray in the tracer coordinate system, l i is the coordinate of the target ray corresponding to the i-th light-emitting unit on the optical tracker in the tracker coordinate system. Formula (5) is the calculation formula for the cosine value of the angle between two vectors, and the two rays are regarded as two vectors.
[0160] When the information of the included angle is the angle of the included angle, the cosine value of the included angle is calculated by formula (5), and then the angle of the included angle is determined according to the cosine value of the included angle.
[0161] S206: Determine the target light-emitting unit that cannot be photographed by the camera according to the information of the angle.
[0162] When the angle information is the cosine value of the angle, when the cosine value of the angle corresponding to the i-th light-emitting unit is less than 0, it is determined that the i-th light-emitting unit is a target light-emitting unit that cannot be photographed by the camera; when the cosine value of the angle corresponding to the i-th light-emitting unit is greater than or equal to 0, it indicates that the i-th light-emitting unit is a light-emitting unit that can be photographed by the camera.
[0163] When the information of the angle is the angle of the angle, when the angle corresponding to the i-th light-emitting unit is greater than 90 degrees, the i-th light-emitting unit is determined to be a target light-emitting unit that cannot be photographed by the camera. When the angle corresponding to the i-th light-emitting unit is less than or equal to 90 degrees, the i-th light-emitting unit is determined to be a light-emitting unit that can be photographed by the camera.
[0164] The above process is explained by a specific example. Assume that the spot image includes 5 spots, and the pixel coordinates of the 5 spots are: P1 (349.11, 196.07), P2 (337.50, 196.50), P3 (337.05, 185.20), P4 (323.05, 182.20), P5 (313.00, 171.50). According to formula (1), the coordinates of the center points of the N spots of the 5 spots are calculated to be (331.94, 186.29).
[0165] According to formula (2), the first ray l from the center point of the optical tracker to the center of the camera is calculated c (0.0451,-0.241,0.9696), where the first ray l c One endpoint of is the center of the camera, and the coordinates of the camera center are (0,0,0). Therefore, the first ray l c It can be expressed as (0.0451,-0.241,0.9696).
[0166] According to formula (3), the first ray l c Convert to the tracker coordinate system and get the coordinate l of the first ray in the tracker coordinate system I (0.8611,0.1305,0.4915).
[0167] The 3D coordinates of each light-emitting unit in the optical tracker in the tracker coordinate system have been calibrated. The coordinates P of the center point of the light-emitting unit of the optical tracker are calculated based on the 3D coordinates of each light-emitting unit in the tracker coordinate system and formula (4):s (0.0461,0.0703,0.0263).
[0168] Assuming that the 3D coordinates of the light unit No. 0 in the tracker coordinate system are (0.00827, 0.03205, -0.0359), then from the center point P of the light unit on the optical tracker s The coordinates of the target ray l0 to P0 of the 0th light-emitting unit are (-0.0378, -0.0382, -0.0622).
[0169] Use formula (5) to calculate l I The cosine value cos0 of the angle between the formula and l0 is -0.7074. If -0.7074 is less than 0, then the luminous unit No. 0 is the target luminous unit that cannot be captured by the camera.
[0170] The cosine values corresponding to the light-emitting units No. 1 to No. 15 are calculated in sequence in the above manner, thereby determining all target light-emitting units.
[0171] It should be noted that in this embodiment, the conversion between the camera coordinate system and the optical tracker coordinate system is realized through the first posture information of the optical tracker. In this embodiment, the first ray is converted to the tracker coordinate system according to the first posture information, and the angle between the first ray and the target ray is obtained in the tracker coordinate system. Optionally, in some embodiments, the target ray corresponding to each light-emitting unit can also be converted to the camera coordinate system according to the first posture information, and the angle between the first ray and the target ray is obtained in the camera coordinate system. Optionally, in some embodiments, the first ray and the target ray can also be converted to the world coordinate system, and the angle between the first ray and the target ray can be obtained in the world coordinate system.
[0172] In this embodiment, according to the pixel coordinates of N spots in the spot image and the camera internal parameters, the first ray from the center of the camera to the center point of the optical tracker in the camera coordinate system is determined, and according to the first posture information, the first ray is converted to the tracker coordinate system; according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, the target ray formed by each light-emitting unit on the optical tracker and the center point of the light-emitting unit of the optical tracker is determined, and according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target ray corresponding to each light-emitting unit, the angle information between the target ray corresponding to each light-emitting unit and the first ray is determined; and the target light-emitting unit that cannot be photographed by the camera is determined according to the angle information. This method obtains the angle information between the first ray from the center of the camera to the center point of the optical tracker and the target ray formed by each light-emitting unit and the center point of the light-emitting unit of the optical tracker, and determines whether the light-emitting unit can be photographed by the camera according to the angle information, so that the light-emitting unit that cannot be photographed by the camera can be accurately excluded.
[0173] In order to facilitate better implementation of the method for determining the position and posture of an optical tracker in an embodiment of the present application, an embodiment of the present application also provides a device for determining the position and posture of an optical tracker. Figure 4 This is a schematic diagram of the structure of the device for determining the position and posture of the optical tracker provided in the third embodiment of the present application. Figure 4 As shown, the optical tracker position determination device 100 may include:
[0174] An image acquisition module 11 is used to control a camera to acquire light spot images of multiple light-emitting units on the optical tracker;
[0175] An acquisition module 12, configured to acquire first posture information of the optical tracker according to data of an inertial sensor in the optical tracker;
[0176] A screening module 13, used for determining a target light-emitting unit that cannot be captured by the camera according to the first posture information of the optical tracker and the light spot image;
[0177] The screening module 13 is further used to exclude the target light-emitting unit from the light-emitting units of the optical tracker to obtain available light-emitting units;
[0178] The posture determination module 14 is used to determine the posture information of the optical tracker according to the light spot image and the information of the available light-emitting units by using a posture estimation algorithm.
[0179] In some embodiments, the screening module 13 is specifically used for:
[0180] Acquire pixel coordinates of the light spot in the light spot image according to the light spot image;
[0181] According to the first posture information of the optical tracker, the pixel coordinates of the light spot in the light spot image, the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system and the internal parameters of the camera, the target light-emitting unit that cannot be captured by the camera is determined.
[0182] In some embodiments, the screening module 13 is specifically used for:
[0183] Determine a first ray in a camera coordinate system according to pixel coordinates of N light spots in the light spot image and the camera intrinsic parameter, where the first ray is a ray from the center of the camera to the center point of the optical tracker, and N is greater than or equal to 3;
[0184] According to the first posture information, converting the first ray into the tracker coordinate system;
[0185] Determine, according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, a target ray corresponding to each light-emitting unit on the optical tracker, wherein the target ray is a ray formed by each light-emitting unit and a center point of the light-emitting unit of the optical tracker;
[0186] Determine information about angles between the target rays corresponding to each light-emitting unit and the first ray according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target rays corresponding to each light-emitting unit;
[0187] The target light-emitting unit that cannot be photographed by the camera is determined according to the information of the angle.
[0188] In some embodiments, the screening module 13 is specifically used for:
[0189] Determine the pixel coordinates of the center points of the N light spots according to the pixel coordinates of the N light spots;
[0190] The first ray in the camera coordinate system is determined according to the pixel coordinates of the center points of the N light spots and the intrinsic parameters of the camera.
[0191] In some embodiments, the screening module 13 is specifically used for:
[0192] The coordinate value l of the first ray in the normalized coordinate system of the camera is determined by the following formula: c :
[0193] l c =-K -1 P img
[0194] Among them, K is the internal parameter of the camera, P img are the pixel coordinates of the center points of the N light spots.
[0195] In some embodiments, the screening module 13 is specifically used for:
[0196] The coordinate l of the first ray in the tracker coordinate system is calculated by the following formula I :
[0197] l I =R c -1 l c
[0198] Among them, R c is the first posture information, l c is the coordinate of the first ray in the camera coordinate system.
[0199] In some embodiments, the screening module 13 is specifically used for:
[0200] Determine the coordinates of the center point of the light-emitting unit of the optical tracker according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system;
[0201] The target rays corresponding to the light-emitting units are calculated according to the coordinates of the light-emitting units in the tracker coordinate system and the coordinates of the center points of the light-emitting units of the optical tracker.
[0202] In some embodiments, the screening module 13 is specifically used for:
[0203] The coordinates of the center point of the light-emitting unit of the optical tracker are calculated by the following formula:
[0204]
[0205] Among them, p i is the coordinate of the i-th light-emitting unit on the optical tracker, and n is the number of light-emitting units on the optical tracker.
[0206] In some embodiments, the screening module 13 is specifically used for:
[0207] According to the pixel coordinates of the N light spots, an average value of the pixel coordinates of the N light spots is calculated, and the average value is determined as the pixel coordinate of the center point of the N light spots.
[0208] In some embodiments, the information of the angle is the cosine value of the angle, and the screening module 13 is specifically used for:
[0209] The cosine of the angle is calculated by the following formula:
[0210]
[0211] Among them, l I is the coordinate of the first ray in the tracer coordinate system, l i is the coordinate of the target ray corresponding to the i-th light-emitting unit on the optical tracker in the tracker coordinate system;
[0212] When the cosine value of the angle corresponding to the i-th light-emitting unit is less than 0, it is determined that the i-th light-emitting unit is a target light-emitting unit that cannot be photographed by the camera.
[0213] In some embodiments, the information of the angle is the angle of the angle, and the screening module 13 is specifically used for:
[0214] The cosine of the angle is calculated by the following formula:
[0215]
[0216] Among them, l I is the coordinate of the first ray in the tracer coordinate system, l i is the coordinate of the target ray corresponding to the i-th light-emitting unit on the optical tracker in the tracker coordinate system;
[0217] Determine the angle of the included angle according to the cosine value of the included angle;
[0218] When the angle corresponding to the i-th light-emitting unit is greater than 90 degrees, it is determined that the i-th light-emitting unit is a target light-emitting unit that cannot be photographed by the camera.
[0219] In some embodiments, the posture determination module 14 is specifically used to:
[0220] Determine a target light spot used by the pose estimation algorithm from the light spot image;
[0221] Generate a plurality of identification lists according to the number of the target light spots and the identifications of the available light-emitting units, wherein the number of identifications included in the identification lists is the same as the number of the target light spots;
[0222] Using the pose estimation algorithm, the coordinates of the light-emitting units in each identification list in the tracker coordinate system and the pixel coordinates of the target light spot are used in turn to calculate the candidate pose information corresponding to each identification list;
[0223] The pose information of the optical tracker is determined from the candidate pose information corresponding to the multiple identification lists.
[0224] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here.
[0225] The above describes the device 100 of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.
[0226] An embodiment of the present application also provides an electronic device. Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present application is shown in FIG. Figure 5 As shown, the electronic device 200 may include:
[0227] The memory 21 and the processor 22, the memory 21 is used to store the computer program and transmit the program code to the processor 22. In other words, the processor 22 can call and run the computer program from the memory 21 to implement the method in the embodiment of the present application.
[0228] For example, the processor 22 may be configured to execute the above method embodiments according to instructions in the computer program.
[0229] In some embodiments of the present application, the processor 22 may include but is not limited to:
[0230] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0231] In some embodiments of the present application, the memory 21 includes but is not limited to:
[0232] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0233] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory 21 and executed by the processor 22 to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0234] like Figure 5 As shown, the electronic device may further include: a transceiver 23 , which may be connected to the processor 22 or the memory 21 .
[0235] The processor 22 may control the transceiver 23 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 23 may include a transmitter and a receiver. The transceiver 23 may further include an antenna, and the number of antennas may be one or more.
[0236] Understandable, although Figure 5 Not shown, the electronic device 200 may also include a camera module, a wireless fidelity WIFI module, a positioning module, a Bluetooth module, a display, a controller, etc., which will not be repeated here.
[0237] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0238] The present application also provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.
[0239] The present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the electronic device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the electronic device executes the corresponding process in the method for controlling the user position in the virtual scene in the embodiment of the present application, which will not be described in detail for the sake of brevity.
[0240] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0241] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0242] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for determining the position and posture of an optical tracker, characterized in that: include: Control the camera to collect light spot images of multiple light-emitting units on the optical tracker; Acquire first posture information of the optical tracker according to data of an inertial sensor in the optical tracker; Determine a target light-emitting unit that cannot be captured by the camera according to the first posture information of the optical tracker and the light spot image; Excluding the target light-emitting unit from the light-emitting units of the optical tracker to obtain available light-emitting units; The pose information of the optical tracker is determined according to the light spot image and the information of the available light-emitting units by using a pose estimation algorithm.
2. The method according to claim 1, characterized in that The step of determining, according to the first posture information of the optical tracker and the light spot image, a target light-emitting unit that cannot be captured by the camera comprises: Acquire pixel coordinates of the light spot in the light spot image according to the light spot image; According to the first posture information of the optical tracker, the pixel coordinates of the light spot in the light spot image, the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system and the internal parameters of the camera, the target light-emitting unit that cannot be captured by the camera is determined.
3. The method according to claim 2, characterized in that The method of determining a target light-emitting unit that cannot be captured by the camera according to the first posture information of the optical tracker, the pixel coordinates of the light spot in the light spot image, the three-dimensional coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, and the internal parameters of the camera includes: Determine a first ray in a camera coordinate system according to pixel coordinates of N light spots in the light spot image and the camera intrinsic parameter, where the first ray is a ray from the center of the camera to the center point of the optical tracker, and N is greater than or equal to 3; According to the first posture information, converting the first ray into the tracker coordinate system; Determine, according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system, a target ray corresponding to each light-emitting unit on the optical tracker, wherein the target ray is a ray formed by each light-emitting unit and a center point of the light-emitting unit of the optical tracker; Determine information about angles between the target rays corresponding to each light-emitting unit and the first ray according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target rays corresponding to each light-emitting unit; The target light-emitting unit that cannot be photographed by the camera is determined according to the information of the angle.
4. The method according to claim 3, characterized in that The first ray in the camera coordinate system according to the pixel coordinates of the N light spots in the light spot image and the camera intrinsic parameters includes: Determine the pixel coordinates of the center points of the N light spots according to the pixel coordinates of the N light spots; The first ray in the camera coordinate system is determined according to the pixel coordinates of the center points of the N light spots and the intrinsic parameters of the camera.
5. The method according to claim 4, characterized in that The determining the first ray in the camera coordinate system according to the pixel coordinates of the center points of the N light spots and the intrinsic parameters of the camera includes: The coordinate value l of the first ray in the normalized coordinate system of the camera is determined by the following formula: c : l c =-K -1 P img Among them, K is the internal parameter of the camera, P img are the pixel coordinates of the center points of the N light spots.
6. The method according to claim 3, characterized in that: The converting the first ray into a tracker coordinate system according to the first posture information to obtain the coordinates of the first ray in the tracker coordinate system includes: The coordinate l of the first ray in the tracker coordinate system is calculated by the following formula I : l I =R c -1 l c Among them, R c is the first posture information, l c is the coordinate of the first ray in the camera coordinate system.
7. The method according to claim 3, characterized in that The step of determining target rays corresponding to the light-emitting units on the optical tracker according to the coordinates of the light-emitting units on the optical tracker in the tracker coordinate system includes: Determine the coordinates of the center point of the light-emitting unit of the optical tracker according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system; The target rays corresponding to the light-emitting units are calculated according to the coordinates of the light-emitting units in the tracker coordinate system and the coordinates of the center points of the light-emitting units of the optical tracker.
8. The method according to claim 7, characterized in that The step of determining the coordinates of the center point of the light-emitting unit of the optical tracker according to the coordinates of each light-emitting unit on the optical tracker in the tracker coordinate system comprises: The coordinates of the center point of the light-emitting unit of the optical tracker are calculated by the following formula: Among them, p i is the coordinate of the i-th light-emitting unit on the optical tracker, and n is the number of light-emitting units on the optical tracker.
9. The method according to claim 4, characterized in that The step of determining the pixel coordinates of the center points of the N light spots according to the pixel coordinates of the N light spots comprises: According to the pixel coordinates of the N light spots, an average value of the pixel coordinates of the N light spots is calculated, and the average value is determined as the pixel coordinate of the center point of the N light spots.
10. The method according to claim 3, characterized in that The information of the angle is a cosine value of the angle, and the information of the angle between the target ray corresponding to each light-emitting unit and the first ray is determined according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target ray corresponding to each light-emitting unit, including: The cosine of the angle is calculated by the following formula: Among them, l I is the coordinate of the first ray in the tracer coordinate system, l i is the coordinate of the target ray corresponding to the i-th light-emitting unit on the optical tracker in the tracker coordinate system; The step of determining the target light-emitting unit that cannot be photographed by the camera according to the information of the angle includes: When the cosine value of the angle corresponding to the i-th light-emitting unit is less than 0, it is determined that the i-th light-emitting unit is a target light-emitting unit that cannot be photographed by the camera.
11. The method according to claim 3, characterized in that The information of the angle is the angle of the angle, and the information of determining the angle between the target ray corresponding to each light-emitting unit and the first ray according to the coordinates of the first ray in the tracker coordinate system and the coordinates of the target ray corresponding to each light-emitting unit includes: The cosine of the angle is calculated by the following formula: Among them, l I is the coordinate of the first ray in the tracer coordinate system, l i is the coordinate of the target ray corresponding to the i-th light-emitting unit on the optical tracker in the tracker coordinate system; Determine the angle of the included angle according to the cosine value of the included angle; The step of determining the target light-emitting unit that cannot be photographed by the camera according to the information of the angle includes: When the angle corresponding to the i-th light-emitting unit is greater than 90 degrees, it is determined that the i-th light-emitting unit is a target light-emitting unit that cannot be photographed by the camera.
12. The method according to any one of claims 1 to 11, characterized in that: The method of using a pose estimation algorithm to determine the pose information of the optical tracker according to the light spot image and the information of the available light-emitting units includes: Determine a target light spot used by the pose estimation algorithm from the light spot image; Generate a plurality of identification lists according to the number of the target light spots and the identifications of the available light-emitting units, wherein the number of identifications included in the identification lists is the same as the number of the target light spots; Using the pose estimation algorithm, the coordinates of the light-emitting units in each identification list in the tracker coordinate system and the pixel coordinates of the target light spot are used in turn to calculate the candidate pose information corresponding to each identification list; The pose information of the optical tracker is determined from the candidate pose information corresponding to the multiple identification lists.
13. A device for determining the position and posture of an optical tracker, characterized in that: The device comprises: An image acquisition module, used to control the camera to acquire light spot images of multiple light-emitting units on the optical tracker; An acquisition module, configured to acquire first posture information of the optical tracker according to data of an inertial sensor in the optical tracker; a screening module, configured to determine, according to the first posture information of the optical tracker and the light spot image, a target light-emitting unit that cannot be captured by the camera; The screening module is further used to exclude the target light-emitting unit from the light-emitting units of the optical tracker to obtain available light-emitting units; The posture determination module is used to determine the posture information of the optical tracker according to the light spot image and the information of the available light-emitting units by using a posture estimation algorithm.
14. An electronic device, characterized in that: include: A processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: Used to store a computer program, the computer program causing a computer to execute the method according to any one of claims 1 to 12.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
