Summary of the invention
The technical problem to be solved in the present invention is, for can not the showing truely and accurately customer location and racked swing, can not judge whether racket hits bead, can not judge the defect of the type of swinging the bat of prior art, provide a kind of computer based bead motion processing method and system.
The technical solution adopted for the present invention to solve the technical problems is to provide a kind of computer based bead motion processing method, by video, racket trace point is identified, and determines racket position, comprises the following steps:
1) gather the position data of racket, and calculate speed data, dynamics data and the user's of described racket position data;
2) calculate the position data of the front bead of batting;
3) according to the position data of described bead before the position data of described racket and batting, judge whether described racket hits described bead;
4) according to the speed data of described racket and/or position data, judge the type of swinging the bat of described racket, and according to swing the bat type and the dynamics data of described racket, calculate the speed data of described bead after batting;
5) calculate the position data of the rear described bead of batting;
6) judge whether described bead falls in opponent's hemisphere table.
In computer based bead motion processing method of the present invention, described step 1) further comprise:
11) on described racket, trace point is set, constantly the position data of racket described in acquisition camera coordinate system;
12) position data of described racket is mapped to virtual coordinate system from described camera coordinate system, and shows in real time the position of racket described in described virtual coordinate system;
13) according to the position data of described racket, calculate described user's position data, and show in real time the position of user described in described virtual coordinate system;
14) according to the position data of described racket, calculate speed data and the dynamics data of described racket.
In computer based bead motion processing method of the present invention, described step 2) in, after batting last time according to described opponent, the speed data of described bead is calculated the position data of described bead before batting, and shows in real time in described virtual coordinate system the position of described bead before batting.
In computer based bead motion processing method of the present invention, described step 3) in, whether the location point that judges described bead by calculating is greater than the radius of described bead to the distance of described racket place plane, be greater than and illustrate that described racket and bead do not intersect, otherwise continue to calculate and judge whether the location point of described bead is greater than the radius of described racket to the distance of the location point of described racket, be greater than and illustrate that described racket and bead do not intersect, otherwise illustrate that described racket and bead intersect, if intersected, judge that described racket hits described bead; If non-intersect, judge that described racket does not hit described bead, this is batted unsuccessfully.
In computer based bead motion processing method of the present invention, described step 4) further comprise:
41) according to the speed data of described racket, judge that swinging the bat of described racket starts and finish;
43) according to the type of swinging the bat of described racket, determine and show described user's racked swing.
In computer based bead motion processing method of the present invention, the type of swinging the bat of described racket comprises horizontal sliding ball, upwards toe lift, smash, chop, wherein,
The feature of described horizontal sliding ball is, described racket is less in left and right and upper and lower displacement, and displacement is forward larger;
The described upwards feature of toe lift is that described racket is very little in the speed of left and right, almost nil, and is upwards having obvious speed;
The feature of described smash is, described racket downwards, all larger with the speed of left and right forward;
The feature of described chop is, described racket downwards, all non-vanishing with the speed of left and right forward, but described speed is less than described smash.
In computer based bead motion processing method of the present invention, described step 5) in, according to the speed data of the rear described bead of batting, calculate the position data of the rear described bead of batting, and show in real time the position of the rear described bead of batting in described virtual coordinate system.
In computer based bead motion processing method of the present invention, described step 6) in, by judging described bead, whether cross the whether out-of-bounds of net and described bead, judge whether described bead falls in described opponent's hemisphere table, if described little over the net and there is no out-of-bounds, judges that described bead falls in described opponent's hemisphere table, this is batted successfully; Otherwise judge that described bead does not fall in described opponent's hemisphere table, this is batted unsuccessfully.
In computer based bead motion processing method of the present invention, described opponent is visual human or other users, wherein, described visual human's motion is controlled by artificial intelligence, and the disposal route of described other user movements is corresponding similar with the disposal route of described user movement.
A bead motion process system, comprises identification module, data processing module and display module, wherein,
Described identification module is for constantly gathering the positional information of racket;
Described data processing module is connected with described identification module, for obtaining position data, speed data, dynamics data and the user's of racket position data, calculate the position data of the front bead of batting, judge whether described racket hits described bead, judge the speed data of swing the bat type the rear described bead of calculating batting of described racket, calculate the position data of described bead after batting, judge that described little placement is whether in opponent's hemisphere table;
Described display module is connected with described data processing module, for showing in real time position, the position of described user's racket, described user's position and the racked swing of bead described in virtual coordinate system, and the position of described opponent's racket is, described opponent's position and racked swing.
In computer based bead motion process system of the present invention, described system also comprises artificial intelligence module, is connected, for controlling described visual human's motion with display module.
In computer based bead motion process system of the present invention, described system also comprises function and connected mode corresponding similar another set of identification module and the data processing module with described identification module and data processing module.
Implement computer based bead motion processing method of the present invention and system, there is following beneficial effect:
Can reflect more accurately user's position and action, user swing the bat or hold bat each constantly, the reaction that the position of racket all can be is strictly according to the facts on display.
Can judge exactly the square stance of swinging the bat, whether really impact bead.
According to the position of racked swing starting point and end point, and the speed of racket while impacting bead, can judge what type of action of this square stance, rather than arbitraryly by sending out a button, realize.
The present invention approaches real fitness project, can allow the home-confined bead of just can enjoying of user move, and takes exercises.
Embodiment
Below in conjunction with accompanying drawing, embodiment is described.
Refer to Fig. 1, the camera coordinate system schematic diagram of the computer based bead motion processing method providing for the preferred embodiment of the present invention.As shown in Figure 1, camera coordinate origin is video frequency pick-up head center, X-axis positive dirction be level to the right, Y-axis positive dirction is for vertically upward, Z axis positive dirction be level backward.This camera coordinate system is for describing identification module racket and user's every terms of information.
Incorporated by reference to consulting Fig. 2, the virtual coordinate system schematic diagram of the computer based bead motion processing method providing for the preferred embodiment of the present invention.As shown in Figure 2, virtual coordinate system initial point is net center, X-axis positive dirction be parallel net to the right, Y-axis positive dirction be vertical ground upwards, Z axis positive dirction be vertical net backward.This virtual coordinate system is for describing display module racket, bead, user and opponent's every terms of information.
Virtual coordinate system shown in camera coordinate system shown in Fig. 1 and Fig. 2, corresponding X-axis, Y-axis, Z axis have respectively identical positive dirction, identical numerical values recited, therefore, racket and user's every terms of information in this camera coordinate system, can be applied directly in this virtual coordinate system, form mapping relations one to one.
Refer to Fig. 3, the process flow diagram of the computer based bead motion processing method providing for the preferred embodiment of the present invention.As shown in Figure 3, the flow process of the method comprises the following steps:
1) gather the position data of racket, and calculate speed data, dynamics data and the user's of described racket position data;
2) calculate the position data of the front bead of batting;
3) according to the position data of described bead before the position data of described racket and batting, judge whether described racket hits described bead;
4) according to the speed data of described racket and/or position data, judge the type of swinging the bat of described racket, and according to swing the bat type and the dynamics data of described racket, calculate the speed data of described bead after batting;
5) calculate the position data of the rear described bead of batting;
6) judge whether described bead falls in opponent's hemisphere table.
Above-mentioned steps forms user's a batting cycle.After user's batting end cycle, if user bats successfully, opponent's the batting cycle starts.After opponent's batting end cycle, if to forehand hit success, user's the batting cycle starts again so.So circulation, until user or opponent wherein a side bat unsuccessfully, local exchange finishes.The failure if user bats, local exchange opponent triumph so; If to forehand hit failure, local subscriber's triumph so.
This user's opponent can be visual human, i.e. man-machine fight, and visual human is controlled by artificial intelligence, and artificial intelligence is not emphasis of the present invention, therefore needn't set forth motion how to process visual human.This user's opponent can be also other users, and two users fight, and the disposal route of other user movements and the disposal route of this user movement are similar, therefore also needn't set forth motion how to process other users.
Illustrate each step in the method for the invention below.
Step 1) specifically comprise the following steps:
11) trace point is set on racket, the position data of racket described in the continuous acquisition camera coordinate system of identification module, is a series of ternary coordinate (x
1, y
1, z
1), (x
2, y
2, z
2) ..., (x
i, y
i, z
i) ..., (x wherein
i, y
i, z
i) representing i constantly, the position coordinates of racket.。
12) data processing module is mapped to virtual coordinate system by the position data of racket from camera coordinate system, and display module shows the position of racket in virtual coordinate system in real time.According to mapping relations one to one, the position coordinates of racket in camera coordinate can be applied directly in virtual coordinate system, be similarly ternary coordinate (x
1, y
1, z
1), (x
2, y
2, z
2) ..., (x
i, y
i, z
i..., (x wherein
i, y
i, z
i) representing i constantly, the position coordinates of racket.
13) data processing module calculates user's position data according to the position data of racket, and display module shows the position of user in virtual coordinate system in real time.Can be according to the ternary coordinate of racket position according to predefined corresponding relation, such as function calculates the ternary coordinate of customer location.
14) data processing module calculates speed data and the dynamics data of racket according to the position data of racket.The formula of concrete each data of calculating is as follows:
I speed v constantly
ix=(x
i-x
i-1)/t, v
iy=(v
i-v
i-1)/t, v
iz=(v
i-v
i-1)/t, t=1/30s wherein, speed is the speed in all directions in X, Y, tri-directions of Z;
I acceleration a constantly
ix=(v
ix-v
(i-1) x)/t, a
iy=(v
iy-v
(i-1) y)/t, a
iz=(v
iz-v
(i-1) z)/t, wherein t=1/30s; Acceleration is the acceleration in all directions in X, Y, tri-directions of Z;
I dynamics f constantly
ix=a
ix* k, f
iy=a
iy* k, f
iz=a
iz* k, wherein k is a scale-up factor, dynamics is the dynamics in all directions in X, Y, tri-directions of Z.
Step 2) in, data processing module according to opponent, batted last time after the speed data of bead calculate the position data of bead before batting, display module shows in virtual coordinate system the position of bead before batting in real time.
Step 3), in, data processing module judges by calculating whether bead and racket intersect, thereby judges whether racket hits bead, if intersected, judges that racket hits bead; Otherwise judgement racket does not hit bead, and this is batted unsuccessfully.Specifically comprise the following steps:
31) data processing module calculates the distance d1 between bead and racket place plane;
32) whether data processing module judging distance d1 is less than the radius r of bead, if it is carries out next step, otherwise judgement racket does not hit bead, and this is batted unsuccessfully;
33) data processing module calculates the distance d2 between bead and racket location point;
34) whether data processing module judging distance d2 is less than the radius R of racket, if it is judges that racket hits bead; Otherwise judgement racket does not hit bead, and this is batted unsuccessfully;
35) data processing module recording distance d2 gets the moment of minimum value, as batting constantly.
Step 4) specifically comprise the following steps:
41) data processing module starts and finishes according to swinging the bat of the speed data judgement racket of racket.Constantly, the speed of racket in X, Y, tri-directions of Z is respectively v to known i
ix, v
iy, v
iz; Dynamics is respectively f
ix, f
iy, f
iz.If the resultant velocity of three square upward velocities surpasses given threshold value v
0,
judge that racked swing starts, record the coordinate (x of this moment racket position
b,y
b, z
b).After this, when resultant velocity is less than given threshold value v
0,
judge that racked swing finishes, record the coordinate (x of this moment racket position
e,y
e, z
e), record action simultaneously and start to each resultant velocity constantly in release, and calculate the mean value of resultant velocity, be designated as
.
42) data processing module judges the type of swinging the bat of racket according to the speed data of racket and/or position data, and according to the speed data of bead after swing the bat type and the dynamics data calculating batting of racket.The racked swing of following several types can judge by Negotiation speed, also can pass through position judgment, can also Negotiation speed and position judgment.
One, horizontal sliding ball.The feature of horizontal sliding ball is, racket is in X-direction (left and right), and the displacement in Y direction (up and down) is less, and displacement in Z axis negative direction (forward) is larger.Therefore, as | x
b-x
e| < d
x, | y
b-y
d| < d
y, and | z
b-z
e| > d
z, d wherein
x, d
y, d
zfor predefined threshold value, judge that this racked swing is horizontal sliding ball.Mainly to bead, the rate in Z axis negative direction is larger for horizontal sliding ball in the present invention, according to batting constantly, and the firmly f in Z axis negative direction
iz, give one of the bead initial velocity in Z axis negative direction, this speed and f
izbe directly proportional, the initial velocity in X-axis, Y-axis is directly given null value.Also can determine whether horizontal sliding ball by Negotiation speed, calculate racket in the speed of X-axis, Y-axis, Z-direction, if the speed of racket in Z axis negative direction is larger, and almost nil in the speed of X-axis, Y direction, think horizontal sliding ball.
Two, upwards toe lift.Upwards the feature of toe lift is that the speed of racket in X-direction (left and right) is very little, almost nil, and has obvious speed in Y-axis positive dirction (making progress).Therefore, as | v
ix| < v
0, | v
iy| > v
0'; V wherein
0and v
0' be predefined threshold value, judge that this racked swing is for upwards toe lift.Making progress in the present invention, mainly to ball, the rate in Y-axis and Z-direction is larger in toe lift, therefore, according to batting constantly, the firmly f in Y-axis, Z-direction
iy, f
iz; Give ball in Y-axis, on Z axis, give respectively one with the speed being firmly directly proportional on this direction of principal axis, and directly give null value (dynamics also can be directly proportional with speed) for the speed of X-direction.Also can determine whether upwards toe lift by Negotiation speed, determination methods and horizontal sliding are seemingly ball.
Three, smash.The feature of smash is that the speed of racket in Y-axis negative direction (downwards), Z axis negative direction (forward), X-direction (left and right) is all larger.Therefore, as | v
ix| > v
0, | v
iy| > v
1, | v
iz| > v
2, wherein: v
0, v
1, v
2for threshold value given in advance, three directions of square stance have larger speed.While using smash action to play ball, bead declines forward rapidly: if speed is left greater than threshold value, | v
ix| > v
0and x
b-x
ethe motion that 0 oriented left avertence of bead of > is moved; If speed is to the right greater than threshold value, | v
ix| > v
0and x
b-x
ethe motion that 0 oriented right avertence of bead of < is moved.In the present invention, when smash action impacts after bead, being firmly directly proportional in three directions when the assignment of bead speed is moved therewith, ratio is predefined.
Four, chop.Chop feature be, the speed of racket in Y-axis negative direction (downwards), Z axis negative direction (forward), X-direction (left and right) is all non-vanishing, but speed is less than smash.Therefore, work as y
b-y
e> 0, z
b-z
e< 0 and v
0' > | v
ix| > v
0, v
1' > | v
iy| > v
1, v
2' > | v
iz| > v
2, v wherein
0', v
0, v
1', v
1, v
2', v
2for threshold value given in advance, judge that this racked swing is for chop: if x
b-x
e0 of > is chop to the right; If x
b-x
e0 of < is chop left.In the present invention, after chop action occurs, according to the firmly situation in the batting moment three directions, ball is given respectively in three directions to the speed being directly proportional to firmly situation on correspondence direction, and give roll rate of bead, when the size of this roll rate is hit to ball, the absolute value of making a concerted effort of three directive effect power is directly proportional.
Above-described several only type of swinging the bat for being suitable in the embodiment of the present invention of type of swinging the bat, not thereby limit the scope of the claims of the present invention, the present invention can also spread to applicable other a greater variety of types of swinging the bat, and all can adopt method provided by the invention to process.
43) data processing module is determined user's racked swing according to the type of swinging the bat of racket, and display module shows user's racked swing, and this racked swing is predefined.
Step 5) in, data processing module calculates the position data of the rear bead of batting according to the speed data of the rear bead of batting, and display module shows the position of the rear bead of batting in virtual coordinate system in real time.
Step 6) in, data processing module, by judge whether whether out-of-bounds of mistake net and bead of bead, judges whether bead falls in opponent's hemisphere table, if little over the net and there is no out-of-bounds judges that bead falls in opponent's hemisphere table, this is batted successfully; Otherwise judgement bead does not fall in opponent's hemisphere table, and this is batted unsuccessfully.Specifically comprise the following steps:
61) data processing module constantly detects the position data of bead, when null value appears in the position coordinate value detecting in Z-direction, now the position coordinate value in Y-axis positive dirction is greater than the height of net, and the position coordinates absolute value in X-direction is less than 1/2nd width of net, judge little over the net, otherwise judgement bead did not have net, batted unsuccessfully.
61) data processing module constantly detects the position data of bead, in X, Y, tri-directions of Z being detected, the position coordinates absolute value of the bead that any one party makes progress surpasses the boundary coordinate absolute value of the other side's hemisphere table, judge little no play, bat unsuccessfully, otherwise judgement bead does not have out-of-bounds, bats successfully.
The above-mentioned batting cycle is applicable to user's service and the two kinds of situations of receiving.
Refer to Fig. 4, the structural representation of the computer based bead motion process system providing for the preferred embodiment of the present invention.As shown in Figure 4, this system comprises identification module, data processing module, display module and artificial intelligence module, is applicable to user and visual human and fights, be i.e. man-machine fight.
Identification module is for constantly gathering the positional information of racket.Identification module can be the camera with trace point recognition function, with p.s. the frequency of 30 times trace point is identified, and record this trace point, i.e. the position of racket.
Data processing module is connected with identification module, for obtaining position data, speed data, dynamics data and the user's of racket position data, calculate the position data of the front bead of batting, judge whether racket hits bead, the speed data of bead after swing the bat type the calculating batting of judgement racket, calculate the position data of bead after batting, judge that little placement is whether in opponent's hemisphere table.Data processing module can be computer processor.
Display module is connected with processing module, and for showing in real time position, the position of user's racket, user's position and the racked swing of virtual coordinate system bead, and the position of opponent's racket is, opponent's position and racked swing.Display module can be display.
Artificial intelligence module is connected with display module for controlling visual human's motion.Artificial intelligence module can be artificial intelligence controller.
Incorporated by reference to consulting Fig. 5, the structural representation of the computer based bead motion process system that second embodiment of the invention provides.As shown in Figure 5, this system comprises successively connected identification module A, data processing module A, display module, data processing module B, identification module B, is applicable to two users and fights.
Comparison diagram 4 and Fig. 5, difference is, the second embodiment replaces the artificial intelligence module in preferred embodiment with identification module B and data processing module B.Therefore, the opponent in the second embodiment can be another user.Identification module for the treatment of two user movements is similar with data processing correspondence, repeats no more herein.
How detailed hereafter utilizes method and system provided by the invention to realize badminton project.
Start terminal computer, enter virtual body-building hall, start shuttlecock project, do the preliminary work of a little necessity, such as, hand-held racket, so just can show by the data point of racket the motion of user all around, above-below direction; The data point of racket is also used to judge the position of racket and the type of action of swinging the bat simultaneously.
After starting, shuttlecock project procedure there is the shuttlecock scene of playing ball on display, the place that belongs to people in reality near the place of display outside, the 3D animated character who has a hand-held racket in place, representing user, user's action, change in location all can be embodied in this 3D animated character, such as: when racket moves toward left, right, front and rear, 3D animated character also can make toward left, right, front and rear the movement of same distance; User lifts, and puts down, and puts down while holding racket, and 3D animated character also can lift, and puts down, the flat racket of holding; Equally, when user plays ball in every way, the racket in 3D animated character hand also can experience the position that in user's hand, shuttlecock experiences, and the spatial position data of racket is the direct position corresponding to the racket in 3D animated character hand.
After badminton starts, a minute following step is carried out.
The first step: service, when truly playing ball, when service, user need to throw up, before video frequency pick-up head, user needs the action of upthrow equally, can on racket in waving one's hand, according to the speed in racket uphill process, the height of the ball that decision is dished out; Then can, as playing ball in realizing, ball be got out to the service process of abandoning, playing ball at this, can calculate the He Qiu position, position of racket, if intersect both positions, ball has been hit always, after hitting, ball will be made athletic performance by the situation of being hit.So far, a complete service process is through with.
Second step: there are three kinds of results in service Hou, club, and a, ball have been got field, and b, ball did not have net on ball table, and c, ball have been got to away ground, serve a ball successfully; For a, two kinds of situations of b, can directly be treated to and serve a ball unsuccessfully, what need continuation processing is c kind situation.Now, ball has passed to away ground, at this moment this opponent receives, a visual human with artificial intelligence receives, the level that it receives/sends ball is according to setting, and in the present invention, main what set forth is how play ball action and the effect of playing ball of user shows on display, and artificial intelligence is not emphasis of the present invention, so do not set forth the visual human with artificial intelligence, how not receive.
The 3rd step: receive, serve a ball successfully when thering is the visual human of artificial intelligence, or successfully receive user and play ball in the past, just take turns to user and received.First, user will assess the own 3D animated character of representative from the position of the ball that will connect, if the 3D animated character of representative of consumer from the falling sphere point of estimating away from, need the body position of movement oneself, in the process of moving, the 3D animated character of representative of consumer also can make identical position and move, therefore, the same with playing ball in reality, first estimate falling sphere point is in which position, then make corresponding movement, if falling sphere point moves on the ,Xiang left side, the 3D animated character left side; If falling sphere point moves in ,Xiang left front, 3D animated character left front; If it is larger to have visual human's dynamics of beating of artificial intelligence, and distant from net, and the 3D animated character of representative of consumer from ball table close to, user need to move backward; Move to the reason of the various situations of receiving other positions and enumerate here identical.
Move to behind suitable position, just can as playing ball in reality, can spike, chop, how horizontal sliding ball etc., specifically should receive, the ball that should beat depending on opponent, and own individual plays ball level, custom and determines.But no matter how to go to receive, in the present invention, first judgement this time swings the bat to receive whether hit ball, if do not hit ball, receive unsuccessfully, if received ball, the type of action of receiving according to this, and the factor such as dynamics, change movement velocity, the rotational speed of ball.Then, after calculating is this time received, ball, in each locus constantly, if fall into outside the other side's hemisphere table, is this time received unsuccessfully, again serves a ball or connects the ball that artificial intelligence visual human sends; If within falling into the other side's hemisphere table, this time receive successfully, continue to prepare to connect next ball.
So far, intactly described and how to have utilized method and system provided by the invention to realize badminton project.
The foregoing is only embodiments of the invention; not thereby limit the scope of the claims of the present invention; every equivalent structure transformation that utilizes instructions of the present invention and accompanying drawing content to do, or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.