WO2021121061A1 - Method for configuring spatial position of virtual object, and electronic device - Google Patents

Method for configuring spatial position of virtual object, and electronic device Download PDF

Info

Publication number
WO2021121061A1
WO2021121061A1 PCT/CN2020/134218 CN2020134218W WO2021121061A1 WO 2021121061 A1 WO2021121061 A1 WO 2021121061A1 CN 2020134218 W CN2020134218 W CN 2020134218W WO 2021121061 A1 WO2021121061 A1 WO 2021121061A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
virtual object
posture
initial
spatial position
Prior art date
Application number
PCT/CN2020/134218
Other languages
French (fr)
Chinese (zh)
Inventor
李江亮
周硙
方俊
Original Assignee
北京外号信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京外号信息技术有限公司 filed Critical 北京外号信息技术有限公司
Publication of WO2021121061A1 publication Critical patent/WO2021121061A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/006Mixed reality

Definitions

  • the present invention relates to the field of augmented reality or virtual reality technology, and in particular to a method and electronic device for setting the spatial position of a virtual object.
  • Virtual Reality (Virtual Reality) technology is a computer simulation technology that can create and experience virtual worlds. It uses a computer to generate virtual objects (for example, icons, pictures, text, emoticons, virtual three-dimensional objects, three-dimensional scene models). , An animation, a video, etc.) simulation environment, so that users can be immersed in the environment.
  • Augmented Reality technology is a technology that ingeniously integrates virtual information with the real world. It can place computer-generated virtual objects on electronic devices (for example, mobile phones, tablets, smart glasses, AR glasses, and smart helmets). , Smart watches, etc.) in the real world observed, so that the virtual object and the real world are complementary to each other, realizing the "enhancement" of the real world.
  • a virtual object can be initially placed at a preset position or a selected position in the field of view of the mobile phone, and then the virtual object can be operated by the user on the mobile phone screen (for example, the operation of the virtual object Drag operation) to set the position of the virtual object in the three-dimensional space.
  • the operation on the mobile phone screen is an operation on a two-dimensional plane, which makes it difficult to accurately or conveniently set the position of the virtual object in the three-dimensional space.
  • One aspect of the present invention relates to a method for setting the spatial position of a virtual object, including: determining the virtual object whose spatial position is to be set; obtaining the initial spatial position of the virtual object; obtaining the position information of the electronic device, the position
  • the information includes: the initial position of the electronic device at the initial moment and the new position of the electronic device, and/or the position change information of the electronic device; and according to the initial spatial position of the virtual object, the electronic device
  • the initial position of the device and the new position of the electronic device are used to set the spatial position of the virtual object, or the virtual object’s position is set according to the initial spatial position of the virtual object and the position change information of the electronic device. Spatial location.
  • the method further includes: obtaining posture information of the electronic device, wherein the position and posture information of the electronic device includes: the initial position and posture of the electronic device at the initial moment and the position and posture of the electronic device New position and posture, and/or the position and posture change information of the electronic device; and wherein the setting the spatial position of the virtual object includes: according to the initial spatial position of the virtual object, the electronic device The initial position and posture of the electronic device and the new position and posture of the electronic device are used to set the spatial position of the virtual object, or set according to the initial spatial position of the virtual object and the position and posture change information of the electronic device The spatial position of the virtual object.
  • the position and posture information of the electronic device includes: the initial position and posture of the electronic device at the initial moment and the new position and posture of the electronic device, and/or the electronic device is at The initial position and posture at the initial time and the position and posture change information of the electronic device
  • the setting the spatial position of the virtual object includes: according to the initial spatial position of the virtual object and the position of the electronic device The initial position and posture, and the new position and posture of the electronic device, or the position and posture change information of the electronic device after the initial moment, set the spatial position of the virtual object.
  • the position and posture change information after the time setting the spatial position of the virtual object includes: determining the relative position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device. The position of the device; and according to the new position and posture of the electronic device and the position of the virtual object relative to the electronic device, the spatial position of the virtual object is set.
  • the position and posture change information after the time setting the spatial position of the virtual object includes: determining the relative position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device. The location of the device; determine the spatial location change information of the virtual object based on the location and posture change information of the electronic device and the location of the virtual object relative to the electronic device; and based on the initial spatial location of the virtual object And the spatial position change information of the virtual object, and the spatial position of the virtual object is set.
  • the position of the virtual object relative to the electronic device includes the direction of the virtual object relative to the electronic device and the distance or depth of the virtual object relative to the electronic device; and wherein, The method further includes changing the distance or depth of the virtual object relative to the electronic device based on input information from the user.
  • a selection icon is presented on the display medium of the electronic device
  • the determination of the virtual object whose spatial position is to be set includes: when a certain virtual object is presented at the position where the selection icon is located, And when the user's selection instruction is received, the virtual object is determined as the virtual object whose spatial position is to be set.
  • the position change information or posture change information of the electronic device is the position change information or posture change information of the electronic device after the initial moment.
  • Another aspect of the present invention relates to a storage medium in which a computer program is stored, and when the computer program is executed by a processor, it can be used to implement the above-mentioned method.
  • Another aspect of the present invention relates to an electronic device, which includes a processor and a memory, and a computer program is stored in the memory.
  • the computer program When the computer program is executed by the processor, the computer program can be used to implement the above-mentioned method.
  • the position of the virtual object in the three-dimensional space can be adjusted correspondingly according to the position or pose change of the electronic device itself, which overcomes the use of a two-dimensional plane (such as a mobile phone screen) in the prior art.
  • the limitation and inconvenience of the operation therefore, enable the user to conveniently and quickly set the spatial position of the virtual object.
  • Fig. 1 shows a method for setting the spatial position of a virtual object through an electronic device according to an embodiment of the present application
  • Fig. 2 shows a schematic diagram of coordinate transformation according to an embodiment
  • Figure 3 shows a hypothetical rigid connection established between the virtual object and the electronic device
  • Figure 4 shows that the position of the virtual object changes when the electronic device is shifted
  • FIG. 5 shows that the position of the virtual object changes when the electronic device further rotates
  • Fig. 6 shows a method for setting the spatial position of a virtual object through an electronic device according to another embodiment of the present application
  • Fig. 7 shows a method for setting the spatial position of a virtual object through an electronic device according to still another embodiment of the present application.
  • the electronic device in this application may be, for example, a mobile phone, a tablet computer, smart glasses, AR/VR glasses, AR/VR helmets, smart watches, etc., which have an image display medium (for example, a screen), and optionally may have image capture Device (for example, camera).
  • a mobile phone is taken as an example for description, but it is understandable that this is not a limitation.
  • an augmented reality application is used as an example for description, but it can be understood that this is not a limitation, and the solution of the present application can also be applied to a virtual reality application.
  • Fig. 1 shows a method for setting the spatial position of a virtual object through an electronic device according to an embodiment of the present application, which includes the following steps:
  • Step 101 Determine the virtual object whose spatial position is to be set.
  • the user of the electronic device may select a certain virtual object presented on the display medium of the electronic device in order to set its position in the space.
  • One or more virtual objects that already exist in the space can be presented on the display medium of the electronic device according to the position and posture information of the electronic device in the space (collectively referred to as pose information), and the one or more virtual objects can have corresponding Spatial location.
  • pose information the position and posture information of the electronic device in the space
  • the user can select a certain virtual object presented on its display medium by operating the electronic device.
  • the user can directly operate (for example, click or double-click the virtual object) on a virtual object presented on the display medium of the electronic device to determine it as the virtual object whose spatial position is to be set.
  • the user may first operate on a virtual object presented on the display medium of the electronic device to select the virtual object, and then perform other operations (for example, click on a virtual button presented on the display medium of the electronic device). , Or press a physical button on the electronic device) to determine the virtual object as the virtual object whose spatial position is to be set.
  • a selection icon for example, circle, cross star, etc.
  • the user may adjust the position or posture of the electronic device to make certain A virtual object is presented at the location of the selection icon.
  • the user performs a corresponding operation on the electronic device (for example, clicks on a virtual button presented on the display medium of the electronic device, or presses a physical button on the electronic device). Press the key) to determine the virtual object as the virtual object whose spatial position is to be set.
  • the virtual object that the user has just added to the space may be determined as the virtual object whose space position is to be set.
  • the virtual object may have a preset or random position relative to the electronic device.
  • Step 102 Obtain the initial spatial position of the virtual object.
  • the initial spatial position of the virtual object may be its position in a certain coordinate system in space (for example, coordinates), and the spatial coordinate system may be, for example, a place coordinate system (for example, established for a certain room, building, park, etc.) Coordinate system) or world coordinate system.
  • the information related to the initial spatial position of the virtual object may be stored in the electronic device, or may be stored in other devices that can be accessed by the electronic device, such as a server.
  • Step 103 Obtain the initial position and posture of the electronic device at the initial moment.
  • the position and posture information (position and posture information) of the electronic device in space can be determined in various existing and possible ways in the future.
  • the electronic device can visually recognize the surrounding scene through the image acquisition device on it to determine its pose information in space.
  • the electronic device can also determine its pose information in the space by interacting with landmarks (for example, visual landmarks or wireless signal landmarks) arranged in the space.
  • landmarks for example, visual landmarks or wireless signal landmarks
  • the electronic device can also use various built-in sensors (for example, a magnetic sensor, a direction sensor, a gravity sensor, a gyroscope, an acceleration sensor, a satellite positioning signal receiver, etc.) to measure or track its position and attitude information.
  • the initial time may be, for example, the time at which the virtual object whose spatial position is to be set is determined, but it may also be other time after this time.
  • the user can perform a certain operation through the electronic device to indicate the initial moment. After the initial moment, changes in the position or posture of the electronic device will affect the spatial position of the virtual object.
  • the user may determine the virtual object whose spatial position is to be set through an operation, and may use the execution time of the operation as the initial time.
  • the user can determine the virtual object whose spatial position is to be set through one operation, and then the user can perform another operation (for example, pressing a virtual button or physical button of the electronic device) to instruct to start setting or The spatial position of the virtual object is adjusted, and the execution time of the other operation can be used as the initial time.
  • another operation for example, pressing a virtual button or physical button of the electronic device
  • Step 104 Determine the position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device.
  • the spatial position of the virtual object may be represented by the coordinates of the virtual object in the spatial coordinate system. It is possible to set an electronic device coordinate system with its origin as the electronic device itself, and the electronic device coordinate system translates and rotates in the space coordinate system with the translation and rotation of the electronic device.
  • the position and posture of the electronic device or the electronic device coordinate system in the space coordinate system can be represented by the rotation matrix R and the displacement vector t, where the rotation matrix R is the rotation matrix between the space coordinate system and the electronic device coordinate system, which can be used
  • the displacement vector t can be used to represent the origin of the electronic device coordinate system or the position information of the electronic device in the space coordinate system.
  • FIG. 2 shows a schematic diagram of coordinate transformation according to an embodiment, which shows a virtual object 201, an electronic device 202, a spatial coordinate system with Oa as the coordinate origin, and an electronic device coordinate system with Ob or the electronic device 202 as the coordinate origin.
  • the virtual object 201 has position coordinates in a spatial coordinate system. According to the position and posture of the electronic device 202 in the space coordinate system, the rotation matrix R and the displacement vector t between the space coordinate system and the electronic device coordinate system can be obtained.
  • the position coordinates of the virtual object 201 in the electronic device coordinate system can be obtained, that is, virtual The position information of the object 201 relative to the electronic device 202.
  • the use of the rotation matrix R and the displacement vector t to perform coordinate system transformation is an existing technology in this field, and will not be repeated here.
  • FIG. 3 shows that the position of the virtual object 201 changes when the electronic device 202 is translated. As shown in FIG.
  • FIG. 5 shows that the position of the virtual object 201 changes when the electronic device 202 rotates further.
  • the virtual object 201 will undergo a corresponding position change in the space coordinate system. The position change depends on the specific rotation mode of the electronic device 202 and The position of the virtual object relative to the electronic device.
  • Step 105 Obtain the new position and posture of the electronic device after the position or posture of the electronic device is changed.
  • the new position and posture information of the electronic device in the spatial coordinate system can be represented by the rotation matrix R and the displacement vector t between the space coordinate system and the new electronic device coordinate system.
  • Step 106 Set the spatial position of the virtual object according to the new position and posture of the electronic device and the position of the virtual object relative to the electronic device.
  • coordinate transformation can be performed to obtain the current position coordinates of the virtual object 201 in the space coordinate system, and the current position coordinates can be set as the new space position of the virtual object 201.
  • the new spatial position set for the virtual object 201 can be recorded or stored.
  • the user can instruct to start setting the spatial position of the virtual object by performing a certain operation on the electronic device (for example, pressing a certain virtual button or physical button of the electronic device), so that the spatial position of the virtual object It is configured to change as the position or posture of the electronic device changes.
  • a certain operation on the electronic device for example, pressing a certain virtual button or physical button of the electronic device
  • the user can perform another operation on the electronic device to indicate the completion of the setting operation, and can correspondingly cancel the selection of the virtual object or cancel the assumption between the virtual object and the electronic device Rigid connection, so that when the position or posture of the electronic device continues to change, the spatial position of the virtual object will not be changed.
  • the user can instruct to start setting the spatial position of the virtual object by pressing a certain virtual key or physical key of the electronic device, and then the user can keep pressing the key and move the electronic device.
  • the button can be released to complete the setting of the spatial position of the virtual object.
  • the spatial position of the virtual object may be configured to no longer change with the position or posture of the electronic device.
  • the virtual object can be presented on the display medium of the electronic device, which can help the user to more intuitively set the spatial position of the virtual object.
  • the virtual object since the position of the virtual object relative to the electronic device always remains unchanged, the virtual object can always be presented at the same position on the display medium of the electronic device during the process of changing the position or posture of the electronic device .
  • the virtual object in space in the process of changing the position and posture of the electronic device, can be updated according to the new position and posture of the electronic device in the spatial coordinate system and the position of the virtual object relative to the electronic device.
  • the position in the coordinate system can then be used to present the virtual object at the corresponding position on the display medium of the electronic device according to the position and posture of the electronic device in the space coordinate system and the position of the virtual object in the space coordinate system. It can be understood that since the position of the virtual object relative to the electronic device is always the same, the virtual object will always be presented at the same position on the display medium of the electronic device.
  • the display medium of the electronic device may present real-world images of the space collected by the image acquisition device of the electronic device, thereby realizing augmented reality applications.
  • the display medium of the electronic device may not present the real-scene image of the space collected by the image acquisition device of the electronic device, so as to realize the virtual reality application.
  • the electronic equipment may not have image acquisition devices.
  • the spatial position of the virtual object is set according to the new position and posture of the electronic device and the position of the virtual object relative to the electronic device.
  • the information can also be changed according to the position and posture of the electronic device.
  • the position of the virtual object relative to the electronic device the spatial position change information of the virtual object is determined, and the spatial position of the virtual object is set.
  • Fig. 6 shows a method for setting the spatial position of a virtual object through an electronic device according to another embodiment of the present application, which includes the following steps (some of the steps are similar to the steps shown in Fig. 1 and will not be explained in detail here. ):
  • Step 601 Determine the virtual object whose spatial position is to be set.
  • Step 602 Obtain the initial spatial position of the virtual object.
  • Step 603 Obtain the initial position and posture of the electronic device at the initial moment.
  • Step 604 Determine the position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device.
  • the position of the virtual object relative to the electronic device may be represented by the position coordinates of the virtual object in the coordinate system of the electronic device.
  • Step 605 Obtain position and posture change information of the electronic device after the initial time.
  • the electronic device can also use various built-in sensors (for example, magnetic sensors, direction sensors, gravity sensors, gyroscopes, acceleration sensors, satellite positioning signal receivers, etc.) through, for example, inertial navigation, visual odometry, SLAM, VSLAM, SFM, etc. to measure or track its position change and/or posture change.
  • various built-in sensors for example, magnetic sensors, direction sensors, gravity sensors, gyroscopes, acceleration sensors, satellite positioning signal receivers, etc.
  • inertial navigation for example, visual odometry, SLAM, VSLAM, SFM, etc.
  • Step 606 Determine the spatial position change information of the virtual object according to the position and posture change information of the electronic device and the position of the virtual object relative to the electronic device.
  • the translation change and the rotation change experienced by the electronic device can be determined.
  • the translation of the electronic device can cause the same translation of the spatial position of the virtual object, as shown in FIG. 4.
  • the rotation of the electronic device may cause the spatial position of the virtual object to undergo a spatial position change corresponding to the rotation. As shown in FIG. 5, the spatial position change depends on the specific rotation mode of the electronic device and the position of the virtual object relative to the electronic device.
  • Step 607 Set the spatial position of the virtual object according to the initial spatial position of the virtual object and the spatial position change information of the virtual object.
  • the current spatial position of the virtual object can be calculated.
  • the current spatial position of the virtual object can be set as the new spatial position of the virtual object, and can be recorded or stored.
  • a method for setting the spatial position of a virtual object which includes: determining the virtual object whose spatial position is to be set; and obtaining the initial spatial position of the virtual object; Obtain the initial position and posture of the electronic device at the initial moment; obtain the new position and posture of the electronic device or the position and posture change information of the electronic device after the initial moment; and according to the initial space of the virtual object.
  • a hypothetical "rigid connection" is established between the electronic device and the virtual object, but it should be emphasized that this is not essential to the present invention. limit.
  • any other desired method or rule can be used according to the new position or pose of the electronic device or the position or pose change information of the electronic device. To set the spatial position of the virtual object.
  • the position of the virtual object relative to the electronic device can be determined according to the initial spatial position of the virtual object and the initial position and posture of the electronic device, which includes the direction of the virtual object relative to the electronic device and the virtual object relative to the electronic device.
  • the distance or depth In the process of adjusting or setting the spatial position of the virtual object, the user of the electronic device can provide input information through the operating elements of the electronic device to change or adjust the distance or depth of the virtual object relative to the electronic device.
  • the virtual object is relative to the electronic device.
  • the direction of the electronic device remains unchanged. That is, when the direction of the "rigid connection" shown by the dashed line in FIG. 3 with respect to the electronic device remains unchanged, the length of the "rigid connection" is changed.
  • the operating element of the electronic device may be a virtual operating element presented on the display medium of the electronic device, or may be a physical operating element on the electronic device.
  • the operating element may be a sliding bar presented on the display medium of the electronic device. By dragging the slider of the sliding bar, the distance or depth of the virtual object relative to the electronic device can be changed.
  • the distance of the virtual object relative to the electronic device may refer to the linear distance between the virtual object and the electronic device.
  • the depth of the virtual object relative to the electronic device may refer to, for example, the vertical distance of the virtual object relative to the plane where the electronic device is located or the imaging plane of the image capture device of the electronic device.
  • FIG. 7 shows a method for setting the spatial position of a virtual object through an electronic device according to an embodiment of the present application, which changes the spatial position of the virtual object according to the position or position change of the electronic device, and includes the following steps:
  • Step 701 Determine the virtual object whose spatial position is to be set
  • Step 702 Obtain the initial spatial position of the virtual object
  • Step 703 Obtain location information of the electronic device, where the location information includes: the initial location of the electronic device at the initial moment and the new location of the electronic device, and/or the location change information of the electronic device; and
  • Step 704 Set the spatial position of the virtual object according to the initial spatial position of the virtual object, the initial position of the electronic device, and the new position of the electronic device, or according to the initial spatial position of the virtual object And the position change information of the electronic device to set the spatial position of the virtual object.
  • the position change amount that is, the displacement amount
  • the position change amount of the electronic device is the same as the position change amount of the virtual object.
  • a zoom ratio between the position change amount of the electronic device and the position change amount of the virtual object can be set.
  • the position change amount of the electronic device can be made larger than the position change amount of the virtual object. This situation is suitable for fine adjustment of the spatial position of the virtual object through the electronic device. In another case, the position change of the electronic device can be made smaller than the position change of the virtual object. This situation is suitable for greatly adjusting the spatial position of the virtual object through a small displacement change of the electronic device.
  • the present invention can be implemented in the form of a computer program.
  • the computer program can be stored in various storage media (for example, a hard disk, an optical disk, a flash memory, etc.), and when the computer program is executed by a processor, it can be used to implement the method of the present invention.
  • the present invention may be implemented in the form of an electronic device.
  • the electronic device includes a processor and a memory, and a computer program is stored in the memory.
  • the computer program When the computer program is executed by the processor, it can be used to implement the method of the present invention.
  • references herein to "each embodiment”, “some embodiments”, “one embodiment”, or “an embodiment”, etc. refer to the specific features, structures, or properties described in connection with the embodiments that are included in In at least one embodiment. Therefore, the appearances of the phrases “in various embodiments”, “in some embodiments”, “in one embodiment”, or “in an embodiment” in various places throughout this document do not necessarily refer to the same implementation example.
  • specific features, structures, or properties can be combined in any suitable manner in one or more embodiments. Therefore, a specific feature, structure, or property shown or described in combination with one embodiment can be combined in whole or in part with the feature, structure, or property of one or more other embodiments without limitation, as long as the combination is not incompatible. Logical or not working.

