A spatial positioning method, device and system

By using acceleration sensors, gyroscopes and image acquisition devices, combined with the acceleration and rotation parameters of electronic devices, the problem of virtual space positioning in the prior art is solved, and the ability to locate objects in the virtual space through ordinary electronic devices is realized.

CN115487493BActive Publication Date: 2025-06-13HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211070503.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-02
Publication Date
2025-06-13
Estimated Expiration
2042-09-02

AI Technical Summary

Technical Problem

The existing virtual space positioning technology requires dedicated equipment support, which makes it not universal and makes it difficult to position objects in virtual space in various scenarios.

Method used

By using electronic devices including an acceleration sensor and a gyroscope, the acceleration and rotation parameters of the device are detected, and combined with the tracking of a specific object by the image acquisition device, the position and attitude information of the device in the virtual space is determined.

Benefits of technology

The ability to locate objects in virtual space through ordinary electronic devices (such as mobile phones) is realized, without the need for dedicated spatial positioning equipment, ensuring the universality and wide application of equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115487493B_ABST
    Figure CN115487493B_ABST
Patent Text Reader

Abstract

The present application discloses a spatial positioning method, device and system. In this solution, the acceleration sensor and gyroscope of an electronic device are used to determine the change information of the position and attitude of the electronic device, and based on the change information of the position and attitude of the electronic device, the position and attitude information of the electronic device in the virtual space is determined, thereby realizing the determination of the change of the position and attitude of an object in the virtual space by detecting the change information of the position and attitude of the electronic device, realizing the positioning of an object in the virtual space by the electronic device, which can be achieved only by an electronic device including an acceleration sensor and a gyroscope, without using a dedicated spatial positioning device, ensuring the universality of the device capable of positioning an object in the virtual space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic information technology, and in particular, to a spatial positioning method, device, and system. Background Art

[0002] With the rise of technologies such as VR, MR, AR, and XR, technicians are urgently in need of adding more immersive experience solutions. For traditional games, control can be achieved through a mouse or keyboard, while for virtual technologies, in order to achieve a better experience effect, spatial positioning is required.

[0003] However, in existing solutions for virtual spatial positioning, dedicated spatial positioning technologies such as Htc LightHouse, Sony PS Move, UWB, lasers, or lidar are usually adopted. Since dedicated spatial positioning technologies require dedicated equipment support, they are not universal. Summary of the Invention

[0004] In view of this, this application provides a spatial positioning method, device, and system, and its specific solutions are as follows:

[0005] A spatial positioning method includes:

[0006] Obtaining the acceleration detected by the acceleration sensor of the electronic device;

[0007] Based on the acceleration, determining the relative offset distance of the electronic device within a preset time interval;

[0008] Obtaining the rotation parameters detected by the gyroscope of the electronic device;

[0009] Based on the relative offset distance and the rotation parameters, determining the change information of the position and attitude of the electronic device;

[0010] Based on the change information of the position and attitude of the electronic device, determining the position and attitude information of the electronic device in the virtual space.

[0011] Further, the obtaining the acceleration detected by the acceleration sensor of the electronic device includes:

[0012] Obtaining the acceleration detected by the linear acceleration sensor of the electronic device;

[0013] And / or,

[0014] Filtering the initial acceleration detected by the acceleration sensor through a first-order low-pass filtering method to obtain the acceleration with the gravitational acceleration eliminated.

[0015] Further, it further includes:

[0016] The image acquisition device of the electronic device tracks a specific object in the viewfinder, determines whether the electronic device has shifted based on the tracking information of the specific object, so that when it is determined that the electronic device has shifted, the relative shift distance of the electronic device within a preset time interval is determined based on the acceleration detected by the acceleration sensor.

[0017] Further, determining whether the electronic device has shifted based on the tracking information of the specific object includes:

[0018] The specific object is an object with a preset fixed position.

[0019] Obtain at least two frames of images of the specific object through the image acquisition device of the electronic device, and compare the specific object presented in the at least two frames of images;

[0020] If it is determined that the position and / or size of the specific object presented in the at least two frames of images has changed, determine that the electronic device has shifted based on the size change information.

[0021] Further, if it is determined that the position and / or size of the specific object presented in the at least two frames of images has changed, and determining that the electronic device has shifted based on the size change information includes:

[0022] If it is determined that the center point position of the specific object presented in the at least two frames of images has changed, determine that the electronic device has moved horizontally;

[0023] If it is determined that the size ratio of the specific object presented in the at least two frames of images has changed, determine that the electronic device has rotated;

[0024] If it is determined that the size of the specific object presented in the at least two frames of images has changed, determine that the electronic device has moved forward and backward.

[0025] Further, tracking a specific object in the viewfinder through the image acquisition device of the electronic device includes:

[0026] Obtain an image of the specific object through the image acquisition device of the electronic device;

[0027] Determine the specific object in the image based on the image recognition method, and / or determine the specific object in the image based on the image difference method.

[0028] A spatial positioning device includes:

[0029] An acceleration acquisition unit for obtaining the acceleration detected by the acceleration sensor of the electronic device;

[0030] A distance determination unit, configured to determine a relative offset distance of the electronic device within a preset time interval based on the acceleration;

[0031] A rotation parameter acquisition unit, configured to acquire rotation parameters detected by a gyroscope of the electronic device;

[0032] A change determination unit, configured to determine change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters;

[0033] A virtual change determination unit, configured to determine position and attitude information of the electronic device in a virtual space based on the change information of the position and attitude of the electronic device.

[0034] Further, it further includes:

[0035] An offset determination unit, configured to track a specific object in a viewfinder through an image acquisition device of the electronic device, and determine whether the electronic device has an offset based on the tracking information of the specific object, so as to, when it is determined that the electronic device has an offset, determine a relative offset distance of the electronic device within a preset time interval based on the acceleration detected by the acceleration sensor.

[0036] A spatial positioning system, including:

[0037] An electronic device, configured to detect acceleration through an acceleration sensor and detect rotation parameters through a gyroscope;

