Coordinate system adjustment method, device, electronic device and storage medium
By transforming the real tracker and coordinate system in augmented reality technology, the problem of inaccurate reflection of virtual objects caused by coordinate system differences is solved, and the matching of virtual and real positions is achieved, which simplifies the project development process.
Patent Information
- Application Number
- CN202110679444.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-18
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2041-06-18
AI Technical Summary
In augmented reality technology, the difference between the coordinate system of a real scene and the coordinate system of a virtual scene causes the virtual objects to be unable to accurately reflect to the real position, increasing the difficulty of project development.
By determining the transformation matrix of the real tracker, its position information is transformed to the coordinate origin of the real coordinate system, and using the preset transformation matrix to transform the real coordinate system so that its coordinate information in the virtual scene is aligned with the reference coordinate system. This enables the virtual tracker to align to the reference coordinate origin in the virtual coordinate system.
The matching of virtual positions and real positions is achieved, so that virtual objects can be accurately reflected to the corresponding real positions, reducing the difficulty of developing augmented reality technology projects.
Smart Images

Figure CN113345105B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of augmented reality technology, and in particular to a coordinate system adjustment method, device, electronic equipment and storage medium. Background Art
[0002] At present, augmented reality technology is being used more and more widely. As we all know, augmented reality technology is a technology that cleverly integrates virtual scenes with real scenes. It widely uses a variety of technical means such as multimedia, three-dimensional modeling, real-time tracking and registration, intelligent interaction, and sensing to simulate computer-generated text, images, three-dimensional models and other virtual information, and then applies them to real scenes. The two types of information complement each other, thereby enhancing the real scene.
[0003] In order to enable different virtual objects to be observed at different positions of the real scene when observing the real scene through a real tracker of the real scene, it is necessary to first observe the virtual position in the virtual scene corresponding to the real position of the real scene through the virtual tracker of the virtual scene, and then deploy the virtual object at the virtual position.
[0004] However, in the process of implementing the present invention, the inventors found that the reference coordinate system used when drawing a virtual scene is usually different from the coordinate system of a real scene, for example, there are differences between left-handed and right-handed coordinate systems, differences in the directions of coordinate axes, differences in coordinate origins, etc. The existence of these differences makes it impossible for a virtual object deployed at a virtual position to accurately reflect the real position corresponding to the virtual position. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a coordinate system adjustment method, device, electronic device and storage medium to align the coordinate system of a real scene with the reference coordinate system used in a virtual scene, so that a virtual object deployed at a virtual position can be accurately reflected at the real position corresponding to the virtual position. The specific technical solution is as follows:
[0006] In a first aspect of the present invention, a coordinate system adjustment method is provided, the method comprising:
[0007] Based on first position information of a real tracker in the real scene, determining a first transformation matrix of the real tracker, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of a real coordinate system of the real scene;
[0008] Based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene is determined, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0009] Based on the first transformation matrix and the preset second transformation matrix, transform the orientation information of the virtual tracker corresponding to the real tracker to obtain transformed second orientation information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0010] Based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0011] Obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0012] Based on the operation information and the second coordinate information, the transformed second coordinate system is aligned with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0013] Optionally, determining second coordinate information of a virtual coordinate system corresponding to the real coordinate system in the virtual scene based on first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix includes:
[0014] Acquire first reference information selected in a real scene and second reference information selected in a virtual scene, wherein the first reference information is position information of a reference object in the real scene, and the second reference information is selected in the virtual scene based on the first reference information;
[0015] Based on the first reference information, the second reference information and the first coordinate information, a preset second transformation matrix is used to determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene.
[0016] Optionally, the operation information includes a movement operation and / or a rotation operation, and based on the operation information and the second coordinate information, aligning the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system includes:
[0017] Adjusting the second coordinate information at least twice according to a preset step length based on the operation information;
[0018] Drawing and displaying the transformed second coordinate system based on the second coordinate information after each adjustment, so as to determine whether to re-operate the transformed second coordinate system;
[0019] When the first re-operation information for re-operating the transformed second coordinate system is not obtained, continue to adjust the adjusted second coordinate information according to a preset step length until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0020] When first re-operation information for re-operating the transformed second coordinate system is obtained, the transformed second coordinate system is aligned to the reference coordinate system based on the first re-operation information and the adjusted second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0021] Optionally, the operation information includes a movement operation and / or a rotation operation, and based on the operation information and the second coordinate information, aligning the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system includes:
[0022] Based on the operation information and the second coordinate information, adjusting the reference coordinate system at least twice according to a preset step size;
[0023] Plotting and displaying the reference coordinate system after each adjustment to determine whether to re-operate the reference coordinate system;
[0024] When the second re-operation information for re-operating the reference coordinate system is not obtained, continue to adjust the adjusted reference coordinate system according to the preset step length until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0025] When second re-operation information for re-operating the reference coordinate system is obtained, the reference coordinate system is aligned to the transformed second coordinate system based on the second re-operation information and the adjusted reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0026] Optionally, the operation information includes: a movement operation and / or a rotation operation and a corresponding adjustment value. Based on the operation information and the second coordinate information, aligning the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system includes:
[0027] Based on the movement operation and / or rotation operation and the corresponding adjustment value, the second coordinate information or the reference coordinate system is adjusted multiple times until the transformed second coordinate system is aligned with the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0028] In a second aspect of the present invention, a coordinate system adjustment device is provided, the device comprising:
[0029] A first determination module is used to determine a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene;
[0030] A second determination module is used to determine second coordinate information of a virtual coordinate system corresponding to the real coordinate system in the virtual scene based on first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix, wherein the second coordinate information is coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is orientation information of the virtual coordinate system relative to a reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0031] a transformation module, configured to transform the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix, so as to obtain the transformed second position information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0032] A drawing module, used for drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene based on the second coordinate information and the second orientation information;
[0033] an acquisition module, for acquiring operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0034] The alignment module is used to align the transformed second coordinate system with the reference coordinate system based on the operation information and the second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0035] Optionally, the second determining module is specifically configured to:
[0036] Acquire first reference information selected in a real scene and second reference information selected in a virtual scene, wherein the first reference information is position information of a reference object in the real scene, and the second reference information is selected in the virtual scene based on the first reference information;
[0037] Based on the first reference information, the second reference information and the first coordinate information, a preset second transformation matrix is used to determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene.
[0038] Optionally, the operation information includes a move operation and / or a rotation operation, and the alignment module is specifically used to:
[0039] Adjusting the second coordinate information at least twice according to a preset step length based on the operation information;
[0040] Drawing and displaying the transformed second coordinate system based on the second coordinate information after each adjustment, so as to determine whether to re-operate the transformed second coordinate system;
[0041] When the first re-operation information for re-operating the transformed second coordinate system is not obtained, continue to adjust the adjusted second coordinate information according to a preset step length until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0042] When first re-operation information for re-operating the transformed second coordinate system is obtained, the transformed second coordinate system is aligned to the reference coordinate system based on the first re-operation information and the adjusted second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0043] Optionally, the operation information includes a move operation and / or a rotation operation, and the alignment module is specifically used to:
[0044] Based on the operation information and the second coordinate information, adjusting the reference coordinate system at least twice according to a preset step size;
[0045] Plotting and displaying the reference coordinate system after each adjustment to determine whether to re-operate the reference coordinate system;
[0046] When the second re-operation information for re-operating the reference coordinate system is not obtained, continue to adjust the adjusted reference coordinate system according to the preset step length until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0047] When second re-operation information for re-operating the reference coordinate system is obtained, the reference coordinate system is aligned to the transformed second coordinate system based on the second re-operation information and the adjusted reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0048] Optionally, the operation information includes: a move operation and / or a rotation operation and a corresponding adjustment value, and the alignment module is specifically used to:
[0049] Based on the movement operation and / or rotation operation and the corresponding adjustment value, the second coordinate information or the reference coordinate system is adjusted multiple times until the transformed second coordinate system is aligned with the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0050] In another aspect of the present invention, there is provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0051] Memory, used to store computer programs;
[0052] The processor is used to implement any of the above-mentioned coordinate system adjustment methods when executing the program stored in the memory.
[0053] In another aspect of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned coordinate system adjustment methods is implemented.
[0054] In another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned coordinate system adjustment methods.
[0055] A coordinate system adjustment method, device, electronic device and storage medium provided by an embodiment of the present invention can first determine a first transformation matrix for transforming the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene based on the first orientation information of the real tracker in the real scene, then determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix, then transform the orientation information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second orientation information of the virtual tracker in the virtual coordinate system; then draw and display the virtual tracker and the transformed second coordinate system in the virtual scene based on the second coordinate information and the second orientation information; finally, when operation information of the operation based on the drawn virtual tracker, the drawn transformed second coordinate system and the reference coordinate system of the virtual scene is obtained; based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system. In this way, by aligning the second coordinate information with the reference coordinate system, the virtual tracker corresponding to the real tracker can be aligned to the reference coordinate system, so that the virtual position observed by the virtual tracker can match the real position observed by the real tracker, so that the virtual object deployed at the virtual position can be accurately reflected in the real position corresponding to the virtual position. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0057] Figure 1 This is a flow chart of a first implementation of a coordinate system adjustment method in an embodiment of the present invention;
[0058] Figure 2 This is a flow chart of a second implementation of a coordinate system adjustment method in an embodiment of the present invention;
[0059] Figure 3 This is a flow chart of a third implementation of a coordinate system adjustment method in an embodiment of the present invention;
[0060] Figure 4 This is a flow chart of a fourth implementation of a coordinate system adjustment method in an embodiment of the present invention;
[0061] Figure 5 This is a flow chart of a fifth implementation of a coordinate system adjustment method in an embodiment of the present invention;
[0062] Figure 6It is a structural schematic diagram of a coordinate system adjustment device in an embodiment of the present invention;
[0063] Figure 7 The figure is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0065] In order to solve the problems existing in the prior art, the embodiments of the present invention provide a coordinate system adjustment method, device, electronic device and storage medium to align the coordinate system of a real scene with the coordinate system used in a virtual scene, so that the virtual objects deployed at the virtual position can be accurately reflected at the real position corresponding to the virtual position.
[0066] Next, a coordinate system adjustment method according to an embodiment of the present invention is first introduced. Figure 1 FIG. 1 is a flow chart of a first implementation of a coordinate system adjustment method in an embodiment of the present invention. The method may include:
[0067] S110, determining a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene;
[0068] S120, based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0069] S130, transforming the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain transformed second position information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0070] S140, based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0071] S150, obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0072] S160 , based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0073] In some examples, when using augmented reality technology to develop a project, the real scene is usually modeled at a certain scale to form a virtual scene corresponding to the real scene. For example, modeling is performed at a 1:1 scale to form a virtual scene with the same size as the real scene. The real scene can be a school, a shopping mall, an office building, or other places where people work and rest daily, which are not listed here one by one.
[0074] However, when modeling a real scene to generate a virtual scene, the coordinate system used may be different from the coordinate system in the real scene. When the coordinate system used by the virtual scene is different from the coordinate system in the real scene, the real scene and the virtual scene will not be able to match completely. For example, the virtual object deployed at the virtual position cannot accurately reflect the real position corresponding to the virtual position. As a result, the objects observed by the real tracker in the real scene during movement may not be exactly the same as the objects observed by the virtual tracker in the virtual scene during movement. If an augmented reality project is developed based on the virtual scene, the difficulty of development will increase.
[0075] In some examples, in order to facilitate the project development of augmented reality technology based on real scenes, a coordinate system is usually set for the real scene, and the coordinate system is the real coordinate system of the real scene.
[0076] In some other examples, the real tracker in the real scene is usually not located at the origin of the real coordinate system, and the real tracker usually has orientation information in the real scene, that is, first orientation information, which is used to describe the position and orientation of the real tracker in the real scene, or to describe the position and orientation of the real tracker relative to the above-mentioned real coordinate system.
[0077] In order to conveniently align the coordinate system of the real scene with the reference coordinate system used when modeling the virtual scene, the position of the real tracker may be first transformed to the coordinate origin of the real coordinate system.
[0078] For example, a first transformation matrix of the real tracker may be determined based on first position information of the real tracker in the real scene. By using the first transformation matrix, the position of the real tracker may be transformed to the coordinate origin of the real coordinate system.
[0079] In some other examples, when modeling a real scene to generate a virtual scene, the real coordinate system can also be mapped to the virtual scene. In order to further facilitate the subsequent alignment of the coordinate system of the real scene with the coordinate system used in the virtual scene, the coordinate system of the real scene can be transformed while mapping, so that at least one coordinate axis direction of the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene is the same as at least one coordinate axis direction of the reference coordinate system;
[0080] To this end, the real coordinate system can be mapped and transformed based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, so as to determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene.
[0081] In some examples, when the coordinate axes of the coordinate system of the real scene are mapped to the virtual scene, they may be in the same direction as or different from the coordinate axes of the reference coordinate system used by the virtual scene. For example, the z-axis of the coordinate system in the real scene may be vertically upward relative to the ground. The z-axis of the reference coordinate system used by the virtual scene may be vertically downward relative to the ground of the virtual scene. In this case, the directions of the z-axes of the two coordinate systems are different.
[0082] At this time, if the directions of the z-axes of the two coordinate systems are not the same, the difficulty of subsequent adjustment will increase. Therefore, in order to reduce the difficulty of subsequent adjustment of coordinate information, the direction of the coordinate axis can be adjusted when mapping the coordinate axis of the coordinate system of the real scene to the virtual scene.
[0083] In some examples, it can be determined whether the direction of the vertical axis in the real coordinate system is the same as the direction of the vertical axis in the reference coordinate system. If they are different, the real coordinate system can be mapped to the virtual scene while using a preset second transformation matrix to transform so that the direction of at least one axis of the second coordinate information is the same as the direction of at least one axis of the reference coordinate system.
[0084] In some examples, the coordinate axis in the vertical direction of the real coordinate system can be rotated by presetting the second transformation matrix so that the direction of at least one coordinate axis of the second coordinate information is the same as the direction of at least one coordinate axis of the reference coordinate system. For example, the coordinate axis in the vertical direction of the real coordinate system is rotated by 180° so that the direction of the coordinate axis in the vertical direction of the second coordinate information is the same as the direction of the coordinate axis in the vertical direction of the reference coordinate system.
[0085] In an embodiment of the present invention, when the direction of the vertical axis in the real coordinate system is different from the direction of the vertical axis in the reference coordinate system, a preset second transformation matrix is used for transformation so that the direction of at least one coordinate axis of the second coordinate information is the same as the direction of at least one coordinate axis of the reference coordinate system. This allows only the remaining coordinate axes in the coordinate system to be aligned during subsequent adjustments, thereby reducing the difficulty of subsequent adjustments to the coordinate information.
[0086] The preset second transformation matrix is a transformation matrix pre-set using the existing technology.
[0087] In some other examples, when modeling a real scene to generate a virtual scene, a real tracker in the real scene can also be mapped to the virtual scene, so as to obtain a virtual tracker in the virtual scene, wherein the position information of the virtual tracker in the virtual scene is the same as the position information of the real tracker in the real scene.
[0088] In order to prevent the virtual object deployed at the virtual position from accurately reflecting the real position corresponding to the virtual position, the position of the virtual tracker can be transformed to the coordinate origin of the virtual coordinate system.
[0089] In this regard, the position information of the virtual tracker corresponding to the real tracker can be transformed based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second position information of the virtual tracker in the virtual coordinate system.
[0090] By using the first transformation matrix and the second preset transformation matrix to transform the orientation information of the virtual tracker, and determining the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, the performance of the transformed virtual tracker in the transformed virtual coordinate system corresponding to the second coordinate information can be consistent with the performance of the real tracker in the real scene.
[0091] In some other examples, the execution order of the above steps S120 and S130 is not specific, and step S120 may be executed first and then step S130; step S130 may be executed first and then step S120; or step S120 and step S130 may be executed simultaneously. All of these are possible.
[0092] After obtaining the second coordinate information and the second orientation information, the transformed second coordinate system can be drawn and displayed in the virtual scene based on the second coordinate information, and the virtual tracker can be drawn and displayed in the virtual scene based on the second orientation information.
[0093] In some examples, when displaying the drawn virtual tracker and the drawn transformed second coordinate system, the reference coordinate system of the virtual scene may also be displayed.
[0094] After displaying the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene, the staff can operate the drawn transformed second coordinate system and / or the reference coordinate system of the virtual scene, for example, by moving or rotating, to align the transformed second coordinate system with the reference coordinate system.
[0095] When operating the drawn transformed second coordinate system and / or the reference coordinate system of the virtual scene, corresponding operation information can be obtained, and then the transformed second coordinate system can be aligned with the reference coordinate system based on the operation information and the second coordinate information.
[0096] In the embodiment of the present invention, by simulating and displaying the transformed second coordinate system and the drawn virtual tracker, the staff can operate the drawn transformed second coordinate system and / or the reference coordinate system of the virtual scene based on the drawn virtual tracker, the drawn transformed second coordinate system and the reference coordinate system of the virtual scene, and then align the transformed second coordinate system with the reference coordinate system through corresponding operation information. In this way, the matching process can be made more intuitive, and the staff can make adjustments according to actual needs, which increases the autonomy of the staff in the adjustment process.
[0097] In some examples, since the virtual tracker is located at the coordinate origin of the transformed second coordinate system, after aligning the transformed second coordinate system with the reference coordinate system, the virtual tracker can be aligned to the coordinate origin of the reference coordinate system.
[0098] A coordinate system adjustment method provided by an embodiment of the present invention can first determine a first transformation matrix for transforming the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene based on the first orientation information of the real tracker in the real scene, and then determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix, and then transform the orientation information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second orientation information of the virtual tracker in the virtual coordinate system; then draw the virtual tracker and the transformed second coordinate system in the virtual scene and display them based on the second coordinate information and the second orientation information; finally, when operation information of the operation based on the drawn virtual tracker, the drawn transformed second coordinate system and the reference coordinate system of the virtual scene is obtained; based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system. In this way, by aligning the second coordinate information with the reference coordinate system, the virtual tracker corresponding to the real tracker can be aligned to the reference coordinate system, so that the virtual position observed by the virtual tracker can match the real position observed by the real tracker, so that the virtual object deployed at the virtual position can be accurately reflected in the real position corresponding to the virtual position.
[0099] exist Figure 1 Based on the coordinate system adjustment method shown in FIG. 1 , the embodiment of the present invention further provides a possible implementation method, such as Figure 2 FIG. 1 is a flow chart of a second implementation of a coordinate system adjustment method in an embodiment of the present invention. The method may include:
[0100] S210, determining a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene;
[0101] S220, acquiring first reference information selected in the real scene and second reference information selected in the virtual scene, wherein the first reference information is position information of a reference object in the real scene, and the second reference information is selected in the virtual scene based on the first reference information;
[0102] S230: Based on the first reference information, the second reference information and the first coordinate information, a preset second transformation matrix is used to determine second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene.
[0103] The second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the second transformation matrix is preset to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0104] S240, transforming the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain transformed second position information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0105] S250, based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0106] S260, obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0107] S270 , based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0108] In some examples, in order to make the obtained first coordinate information more accurate and reduce the amount of calculation in the coordinate system mapping process, when mapping the coordinate system of the real scene to the virtual scene, at least two reference objects can be first selected in the real scene, and first reference information corresponding to the at least two reference objects in the real scene can be obtained. Then, at least two reference objects can be selected in the virtual scene, and second reference information corresponding to the at least two reference objects in the virtual scene can be obtained.
[0109] The first reference information is position information of a reference object in a real scene, and the second reference information is selected in a virtual scene based on the first reference information.
[0110] In some examples, the at least two reference objects selected in the virtual scene are virtual objects corresponding to the at least two reference objects selected in the real scene.
[0111] By selecting at least two reference objects in the real scene, relative position information between the coordinate system of the real scene and the at least two reference objects in the real scene can be determined.
[0112] Therefore, based on the first reference information, the second reference information and the first coordinate information, the real coordinate system of the real scene can be mapped to the virtual scene, and the relative position information of the mapped virtual coordinate system with respect to the virtual scene can be obtained.
[0113] In order to make at least one coordinate axis of the mapped virtual coordinate system have the same direction as at least one coordinate axis of the reference coordinate system of the virtual scene, a preset second transformation matrix can be used to transform the mapped virtual coordinate system. In this way, the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene can be determined by using the preset second transformation matrix based on the first reference information, the second reference information and the first coordinate information.
[0114] In the embodiment of the present invention, by selecting a reference object and performing a mapping transformation of the coordinate system based on reference information corresponding to the reference object, the second coordinate information can be obtained more accurately.
[0115] It can be understood that steps S210 and S240 to S270 in the embodiment of the present invention are the same as or similar to steps S110 to S160 in the first embodiment, and are not described in detail here.
[0116] exist Figure 1 Based on the coordinate system adjustment method shown in FIG. 1 , the embodiment of the present invention further provides a possible implementation method, such as Figure 3 FIG. 1 is a flowchart of a third implementation of a coordinate system adjustment method in an embodiment of the present invention. The method may include:
[0117] S310, determining a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene;
[0118] S320, based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0119] S330, transforming the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain transformed second position information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0120] S340, based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0121] S350, obtaining operation information of an operation performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene, the operation information including a movement operation and / or a rotation operation;
[0122] S360, adjusting the second coordinate information at least twice according to a preset step length based on the operation information;
[0123] S370, drawing and displaying the transformed second coordinate system based on the second coordinate information after each adjustment, so as to determine whether to re-operate the transformed second coordinate system;
[0124] S380, when the first re-operation information for re-operating the transformed second coordinate system is not obtained, continue to adjust the adjusted second coordinate information according to a preset step length until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0125] S390, when first re-operation information for re-operating the transformed second coordinate system is obtained, based on the first re-operation information and the adjusted second coordinate information, the transformed second coordinate system is aligned to the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0126] In some examples, in the process of aligning the transformed second coordinate system with the reference coordinate system, the transformed second coordinate system may be aligned to the reference coordinate system by adjusting the transformed second coordinate system.
[0127] In this regard, after obtaining the operation information, the second coordinate information can be adjusted at least twice according to the preset step length based on the operation information. For example, assuming that the operation information is to adjust to the left and the preset step length is 5 cm, the second coordinate information can be adjusted at least twice according to 5 cm.
[0128] In order to ensure the accuracy of the adjustment, after each adjustment, the transformed second coordinate system can be drawn and displayed based on the second coordinate information after each adjustment to determine whether the adjustment is correct. If it is correct, it can be determined that the transformed second coordinate system does not need to be readjusted. If it is incorrect, it can be determined that the transformed second coordinate system needs to be readjusted.
[0129] In some examples, when it is determined that the transformed second coordinate system is not to be readjusted, the staff does not need to perform any operation. Therefore, the electronic device using a coordinate system adjustment method according to an embodiment of the present invention will not obtain the first re-operation information for re-operating the transformed second coordinate system, and can continue to adjust the adjusted second coordinate information according to a preset step length until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0130] When it is determined that the transformed second coordinate system needs to be readjusted, the staff can perform the readjustment operation. Therefore, the electronic device can obtain the first re-operation information for re-operating the transformed second coordinate system. At this time, based on the adjusted second coordinate information, it can be readjusted according to the preset step size based on the first re-operation information until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0131] In an embodiment of the present invention, by performing an adjustment operation on the transformed second coordinate system, the transformed second coordinate system can be aligned to the reference coordinate system to achieve alignment of the transformed second coordinate system with the reference coordinate system, thereby aligning the virtual tracker to the coordinate origin of the reference coordinate system.
[0132] It can be understood that steps S310 to S350 in the embodiment of the present invention are the same as or similar to steps S110 to S150 in the first embodiment, and are not described in detail here.
[0133] exist Figure 1 Based on the coordinate system adjustment method shown in FIG. 1 , the embodiment of the present invention further provides a possible implementation method, such as Figure 4 FIG. 1 is a flowchart of a fourth implementation of a coordinate system adjustment method in an embodiment of the present invention. The method may include:
[0134] S410, determining a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene;
[0135] S420, based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0136] S430, transforming the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain transformed second position information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0137] S440, based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0138] S450, obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0139] S460, adjusting the reference coordinate system at least twice according to a preset step length based on the operation information and the second coordinate information;
[0140] S470, drawing and displaying the reference coordinate system after each adjustment, so as to determine whether to re-operate the reference coordinate system;
[0141] S480, when the second re-operation information for re-operating the reference coordinate system is not obtained, continue to adjust the adjusted reference coordinate system according to the preset step length until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0142] S490, when second re-operation information for re-operating the reference coordinate system is obtained, the reference coordinate system is aligned to the transformed second coordinate system based on the second re-operation information and the adjusted reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0143] In some examples, in the process of aligning the transformed second coordinate system and the reference coordinate system, the reference coordinate system may be aligned to the transformed second coordinate system by adjusting the reference coordinate system.
[0144] In this regard, after obtaining the operation information, the reference coordinate system can be adjusted at least twice according to the preset step size based on the operation information. For example, assuming that the operation information is to adjust to the left and the preset step size is 5 cm, the reference coordinate system can be adjusted at least twice according to 5 cm.
[0145] In order to ensure the accuracy of the adjustment, the reference coordinate system after each adjustment can be drawn and displayed to determine whether the adjustment is correct. If it is correct, it can be determined that the reference coordinate system does not need to be readjusted. If it is incorrect, it can be determined that the reference coordinate system needs to be readjusted.
[0146] In some examples, when it is determined that the reference coordinate system is not to be readjusted, the staff does not need to perform any operation. Therefore, the electronic device using a coordinate system adjustment method according to an embodiment of the present invention will not obtain the second re-operation information for re-operating the reference coordinate system, and can continue to adjust the adjusted reference coordinate system according to a preset step length until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0147] When it is determined that the reference coordinate system needs to be readjusted, the staff can perform the readjustment operation. Therefore, the electronic device can obtain second re-operation information for re-operating the reference coordinate system. At this time, based on the adjusted reference coordinate system, it can be readjusted according to the preset step size based on the second re-operation information until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0148] In an embodiment of the present invention, by performing an adjustment operation on the reference coordinate system, the reference coordinate system can be aligned to the transformed second coordinate system to achieve alignment of the transformed second coordinate system with the reference coordinate system, thereby aligning the virtual tracker to the coordinate origin of the reference coordinate system.
[0149] Through the third embodiment and the fourth embodiment of the present invention, it is possible to align the transformed second coordinate system with the reference coordinate system in a variety of ways, thereby increasing the diversity of ways to align the transformed second coordinate system with the reference coordinate system.
[0150] It can be understood that steps S410 to S450 in the embodiment of the present invention are the same as or similar to steps S110 to S150 in the first embodiment, and are not described in detail here.
[0151] In some other examples, when aligning the transformed second coordinate system with the reference coordinate system, the difference between the second coordinate information and the reference coordinate system may be determined first.
[0152] The difference may include the difference between the position information of the coordinate origin in the second coordinate information and the coordinate origin in the reference coordinate system, and may also include the difference between the direction of the coordinate axis in the second coordinate information and the direction of the coordinate axis in the reference coordinate system.
[0153] After the difference value is determined, the transformed second coordinate system or the reference coordinate system may be adjusted based on the difference value to align the transformed second coordinate system with the reference coordinate system.
[0154] In some other examples, when adjusting the transformed second coordinate system, the second coordinate information can be increased or decreased by a certain angle value or distance value; when adjusting the reference coordinate system, the relative angle value or relative distance value of the reference coordinate system can be increased or decreased by a certain angle value or distance value.
[0155] In an embodiment of the present invention, by using the difference between the second coordinate information and the reference coordinate system; adjusting the transformed second coordinate system or the reference coordinate system, the transformed second coordinate system can be quickly aligned with the reference coordinate system, reducing the time overhead in the process of adjusting the coordinate system.
[0156] exist Figure 1 Based on the coordinate system adjustment method shown in FIG. 1 , the embodiment of the present invention further provides a possible implementation method, such as Figure 5 FIG. 1 is a flowchart of a fifth implementation of a coordinate system adjustment method in an embodiment of the present invention. The method may include:
[0157] S510, determining a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene;
[0158] S520, based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0159] S530, transforming the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain transformed second position information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0160] S540, based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0161] S550, obtaining operation information of an operation performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene, the operation information including: a move operation and / or a rotation operation and a corresponding adjustment value;
[0162] S560, based on the movement operation and / or the rotation operation and the corresponding adjustment value, the second coordinate information or the reference coordinate system is adjusted multiple times until the transformed second coordinate system is aligned with the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0163] In some examples, the above operation information may include, in addition to the moving operation and / or the rotating operation, an adjustment value corresponding to the moving operation and / or an adjustment value corresponding to the rotating operation.
[0164] Therefore, an electronic device that applies a coordinate system adjustment method according to an embodiment of the present invention can obtain a movement operation and / or a rotation operation and an adjustment value corresponding to the movement operation and / or an adjustment value corresponding to the rotation operation;
[0165] At this time, the second coordinate information or the reference coordinate system can be adjusted multiple times based on the movement operation and / or rotation operation and the corresponding adjustment value until the transformed second coordinate system is aligned with the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0166] In some other examples, in the process of making multiple adjustments to the second coordinate information or the reference coordinate system based on the moving operation and / or the rotation operation and the corresponding adjustment value, the transformed second coordinate system and / or the reference coordinate system may be drawn after each adjustment to determine whether the adjustment of the transformed second coordinate system and / or the reference coordinate system is correct. If incorrect, the adjustment may be made again based on the re-executed operation and the corresponding operation value. If correct, the second coordinate information or the reference coordinate system may be adjusted multiple times based on the moving operation and / or the rotation operation and the corresponding adjustment value until the transformed second coordinate system is aligned with the reference coordinate system.
[0167] Through the embodiments of the present invention, it is possible to input a corresponding adjustment value to automatically perform an adjustment during an operation, thereby reducing the time overhead in adjusting the coordinate system.
[0168] It can be understood that steps S510 to S550 in the embodiment of the present invention are the same as or similar to steps S110 to S150 in the first embodiment, and are not described in detail here.
[0169] Corresponding to the above method embodiment, the embodiment of the present invention further provides a coordinate system adjustment device, such as Figure 6 FIG. 1 is a schematic diagram of a coordinate system adjustment device according to an embodiment of the present invention. The device may include:
[0170] A first determination module 610 is used to determine a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene;
[0171] The second determination module 620 is used to determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0172] The transformation module 630 is used to transform the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second position information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0173] A drawing module 640, for drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene based on the second coordinate information and the second orientation information;
[0174] an acquisition module 650 for acquiring operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0175] The alignment module 660 is used to align the transformed second coordinate system with the reference coordinate system based on the operation information and the second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0176] A coordinate system adjustment device provided by an embodiment of the present invention can first determine a first transformation matrix for transforming the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene based on the first orientation information of the real tracker in the real scene, and then determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix, and then transform the orientation information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second orientation information of the virtual tracker in the virtual coordinate system; then draw the virtual tracker and the transformed second coordinate system in the virtual scene and display them based on the second coordinate information and the second orientation information; finally, when operation information of the operation based on the drawn virtual tracker, the drawn transformed second coordinate system and the reference coordinate system of the virtual scene is obtained; based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system. In this way, by aligning the second coordinate information with the reference coordinate system, the virtual tracker corresponding to the real tracker can be aligned to the reference coordinate system, so that the virtual position observed by the virtual tracker can match the real position observed by the real tracker, so that the virtual object deployed at the virtual position can be accurately reflected in the real position corresponding to the virtual position.
[0177] In some examples, the second determination module 620 is specifically configured to:
[0178] Acquire first reference information selected in a real scene and second reference information selected in a virtual scene, wherein the first reference information is position information of a reference object in the real scene, and the second reference information is selected in the virtual scene based on the first reference information;
[0179] Based on the first reference information, the second reference information and the first coordinate information, a preset second transformation matrix is used to determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene.
[0180] In some examples, the operation information includes a move operation and / or a rotation operation, and the alignment module 660 is specifically configured to:
[0181] Adjusting the second coordinate information at least twice according to a preset step length based on the operation information;
[0182] Drawing and displaying the transformed second coordinate system based on the second coordinate information after each adjustment, so as to determine whether to re-operate the transformed second coordinate system;
[0183] When the first re-operation information for re-operating the transformed second coordinate system is not obtained, continue to adjust the adjusted second coordinate information according to a preset step length until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0184] When first re-operation information for re-operating the transformed second coordinate system is obtained, the transformed second coordinate system is aligned to the reference coordinate system based on the first re-operation information and the adjusted second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0185] In some examples, the operation information includes a move operation and / or a rotation operation, and the alignment module 660 is specifically configured to:
[0186] Based on the operation information and the second coordinate information, adjusting the reference coordinate system at least twice according to a preset step size;
[0187] Plotting and displaying the reference coordinate system after each adjustment to determine whether to re-operate the reference coordinate system;
[0188] When the second re-operation information for re-operating the reference coordinate system is not obtained, continue to adjust the adjusted reference coordinate system according to the preset step length until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system;
[0189] When second re-operation information for re-operating the reference coordinate system is obtained, the reference coordinate system is aligned to the transformed second coordinate system based on the second re-operation information and the adjusted reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0190] In some examples, the operation information includes: a move operation and / or a rotation operation and a corresponding adjustment value, and the alignment module 660 is specifically used to:
[0191] Based on the movement operation and / or rotation operation and the corresponding adjustment value, the second coordinate information or the reference coordinate system is adjusted multiple times until the transformed second coordinate system is aligned with the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0192] The embodiment of the present invention further provides an electronic device, such as Figure 7As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0193] Memory 703, used for storing computer programs;
[0194] The processor 701 is used to execute the program stored in the memory 703 to implement the following steps:
[0195] Based on first position information of a real tracker in the real scene, determining a first transformation matrix of the real tracker, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of a real coordinate system of the real scene;
[0196] Based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene is determined, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0197] Based on the first transformation matrix and the preset second transformation matrix, transform the orientation information of the virtual tracker corresponding to the real tracker to obtain transformed second orientation information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0198] Based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0199] Obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0200] Based on the operation information and the second coordinate information, the transformed second coordinate system is aligned with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0201] An electronic device provided by an embodiment of the present invention can first determine a first transformation matrix for transforming the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene based on the first orientation information of the real tracker in the real scene, and then determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix, and then transform the orientation information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second orientation information of the virtual tracker in the virtual coordinate system; then draw the virtual tracker and the transformed second coordinate system in the virtual scene and display them based on the second coordinate information and the second orientation information; finally, when operation information of the operation based on the drawn virtual tracker, the drawn transformed second coordinate system and the reference coordinate system of the virtual scene is obtained; based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system. In this way, by aligning the second coordinate information with the reference coordinate system, the virtual tracker corresponding to the real tracker can be aligned to the reference coordinate system, so that the virtual position observed by the virtual tracker can match the real position observed by the real tracker, so that the virtual object deployed at the virtual position can be accurately reflected in the real position corresponding to the virtual position.
[0202] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0203] The communication interface is used for communication between the above terminal and other devices.
[0204] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0205] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0206] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0207] Based on first position information of a real tracker in the real scene, determining a first transformation matrix of the real tracker, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of a real coordinate system of the real scene;
[0208] Based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene is determined, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0209] Based on the first transformation matrix and the preset second transformation matrix, transform the orientation information of the virtual tracker corresponding to the real tracker to obtain transformed second orientation information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0210] Based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0211] Obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0212] Based on the operation information and the second coordinate information, the transformed second coordinate system is aligned with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0213] A computer-readable storage medium provided by an embodiment of the present invention can first determine a first transformation matrix for transforming the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene based on the first orientation information of the real tracker in the real scene, then determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix, then transform the orientation information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second orientation information of the virtual tracker in the virtual coordinate system; then draw and display the virtual tracker and the transformed second coordinate system in the virtual scene based on the second coordinate information and the second orientation information; finally, when operation information of the operation based on the drawn virtual tracker, the drawn transformed second coordinate system and the reference coordinate system of the virtual scene is obtained; based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system. In this way, by aligning the second coordinate information with the reference coordinate system, the virtual tracker corresponding to the real tracker can be aligned to the reference coordinate system, so that the virtual position observed by the virtual tracker can match the real position observed by the real tracker, so that the virtual object deployed at the virtual position can be accurately reflected in the real position corresponding to the virtual position.
[0214] In another embodiment of the present invention, a computer program product including instructions is provided, which, when executed on a computer, causes the computer to execute the following steps:
[0215] Based on first position information of a real tracker in the real scene, determining a first transformation matrix of the real tracker, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of a real coordinate system of the real scene;
[0216] Based on the first coordinate information of the real coordinate system relative to the real scene and the preset second transformation matrix, the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene is determined, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information;
[0217] Based on the first transformation matrix and the preset second transformation matrix, transform the orientation information of the virtual tracker corresponding to the real tracker to obtain transformed second orientation information of the virtual tracker in the virtual coordinate system, wherein the transformed virtual tracker is located at the coordinate origin of the virtual coordinate system;
[0218] Based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene;
[0219] Obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene;
[0220] Based on the operation information and the second coordinate information, the transformed second coordinate system is aligned with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
[0221] A computer program product including instructions provided by an embodiment of the present invention can first determine a first transformation matrix for transforming the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene based on the first orientation information of the real tracker in the real scene, then determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene based on the first coordinate information of the real coordinate system relative to the real scene and a preset second transformation matrix, then transform the orientation information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix to obtain the transformed second orientation information of the virtual tracker in the virtual coordinate system; then draw and display the virtual tracker and the transformed second coordinate system in the virtual scene based on the second coordinate information and the second orientation information; finally, when obtaining operation information of the operation based on the drawn virtual tracker, the drawn transformed second coordinate system and the reference coordinate system of the virtual scene; based on the operation information and the second coordinate information, align the transformed second coordinate system with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system. In this way, by aligning the second coordinate information with the reference coordinate system, the virtual tracker corresponding to the real tracker can be aligned to the reference coordinate system, so that the virtual position observed by the virtual tracker can match the real position observed by the real tracker, so that the virtual object deployed at the virtual position can be accurately reflected in the real position corresponding to the virtual position.
[0222] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0223] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0224] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0225] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A coordinate system adjustment method, characterized in that: The method comprises: Determine a first transformation matrix of the real tracker based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of the real coordinate system of the real scene; Acquire first reference information selected in the real scene and second reference information selected in the virtual scene, wherein the first reference information is position information of a reference object in the real scene, and the second reference information is selected in the virtual scene based on the first reference information; Based on the first reference information, the second reference information and the first coordinate information, a preset second transformation matrix is used to determine the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information; Based on the first transformation matrix and the preset second transformation matrix, transform the position information of the virtual tracker corresponding to the real tracker to obtain the transformed second position information of the virtual tracker in the virtual coordinate system, wherein the virtual tracker after the position information is transformed is located at the coordinate origin of the virtual coordinate system; Based on the second coordinate information and the second orientation information, drawing and displaying the virtual tracker and the transformed second coordinate system in the virtual scene; Obtaining operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene; Based on the operation information and the second coordinate information, the transformed second coordinate system is aligned with the reference coordinate system so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
2. The method according to claim 1, characterized in that The operation information includes a movement operation and / or a rotation operation, and the aligning the transformed second coordinate system with the reference coordinate system based on the operation information and the second coordinate information so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system includes: Adjusting the second coordinate information at least twice according to a preset step length based on the operation information; Drawing and displaying the transformed second coordinate system based on the second coordinate information after each adjustment, so as to determine whether to re-operate the transformed second coordinate system; When the first re-operation information for re-operating the transformed second coordinate system is not obtained, continue to adjust the adjusted second coordinate information according to the preset step length until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system; When first re-operation information for re-operating the transformed second coordinate system is obtained, the transformed second coordinate system is aligned to the reference coordinate system based on the first re-operation information and the adjusted second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
3. The method according to claim 1, characterized in that The operation information includes a movement operation and / or a rotation operation, and the aligning the transformed second coordinate system with the reference coordinate system based on the operation information and the second coordinate information so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system includes: Based on the operation information and the second coordinate information, adjusting the reference coordinate system at least twice according to a preset step size; Plotting and displaying the reference coordinate system after each adjustment so as to determine whether to re-operate the reference coordinate system; When the second re-operation information for re-operating the reference coordinate system is not obtained, continue to adjust the adjusted reference coordinate system according to the preset step length until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system; When second re-operation information for re-operating the reference coordinate system is obtained, the reference coordinate system is aligned to the transformed second coordinate system based on the second re-operation information and the adjusted reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
4. The method according to claim 1, characterized in that: The operation information includes: a movement operation and / or a rotation operation and a corresponding adjustment value, and the aligning the transformed second coordinate system with the reference coordinate system based on the operation information and the second coordinate information so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system includes: Based on the movement operation and / or the rotation operation and the corresponding adjustment value, the second coordinate information or the reference coordinate system is adjusted multiple times until the transformed second coordinate system is aligned with the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
5. A coordinate system adjustment device, characterized in that: The device comprises: A first determination module, configured to determine a first transformation matrix of a real tracker in a real scene based on first position information of the real tracker in the real scene, wherein the first transformation matrix is used to transform the position information of the real tracker to the coordinate origin of a real coordinate system of the real scene; A second determination module is used to obtain first reference information selected in the real scene and second reference information selected in the virtual scene, wherein the first reference information is position information of a reference object in the real scene, and the second reference information is selected in the virtual scene based on the first reference information; The second determination module is further used to determine, based on the first reference information, the second reference information and the first coordinate information, the second coordinate information of the virtual coordinate system corresponding to the real coordinate system in the virtual scene by using a preset second transformation matrix, wherein the second coordinate information is the coordinate information of the virtual coordinate system corresponding to the real coordinate system relative to the virtual scene; wherein the first coordinate information includes the position information and direction information of the real coordinate system relative to the real scene; the second coordinate information is the orientation information of the virtual coordinate system relative to the reference coordinate system of the virtual scene, and the preset second transformation matrix is used to make at least one coordinate axis direction of the second coordinate information the same as at least one coordinate axis direction of the reference coordinate system when transforming the first coordinate information into the second coordinate information; a transformation module, configured to transform the position information of the virtual tracker corresponding to the real tracker based on the first transformation matrix and the preset second transformation matrix, so as to obtain the transformed second position information of the virtual tracker in the virtual coordinate system, wherein the virtual tracker after the position information is transformed is located at the coordinate origin of the virtual coordinate system; a drawing module, configured to draw and display the virtual tracker and the transformed second coordinate system in the virtual scene based on the second coordinate information and the second orientation information; an acquisition module, configured to acquire operation information of operations performed based on the drawn virtual tracker, the drawn transformed second coordinate system, and the reference coordinate system of the virtual scene; An alignment module is used to align the transformed second coordinate system with the reference coordinate system based on the operation information and the second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
6. The device according to claim 5, characterized in that The operation information includes a moving operation and / or a rotating operation, and the alignment module is specifically used for: Adjusting the second coordinate information at least twice according to a preset step length based on the operation information; Drawing and displaying the transformed second coordinate system based on the second coordinate information after each adjustment, so as to determine whether to re-operate the transformed second coordinate system; When the first re-operation information for re-operating the transformed second coordinate system is not obtained, continue to adjust the adjusted second coordinate information according to the preset step length until the transformed second coordinate system is aligned to the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system; When first re-operation information for re-operating the transformed second coordinate system is obtained, the transformed second coordinate system is aligned to the reference coordinate system based on the first re-operation information and the adjusted second coordinate information, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
7. The device according to claim 5, characterized in that The operation information includes a moving operation and / or a rotating operation, and the alignment module is specifically used for: Based on the operation information and the second coordinate information, adjusting the reference coordinate system at least twice according to a preset step size; Plotting and displaying the reference coordinate system after each adjustment so as to determine whether to re-operate the reference coordinate system; When the second re-operation information for re-operating the reference coordinate system is not obtained, continue to adjust the adjusted reference coordinate system according to the preset step length until the reference coordinate system is aligned to the transformed second coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system; When second re-operation information for re-operating the reference coordinate system is obtained, the reference coordinate system is aligned to the transformed second coordinate system based on the second re-operation information and the adjusted reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
8. The device according to claim 5, characterized in that The operation information includes: a moving operation and / or a rotating operation and a corresponding adjustment value. The alignment module is specifically used to: Based on the movement operation and / or the rotation operation and the corresponding adjustment value, the second coordinate information or the reference coordinate system is adjusted multiple times until the transformed second coordinate system is aligned with the reference coordinate system, so that the virtual tracker is aligned to the coordinate origin of the reference coordinate system.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 4 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 4 are implemented.