Landscapes

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

Abstract

A method for configuring a spatial position of a virtual object, and an electronic device. The method comprises: determining a virtual object to be configured with a spatial position; obtaining the initial spatial position of the virtual object; obtaining position information of an electronic device, wherein the position information comprises: the initial position of the electronic device at an initial moment and a new position of the electronic device, and/or position change information of the electronic device; and configuring a spatial position of the virtual object according to the initial spatial position of the virtual object, the initial position of the electronic device, and the new position of the electronic device, or according to the initial spatial position of the virtual object and the position change information of the electronic device.

Description

用于设置虚拟对象的空间位置的方法和电子设备Method and electronic device for setting the spatial position of virtual objects 技术领域Technical field
本发明涉及增强现实或虚拟现实技术领域,尤其涉及一种用于设置虚拟对象的空间位置的方法和电子设备。The present invention relates to the field of augmented reality or virtual reality technology, and in particular to a method and electronic device for setting the spatial position of a virtual object.
背景技术Background technique
本部分的陈述仅仅是为了提供与本申请的技术方案有关的背景信息,以帮助理解,其对于本申请的技术方案而言并不一定构成现有技术。The statements in this section are only for providing background information related to the technical solutions of the present application to help understanding, and they do not necessarily constitute prior art for the technical solutions of the present application.
虚拟现实(Virtual Reality)技术是一种可以创建和体验虚拟世界的计算机仿真技术,它利用计算机生成一种包含虚拟对象(例如,图标、图片、文字、表情符号、虚拟的三维物体、三维场景模型、一段动画、一段视频、等等)的模拟环境,使用户能够沉浸到该环境中。增强现实(Augmented Reality)技术是一种将虚拟信息与真实世界巧妙融合的技术,其可以将计算机生成的虚拟对象放置到通过电子设备(例如,手机、平板电脑、智能眼镜、AR眼镜、智能头盔、智能手表等)观察到的真实世界中,从而使得虚拟对象与真实世界互为补充,实现对真实世界的“增强”。Virtual Reality (Virtual Reality) technology is a computer simulation technology that can create and experience virtual worlds. It uses a computer to generate virtual objects (for example, icons, pictures, text, emoticons, virtual three-dimensional objects, three-dimensional scene models). , An animation, a video, etc.) simulation environment, so that users can be immersed in the environment. Augmented Reality technology is a technology that ingeniously integrates virtual information with the real world. It can place computer-generated virtual objects on electronic devices (for example, mobile phones, tablets, smart glasses, AR glasses, and smart helmets). , Smart watches, etc.) in the real world observed, so that the virtual object and the real world are complementary to each other, realizing the "enhancement" of the real world.
为了实现良好的虚拟现实或增强现实效果,经常需要将虚拟对象放置到空间中的准确位置并且经常需要调整虚拟对象的位置。在现有技术的一种方案中,可以在初始时在手机的视野中的预设位置或者选中位置处放置虚拟对象,然后通过用户在手机屏幕上对虚拟对象的操作(例如,对虚拟对象的拖拽操作)来设置虚拟对象在三维空间中的位置。然而,手机屏幕上的操作是在二维平面上的操作,这使得其难以准确地或者方便地设置虚拟对象在三维空间中的位置。In order to achieve a good virtual reality or augmented reality effect, it is often necessary to place the virtual object at an accurate position in the space and often need to adjust the position of the virtual object. In a solution in the prior art, a virtual object can be initially placed at a preset position or a selected position in the field of view of the mobile phone, and then the virtual object can be operated by the user on the mobile phone screen (for example, the operation of the virtual object Drag operation) to set the position of the virtual object in the three-dimensional space. However, the operation on the mobile phone screen is an operation on a two-dimensional plane, which makes it difficult to accurately or conveniently set the position of the virtual object in the three-dimensional space.
因此,需要一种能够方便、快捷地设置虚拟对象的空间位置的方法。Therefore, there is a need for a method that can conveniently and quickly set the spatial position of a virtual object.
发明内容Summary of the invention
本发明的一个方面涉及一种用于设置虚拟对象的空间位置的方法,包 括:确定要设置空间位置的虚拟对象;获得所述虚拟对象的初始空间位置;获得电子设备的位置信息,所述位置信息包括:所述电子设备在初始时刻的初始位置以及所述电子设备的新的位置,和/或,所述电子设备的位置变化信息;以及根据所述虚拟对象的初始空间位置、所述电子设备的初始位置、以及所述电子设备的新的位置来设置所述虚拟对象的空间位置,或者根据所述虚拟对象的初始空间位置以及所述电子设备的位置变化信息来设置所述虚拟对象的空间位置。One aspect of the present invention relates to a method for setting the spatial position of a virtual object, including: determining the virtual object whose spatial position is to be set; obtaining the initial spatial position of the virtual object; obtaining the position information of the electronic device, the position The information includes: the initial position of the electronic device at the initial moment and the new position of the electronic device, and/or the position change information of the electronic device; and according to the initial spatial position of the virtual object, the electronic device The initial position of the device and the new position of the electronic device are used to set the spatial position of the virtual object, or the virtual object’s position is set according to the initial spatial position of the virtual object and the position change information of the electronic device. Spatial location.
可选地,所述方法还包括:获得所述电子设备的姿态信息,其中,所述电子设备的位置和姿态信息包括:所述电子设备在初始时刻的初始位置和姿态以及所述电子设备的新的位置和姿态,和/或,所述电子设备的位置和姿态变化信息;以及其中,所述设置所述虚拟对象的空间位置包括:根据所述虚拟对象的初始空间位置、所述电子设备的初始位置和姿态、以及所述电子设备的新的位置和姿态来设置所述虚拟对象的空间位置,或者根据所述虚拟对象的初始空间位置以及所述电子设备的位置和姿态变化信息来设置所述虚拟对象的空间位置。Optionally, the method further includes: obtaining posture information of the electronic device, wherein the position and posture information of the electronic device includes: the initial position and posture of the electronic device at the initial moment and the position and posture of the electronic device New position and posture, and/or the position and posture change information of the electronic device; and wherein the setting the spatial position of the virtual object includes: according to the initial spatial position of the virtual object, the electronic device The initial position and posture of the electronic device and the new position and posture of the electronic device are used to set the spatial position of the virtual object, or set according to the initial spatial position of the virtual object and the position and posture change information of the electronic device The spatial position of the virtual object.
可选地,其中,所述电子设备的位置和姿态信息包括:所述电子设备在初始时刻的初始位置和姿态以及所述电子设备的新的位置和姿态,和/或,所述电子设备在初始时刻的初始位置和姿态以及所述电子设备的位置和姿态变化信息,以及其中,所述设置所述虚拟对象的空间位置包括:根据所述虚拟对象的初始空间位置、所述电子设备的所述初始位置和姿态、以及所述电子设备的新的位置和姿态或者所述电子设备在所述初始时刻之后的位置和姿态变化信息,设置所述虚拟对象的空间位置。Optionally, wherein the position and posture information of the electronic device includes: the initial position and posture of the electronic device at the initial moment and the new position and posture of the electronic device, and/or the electronic device is at The initial position and posture at the initial time and the position and posture change information of the electronic device, and wherein the setting the spatial position of the virtual object includes: according to the initial spatial position of the virtual object and the position of the electronic device The initial position and posture, and the new position and posture of the electronic device, or the position and posture change information of the electronic device after the initial moment, set the spatial position of the virtual object.
可选地,其中,所述根据所述虚拟对象的初始空间位置、所述电子设备的所述初始位置和姿态、以及所述电子设备的新的位置和姿态或者所述电子设备在所述初始时刻之后的位置和姿态变化信息设置所述虚拟对象的空间位置包括:根据所述虚拟对象的初始空间位置以及所述电子设备的所述初始位置和姿态,确定所述虚拟对象相对于所述电子设备的位置;以及根据所述电子设备的新的位置和姿态以及所述虚拟对象相对于所述电子设备的位置,设置所述虚拟对象的空间位置。Optionally, wherein, according to the initial spatial position of the virtual object, the initial position and posture of the electronic device, and the new position and posture of the electronic device or the electronic device in the initial The position and posture change information after the time setting the spatial position of the virtual object includes: determining the relative position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device. The position of the device; and according to the new position and posture of the electronic device and the position of the virtual object relative to the electronic device, the spatial position of the virtual object is set.
可选地,其中,所述根据所述虚拟对象的初始空间位置、所述电子设 备的所述初始位置和姿态、以及所述电子设备的新的位置和姿态或者所述电子设备在所述初始时刻之后的位置和姿态变化信息设置所述虚拟对象的空间位置包括:根据所述虚拟对象的初始空间位置以及所述电子设备的所述初始位置和姿态,确定所述虚拟对象相对于所述电子设备的位置;根据所述电子设备的位置和姿态变化信息以及所述虚拟对象相对于所述电子设备的位置,确定所述虚拟对象的空间位置变化信息;以及根据所述虚拟对象的初始空间位置以及所述虚拟对象的空间位置变化信息,设置所述虚拟对象的空间位置。Optionally, wherein, according to the initial spatial position of the virtual object, the initial position and posture of the electronic device, and the new position and posture of the electronic device or the electronic device in the initial The position and posture change information after the time setting the spatial position of the virtual object includes: determining the relative position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device. The location of the device; determine the spatial location change information of the virtual object based on the location and posture change information of the electronic device and the location of the virtual object relative to the electronic device; and based on the initial spatial location of the virtual object And the spatial position change information of the virtual object, and the spatial position of the virtual object is set.
可选地,其中,所述虚拟对象相对于所述电子设备的位置始终保持不变。Optionally, wherein the position of the virtual object relative to the electronic device always remains unchanged.
可选地,其中,所述虚拟对象相对于所述电子设备的位置包括所述虚拟对象相对于所述电子设备的方向以及所述虚拟对象相对于所述电子设备的距离或深度;以及其中,所述方法还包括:基于来自用户的输入信息改变所述虚拟对象相对于所述电子设备的距离或深度。Optionally, wherein the position of the virtual object relative to the electronic device includes the direction of the virtual object relative to the electronic device and the distance or depth of the virtual object relative to the electronic device; and wherein, The method further includes changing the distance or depth of the virtual object relative to the electronic device based on input information from the user.
可选地,其中,在所述电子设备的显示媒介上呈现有选择图标,以及其中,所述确定要设置空间位置的虚拟对象包括:当某个虚拟对象呈现于所述选择图标所在的位置,并且接收到用户的选择指示时,将所述虚拟对象确定为要设置空间位置的虚拟对象。Optionally, wherein a selection icon is presented on the display medium of the electronic device, and wherein the determination of the virtual object whose spatial position is to be set includes: when a certain virtual object is presented at the position where the selection icon is located, And when the user's selection instruction is received, the virtual object is determined as the virtual object whose spatial position is to be set.
可选地,其中,所述电子设备的位置变化信息或姿态变化信息是所述电子设备在所述初始时刻之后的位置变化信息或姿态变化信息。Optionally, wherein the position change information or posture change information of the electronic device is the position change information or posture change information of the electronic device after the initial moment.
本发明的另一个方面涉及一种存储介质,其中存储有计算机程序,在所述计算机程序被处理器执行时,能够用于实现上述的方法。Another aspect of the present invention relates to a storage medium in which a computer program is stored, and when the computer program is executed by a processor, it can be used to implement the above-mentioned method.
本发明的再一个方面涉及一种电子设备,其包括处理器和存储器,所述存储器中存储有计算机程序,在所述计算机程序被处理器执行时,能够用于实现上述的方法。Another aspect of the present invention relates to an electronic device, which includes a processor and a memory, and a computer program is stored in the memory. When the computer program is executed by the processor, the computer program can be used to implement the above-mentioned method.
通过采用本发明的方案,可以根据电子设备本身在三维空间中的位置或位姿变化来相应地调整虚拟对象在三维空间中的位置,克服了现有技术中通过二维平面(例如手机屏幕)进行操作的局限性和不便性,因此使得用户能够方便、快捷地设置虚拟对象的空间位置。By adopting the solution of the present invention, the position of the virtual object in the three-dimensional space can be adjusted correspondingly according to the position or pose change of the electronic device itself, which overcomes the use of a two-dimensional plane (such as a mobile phone screen) in the prior art. The limitation and inconvenience of the operation, therefore, enable the user to conveniently and quickly set the spatial position of the virtual object.
附图说明Description of the drawings
以下参照附图对本发明的实施例作进一步说明,其中:The embodiments of the present invention will be further described below with reference to the accompanying drawings, in which:
图1示出了根据本申请的一个实施例的用于通过电子设备设置虚拟对象的空间位置的方法;Fig. 1 shows a method for setting the spatial position of a virtual object through an electronic device according to an embodiment of the present application;
图2示出了根据一个实施例的坐标变换示意图;Fig. 2 shows a schematic diagram of coordinate transformation according to an embodiment;
图3示出了在虚拟对象和电子设备之间建立的假设的刚性连接;Figure 3 shows a hypothetical rigid connection established between the virtual object and the electronic device;
图4示出了当电子设备发生平移时虚拟对象的位置改变;Figure 4 shows that the position of the virtual object changes when the electronic device is shifted;
图5示出了当电子设备进一步发生旋转时虚拟对象的位置改变;FIG. 5 shows that the position of the virtual object changes when the electronic device further rotates;
图6示出了根据本申请的另一个实施例的用于通过电子设备设置虚拟对象的空间位置的方法;Fig. 6 shows a method for setting the spatial position of a virtual object through an electronic device according to another embodiment of the present application;
图7示出了根据本申请的再一个实施例的用于通过电子设备设置虚拟对象的空间位置的方法。Fig. 7 shows a method for setting the spatial position of a virtual object through an electronic device according to still another embodiment of the present application.
具体实施方式Detailed ways
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图通过具体实施例对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限制本发明。In order to make the objectives, technical solutions, and advantages of the present invention clearer, the following further describes the present invention in detail through specific embodiments with reference to the accompanying drawings. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention.
本申请中的电子设备例如可以是手机、平板电脑、智能眼镜、AR/VR眼镜、AR/VR头盔、智能手表等,其具有图像显示媒介(例如,屏幕),并且可选地可以具有图像采集器件(例如,摄像头)。在本申请的一些实施例中以手机为例进行了描述,但可以理解,这并非限制。在本申请的一些实施例中以增强现实应用为例进行了描述,但可以理解,这并非限制,本申请的方案也可以适用于虚拟现实应用。The electronic device in this application may be, for example, a mobile phone, a tablet computer, smart glasses, AR/VR glasses, AR/VR helmets, smart watches, etc., which have an image display medium (for example, a screen), and optionally may have image capture Device (for example, camera). In some embodiments of the present application, a mobile phone is taken as an example for description, but it is understandable that this is not a limitation. In some embodiments of the present application, an augmented reality application is used as an example for description, but it can be understood that this is not a limitation, and the solution of the present application can also be applied to a virtual reality application.
图1示出了根据本申请的一个实施例的用于通过电子设备设置虚拟对象的空间位置的方法,其包括如下步骤:Fig. 1 shows a method for setting the spatial position of a virtual object through an electronic device according to an embodiment of the present application, which includes the following steps:
步骤101:确定要设置空间位置的虚拟对象。Step 101: Determine the virtual object whose spatial position is to be set.
在一个实施例中,电子设备的用户可以选择在电子设备的显示媒介上呈现的某个虚拟对象以便设置其在空间中的位置。可以根据电子设备在空间中的位置和姿态信息(统称为位姿信息)在电子设备的显示媒介上呈现空间中已经存在的一个或多个虚拟对象,该一个或多个虚拟对象可以具有相应的空间位置。在增强现实应用中,还可以在电子设备的显示媒介上呈 现通过电子设备的图像采集器件采集到的空间的实景图像,并且可以将虚拟对象与该实景图像一起呈现在电子设备的显示媒介上,从而实现增强现实效果。用户可以通过对电子设备进行操作来选择在其显示媒介上呈现的某个虚拟对象。在一个实施例中,用户可以直接对电子设备的显示媒介上呈现的某个虚拟对象进行操作(例如,单击或双击该虚拟对象)来将其确定为要设置空间位置的虚拟对象。在一个实施例中,用户可以先对电子设备的显示媒介上呈现的某个虚拟对象进行操作以选中该虚拟对象,然后通过其他操作(例如,点击电子设备的显示媒介上呈现的某个虚拟按键,或者按压电子设备上的某个物理按键)来将该虚拟对象确定为要设置空间位置的虚拟对象。在一个实施例中,可以在电子设备的显示媒介上呈现一个用于标识选择区域或者选择点的选择图标(例如,圆环、十字星等),用户可以调整电子设备的位置或姿态以使得某个虚拟对象呈现于该选择图标所在的位置,此时,如果用户对电子设备执行相应的操作(例如,点击电子设备的显示媒介上呈现的某个虚拟按键,或者按压电子设备上的某个物理按键),可以将该虚拟对象确定为要设置空间位置的虚拟对象。In one embodiment, the user of the electronic device may select a certain virtual object presented on the display medium of the electronic device in order to set its position in the space. One or more virtual objects that already exist in the space can be presented on the display medium of the electronic device according to the position and posture information of the electronic device in the space (collectively referred to as pose information), and the one or more virtual objects can have corresponding Spatial location. In augmented reality applications, it is also possible to present the real-scene image of the space collected by the image acquisition device of the electronic device on the display medium of the electronic device, and to present the virtual object together with the real-scene image on the display medium of the electronic device, In order to achieve augmented reality effects. The user can select a certain virtual object presented on its display medium by operating the electronic device. In an embodiment, the user can directly operate (for example, click or double-click the virtual object) on a virtual object presented on the display medium of the electronic device to determine it as the virtual object whose spatial position is to be set. In one embodiment, the user may first operate on a virtual object presented on the display medium of the electronic device to select the virtual object, and then perform other operations (for example, click on a virtual button presented on the display medium of the electronic device). , Or press a physical button on the electronic device) to determine the virtual object as the virtual object whose spatial position is to be set. In one embodiment, a selection icon (for example, circle, cross star, etc.) for identifying the selection area or selection point may be presented on the display medium of the electronic device, and the user may adjust the position or posture of the electronic device to make certain A virtual object is presented at the location of the selection icon. At this time, if the user performs a corresponding operation on the electronic device (for example, clicks on a virtual button presented on the display medium of the electronic device, or presses a physical button on the electronic device). Press the key) to determine the virtual object as the virtual object whose spatial position is to be set.
在一个实施例中,可以将用户刚刚添加到空间中的虚拟对象确定为要设置空间位置的虚拟对象。当用户将某个虚拟对象添加到空间中时,该虚拟对象可以具有相对于电子设备的预设的或者随机的位置。In one embodiment, the virtual object that the user has just added to the space may be determined as the virtual object whose space position is to be set. When the user adds a certain virtual object to the space, the virtual object may have a preset or random position relative to the electronic device.
步骤102:获得所述虚拟对象的初始空间位置。Step 102: Obtain the initial spatial position of the virtual object.
虚拟对象的初始空间位置可以是其在空间的某一坐标系中的位置(例如,坐标),该空间坐标系例如可以是场所坐标系(例如,针对某个房间、建筑物、园区等建立的坐标系)或者世界坐标系。与虚拟对象的初始空间位置有关的信息可以存储于电子设备,也可以存储于能够被电子设备访问的其他装置,例如服务器。The initial spatial position of the virtual object may be its position in a certain coordinate system in space (for example, coordinates), and the spatial coordinate system may be, for example, a place coordinate system (for example, established for a certain room, building, park, etc.) Coordinate system) or world coordinate system. The information related to the initial spatial position of the virtual object may be stored in the electronic device, or may be stored in other devices that can be accessed by the electronic device, such as a server.
步骤103:获得电子设备在初始时刻的初始位置和姿态。Step 103: Obtain the initial position and posture of the electronic device at the initial moment.
可以以现有的以及未来可能出现的各种方式来确定电子设备在空间中的位置和姿态信息(位姿信息)。例如,电子设备可以通过其上的图像采集器件对周围场景进行视觉识别来确定其在空间中的位姿信息。电子设备也可以通过与空间中布置的标志点(例如,视觉标志点或者无线信号标志点)进行交互来确定其在该空间中的位姿信息。电子设备还可以使用内置的各种传感器(例如,磁力传感器、方向传感器、重力传感器、陀螺仪、加速度传感器、卫星定位信号接收器等)来测量或跟踪其位姿信息。The position and posture information (position and posture information) of the electronic device in space can be determined in various existing and possible ways in the future. For example, the electronic device can visually recognize the surrounding scene through the image acquisition device on it to determine its pose information in space. The electronic device can also determine its pose information in the space by interacting with landmarks (for example, visual landmarks or wireless signal landmarks) arranged in the space. The electronic device can also use various built-in sensors (for example, a magnetic sensor, a direction sensor, a gravity sensor, a gyroscope, an acceleration sensor, a satellite positioning signal receiver, etc.) to measure or track its position and attitude information.
所述初始时刻例如可以是确定要设置空间位置的虚拟对象的时刻,但也可以是在该时刻之后的其他时刻。例如,在确定要设置空间位置的虚拟对象之后,用户可以通过电子设备执行某一操作来指示初始时刻。在初始时刻之后,电子设备的位置或姿态变化会对虚拟对象的空间位置产生影响。在一个实施例中,用户可以通过一个操作确定要设置空间位置的虚拟对象,并可以将该操作的执行时刻作为初始时刻。在另一个实施例中,用户可以通过一个操作确定要设置空间位置的虚拟对象,之后,用户可以执行另一操作(例如,按下电子设备的某个虚拟按键或物理按键)来指示开始设置或调整虚拟对象的空间位置,并可以将该另一操作的执行时刻作为初始时刻。The initial time may be, for example, the time at which the virtual object whose spatial position is to be set is determined, but it may also be other time after this time. For example, after determining the virtual object whose spatial position is to be set, the user can perform a certain operation through the electronic device to indicate the initial moment. After the initial moment, changes in the position or posture of the electronic device will affect the spatial position of the virtual object. In an embodiment, the user may determine the virtual object whose spatial position is to be set through an operation, and may use the execution time of the operation as the initial time. In another embodiment, the user can determine the virtual object whose spatial position is to be set through one operation, and then the user can perform another operation (for example, pressing a virtual button or physical button of the electronic device) to instruct to start setting or The spatial position of the virtual object is adjusted, and the execution time of the other operation can be used as the initial time.
步骤104:根据所述虚拟对象的初始空间位置以及所述电子设备的初始位置和姿态,确定所述虚拟对象相对于所述电子设备的位置。Step 104: Determine the position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device.
在一个实施例中,虚拟对象的空间位置可以由该虚拟对象在空间坐标系中的坐标来表示。可以为电子设备本身设置一个以其为原点的电子设备坐标系,电子设备坐标系随着电子设备的平移和旋转而在空间坐标系中发生平移和旋转。电子设备或者电子设备坐标系在空间坐标系中的位置和姿态可以由旋转矩阵R与位移向量t来表示,其中旋转矩阵R为空间坐标系与电子设备坐标系之间的旋转矩阵,其可以用于表示电子设备在空间坐标系中的姿态信息,位移向量t可以用于表示电子设备坐标系的原点或者电子设备在空间坐标系中的位置信息。In an embodiment, the spatial position of the virtual object may be represented by the coordinates of the virtual object in the spatial coordinate system. It is possible to set an electronic device coordinate system with its origin as the electronic device itself, and the electronic device coordinate system translates and rotates in the space coordinate system with the translation and rotation of the electronic device. The position and posture of the electronic device or the electronic device coordinate system in the space coordinate system can be represented by the rotation matrix R and the displacement vector t, where the rotation matrix R is the rotation matrix between the space coordinate system and the electronic device coordinate system, which can be used To represent the posture information of the electronic device in the space coordinate system, the displacement vector t can be used to represent the origin of the electronic device coordinate system or the position information of the electronic device in the space coordinate system.
图2示出了根据一个实施例的坐标变换示意图,其中示出了虚拟对象201、电子设备202、以Oa为坐标原点的空间坐标系、以Ob或者电子设备202为坐标原点的电子设备坐标系。虚拟对象201具有在空间坐标系中的位置坐标。根据电子设备202在空间坐标系中的位置和姿态,可以获得空间坐标系与电子设备坐标系之间的旋转矩阵R与位移向量t。基于虚拟对象201在空间坐标系中的位置坐标以及空间坐标系与电子设备坐标系之间的旋转矩阵R与位移向量t,可以获得虚拟对象201在电子设备坐标系中的位置坐标,也即虚拟对象201相对于电子设备202的位置信息。使用旋转矩阵R和位移向量t进行坐标系变换是本领域的现有技术,在此不再赘述。2 shows a schematic diagram of coordinate transformation according to an embodiment, which shows a virtual object 201, an electronic device 202, a spatial coordinate system with Oa as the coordinate origin, and an electronic device coordinate system with Ob or the electronic device 202 as the coordinate origin. . The virtual object 201 has position coordinates in a spatial coordinate system. According to the position and posture of the electronic device 202 in the space coordinate system, the rotation matrix R and the displacement vector t between the space coordinate system and the electronic device coordinate system can be obtained. Based on the position coordinates of the virtual object 201 in the space coordinate system and the rotation matrix R and displacement vector t between the space coordinate system and the electronic device coordinate system, the position coordinates of the virtual object 201 in the electronic device coordinate system can be obtained, that is, virtual The position information of the object 201 relative to the electronic device 202. The use of the rotation matrix R and the displacement vector t to perform coordinate system transformation is an existing technology in this field, and will not be repeated here.
在确定了虚拟对象201相对于电子设备202的位置信息之后,可以假设在虚拟对象201和电子设备202之间建立了一个由图3中的虚线所示的 “刚性连接”。如此,当电子设备202发生平移或旋转而导致其在空间坐标系中的位置或姿态发生改变时,相应地,由于所述刚性连接的存在,虚拟对象201在空间坐标系中的位置也会发生改变,同时,虚拟对象201相对于电子设备202的位置始终保持不变。图4示出了当电子设备202发生平移时虚拟对象201的位置改变。如图4所示,当电子设备202在空间坐标系中发生平移而改变位置时,虚拟对象201也会在空间坐标系中发生同样的平移并导致同样的位置变化。图5示出了当电子设备202进一步发生旋转时虚拟对象201的位置改变。如图5所示,当电子设备202在空间坐标系中发生旋转而改变姿态时,虚拟对象201会在空间坐标系中发生相应的位置变化,该位置变化取决于电子设备202的具体旋转方式以及虚拟对象相对于所述电子设备的位置。After determining the position information of the virtual object 201 relative to the electronic device 202, it can be assumed that a "rigid connection" shown by the dashed line in FIG. 3 is established between the virtual object 201 and the electronic device 202. In this way, when the electronic device 202 shifts or rotates and causes its position or posture in the space coordinate system to change, correspondingly, due to the existence of the rigid connection, the position of the virtual object 201 in the space coordinate system also changes. At the same time, the position of the virtual object 201 relative to the electronic device 202 always remains unchanged. FIG. 4 shows that the position of the virtual object 201 changes when the electronic device 202 is translated. As shown in FIG. 4, when the electronic device 202 shifts in the spatial coordinate system and changes its position, the virtual object 201 also shifts in the spatial coordinate system and causes the same position change. FIG. 5 shows that the position of the virtual object 201 changes when the electronic device 202 rotates further. As shown in FIG. 5, when the electronic device 202 rotates in the space coordinate system to change its posture, the virtual object 201 will undergo a corresponding position change in the space coordinate system. The position change depends on the specific rotation mode of the electronic device 202 and The position of the virtual object relative to the electronic device.
步骤105:在所述电子设备的位置或姿态发生改变后获得所述电子设备的新的位置和姿态。Step 105: Obtain the new position and posture of the electronic device after the position or posture of the electronic device is changed.
如上文所提到的,可以使用现有的以及未来可能出现的各种方式来确定电子设备在空间坐标系中的新的位置和姿态信息,其也对应于电子设备坐标系的新的位置和姿态信息。电子设备在空间坐标系中的新的位置和姿态可以由空间坐标系与新的电子设备坐标系之间的旋转矩阵R与位移向量t来表示。As mentioned above, various existing and possible future methods can be used to determine the new position and posture information of the electronic device in the spatial coordinate system, which also corresponds to the new position and posture information of the electronic device coordinate system. Posture information. The new position and posture of the electronic device in the space coordinate system can be represented by the rotation matrix R and the displacement vector t between the space coordinate system and the new electronic device coordinate system.
步骤106:根据所述电子设备的新的位置和姿态以及所述虚拟对象相对于所述电子设备的位置,设置所述虚拟对象的空间位置。Step 106: Set the spatial position of the virtual object according to the new position and posture of the electronic device and the position of the virtual object relative to the electronic device.
重新参见图2所示的坐标变换示意图,基于虚拟对象201相对于电子设备202的位置信息(也即,虚拟对象201在电子设备坐标系中的位置坐标)以及空间坐标系与新的电子设备坐标系之间的旋转矩阵R与位移向量t,可以进行坐标变换以获得虚拟对象201在空间坐标系中的当前位置坐标,并可以将该当前位置坐标设置为虚拟对象201的新的空间位置。为虚拟对象201设置的新的空间位置可以被记录或存储。Referring again to the coordinate transformation diagram shown in FIG. 2, based on the position information of the virtual object 201 relative to the electronic device 202 (that is, the position coordinates of the virtual object 201 in the electronic device coordinate system), the space coordinate system and the new electronic device coordinates For the rotation matrix R and the displacement vector t between the systems, coordinate transformation can be performed to obtain the current position coordinates of the virtual object 201 in the space coordinate system, and the current position coordinates can be set as the new space position of the virtual object 201. The new spatial position set for the virtual object 201 can be recorded or stored.
在一个实施例中,用户可以通过在电子设备上执行某个操作(例如,按下电子设备的某个虚拟按键或物理按键)来指示开始设置虚拟对象的空间位置,从而,虚拟对象的空间位置被配置为可以随着电子设备的位置或姿态变化而发生变化。在将虚拟对象移动到期望的空间位置时,用户可以在电子设备上执行另一操作以指示设置操作完成,并可以相应地解除对虚拟对象的选择或者解除虚拟对象与电子设备之间的假设的刚性连接,从 而,当电子设备的位置或姿态继续发生变化时,不会改变虚拟对象的空间位置。In one embodiment, the user can instruct to start setting the spatial position of the virtual object by performing a certain operation on the electronic device (for example, pressing a certain virtual button or physical button of the electronic device), so that the spatial position of the virtual object It is configured to change as the position or posture of the electronic device changes. When moving the virtual object to the desired spatial position, the user can perform another operation on the electronic device to indicate the completion of the setting operation, and can correspondingly cancel the selection of the virtual object or cancel the assumption between the virtual object and the electronic device Rigid connection, so that when the position or posture of the electronic device continues to change, the spatial position of the virtual object will not be changed.
在一个实施例中,用户可以通过按下电子设备的某个虚拟按键或物理按键来指示开始设置虚拟对象的空间位置,之后,用户可以保持按压所述按键并移动电子设备。当用户将虚拟对象移动到期望的空间位置时,可以释放所述按键以完成对虚拟对象的空间位置的设置。在释放所述按键之后,虚拟对象的空间位置可以被配置为不再随着电子设备的位置或姿态变化而发生变化。In one embodiment, the user can instruct to start setting the spatial position of the virtual object by pressing a certain virtual key or physical key of the electronic device, and then the user can keep pressing the key and move the electronic device. When the user moves the virtual object to a desired spatial position, the button can be released to complete the setting of the spatial position of the virtual object. After the key is released, the spatial position of the virtual object may be configured to no longer change with the position or posture of the electronic device.
在电子设备的位置或姿态发生改变的过程中,可以在电子设备的显示媒介上呈现虚拟对象,如此可以有利于用户更直观地设置虚拟对象的空间位置。During the process of changing the position or posture of the electronic device, the virtual object can be presented on the display medium of the electronic device, which can help the user to more intuitively set the spatial position of the virtual object.
在一个实施例中,由于虚拟对象相对于电子设备的位置始终保持不变,因此在电子设备的位置或姿态发生改变的过程中,可以始终在电子设备的显示媒介上的相同位置处呈现虚拟对象。In one embodiment, since the position of the virtual object relative to the electronic device always remains unchanged, the virtual object can always be presented at the same position on the display medium of the electronic device during the process of changing the position or posture of the electronic device .
在另一个实施例中,在电子设备的位置和姿态发生改变的过程中,可以根据电子设备在空间坐标系中的新的位置和姿态以及虚拟对象相对于电子设备的位置,更新虚拟对象在空间坐标系中的位置,之后,可以根据电子设备在空间坐标系中的位置和姿态以及虚拟对象在空间坐标系中的位置,在电子设备的显示媒介上的相应位置处呈现该虚拟对象。可以理解,由于虚拟对象相对于电子设备的位置始终不变,因此,始终会在电子设备的显示媒介上的相同位置处呈现所述虚拟对象。In another embodiment, in the process of changing the position and posture of the electronic device, the virtual object in space can be updated according to the new position and posture of the electronic device in the spatial coordinate system and the position of the virtual object relative to the electronic device. The position in the coordinate system can then be used to present the virtual object at the corresponding position on the display medium of the electronic device according to the position and posture of the electronic device in the space coordinate system and the position of the virtual object in the space coordinate system. It can be understood that since the position of the virtual object relative to the electronic device is always the same, the virtual object will always be presented at the same position on the display medium of the electronic device.
在一个实施例中,电子设备的显示媒介上可以呈现通过电子设备的图像采集器件采集到的空间的实景图像,从而实现增强现实应用。在另一个实施例中,电子设备的显示媒介上也可以不呈现通过电子设备的图像采集器件采集到的空间的实景图像,从而实现虚拟现实应用。在虚拟现实应用中,电子设备中可以不具有图像采集器件。In an embodiment, the display medium of the electronic device may present real-world images of the space collected by the image acquisition device of the electronic device, thereby realizing augmented reality applications. In another embodiment, the display medium of the electronic device may not present the real-scene image of the space collected by the image acquisition device of the electronic device, so as to realize the virtual reality application. In virtual reality applications, the electronic equipment may not have image acquisition devices.
在图1所示的实施例中,根据电子设备的新的位置和姿态以及虚拟对象相对于电子设备的位置,来设置虚拟对象的空间位置,但是,也可以根据电子设备的位置和姿态变化信息以及虚拟对象相对于电子设备的位置,确定虚拟对象的空间位置变化信息,从而设置虚拟对象的空间位置。图6示出了根据本申请的另一个实施例的用于通过电子设备设置虚拟对象的空间位置的方法,其包括如下步骤(部分步骤与图1所示的步骤类似,在 此不再详细解释):In the embodiment shown in FIG. 1, the spatial position of the virtual object is set according to the new position and posture of the electronic device and the position of the virtual object relative to the electronic device. However, the information can also be changed according to the position and posture of the electronic device. And the position of the virtual object relative to the electronic device, the spatial position change information of the virtual object is determined, and the spatial position of the virtual object is set. Fig. 6 shows a method for setting the spatial position of a virtual object through an electronic device according to another embodiment of the present application, which includes the following steps (some of the steps are similar to the steps shown in Fig. 1 and will not be explained in detail here. ):
步骤601:确定要设置空间位置的虚拟对象。Step 601: Determine the virtual object whose spatial position is to be set.
步骤602:获得所述虚拟对象的初始空间位置。Step 602: Obtain the initial spatial position of the virtual object.
步骤603:获得电子设备在初始时刻的初始位置和姿态。Step 603: Obtain the initial position and posture of the electronic device at the initial moment.
步骤604:根据所述虚拟对象的初始空间位置以及所述电子设备的初始位置和姿态,确定所述虚拟对象相对于所述电子设备的位置。Step 604: Determine the position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device.
如上文提到的,虚拟对象相对于电子设备的位置可以由虚拟对象在电子设备坐标系中的位置坐标来表示。As mentioned above, the position of the virtual object relative to the electronic device may be represented by the position coordinates of the virtual object in the coordinate system of the electronic device.
步骤605:获得所述电子设备在所述初始时刻之后的位置和姿态变化信息。Step 605: Obtain position and posture change information of the electronic device after the initial time.
可以使用现有的以及未来可能出现的各种方式来确定电子设备在空间中的位置和姿态变化信息。例如,电子设备还可以使用内置的各种传感器(例如,磁力传感器、方向传感器、重力传感器、陀螺仪、加速度传感器、卫星定位信号接收器等)通过例如惯性导航、视觉里程计、SLAM、VSLAM、SFM等来测量或跟踪其位置变化和/或姿态变化。Various existing and possible future methods can be used to determine the position and posture change information of the electronic device in space. For example, the electronic device can also use various built-in sensors (for example, magnetic sensors, direction sensors, gravity sensors, gyroscopes, acceleration sensors, satellite positioning signal receivers, etc.) through, for example, inertial navigation, visual odometry, SLAM, VSLAM, SFM, etc. to measure or track its position change and/or posture change.
步骤606:根据所述电子设备的位置和姿态变化信息以及所述虚拟对象相对于所述电子设备的位置,确定所述虚拟对象的空间位置变化信息。Step 606: Determine the spatial position change information of the virtual object according to the position and posture change information of the electronic device and the position of the virtual object relative to the electronic device.
在一个实施例中,根据电子设备的位置和姿态变化信息,可以确定电子设备所经历的平移变化和旋转变化。电子设备的平移可以导致虚拟对象的空间位置发生同样的平移,参见图4所示。电子设备的旋转可以导致虚拟对象的空间位置发生与该旋转对应的空间位置变化,参见图5所示,该空间位置变化取决于电子设备的具体旋转方式以及虚拟对象相对于电子设备的位置。In one embodiment, according to the position and posture change information of the electronic device, the translation change and the rotation change experienced by the electronic device can be determined. The translation of the electronic device can cause the same translation of the spatial position of the virtual object, as shown in FIG. 4. The rotation of the electronic device may cause the spatial position of the virtual object to undergo a spatial position change corresponding to the rotation. As shown in FIG. 5, the spatial position change depends on the specific rotation mode of the electronic device and the position of the virtual object relative to the electronic device.
步骤607:根据所述虚拟对象的初始空间位置以及所述虚拟对象的空间位置变化信息,设置所述虚拟对象的空间位置。Step 607: Set the spatial position of the virtual object according to the initial spatial position of the virtual object and the spatial position change information of the virtual object.
根据虚拟对象的初始空间位置以及虚拟对象的空间位置变化信息,可以计算出虚拟对象的当前空间位置。虚拟对象的当前空间位置可以被设置为虚拟对象的新的空间位置,并且可以被记录或者存储。According to the initial spatial position of the virtual object and the spatial position change information of the virtual object, the current spatial position of the virtual object can be calculated. The current spatial position of the virtual object can be set as the new spatial position of the virtual object, and can be recorded or stored.
图1和图6所示的两种方法的区别在于,根据图1所示的方法,并不需要始终跟踪电子设备的位置和姿态变化,只需要确定电子设备的初始位置和姿态以及最终位置和姿态即可;而根据图6所示的方法,并不需要确定电子设备的最终位置和姿态,只需要跟踪其位置和姿态变化信息即可。 可以理解,这两种方法的实际原理是类似的,因为根据电子设备的初始位置和姿态以及最终位置和姿态,可以计算出其位置和姿态变化信息;相应地,根据电子设备的初始位置和姿态以及其位置和姿态变化信息,也可以计算出电子设备的最终位置和姿态。因此,在一个更具一般性的实施例中,提供了一种用于设置虚拟对象的空间位置的方法,其包括:确定要设置空间位置的虚拟对象;获得所述虚拟对象的初始空间位置;获得电子设备在初始时刻的初始位置和姿态;获得所述电子设备的新的位置和姿态或者所述电子设备在所述初始时刻后的位置和姿态变化信息;以及根据所述虚拟对象的初始空间位置、所述电子设备的初始位置和姿态、以及所述电子设备的新的位置和姿态或者所述电子设备在所述初始时刻之后的位置和姿态变化信息,设置所述虚拟对象的空间位置。The difference between the two methods shown in Figure 1 and Figure 6 is that, according to the method shown in Figure 1, the position and posture changes of the electronic device do not always need to be tracked, only the initial position and posture and final position and posture of the electronic device need to be determined. The posture is sufficient; and according to the method shown in FIG. 6, the final position and posture of the electronic device are not required to be determined, only the position and posture change information of the electronic device needs to be tracked. It can be understood that the actual principles of these two methods are similar, because according to the initial position and posture and final position and posture of the electronic device, the position and posture change information can be calculated; accordingly, according to the initial position and posture of the electronic device As well as its position and posture change information, the final position and posture of the electronic device can also be calculated. Therefore, in a more general embodiment, a method for setting the spatial position of a virtual object is provided, which includes: determining the virtual object whose spatial position is to be set; and obtaining the initial spatial position of the virtual object; Obtain the initial position and posture of the electronic device at the initial moment; obtain the new position and posture of the electronic device or the position and posture change information of the electronic device after the initial moment; and according to the initial space of the virtual object The position, the initial position and posture of the electronic device, and the new position and posture of the electronic device, or the position and posture change information of the electronic device after the initial moment, set the spatial position of the virtual object.
在上文的一些实施例中,在调整或设置虚拟对象的空间位置的过程中,在电子设备和虚拟对象之间建立了假设的“刚性连接”,但是需要强调的是,这并非对本发明的限制。在本申请的其他一些实施例中,在确定要设置空间位置的虚拟对象之后,可以根据电子设备的新的位置或位姿或者电子设备的位置或位姿变化信息以其他任何期望的方式或规则来设置虚拟对象的空间位置。In some of the above embodiments, in the process of adjusting or setting the spatial position of the virtual object, a hypothetical "rigid connection" is established between the electronic device and the virtual object, but it should be emphasized that this is not essential to the present invention. limit. In some other embodiments of the present application, after determining the virtual object whose spatial position is to be set, any other desired method or rule can be used according to the new position or pose of the electronic device or the position or pose change information of the electronic device. To set the spatial position of the virtual object.
在一个实施例中,可以根据虚拟对象的初始空间位置以及电子设备的初始位置和姿态,确定虚拟对象相对于电子设备的位置,其包括虚拟对象相对于电子设备的方向以及虚拟对象相对于电子设备的距离或深度。在调整或设置虚拟对象的空间位置的过程中,电子设备的用户可以通过电子设备的操作元件来提供输入信息,以改变或调整虚拟对象相对于电子设备的距离或深度,同时,虚拟对象相对于电子设备的方向保持不变。也即,在图3中的虚线所示的“刚性连接”相对于电子设备的方向保持不变的情况下,改变该“刚性连接”的长度。电子设备的操作元件可以是电子设备的显示媒介上呈现的虚拟操作元件,也可以是电子设备上具有的物理操作元件。在一个实施例中,操作元件可以是在电子设备的显示媒介上呈现的滑动条,通过拖动滑动条的滑块,可以改变虚拟对象相对于电子设备的距离或深度。虚拟对象相对于电子设备的距离可以是指虚拟对象到电子设备的直线距离。虚拟对象相对于电子设备的深度例如可以是指虚拟对象相对于 电子设备所处的平面或者电子设备的图像采集器件的成像平面的垂直距离。本领域技术人员可以理解,由于虚拟对象相对于电子设备的方向保持不变,因此设置虚拟对象相对于电子设备的距离实际上会相应地设置虚拟对象相对于电子设备的深度,反之亦然,因此,设置距离和设置深度在很多情况下具有相同的效果。可以在设置虚拟对象相对于电子设备的距离或深度时,在电子设备的显示媒介上实时地显示当前设置的距离或深度的数值。在一些实施例中,可以根据虚拟对象相对于电子设备的距离或深度来改变所呈现的虚拟对象的大小或尺寸。In one embodiment, the position of the virtual object relative to the electronic device can be determined according to the initial spatial position of the virtual object and the initial position and posture of the electronic device, which includes the direction of the virtual object relative to the electronic device and the virtual object relative to the electronic device. The distance or depth. In the process of adjusting or setting the spatial position of the virtual object, the user of the electronic device can provide input information through the operating elements of the electronic device to change or adjust the distance or depth of the virtual object relative to the electronic device. At the same time, the virtual object is relative to the electronic device. The direction of the electronic device remains unchanged. That is, when the direction of the "rigid connection" shown by the dashed line in FIG. 3 with respect to the electronic device remains unchanged, the length of the "rigid connection" is changed. The operating element of the electronic device may be a virtual operating element presented on the display medium of the electronic device, or may be a physical operating element on the electronic device. In one embodiment, the operating element may be a sliding bar presented on the display medium of the electronic device. By dragging the slider of the sliding bar, the distance or depth of the virtual object relative to the electronic device can be changed. The distance of the virtual object relative to the electronic device may refer to the linear distance between the virtual object and the electronic device. The depth of the virtual object relative to the electronic device may refer to, for example, the vertical distance of the virtual object relative to the plane where the electronic device is located or the imaging plane of the image capture device of the electronic device. Those skilled in the art can understand that since the direction of the virtual object relative to the electronic device remains unchanged, setting the distance of the virtual object relative to the electronic device will actually set the depth of the virtual object relative to the electronic device accordingly, and vice versa. , Setting distance and setting depth have the same effect in many cases. When setting the distance or depth of the virtual object relative to the electronic device, the currently set distance or depth value can be displayed on the display medium of the electronic device in real time. In some embodiments, the size or size of the virtual object presented can be changed according to the distance or depth of the virtual object relative to the electronic device.
在一个实施例中,可以仅考虑电子设备的位置信息,并根据电子设备的位置或者位置变化来改变虚拟对象的空间位置。在一种方式中,可以根据电子设备的初始位置以及电子设备的新的位置来确定电子设备的位移,从而对虚拟对象的初始空间位置进行更改。在另一种方式中,可以跟踪电子设备的位置变化信息并根据电子设备的位置变化信息对虚拟对象的初始空间位置进行更改。图7示出了根据本申请的一个实施例的用于通过电子设备设置虚拟对象的空间位置的方法,其根据电子设备的位置或者位置变化来改变虚拟对象的空间位置,并包括如下步骤:In an embodiment, only the position information of the electronic device may be considered, and the spatial position of the virtual object may be changed according to the position or position change of the electronic device. In one manner, the displacement of the electronic device can be determined according to the initial position of the electronic device and the new position of the electronic device, so as to change the initial spatial position of the virtual object. In another way, the position change information of the electronic device can be tracked and the initial spatial position of the virtual object can be changed according to the position change information of the electronic device. FIG. 7 shows a method for setting the spatial position of a virtual object through an electronic device according to an embodiment of the present application, which changes the spatial position of the virtual object according to the position or position change of the electronic device, and includes the following steps:
步骤701:确定要设置空间位置的虚拟对象;Step 701: Determine the virtual object whose spatial position is to be set;
步骤702:获得所述虚拟对象的初始空间位置;Step 702: Obtain the initial spatial position of the virtual object;
步骤703:获得电子设备的位置信息,所述位置信息包括:所述电子设备在初始时刻的初始位置以及所述电子设备的新的位置,和/或,所述电子设备的位置变化信息;以及Step 703: Obtain location information of the electronic device, where the location information includes: the initial location of the electronic device at the initial moment and the new location of the electronic device, and/or the location change information of the electronic device; and
步骤704:根据所述虚拟对象的初始空间位置、所述电子设备的初始位置、以及所述电子设备的新的位置来设置所述虚拟对象的空间位置,或者根据所述虚拟对象的初始空间位置以及所述电子设备的位置变化信息来设置所述虚拟对象的空间位置。在一个实施例中,当根据电子设备的位置或位姿变化来改变虚拟对象的空间位置时,电子设备的位置变化量(也即位移量)与虚拟对象的位置变化量是相同的。在另一个实施例中,当根据电子设备的位置或位姿变化来改变虚拟对象的空间位置时,可以设置电子设备的位置变化量与虚拟对象的位置变化量之间的缩放比例。在一种情况下,可以使得电子设备的位置变化量大于虚拟对象的位置变化量,这种 情况适合于通过电子设备对虚拟对象的空间位置进行精细调整。在另一种情况下,可以使得电子设备的位置变化量小于虚拟对象的位置变化量,这种情况适合于通过电子设备的小的位移变化对虚拟对象的空间位置进行大幅度调整。Step 704: Set the spatial position of the virtual object according to the initial spatial position of the virtual object, the initial position of the electronic device, and the new position of the electronic device, or according to the initial spatial position of the virtual object And the position change information of the electronic device to set the spatial position of the virtual object. In one embodiment, when the spatial position of the virtual object is changed according to the position or pose change of the electronic device, the position change amount (that is, the displacement amount) of the electronic device is the same as the position change amount of the virtual object. In another embodiment, when the spatial position of the virtual object is changed according to the position or pose change of the electronic device, a zoom ratio between the position change amount of the electronic device and the position change amount of the virtual object can be set. In one case, the position change amount of the electronic device can be made larger than the position change amount of the virtual object. This situation is suitable for fine adjustment of the spatial position of the virtual object through the electronic device. In another case, the position change of the electronic device can be made smaller than the position change of the virtual object. This situation is suitable for greatly adjusting the spatial position of the virtual object through a small displacement change of the electronic device.
在本发明的一个实施例中,可以以计算机程序的形式来实现本发明。计算机程序可以存储于各种存储介质(例如,硬盘、光盘、闪存等)中,当该计算机程序被处理器执行时,能够用于实现本发明的方法。In an embodiment of the present invention, the present invention can be implemented in the form of a computer program. The computer program can be stored in various storage media (for example, a hard disk, an optical disk, a flash memory, etc.), and when the computer program is executed by a processor, it can be used to implement the method of the present invention.
在本发明的另一个实施例中,可以以电子设备的形式来实现本发明。该电子设备包括处理器和存储器,在存储器中存储有计算机程序,当该计算机程序被处理器执行时,能够用于实现本发明的方法。In another embodiment of the present invention, the present invention may be implemented in the form of an electronic device. The electronic device includes a processor and a memory, and a computer program is stored in the memory. When the computer program is executed by the processor, it can be used to implement the method of the present invention.
本文中针对“各个实施例”、“一些实施例”、“一个实施例”、或“实施例”等的参考指代的是结合所述实施例所描述的特定特征、结构、或性质包括在至少一个实施例中。因此,短语“在各个实施例中”、“在一些实施例中”、“在一个实施例中”、或“在实施例中”等在整个本文中各处的出现并非必须指代相同的实施例。此外,特定特征、结构、或性质可以在一个或多个实施例中以任何合适方式组合。因此,结合一个实施例中所示出或描述的特定特征、结构或性质可以整体地或部分地与一个或多个其他实施例的特征、结构、或性质无限制地组合,只要该组合不是不符合逻辑的或不能工作。本文中出现的类似于“根据A”、“基于A”、“通过A”或“使用A”的表述意指非排他性的,也即,“根据A”可以涵盖“仅仅根据A”,也可以涵盖“根据A和B”,除非特别声明其含义为“仅仅根据A”。在本申请中为了清楚说明,以一定的顺序描述了一些示意性的操作步骤,但本领域技术人员可以理解,这些操作步骤中的每一个并非是必不可少的,其中的一些步骤可以被省略或者被其他步骤替代。这些操作步骤也并非必须以所示的方式依次执行,相反,这些操作步骤中的一些可以根据实际需要以不同的顺序执行,或者并行执行,只要新的执行方式不是不符合逻辑的或不能工作。References herein to "each embodiment", "some embodiments", "one embodiment", or "an embodiment", etc. refer to the specific features, structures, or properties described in connection with the embodiments that are included in In at least one embodiment. Therefore, the appearances of the phrases "in various embodiments", "in some embodiments", "in one embodiment", or "in an embodiment" in various places throughout this document do not necessarily refer to the same implementation example. In addition, specific features, structures, or properties can be combined in any suitable manner in one or more embodiments. Therefore, a specific feature, structure, or property shown or described in combination with one embodiment can be combined in whole or in part with the feature, structure, or property of one or more other embodiments without limitation, as long as the combination is not incompatible. Logical or not working. Expressions similar to "according to A", "based on A", "through A" or "using A" appearing in this article mean non-exclusive, that is, "according to A" can cover "only according to A" or Covers "according to A and B" unless it is specifically stated to mean "only according to A". For clarity in this application, some illustrative operating steps are described in a certain order, but those skilled in the art can understand that each of these operating steps is not indispensable, and some of the steps can be omitted. Or replaced by other steps. These operation steps do not have to be executed sequentially in the manner shown. On the contrary, some of these operation steps can be executed in a different order according to actual needs, or executed in parallel, as long as the new execution method is not illogical or unable to work.
由此描述了本发明的至少一个实施例的几个方面,可以理解,对本领域技术人员来说容易地进行各种改变、修改和改进。这种改变、修改和改进意于在本发明的精神和范围内。虽然本发明已经通过优选实施例进行了 描述,然而本发明并非局限于这里所描述的实施例,在不脱离本发明范围的情况下还包括所作出的各种改变以及变化。Thus, several aspects of at least one embodiment of the present invention have been described, and it can be understood that various changes, modifications and improvements can be easily made by those skilled in the art. Such changes, modifications and improvements are intended to be within the spirit and scope of the present invention. Although the present invention has been described through preferred embodiments, the present invention is not limited to the embodiments described herein, and also includes various changes and changes made without departing from the scope of the present invention.