[0038] A spatial positioning device, configured to acquire the acceleration detected by the acceleration sensor of the electronic device; determine a relative offset distance of the electronic device within a preset time interval based on the acceleration; acquire the rotation parameters detected by the gyroscope of the electronic device; determine change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters; determine position and attitude information of the electronic device in a virtual space based on the change information of the position and attitude of the electronic device.

[0039] A storage medium, configured to store at least one set of instruction sets;

[0040] The instruction sets are used to be called and at least execute the spatial positioning method as described in any one of the above.

[0041] As can be seen from the above technical solution, the spatial positioning method, device, and system disclosed in this application obtain the acceleration detected by the acceleration sensor of the electronic device, determine the relative offset distance of the electronic device within a preset time interval based on the acceleration, obtain the rotation parameters detected by the gyroscope of the electronic device, determine the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters, and determine the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device. In this solution, the change information of the position and attitude of the electronic device is determined through the acceleration sensor and gyroscope of the electronic device, and the position and attitude information of the electronic device in the virtual space is determined based on the change information of the position and attitude of the electronic device, thereby realizing the detection of the change information of the position and attitude of the object in the virtual space by detecting the change information of the position and attitude of the electronic device, realizing the positioning of the object in the virtual space by the electronic device, which can be achieved only by means of an electronic device including an acceleration sensor and a gyroscope, without using a dedicated spatial positioning device, ensuring the universality of the device capable of positioning objects in the virtual space. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0043] Figure 1 It is a flowchart of a spatial positioning method disclosed in an embodiment of the present application;

[0044] Figure 2 It is a flowchart of a spatial positioning method disclosed in an embodiment of the present application;

[0045] Figure 3 It is a flowchart of a spatial positioning method disclosed in an embodiment of the present application;

[0046] Figure 4 It is a schematic structural diagram of a spatial positioning device disclosed in an embodiment of the present application;

[0047] Figure 5 It is a schematic structural diagram of a spatial positioning system disclosed in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0048] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0049] The present application discloses a spatial positioning method, and its flowchart is as Figure 1 shown, including:

[0050] Step S11: Obtain the acceleration detected by the acceleration sensor of the electronic device;

[0051] Step S12: Determine the relative offset distance of the electronic device within a preset time interval based on the acceleration;

[0052] Step S13: Obtain the rotation parameters detected by the gyroscope of the electronic device;

[0053] Step S14: Determine the position and attitude change information of the electronic device based on the relative offset distance and the rotation parameters;

[0054] Step S15: Determine the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device.

[0055] For virtual concert live broadcasts, virtual humans or real humans for human-computer interaction, virtual e-commerce live broadcasts, virtual hosts or real hosts for human-computer interaction, virtual somatosensory game human-computer interaction, etc., all need to rely on external dedicated somatosensory devices to achieve, that is, dedicated somatosensory devices are required to achieve the positioning of objects in the virtual space.

[0056] In this solution, the positioning of objects in the virtual space can be directly achieved by using common electronic devices, such as mobile phones, that is, any of the above scenarios can be achieved without using dedicated somatosensory devices.

[0057] As long as an acceleration sensor and a gyroscope are set in the electronic device, it can be achieved. Then, the electronic device can be a mobile phone or other common electronic devices.

[0058] Among them, the acceleration sensor is mainly used to collect the acceleration in 6 directions, namely the up, down, left, right, front, and back directions. By collecting the acceleration in 6 directions, the displacement of the electronic device within a preset time interval can be determined, including both direction and distance.

[0059] Among them, the displacement can be calculated using the following formula:

[0060]

[0061] Where s is the relative offset distance, a is the acceleration with direction, and t is the preset time interval. Using the above formula, the relative offset distance of the electronic device within the preset time interval can be determined. By accumulating the relative offset distances, the overall movement distance of the electronic device after the acceleration sensor is turned on can be determined.

[0062] The principle of the gyroscope in an electronic device is usually that an independent acceleration sensor calculates the offset angle after angular velocity integration conversion. The gyroscope can calculate stable triaxial offset angles in a short period of time. Among them, the acceleration sensor can be an acceleration sensor of the MEMS series, and the MEMS sensor is a Microelectro Mechanical Systems.

[0063] The gyroscope can detect three parameters, which represent the Euler angles of the object's rotation. By directly assigning the Euler angles to the virtual object's rotation Euler angles, the function of virtual object rotation can be realized.

[0064] After obtaining the acceleration through the acceleration sensor of the electronic device, calculating the relative offset distance, obtaining the Euler angles through the rotation sensor of the gyroscope of the electronic device, and calculating the rotation values, the position change and attitude change of the electronic device can be determined based on the relative offset distance and the rotation values. Thus, the spatial coordinates and rotation values of the electronic device can be determined. Uploading these data to the virtual space can determine the coordinates and rotation values of the object in the virtual space.

[0065] Specifically, a 3D program is established. The 3D program can construct virtual scenes and other functions through virtual technology. Connect the specific application of the electronic device to the 3D program, and establish network communication between the specific application of the electronic device and the 3D program through Socket. Among them, the network data to be uploaded to the virtual space includes: three floating-point data, which represent three coordinate values, and three floating-point data, which represent triaxial Euler angles. The data is uploaded to the 3D program through two instructions, and the two instructions are rotation and movement operations respectively. After receiving the data, the 3D program assigns the received data to the virtual object to be controlled, controls the virtual object to perform rotation and movement operations, assigns the coordinates to the Position of the virtual object to realize the movement of the virtual object's position, and assigns the triaxial Euler angles to EulerAngle to realize the rotation of the virtual object. Through the above method, the positioning of the virtual object in the virtual space can be completed.

[0066] The positioning of the virtual object in the virtual space is realized through an electronic device, such as a mobile phone. Since the electronic device only needs to have an acceleration sensor and a gyroscope, the electronic device is relatively popular, making it relatively convenient to position the virtual object in the virtual space.

[0067] It should be noted that to implement the positioning of virtual objects in a virtual space through an electronic device, it is first necessary to determine the virtual objects to be positioned. Then, the electronic device in the physical space is defined as a virtual object in the virtual space. After that, the position and attitude changes of the virtual object in the virtual space can be determined by using the position and attitude changes of the electronic device, so as to determine the position and attitude of the virtual object in the virtual space.

