Disclosure of Invention
In order to solve the above problems in the prior art, the present invention provides a method and an apparatus for detecting steps.
The technical scheme of the invention is as follows:
in one aspect, the present invention provides a method for detecting steps, comprising:
acquiring a plurality of first detection points on the periphery of a front sole and a plurality of second detection points on the periphery of a rear sole in a detection area;
the first detection points are connected in sequence to form a first convex polygon, and the second detection points are connected in sequence to form a second convex polygon;
respectively calculating to obtain a first barycentric coordinate of the first convex polygon and a second barycentric coordinate of the second convex polygon;
and obtaining the moving direction and the moving distance of the footstep based on the first barycentric coordinate and the second barycentric coordinate.
Optionally, the method for obtaining a plurality of first detection points on the periphery of the front sole and a plurality of second detection points on the periphery of the rear sole in the detection region includes:
sequentially scanning by a plurality of groups of infrared detection devices arranged around the detection area to respectively obtain a first shielding area shielded by the front sole and a second shielding area shielded by the rear sole;
and obtaining a plurality of first detection points according to the outer edge infrared intersection points of the first shielding area, and obtaining a plurality of second detection points according to the outer edge infrared intersection points of the second shielding area.
Optionally, the method for obtaining the first barycentric coordinate of the first convex polygon through calculation includes:
dividing the first convex polygon into a plurality of triangles;
respectively calculating to obtain the gravity center and the area of each triangle;
and calculating to obtain the first barycentric coordinate based on a preset algorithm according to the barycenter and the area of each triangle.
Further optionally, the method for obtaining the first barycentric coordinate based on the preset algorithm includes:
and calculating the weighted average value by the gravity center of each triangle according to the area weight.
On the other hand, the invention provides a foot detection device, which comprises a foot tray and a plurality of infrared detection units arranged around the foot tray, wherein the infrared detection units are electrically connected with a controller, and the foot detection device detects the moving direction and the moving distance of the foot of a user by applying the foot detection method.
Preferably, infrared detecting unit includes infrared emission board and infrared ray receiving board, the symmetry set up in the both sides of step tray, be provided with a plurality of infrared emission pipes on the infrared emission board side by side, correspond on the infrared receiving board position department of infrared emission pipe has set gradually a plurality of infrared receiving pipes.
Preferably, the foot tray is of an octagonal structure, and 4 infrared transmitting plates and 4 corresponding infrared receiving plates are sequentially arranged on the periphery of the foot tray.
Compared with the prior art, the technical scheme provided by the invention has the following beneficial effects or advantages:
the method and the device for detecting the steps solve the problem that the step position and the step moving direction of the user cannot be accurately detected in VR, and greatly improve the experience of the user; moreover, the hardware of the step detection device provided by the invention consists of conventional electronic components, so that the hardware cost is greatly reduced; can be directly fixed on the periphery of the game platform, and is very easy to install and maintain.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
As shown in fig. 1, an embodiment of the present invention provides a method for detecting steps, including:
step S1: a plurality of first detection points on the periphery of the front sole and a plurality of second detection points on the periphery of the rear sole in the detection area are obtained.
In a specific implementation process, there are many methods for obtaining a plurality of first detection points on the periphery of the forefoot and a plurality of second detection points on the periphery of the forefoot in the detection region, and optionally, in an embodiment of the present invention, the method for obtaining a plurality of first detection points on the periphery of the forefoot and a plurality of second detection points on the periphery of the forefoot in the detection region specifically includes:
sequentially scanning by a plurality of groups of infrared detection devices arranged around the detection area to respectively obtain a first shielding area shielded by the front sole and a second shielding area shielded by the rear sole;
and obtaining a plurality of first detection points according to the outer edge infrared intersection points of the first shielding area, and obtaining a plurality of second detection points according to the outer edge infrared intersection points of the second shielding area.
The infrared detection device has low cost and is convenient to install and maintain.
After completion of step S1, step S2 is executed: the first detection points are connected in sequence to form a first convex polygon, and the second detection points are connected in sequence to form a second convex polygon. Fig. 2 is a schematic structural view of the first convex polygon.
After the first convex polygon and the second convex polygon are formed, step S3 is executed: and respectively calculating to obtain a first barycentric coordinate of the first convex polygon and a second barycentric coordinate of the second convex polygon.
In a specific implementation process, in order to quickly and accurately obtain the first barycentric coordinate, a method adopted in an embodiment of the present invention specifically includes:
first, the first convex polygon is divided into a plurality of triangles, and as shown in fig. 3, the first convex polygon is divided into three triangles a, b, and c.
After the division, the gravity center and the area of each triangle are obtained through calculation respectively.
Specifically, the method for calculating the gravity center of the triangle a specifically includes:
the coordinates of the three first detection points A, B, C of the triangle a are: a (x)1,y1);B(x2,y2);C(x3,y3);
Center of gravity abscissa Wax=(x1+x2+x3)/3;
Ordinate Wa of center of gravityy=(y1+y2+y3)/3。
The area calculation formula of triangle a is as follows:
Sa=(x1(y2-y3)+x2(y3-y1)+x3(y1-y2))。
the gravity center Wb of the triangle b can be obtained by the same methodx、WbySum area Sb and center of gravity Wc of triangle cx、WcyAnd an area Sc.
And after the gravity center and the area of each triangle are obtained, calculating and obtaining the first gravity center coordinate based on a preset algorithm according to the gravity center and the area of each triangle.
Specifically, the method for obtaining the first barycentric coordinate based on the preset algorithm includes:
and calculating the gravity center of each triangle by an area weight to obtain a weighted average value, wherein the specific calculation formula is as follows:
x=(Wax×Sa+Wbx×Sb+Wcx×Sc...)/(Sa+Sb+Sc+...);
y=(Way×Sa+Wy2×Sb+Wcy×Sc...)/(Sa+Sb+Sc+...)。
the weighted average is the first barycentric coordinate.
The second centroid coordinate may be obtained based on the same calculation.
After completion of step S3, step S4 is executed: and obtaining the moving direction and the moving distance of the footstep based on the first barycentric coordinate and the second barycentric coordinate.
The step detection method provided by the embodiment of the invention can accurately detect the step position and the step moving direction of the user, and greatly improves the experience of the user.
Corresponding to the above-mentioned foot detecting method, an embodiment of the present invention further provides a foot detecting device, as shown in fig. 4 and 5, including a foot tray 1 and a plurality of infrared detecting units 2 disposed around the foot tray, the infrared detecting units 2 being electrically connected to the controller, the foot detecting device detecting the moving direction and the moving distance of the foot of the user by using the above-mentioned foot detecting method.
In a specific implementation process, in order to obtain the step position information more accurately, it is preferable that the infrared detection unit 2 in the embodiment of the present invention includes an infrared emission plate 21 and an infrared receiving plate 22, which are symmetrically disposed on two sides of the step tray, wherein a plurality of infrared emission tubes are disposed on the infrared emission plate 21 side by side, and a plurality of infrared receiving tubes are sequentially disposed on the infrared receiving plate 22 at positions corresponding to the infrared emission tubes. Through setting up infrared emission pipe and infrared ray receiver tube side by side, can make the infrared ray cover denser to more accurately obtain step position information.
In a specific implementation process, the foot tray 1 in the embodiment of the present invention is preferably an octagonal structure, and 4 infrared emission plates 21 and 4 corresponding infrared reception plates 22 are sequentially disposed around the octagonal structure. The device is arranged to be an octagonal structure, so that the sole can be scanned at multiple angles, more first detection points and more second detection points are obtained, and more accurate step position information is obtained.
The hardware of the step detection device provided by the embodiment of the invention consists of conventional electronic components, so that the hardware cost is greatly reduced; can be directly fixed on the periphery of the game platform, and is very easy to install and maintain.
In one or more embodiments provided by the present invention, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.