Claims (15)

  1. 一种用于设置虚拟对象的空间位置的方法,包括:A method for setting the spatial position of a virtual object, including:
    确定要设置空间位置的虚拟对象;Determine the virtual object whose spatial position is to be set;
    获得所述虚拟对象的初始空间位置;Obtaining the initial spatial position of the virtual object;
    获得电子设备的位置信息,所述位置信息包括:所述电子设备在初始时刻的初始位置以及所述电子设备的新的位置,和/或,所述电子设备的位置变化信息;以及Obtain location information of the electronic device, where the location information includes: the initial location of the electronic device at the initial moment and the new location of the electronic device, and/or the location change information of the electronic device; and
    根据所述虚拟对象的初始空间位置、所述电子设备的初始位置、以及所述电子设备的新的位置来设置所述虚拟对象的空间位置,或者根据所述虚拟对象的初始空间位置以及所述电子设备的位置变化信息来设置所述虚拟对象的空间位置。Set the spatial position of the virtual object according to the initial spatial position of the virtual object, the initial position of the electronic device, and the new position of the electronic device, or according to the initial spatial position of the virtual object and the The position change information of the electronic device is used to set the spatial position of the virtual object.
  2. 根据权利要求1所述的方法,还包括:获得所述电子设备的姿态信息,其中,所述电子设备的位置和姿态信息包括:所述电子设备在初始时刻的初始位置和姿态以及所述电子设备的新的位置和姿态,和/或,所述电子设备的位置和姿态变化信息;The method according to claim 1, further comprising: obtaining posture information of the electronic device, wherein the position and posture information of the electronic device includes: the initial position and posture of the electronic device at the initial moment and the electronic device The new position and posture of the device, and/or the position and posture change information of the electronic device;
    以及其中,所述设置所述虚拟对象的空间位置包括:根据所述虚拟对象的初始空间位置、所述电子设备的初始位置和姿态、以及所述电子设备的新的位置和姿态来设置所述虚拟对象的空间位置,或者根据所述虚拟对象的初始空间位置以及所述电子设备的位置和姿态变化信息来设置所述虚拟对象的空间位置。And wherein, the setting the spatial position of the virtual object includes: setting the virtual object according to the initial spatial position of the virtual object, the initial position and posture of the electronic device, and the new position and posture of the electronic device. The spatial position of the virtual object, or the spatial position of the virtual object is set according to the initial spatial position of the virtual object and the position and posture change information of the electronic device.
  3. 根据权利要求1所述的方法,还包括:获得所述电子设备的姿态信息,其中,所述电子设备的位置和姿态信息包括:所述电子设备在初始时刻的初始位置和姿态以及所述电子设备的新的位置和姿态,和/或,所述电子设备在初始时刻的初始位置和姿态以及所述电子设备的位置和姿态变化信息,The method according to claim 1, further comprising: obtaining posture information of the electronic device, wherein the position and posture information of the electronic device includes: the initial position and posture of the electronic device at the initial moment and the electronic device The new position and posture of the device, and/or the initial position and posture of the electronic device at the initial moment, and the position and posture change information of the electronic device,
    以及其中,所述设置所述虚拟对象的空间位置包括:根据所述虚拟对象的初始空间位置、所述电子设备的所述初始位置和姿态、以及所述电子 设备的新的位置和姿态或者所述电子设备在所述初始时刻之后的位置和姿态变化信息,设置所述虚拟对象的空间位置。And wherein, the setting the spatial position of the virtual object includes: according to the initial spatial position of the virtual object, the initial position and posture of the electronic device, and the new position and posture of the electronic device or The position and posture change information of the electronic device after the initial time set the spatial position of the virtual object.
  4. 根据权利要求3所述的方法,其中,所述根据所述虚拟对象的初始空间位置、所述电子设备的所述初始位置和姿态、以及所述电子设备的新的位置和姿态或者所述电子设备在所述初始时刻之后的位置和姿态变化信息设置所述虚拟对象的空间位置包括:3. The method according to claim 3, wherein the initial spatial position of the virtual object, the initial position and posture of the electronic device, and the new position and posture of the electronic device or the electronic device Setting the spatial position of the virtual object by the position and posture change information of the device after the initial moment includes:
    根据所述虚拟对象的初始空间位置以及所述电子设备的所述初始位置和姿态,确定所述虚拟对象相对于所述电子设备的位置;以及Determine the position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device; and
    根据所述电子设备的新的位置和姿态以及所述虚拟对象相对于所述电子设备的位置,设置所述虚拟对象的空间位置。The spatial position of the virtual object is set according to the new position and posture of the electronic device and the position of the virtual object relative to the electronic device.
  5. 根据权利要求3所述的方法,其中,所述根据所述虚拟对象的初始空间位置、所述电子设备的所述初始位置和姿态、以及所述电子设备的新的位置和姿态或者所述电子设备在所述初始时刻之后的位置和姿态变化信息设置所述虚拟对象的空间位置包括:3. The method according to claim 3, wherein the initial spatial position of the virtual object, the initial position and posture of the electronic device, and the new position and posture of the electronic device or the electronic device Setting the spatial position of the virtual object by the position and posture change information of the device after the initial moment includes:
    根据所述虚拟对象的初始空间位置以及所述电子设备的所述初始位置和姿态,确定所述虚拟对象相对于所述电子设备的位置;Determine the position of the virtual object relative to the electronic device according to the initial spatial position of the virtual object and the initial position and posture of the electronic device;
    根据所述电子设备的位置和姿态变化信息以及所述虚拟对象相对于所述电子设备的位置,确定所述虚拟对象的空间位置变化信息;以及Determine the spatial position change information of the virtual object according to the position and posture change information of the electronic device and the position of the virtual object relative to the electronic device; and
    根据所述虚拟对象的初始空间位置以及所述虚拟对象的空间位置变化信息,设置所述虚拟对象的空间位置。The spatial position of the virtual object is set according to the initial spatial position of the virtual object and the spatial position change information of the virtual object.
  6. 根据权利要求4或5所述的方法,其中,所述虚拟对象相对于所述电子设备的位置始终保持不变。The method according to claim 4 or 5, wherein the position of the virtual object relative to the electronic device always remains unchanged.
  7. 根据权利要求4或5所述的方法,其中,所述虚拟对象相对于所述电子设备的位置包括所述虚拟对象相对于所述电子设备的方向以及所述虚拟对象相对于所述电子设备的距离或深度;The method according to claim 4 or 5, wherein the position of the virtual object relative to the electronic device includes the direction of the virtual object relative to the electronic device and the position of the virtual object relative to the electronic device. Distance or depth
    以及其中,所述方法还包括:基于来自用户的输入信息改变所述虚拟 对象相对于所述电子设备的距离或深度。And wherein, the method further includes: changing the distance or depth of the virtual object relative to the electronic device based on the input information from the user.
  8. 根据权利要求1-5中任一项所述的方法,其中,在所述初始时刻之后,所述电子设备的位置或姿态变化对所述虚拟对象的空间位置产生影响。The method according to any one of claims 1 to 5, wherein after the initial moment, a change in the position or posture of the electronic device affects the spatial position of the virtual object.
  9. 根据权利要求1-5中任一项所述的方法,其中,在所述电子设备的显示媒介上呈现有选择图标,以及其中,所述确定要设置空间位置的虚拟对象包括:The method according to any one of claims 1 to 5, wherein a selection icon is presented on the display medium of the electronic device, and wherein the determining the virtual object to be set in the spatial position comprises:
    当某个虚拟对象呈现于所述选择图标所在的位置,并且接收到用户的选择指示时,将所述虚拟对象确定为要设置空间位置的虚拟对象。When a certain virtual object is presented at the location where the selection icon is located, and a user's selection instruction is received, the virtual object is determined as the virtual object whose spatial position is to be set.
  10. 根据权利要求1-5中任一项所述的方法,其中,当所述电子设备的某个虚拟按键或物理按键被用户按压时,随着所述电子设备的位置或姿态变化而设置所述虚拟对象的空间位置;以及其中,当所述虚拟按键或物理按键被用户释放时,所述虚拟对象的空间位置被配置为不再随着所述电子设备的位置或姿态变化而发生变化。The method according to any one of claims 1-5, wherein when a certain virtual key or physical key of the electronic device is pressed by the user, the electronic device is set as the position or posture of the electronic device changes. The spatial position of the virtual object; and wherein, when the virtual button or the physical button is released by the user, the spatial position of the virtual object is configured to no longer change with the position or posture of the electronic device.
  11. 根据权利要求1-5中任一项所述的方法,其中,所述电子设备的位置变化信息或姿态变化信息是所述电子设备在所述初始时刻之后的位置变化信息或姿态变化信息。The method according to any one of claims 1 to 5, wherein the position change information or posture change information of the electronic device is position change information or posture change information of the electronic device after the initial moment.
  12. 根据权利要求1-5中任一项所述的方法,其中,所述电子设备的位置变化量与所述虚拟对象的位置变化量相等。The method according to any one of claims 1 to 5, wherein the position change amount of the electronic device is equal to the position change amount of the virtual object.
  13. 根据权利要求1-5中任一项所述的方法,其中,所述电子设备的位置变化量与所述虚拟对象的位置变化量不相等。The method according to any one of claims 1 to 5, wherein the position change amount of the electronic device is not equal to the position change amount of the virtual object.
  14. 一种存储介质,其中存储有计算机程序,在所述计算机程序被处理器执行时,能够用于实现权利要求1-13中任一项所述的方法。A storage medium in which a computer program is stored, and when the computer program is executed by a processor, it can be used to implement the method of any one of claims 1-13.
  15. 一种电子设备,包括处理器和存储器,所述存储器中存储有计算机程序,在所述计算机程序被处理器执行时,能够用于实现权利要求1-13中任一项所述的方法。An electronic device comprising a processor and a memory, and a computer program is stored in the memory. When the computer program is executed by the processor, the computer program can be used to implement the method according to any one of claims 1-13.