[0068] For the positioning of virtual objects in different scenarios, the same electronic device can be defined as different virtual objects in different virtual scenarios. Or, in the same virtual scenario, by defining the same electronic device as different virtual objects, the spatial positioning of different virtual objects can be determined in sequence through the same electronic device. Specifically, the above 3D program can be used to define different virtual objects for the electronic device. When the virtual object corresponding to the electronic device changes, the positioning of the virtual object corresponding to the electronic device starts over.

[0069] The spatial positioning method disclosed in this embodiment obtains the acceleration detected by the acceleration sensor of the electronic device, determines the relative offset distance of the electronic device within a preset time interval based on the acceleration, obtains the rotation parameters detected by the gyroscope of the electronic device, determines the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters, and determines the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device. In this solution, the change information of the position and attitude of the electronic device is determined through the acceleration sensor and gyroscope of the electronic device, and the position and attitude information of the electronic device in the virtual space is determined based on the change information of the position and attitude of the electronic device. Thus, by detecting the change information of the position and attitude of the electronic device, the change of the position and attitude of the object in the virtual space is determined, and the positioning of the object in the virtual space is realized through the electronic device. It can be realized only by using an electronic device equipped with an acceleration sensor and a gyroscope, without using a dedicated spatial positioning device, ensuring the universality of the device capable of positioning objects in the virtual space.

[0070] This embodiment discloses a spatial positioning method, and its flowchart is as Figure 2 shown, including:

[0071] Step S21: Obtain the acceleration detected by the linear acceleration sensor of the electronic device;

[0072] Step S22: Determine the relative offset distance of the electronic device within a preset time interval based on the acceleration;

[0073] Step S23: Obtain the rotation parameters detected by the gyroscope of the electronic device;

[0074] Step S24: Determine the position and attitude change information of the electronic device based on the relative offset distance and rotation parameters;

[0075] Step S25: Determine the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device.

[0076] The acceleration sensors in an electronic device usually include three types of acceleration sensors, such as: a gravity acceleration sensor, which is only used to detect the influence of gravity on the acceleration of the electronic device; a linear acceleration sensor, which is used to detect the influence of other forces except gravity on the acceleration of the electronic device; a general acceleration sensor, which can detect the influence of all forces on the acceleration of the electronic device.

[0077] In the actual use process, gravity will affect the detection of acceleration. In order to eliminate the influence of gravity, the linear acceleration sensor in the electronic device can be directly selected for the detection of acceleration. Since the linear acceleration sensor detects the influence of other forces except gravity on the acceleration of the electronic device, therefore, what the linear acceleration sensor detects directly is the influence of other forces on the acceleration of the electronic device after eliminating the influence of gravity. Therefore, the detected acceleration is the acceleration without the influence of gravity.

[0078] Or, the general acceleration sensor can also be directly used. Since the acceleration detected by the general acceleration sensor is the acceleration affected by gravity, therefore, the initial acceleration detected by the general acceleration sensor is filtered by a first-order low-pass filter method to obtain the acceleration after eliminating the influence of gravity, so as to ensure that the finally obtained acceleration is the acceleration not affected by gravity.

[0079] In addition, during the acceleration calculation process, rotation will also affect the acceleration. In order to eliminate the influence of rotation on the acceleration, the rotation sensor of the gyroscope can be used, that is, the three-axis rotation angular velocity is obtained through the rotation sensor of the gyroscope, and then the three-axis rotation angular velocity is calculated to obtain the acceleration after eliminating the influence of rotation.

[0080] The calculation through the three-axis angular velocity can be carried out by the following formula:

[0081] Ax' = lg * cos(pitch)

[0082] Ay' = lg * cos(roll)

[0083] Az' = lg * cos(yaw)

[0084] Among them, pitch is the pitch angle of rotation around the x-axis, roll is the roll angle of rotation around the z-axis, and yaw is the yaw angle of rotation around the y-axis. Correspondingly, Ax' is the angular velocity of rotation around the x-axis, Ay' is the angular velocity of rotation around the y-axis, and Az' is the angular velocity of rotation around the z-axis.

[0085] The spatial positioning method disclosed in this embodiment obtains the acceleration detected by the acceleration sensor of the electronic device, determines the relative offset distance of the electronic device within a preset time interval based on the acceleration, obtains the rotation parameters detected by the gyroscope of the electronic device, determines the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters, and determines the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device. In this solution, the change information of the position and attitude of the electronic device is determined through the acceleration sensor and the gyroscope of the electronic device, and the position and attitude information of the electronic device in the virtual space is determined based on the change information of the position and attitude of the electronic device, thereby realizing the detection of the change of the position and attitude of the object in the virtual space by detecting the change information of the position and attitude of the electronic device, and realizing the positioning of the object in the virtual space by the electronic device. It can be achieved only by using an electronic device equipped with an acceleration sensor and a gyroscope, without using a dedicated spatial positioning device, ensuring the universality of the device capable of positioning objects in the virtual space.

[0086] This embodiment discloses a spatial positioning method, and its flowchart is as Figure 3 shown, including:

[0087] Step S31: Track a specific object in the viewfinder through the image acquisition device of the electronic device, and determine whether the electronic device has shifted based on the tracking information of the specific object;

[0088] Step S32: If it is determined that the electronic device has shifted, determine the relative offset distance of the electronic device within a preset time interval based on the acceleration detected by the acceleration sensor;

[0089] Step S33: Obtain the rotation parameters detected by the gyroscope of the electronic device;

[0090] Step S34: Determine the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters;

[0091] Step S35: Determine the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device.

[0092] The acceleration sensor and gyroscope of an electronic device can accurately measure the position and attitude changes of the electronic device. However, whether the electronic device has moved cannot be determined by the acceleration sensor and gyroscope. If one wants to determine whether the electronic device has moved through the acceleration sensor and gyroscope, the acceleration sensor and gyroscope need to be in an operating state all the time, constantly determining the data of the position and attitude of the electronic device. Only in this way can it be determined whether the electronic device has moved. However, this will lead to an increase in the amount of data processing. To avoid this problem, it is possible to determine whether the position of the electronic device has changed through the parameters obtained by the image acquisition device of the electronic device.

[0093] Specifically, a specific object is preset. The position of this specific object will not change, that is, under any circumstances, the position of the specific object is fixed. The specific object can be: a tree, a sculpture, a building, etc.

[0094] Collect the image of the specific object through the image acquisition device of the electronic device, and track the specific object, so as to determine whether the position or shape of the specific object has changed in the image collected by the image acquisition device. As long as the position or shape of the specific object has changed in the image collected by the image acquisition device, since the position of the specific object itself will not change, then it can be directly determined that the position or shape of the electronic device has changed. Since the position or shape of the electronic device has changed, then the position or shape presented by the specific object with a fixed position collected by the image acquisition device of the electronic device in the image will change. From this, it can be determined that the electronic device has shifted.

[0095] After it is determined through the image acquisition device of the electronic device that the electronic device has shifted, then in combination with the acceleration sensor and gyroscope of the electronic device, further determine the distance and direction of the shift of the electronic device, so as to determine the shift of the virtual object in the virtual space and the position and shape after the shift.

[0096] Specifically, tracking the specific object through the image acquisition device of the electronic device can be specifically: obtaining the image of the specific object through the image acquisition device of the electronic device, determining the specific object in the image based on the image recognition method, and / or determining the specific object in the image based on the image difference method.

[0097] Specifically, the method of tracking an object can be: if in a green screen environment, first use the image difference algorithm and the green screen keying algorithm to extract the object in the image collected by the image acquisition device, then use the contour tracking method to outline the contour of the object, calculate the bounding box information of the object in the two-dimensional image through AABB in image processing, and determine the change of the specific object through the bounding box information, so as to realize the tracking of the specific object;

[0098] In a non-green screen environment, a specific object can be tracked through object image recognition, and then the object can be cropped from the image through the above method to determine the bounding box information of the object. The change of the specific object can be determined through the bounding box information, so as to realize the tracking of the specific object.

[0099] In addition, determining whether the electronic device has shifted based on the tracking information of the specific object includes: obtaining at least two frames of images of the specific object through the image acquisition device of the electronic device, comparing the specific objects presented in the at least two frames of images. If it is determined that the position and / or size of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has shifted based on the size change information.

[0100] Tracking a specific object through the image acquisition device requires acquiring multiple frames of images of the specific object, comparing the multiple frames of images, and determining whether the position and / or size of the specific object in the consecutive multiple frames of images has changed. Whether the position or the size of the specific object in the multiple frames of images has changed can indicate that the electronic device has shifted. Based on the conclusion that the electronic device has shifted, the distance and direction of the shift of the electronic device can be determined by combining the acceleration sensor and gyroscope of the electronic device.

[0101] If it is determined that the center point position of the specific object presented in the at least two frames of images has changed, it can be determined that the electronic device has moved in a plane; if it is determined that the size ratio of the specific object presented in the at least two frames of images has changed, it can be determined that the electronic device has rotated; if it is determined that the size of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has moved forward and backward.

[0102] Determine the bounding box of the specific object in each frame of the image obtained by the image acquisition device. Based on the bounding box information, the four vertices and the lengths of the four sides of the quadrilateral and the coordinates of the center point of the bounding box can be determined.

[0103] Through the comparison of two consecutive frames of images obtained by the image acquisition device, compare the lengths of the four sides of the bounding box in the current frame image with the lengths of the four sides of the bounding box in the previous frame image, compare the center point position of the bounding box in the current frame image with the center point position of the bounding box in the previous frame image, and compare the ratio of the lengths of different sides of the bounding box in the current frame image with the ratio of the lengths of different sides of the bounding box in the previous frame image.

[0104] If it is determined that the lengths of the four sides of the bounding box in the current frame image are greater than those of the bounding box in the previous frame image, it can be determined that the electronic device is moving forward, i.e., moving forward towards the image acquisition device side. At this time, for two consecutive frame images, the specific object is in an enlarged state; if it is determined that the lengths of the four sides of the bounding box in the current frame image are less than those of the bounding box in the previous frame image, it can be determined that the electronic device is moving backward, i.e., moving backward towards the image acquisition device side. At this time, for two consecutive frame images, the specific object is in a reduced state;

[0105] If it is determined that the left side length of the bounding box in the current frame image is greater than that of the bounding box in the previous frame image, while the right side length of the bounding box in the current frame image is less than that of the bounding box in the previous frame image, it indicates that the electronic device rotates to the right side of the image acquisition device; if it is determined that the left side length of the bounding box in the current frame image is less than that of the bounding box in the previous frame image, while the right side length of the bounding box in the current frame image is greater than that of the bounding box in the previous frame image, it indicates that the electronic device rotates to the left side of the image acquisition device;

[0106] If it is determined that the upper side length of the bounding box in the current frame image is greater than that of the bounding box in the previous frame image, while the lower side length of the bounding box in the current frame image is less than that of the bounding box in the previous frame image, it indicates that the electronic device rotates downward towards the image acquisition device; if it is determined that the upper side length of the bounding box in the current frame image is less than that of the bounding box in the previous frame image, while the lower side length of the bounding box in the current frame image is greater than that of the bounding box in the previous frame image, it indicates that the electronic device rotates upward towards the image acquisition device;

[0107] If it is determined that the center point of the bounding box in the current frame image has an offset in the up, down, left, or right direction relative to the center point of the bounding box in the previous frame image, it indicates that the electronic device moves in the corresponding up, down, left, or right direction.

[0108] In this embodiment, at least two frame images are obtained through the image acquisition device, and the obtained at least two frame images are compared in the above manner to determine whether the electronic device has an offset or rotation; when it is determined that the electronic device has moved, the acceleration sensor is used to calculate to determine the moving distance, which can be determined through the displacement calculation formula; when it is determined that the electronic device has rotated, the three-axis rotation angular velocity is obtained through the rotation sensor of the gyroscope, and then the acceleration change amounts of the three components are determined through the three-axis rotation angular velocity to obtain the acceleration after eliminating the rotation influence; and further, after determining the angular velocity, it is sent to the rendering end through the network, the Euler angle is recalculated through the angle, and the offset distance is also sent to the rendering end through the network for calculating the offset accumulation, so as to realize the repositioning of the electronic device.