PCT/CN2020/134218 2019-12-20 2020-12-07 Method for configuring spatial position of virtual object, and electronic device WO2021121061A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911322368.9A CN113012214A (en) 2019-12-20 2019-12-20 Method and electronic device for setting spatial position of virtual object
CN201911322368.9 2019-12-20

Publications (1)

Publication Number Publication Date
WO2021121061A1 true WO2021121061A1 (en) 2021-06-24

Family

ID=76382113

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/134218 WO2021121061A1 (en) 2019-12-20 2020-12-07 Method for configuring spatial position of virtual object, and electronic device

Country Status (3)

Country Link
CN (1) CN113012214A (en)
TW (1) TWI777333B (en)
WO (1) WO2021121061A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114415839A (en) * 2022-01-27 2022-04-29 歌尔科技有限公司 Information display method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090093304A1 (en) * 2007-10-09 2009-04-09 Nintendo Co., Ltd. Computer readable storage medium having a game program stored thereon and a game apparatus
CN103391357A (en) * 2012-05-09 2013-11-13 北京千橡网景科技发展有限公司 Mobile-terminal-related method and device
CN107861682A (en) * 2017-11-03 2018-03-30 网易(杭州)网络有限公司 The control method for movement and device of virtual objects
CN108543309A (en) * 2018-04-03 2018-09-18 网易(杭州)网络有限公司 The method, apparatus and terminal of the movement of virtual controlling object are controlled in augmented reality

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013093906A1 (en) * 2011-09-19 2013-06-27 Eyesight Mobile Technologies Ltd. Touch free interface for augmented reality systems
KR20140068410A (en) * 2012-11-28 2014-06-09 삼성전자주식회사 Method for providing user interface based on physical engine and an electronic device thereof
US20180210628A1 (en) * 2017-01-23 2018-07-26 Snap Inc. Three-dimensional interaction system
CN108520552A (en) * 2018-03-26 2018-09-11 广东欧珀移动通信有限公司 Image processing method, device, storage medium and electronic equipment
CN109782901A (en) * 2018-12-06 2019-05-21 网易(杭州)网络有限公司 Augmented reality exchange method, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090093304A1 (en) * 2007-10-09 2009-04-09 Nintendo Co., Ltd. Computer readable storage medium having a game program stored thereon and a game apparatus
CN103391357A (en) * 2012-05-09 2013-11-13 北京千橡网景科技发展有限公司 Mobile-terminal-related method and device
CN107861682A (en) * 2017-11-03 2018-03-30 网易(杭州)网络有限公司 The control method for movement and device of virtual objects
CN108543309A (en) * 2018-04-03 2018-09-18 网易(杭州)网络有限公司 The method, apparatus and terminal of the movement of virtual controlling object are controlled in augmented reality