[0109] The spatial positioning method disclosed in this embodiment obtains the acceleration detected by the acceleration sensor of the electronic device, determines the relative offset distance of the electronic device within a preset time interval based on the acceleration, obtains the rotation parameters detected by the gyroscope of the electronic device, determines the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters, and determines the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device. In this solution, the change information of the position and attitude of the electronic device is determined by the acceleration sensor and the gyroscope of the electronic device, and the position and attitude information of the electronic device in the virtual space is determined based on the change information of the position and attitude of the electronic device, thereby realizing the detection of the change information of the position and attitude of the object in the virtual space by detecting the change information of the position and attitude of the electronic device, realizing the positioning of the object in the virtual space by the electronic device, which can be realized only by means of an electronic device including an acceleration sensor and a gyroscope, without using a dedicated spatial positioning device, ensuring the universality of the device capable of positioning objects in the virtual space.

[0110] This embodiment discloses a spatial positioning device, and its structural schematic diagram is as Figure 4 shown, including:

[0111] An acceleration acquisition unit 41, a distance determination unit 42, a rotation parameter acquisition unit 43, a change determination unit 44 and a virtual change determination unit 45.

[0112] Among them, the acceleration acquisition unit 41 is used to obtain the acceleration detected by the acceleration sensor of the electronic device;

[0113] The distance determination unit 42 is used to determine the relative offset distance of the electronic device within a preset time interval based on the acceleration;

[0114] The rotation parameter acquisition unit 43 is used to obtain the rotation parameters detected by the gyroscope of the electronic device;

[0115] The change determination unit 44 is used to determine the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters;

[0116] The virtual change determination unit 45 is used to determine the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device.

[0117] For virtual concert live broadcasts, virtual humans or real humans for human-computer interaction, virtual e-commerce live broadcasts, virtual hosts or real hosts for human-computer interaction, virtual somatosensory game human-computer interaction, etc., all need to rely on external dedicated somatosensory devices to achieve, that is, dedicated somatosensory devices are required to achieve the positioning of objects in the virtual space.

[0118] In this solution, a common electronic device, such as a mobile phone, can be directly used to achieve the positioning of objects in the virtual space, realizing any of the above scenarios without using a dedicated somatosensory device.

[0119] As long as an acceleration sensor and a gyroscope are set in the electronic device, it can be achieved. Then, the electronic device can be a mobile phone or other common electronic devices.

[0120] Among them, the acceleration sensor is mainly used to collect the acceleration in 6 directions, namely the 6 directions of up, down, left, right, front, and back. By collecting the acceleration in these 6 directions, the displacement of the electronic device within a preset time interval can be determined, including both direction and distance.

[0121] Among them, the displacement can be calculated using the following formula:

[0122]

[0123] Among them, s is the relative offset distance, a is the acceleration including direction, t is the preset time interval. Using the above formula, the relative offset distance of the electronic device within the preset time interval can be determined. By accumulating the relative offset distances, the overall moving distance of the electronic device after turning on the acceleration sensor can be determined.

[0124] The principle of the gyroscope in the electronic device is usually that an independent acceleration sensor calculates the offset angle through angular velocity integration. The gyroscope can calculate stable triaxial offset angles in a short period of time. Among them, the acceleration sensor can use an acceleration sensor of the MEMS series. Among them, the MEMS sensor is a Microelectro Mechanical Systems.

[0125] The gyroscope can detect three parameters, and these three parameters represent the Euler angles of the object's rotation. Assigning the Euler angles directly to the virtual object's rotation Euler angles can realize the function of virtual object rotation.

[0126] By obtaining the acceleration through the acceleration sensor of the electronic device, calculating the relative offset distance, obtaining the Euler angles through the rotation sensor of the gyroscope of the electronic device, and calculating the rotation value, based on the relative offset distance and the rotation value, the position change and attitude change of the electronic device can be determined, so that the spatial coordinates and rotation value of the electronic device can be determined. Uploading these data to the virtual space can determine the coordinates and rotation value of the object in the virtual space.

[0127] Specifically, a 3D program is established. The 3D program can construct virtual scenes and other functions through virtual technology, connect a specific application of the electronic device to the 3D program, and establish network communication between the specific application of the electronic device and the 3D program through Socket. Among them, the network data to be uploaded to the virtual space includes: three floating-point data, which represent three coordinate values, and three floating-point data, which represent three-axis Euler angles. The data is uploaded to the 3D program through two instructions, which are rotation and movement operations respectively. After receiving the data, the 3D program assigns the received data to the virtual object to be controlled, controls the virtual object to perform rotation and movement operations, assigns the coordinates to the Position of the virtual object to achieve the movement of the virtual object's position, and assigns the three-axis Euler angles to EulerAngle to achieve the rotation of the virtual object. In the above way, the positioning of the virtual object in the virtual space can be completed.

[0128] The positioning of the virtual object in the virtual space is realized through an electronic device, such as a mobile phone. Since the electronic device only needs to be equipped with an acceleration sensor and a gyroscope, the electronic device is relatively popular, making it relatively convenient to position the virtual object in the virtual space.

[0129] It should be noted that to realize the positioning of the virtual object in the virtual space through an electronic device, first, the virtual object to be positioned needs to be determined. Then, the electronic device in the physical space is defined as the virtual object in the virtual space. After that, the position and attitude changes of the virtual object in the virtual space can be determined by using the position and attitude changes of the electronic device, so as to determine the position and attitude of the virtual object in the virtual space.

[0130] For the positioning of virtual objects in different scenarios, the same electronic device can be defined as different virtual objects in different virtual scenarios. Or, in the same virtual scenario, the same electronic device can be defined as different virtual objects, so as to realize that different virtual objects' spatial positioning can be determined in sequence through the same electronic device. Specifically, the above 3D program can be used to define different virtual objects for the electronic device. When the virtual object corresponding to the electronic device changes, the positioning of the virtual object corresponding to the electronic device starts over.

[0131] Furthermore, the acceleration acquisition unit is used to: obtain the acceleration detected by the linear acceleration sensor of the electronic device; and / or, filter the initial acceleration detected by the acceleration sensor through a first-order low-pass filter to obtain the acceleration with the gravitational acceleration eliminated.

[0132] Acceleration sensors in electronic devices usually include three types of acceleration sensors, such as: a gravity acceleration sensor, which is only used to detect the influence of gravity on the acceleration of the electronic device; a linear acceleration sensor, which is used to detect the influence of other forces except gravity on the acceleration of the electronic device; a general acceleration sensor, which can detect the influence of all forces on the acceleration of the electronic device.

[0133] During actual use, gravity will affect the detection of acceleration. In order to eliminate the influence of gravity, a linear acceleration sensor in the electronic device can be directly selected for acceleration detection. Since the linear acceleration sensor detects the influence of other forces except gravity on the acceleration of the electronic device, the acceleration detected by the linear acceleration sensor is directly the influence of other forces on the acceleration of the electronic device after eliminating the influence of gravity. Therefore, the detected acceleration is the acceleration without the influence of gravity.

[0134] Alternatively, a general acceleration sensor can also be directly used. Since the acceleration detected by the general acceleration sensor is the acceleration affected by gravity, the initial acceleration detected by the general acceleration sensor is filtered by a first-order low-pass filtering method to obtain the acceleration after eliminating the influence of gravity, so as to ensure that the finally obtained acceleration is the acceleration not affected by gravity.

[0135] In addition, during the acceleration calculation process, rotation will also affect the acceleration. To eliminate the influence of rotation on the acceleration, a rotation sensor of the gyroscope can be used, that is, the triaxial rotation angular velocity is obtained through the rotation sensor of the gyroscope, and then the acceleration after eliminating the influence of rotation is calculated through the triaxial rotation angular velocity.

[0136] The calculation through the triaxial angular velocity can be carried out by the following formula:

[0137] Ax' = lg * cos(pitch)

[0138] Ay' = lg * cos(roll)

[0139] Az' = lg * cos(yaw)

[0140] Where pitch is the pitch angle of rotation around the x-axis, roll is the roll angle of rotation around the z-axis, yaw is the yaw angle of rotation around the y-axis. Correspondingly, Ax' is the angular velocity of rotation around the x-axis, Ay' is the angular velocity of rotation around the y-axis, and Az' is the angular velocity of rotation around the z-axis.

[0141] Furthermore, the spatial positioning device disclosed in this embodiment further includes: an offset determination unit.

[0142] The offset determination unit is used to track a specific object in the viewfinder through the image acquisition device of the electronic device, and determine whether the electronic device has an offset based on the tracking information of the specific object, so that when it is determined that the electronic device has an offset, the relative offset distance of the electronic device within a preset time interval can be determined based on the acceleration detected by the acceleration sensor.

[0143] The position and attitude changes of the electronic device can be accurately measured through the acceleration sensor and gyroscope of the electronic device. However, whether the electronic device has moved cannot be judged by the acceleration sensor and gyroscope. If it is necessary to judge whether the electronic device has moved through the acceleration sensor and gyroscope, the acceleration sensor and gyroscope need to be always in operation, and always determine the data of the position and attitude of the electronic device. Only in this way can it be determined whether the electronic device has moved. However, this will lead to an increase in the amount of data processing. To avoid this problem, it is possible to determine whether the position of the electronic device has changed through the parameters obtained by the image acquisition device of the electronic device.

[0144] Specifically, a specific object is preset. The position of this specific object will not change, that is, no matter what the situation is, the position of the specific object is fixed. The specific object can be: a tree, a sculpture, a building, etc.

[0145] Collect the image of the specific object through the image acquisition device of the electronic device, track the specific object, and thus determine whether the position or shape of the specific object has changed in the image collected by the image acquisition device. As long as the position or shape of the specific object has changed in the image collected by the image acquisition device, since the position of the specific object itself will not change, then it can be directly determined that the position or shape of the electronic device has changed. Since the position or shape of the electronic device has changed, then the position or shape presented by the specific object with a fixed position collected by the image acquisition device of the electronic device in the image will change, and thus it can be determined that the electronic device has an offset.

[0146] After it is determined that the electronic device has an offset through the image acquisition device of the electronic device, further combine the acceleration sensor and gyroscope of the electronic device to determine the distance and direction of the offset of the electronic device, so as to determine the offset of the virtual object in the virtual space and the position and shape after the offset.

[0147] Specifically, tracking a specific object in the viewfinder through the image acquisition device of the electronic device can be specifically: obtaining the image of the specific object through the image acquisition device of the electronic device, and determining the specific object in the image based on the image recognition method, and / or determining the specific object in the image based on the image difference method.

[0148] Specifically, the method for tracking an object can be as follows: In a green screen environment, first, use the image difference algorithm and the green screen keying algorithm to extract the object in the image collected by the image acquisition device, then use the contour tracking method to outline the contour of the object, calculate the bounding box information of the object in the two-dimensional image through AABB in image processing, and determine the change of the specific object through the bounding box information, so as to realize the tracking of the specific object;

[0149] In a non-green screen environment, the specific object can be tracked by the object image recognition method, and then the object can be extracted from the image by the above method to determine the bounding box information of the object, and the change of the specific object can be determined through the bounding box information, so as to realize the tracking of the specific object.

[0150] In addition, determining whether the electronic device has shifted based on the tracking information of the specific object includes: obtaining at least two frames of images of the specific object through the image acquisition device of the electronic device, comparing the specific objects presented in the at least two frames of images, and if it is determined that the position and / or size of the specific object presented in the at least two frames of images has changed, determining that the electronic device has shifted based on the size change information.

[0151] Tracking a specific object through the image acquisition device requires collecting multiple frames of images of the specific object, comparing the multiple frames of images, and determining whether the position and / or size of the specific object in the consecutive multiple frames of images has changed. Whether the position or the size of the specific object in the multiple frames of images has changed, it can indicate that the electronic device has shifted. Based on the conclusion that the electronic device has shifted, the distance and direction of the shift of the electronic device can be determined by combining the acceleration sensor and the gyroscope of the electronic device.