Also Published As

Publication number Publication date
CN113012214A (en) 2021-06-22
TWI777333B (en) 2022-09-11
TW202125203A (en) 2021-07-01

Similar Documents

Publication Publication Date Title
KR101433305B1 (en) Mobile device based content mapping for augmented reality environment
CN110073313B (en) Interacting with an environment using a parent device and at least one companion device
WO2019205850A1 (en) Pose determination method and device, intelligent apparatus, and storage medium
JP6469706B2 (en) Modeling structures using depth sensors
CA2792577C (en) 3d position tracking for panoramic imagery navigation
JP5807686B2 (en) Image processing apparatus, image processing method, and program
JP6421670B2 (en) Display control method, display control program, and information processing apparatus
US20140248950A1 (en) System and method of interaction for mobile devices
JP2022537614A (en) Multi-virtual character control method, device, and computer program
KR20120038316A (en) User equipment and method for providing ar service
TW201346640A (en) Image processing device, and computer program product
US10359906B2 (en) Haptic interface for population of a three-dimensional virtual environment
KR20130050701A (en) Method and apparatus for controlling content of the remote screen
US9536351B1 (en) Third person view augmented reality
JP2016122392A (en) Information processing apparatus, information processing system, control method and program of the same
US10931926B2 (en) Method and apparatus for information display, and display device
WO2021121061A1 (en) Method for configuring spatial position of virtual object, and electronic device
CN112099681B (en) Interaction method and device based on three-dimensional scene application and computer equipment
JP2008219390A (en) Image reader
JP2018124746A (en) Information processing device, information processing system, information processing method and program
CN113010005A (en) Method and electronic device for setting position of virtual object in space
CN117666765A (en) Display method and device of attribute setting control, electronic equipment and medium
Lue et al. 3D whiteboard: collaborative sketching with 3D-tracked smart phones

Legal Events

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

Ref document number: 20904006

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20904006

Country of ref document: EP

Kind code of ref document: A1