[0152] If it is determined that the center point position of the specific object presented in at least two frames of images has changed, it can be determined that the electronic device has moved horizontally; if it is determined that the size ratio of the specific object presented in at least two frames of images has changed, it can be determined that the electronic device has rotated; if it is determined that the size of the specific object presented in at least two frames of images has changed, it is determined that the electronic device has moved forward and backward.

[0153] Determine the bounding box of the specific object in each frame of image obtained by the image acquisition device. Based on the bounding box information, the four vertices and the lengths of the four sides of the quadrilateral and the coordinates of the center point of the bounding box can be determined.

[0154] Through the comparison of two consecutive frames of images obtained by the image acquisition device, compare the lengths of the four sides of the bounding box in the current frame of image with the lengths of the four sides of the bounding box in the previous frame of image, compare the center point position of the bounding box in the current frame of image with the center point position of the bounding box in the previous frame of image, and compare the ratio of the lengths of different sides of the bounding box in the current frame of image with the ratio of the lengths of different sides of the bounding box in the previous frame of image.

[0155] If it is determined that the lengths of the four sides of the bounding box in the current frame image are greater than those of the bounding box in the previous frame image, it can be determined that the electronic device is moving forward, moving forward towards the image acquisition device side. At this time, for two consecutive frame images, the specific object is in an enlarged state; if it is determined that the lengths of the four sides of the bounding box in the current frame image are less than those of the bounding box in the previous frame image, it can be determined that the electronic device is moving backward, moving backward towards the rear of the image acquisition device side. At this time, for two consecutive frame images, the specific object is in a reduced state;

[0156] If it is determined that the length of the left side of the bounding box in the current frame image is greater than that of the left side of the bounding box in the previous frame image, and the length of the right side of the bounding box in the current frame image is less than that of the right side of the bounding box in the previous frame image, it indicates that the electronic device rotates to the right side of the image acquisition device; if it is determined that the length of the left side of the bounding box in the current frame image is less than that of the left side of the bounding box in the previous frame image, and the length of the right side of the bounding box in the current frame image is greater than that of the right side of the bounding box in the previous frame image, it indicates that the electronic device rotates to the left side of the image acquisition device;

[0157] If it is determined that the length of the upper side of the bounding box in the current frame image is greater than that of the upper side of the bounding box in the previous frame image, and the length of the lower side of the bounding box in the current frame image is less than that of the lower side of the bounding box in the previous frame image, it indicates that the electronic device rotates downward of the image acquisition device; if it is determined that the length of the upper side of the bounding box in the current frame image is less than that of the upper side of the bounding box in the previous frame image, and the length of the lower side of the bounding box in the current frame image is greater than that of the lower side of the bounding box in the previous frame image, it indicates that the electronic device rotates upward of the image acquisition device;

[0158] If it is determined that the center point of the bounding box in the current frame image has an offset in the up, down, left, or right direction relative to the center point of the bounding box in the previous frame image, it indicates that the electronic device moves in the corresponding up, down, left, or right direction.

[0159] In this embodiment, at least two frame images are obtained through the image acquisition device, and the obtained at least two frame images are compared in the above manner to determine whether the electronic device has an offset or rotation; and when it is determined that the electronic device moves, the acceleration sensor is used to calculate to determine the moving distance, which can be determined through the displacement calculation formula; when it is determined that the electronic device rotates, the three-axis rotation angular velocity is obtained through the rotation sensor of the gyroscope, and then the acceleration change amounts of the three components are determined through the three-axis rotation angular velocity to obtain the acceleration after eliminating the rotation influence; and further after determining the angular velocity, it is sent to the rendering end through the network, the Euler angle is recalculated through the angle, and the offset distance is also sent to the rendering end through the network for calculating the offset accumulation, so as to realize the repositioning of the electronic device.

[0160] The spatial positioning device disclosed in this embodiment obtains the acceleration detected by the acceleration sensor of the electronic device, determines the relative offset distance of the electronic device within a preset time interval based on the acceleration, obtains the rotation parameters detected by the gyroscope of the electronic device, determines the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters, and determines the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device. In this solution, the change information of the position and attitude of the electronic device is determined through the acceleration sensor and the gyroscope of the electronic device, and the position and attitude information of the electronic device in the virtual space is determined based on the change information of the position and attitude of the electronic device, thereby realizing the detection of the change of the position and attitude of the object in the virtual space by detecting the change information of the position and attitude of the electronic device, realizing the positioning of the object in the virtual space by the electronic device, which can be achieved only by means of an electronic device including an acceleration sensor and a gyroscope, without using a dedicated spatial positioning device, ensuring the universality of the device capable of positioning objects in the virtual space.

[0161] This embodiment discloses a spatial positioning system, and its structural schematic diagram is as Figure 5 shown, including:

[0162] An electronic device 51 and a spatial positioning device 52.

[0163] Among them, the electronic device 51 is used to detect acceleration through an acceleration sensor and detect rotation parameters through a gyroscope;

[0164] The spatial positioning device 52 is used to obtain the acceleration detected by the acceleration sensor of the electronic device; determine the relative offset distance of the electronic device within a preset time interval based on the acceleration; obtain the rotation parameters detected by the gyroscope of the electronic device; determine the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters; determine the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device.

[0165] Further, the electronic device detects acceleration through an acceleration sensor, including: the electronic device detects acceleration through a linear acceleration sensor, and / or filters the initial acceleration detected by the acceleration sensor by a first-order low-pass filtering method to obtain the acceleration after eliminating the gravitational acceleration.

[0166] Further, the spatial positioning device is also used for:

[0167] The image acquisition device of the electronic device tracks a specific object in the viewfinder, and determines whether the electronic device has shifted based on the tracking information of the specific object, so that when it is determined that the electronic device has shifted, the relative shift distance of the electronic device within a preset time interval is determined based on the acceleration detected by the acceleration sensor.

[0168] Further, the spatial positioning device determines whether the electronic device has shifted based on the tracking information of the specific object, including:

[0169] The specific object is an object with a preset fixed position.

[0170] The image acquisition device of the electronic device obtains at least two frames of images of the specific object, and compares the specific object presented in the at least two frames of images; if it is determined that the position and / or size of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has shifted based on the size change information.

[0171] Further, if the spatial positioning device determines that the position and / or size of the specific object presented in the at least two frames of images has changed, and determines that the electronic device has shifted based on the size change information, including:

[0172] If the spatial positioning device determines that the center point position of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has moved in a plane; if it is determined that the size ratio of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has rotated; if it is determined that the size of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has moved forward and backward.

[0173] Further, the spatial positioning device tracks a specific object in the viewfinder through the image acquisition device of the electronic device, including:

[0174] The spatial positioning device obtains an image of the specific object through the image acquisition device of the electronic device; determines the specific object in the image based on the image recognition method, and / or determines the specific object in the image based on the image difference method.

[0175] The spatial positioning system based on this embodiment is implemented based on the spatial positioning method disclosed in the above embodiment, and will not be elaborated here.

[0176] The spatial positioning system disclosed in this embodiment obtains the acceleration detected by the acceleration sensor of the electronic device, determines the relative offset distance of the electronic device within a preset time interval based on the acceleration, obtains the rotation parameters detected by the gyroscope of the electronic device, determines the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters, and determines the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device. In this solution, the change information of the position and attitude of the electronic device is determined through the acceleration sensor and the gyroscope of the electronic device, and the position and attitude information of the electronic device in the virtual space is determined based on the change information of the position and attitude of the electronic device, thereby realizing the detection of the change of the position and attitude of the object in the virtual space by detecting the change information of the position and attitude of the electronic device, and realizing the positioning of the object in the virtual space by the electronic device. It can be achieved only by means of an electronic device including an acceleration sensor and a gyroscope, without the use of a dedicated spatial positioning device, ensuring the universality of the device capable of positioning objects in the virtual space.

[0177] This embodiment discloses a storage medium for storing at least a set of instruction sets, and the instruction sets are used to be called and at least execute the spatial positioning method as described in any one of the above.

[0178] In this specification, each embodiment is described in a progressive manner. The key point of each embodiment is the difference from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0179] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0180] The steps of the method or algorithm described in combination with the embodiments disclosed in this article can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0181] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A spatial positioning method, characterized in that, it includes: obtaining the acceleration detected by the acceleration sensor of the electronic device; determining the relative offset distance of the electronic device within a preset time interval based on the acceleration; obtaining the rotation parameters detected by the gyroscope of the electronic device; determining the change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters; determining the position and attitude information of the electronic device in the virtual space based on the change information of the position and attitude of the electronic device; It further includes: tracking a specific object in the viewfinder through the image acquisition device of the electronic device, and determining whether the electronic device has shifted based on the tracking information of the specific object, so that when it is determined that the electronic device has shifted, the relative offset distance of the electronic device within a preset time interval is determined based on the acceleration detected by the acceleration sensor.

2. The method according to claim 1, characterized in that, the obtaining the acceleration detected by the acceleration sensor of the electronic device includes: obtaining the acceleration detected by the linear acceleration sensor of the electronic device; and / or, filtering the initial acceleration detected by the acceleration sensor through a first-order low-pass filtering method to obtain the acceleration with the gravitational acceleration eliminated.

3. The method according to claim 1, characterized in that, the determining whether the electronic device has shifted based on the tracking information of the specific object includes: the specific object is a pre-set object with a fixed position, obtaining at least two frames of images of the specific object through the image acquisition device of the electronic device, and comparing the specific object presented in the at least two frames of images; if it is determined that the position and / or size of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has shifted based on the size change information.

4. The method according to claim 3, characterized in that, the if it is determined that the position and / or size of the specific object presented in the at least two frames of images has changed, and it is determined that the electronic device has shifted based on the size change information includes: if it is determined that the center point position of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has undergone a planar movement; if it is determined that the size ratio of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has rotated; if it is determined that the size of the specific object presented in the at least two frames of images has changed, it is determined that the electronic device has moved forward and backward.

5. The method according to claim 1, characterized in that, the tracking a specific object in the viewfinder through the image acquisition device of the electronic device includes: obtaining an image of the specific object through the image acquisition device of the electronic device; determining the specific object in the image based on an image recognition method, and / or determining the specific object in the image based on an image difference method.

6. A spatial positioning device, characterized in that, it includes: an acceleration obtaining unit for obtaining the acceleration detected by the acceleration sensor of the electronic device; A distance determination unit, configured to determine a relative offset distance of the electronic device within a preset time interval based on the acceleration; A rotation parameter acquisition unit, configured to acquire rotation parameters detected by a gyroscope of the electronic device; A change determination unit, configured to determine change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters; A virtual change determination unit, configured to determine position and attitude information of the electronic device in a virtual space based on the change information of the position and attitude of the electronic device; It further includes: An offset determination unit, configured to track a specific object in a viewfinder through an image acquisition device of the electronic device, and determine whether the electronic device has an offset based on the tracking information of the specific object, so as to, when it is determined that the electronic device has an offset, determine a relative offset distance of the electronic device within a preset time interval based on the acceleration detected by the acceleration sensor.

7. A spatial positioning system, characterized in that, it includes: An electronic device, configured to detect acceleration through an acceleration sensor and detect rotation parameters through a gyroscope; A spatial positioning device, configured to track a specific object in a viewfinder through an image acquisition device of the electronic device, determine whether the electronic device has an offset based on the tracking information of the specific object, so as to, when it is determined that the electronic device has an offset, determine a relative offset distance of the electronic device within a preset time interval based on the acceleration detected by the acceleration sensor; acquire the acceleration detected by the acceleration sensor of the electronic device; determine a relative offset distance of the electronic device within a preset time interval based on the acceleration; acquire rotation parameters detected by the gyroscope of the electronic device; determine change information of the position and attitude of the electronic device based on the relative offset distance and the rotation parameters; determine position and attitude information of the electronic device in a virtual space based on the change information of the position and attitude of the electronic device.

8. A storage medium, configured to store at least one set of instruction sets; The instruction sets are used to be called and at least execute the spatial positioning method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Determination method and apparatus for position and orientation of mobile robot

    CN105928505A

  • Space-assisted electronic equipment positioning method and device, computer equipment and medium

    CN113124861A

  • Method for using mobile phone as somatosensory sensor, storage medium and mobile phone

    CN114757248A