Based on many exchange methods and the device of Kinect and Unity3D
Technical field
The present invention relates to computing machine augmented reality field, particularly relate to a kind of many exchange methods based on Kinect and Unity3D and device.
Background technology
Augmented reality (Augmented Reality) proposes with the nineties in last century the earliest, is widely used in medical treatment now, education, industry, the many aspects such as business.What augmented reality one was comparatively general be defined in 1997 is proposed by the Ronald Azuma of North Carolina University, comprise three main aspects: to be virtually combined with reality (Combines real and virtual), immediate interactive (Interactive in real time), three-dimensional registration (Registered in3D).Virtual scene is superimposed upon on reality scene by this technology on screen, and makes participant can be interactive with virtual scene.The realization flow of current augmented reality is generally: 1) obtain scene image by image acquiring device; 2) identify and follow the tracks of uncalibrated image or word in scene, calculating its displacement rotating matrix of its deformation calculation; 3) according to position and the rotation matrix of uncalibrated image, corresponding dummy model positional information is registered in three dimensions; 4) merge dummy model and real scene, and be presented on screen.
But, there is following a few point defect in current common technology: 1) interactive mode simplification, can only trigger dummy model registration, and can only carry out the operations such as translation rotation to model after registration by uncalibrated image or word, model can only be followed and be demarcated thing motion, and interactive mode is few and limit more; 2) three-dimensional registration algorithm is loaded down with trivial details, needs according to unique point coordinate system Confirming model position and attitude, then is transformed into camera coordinate system, finally merges dummy model and reality scene and shows it according to indicator screen coordinate.Visible current art needs the calculating compared with multi-step at the three-dimensional registration phase of dummy model, operates succinct not and robotization.
Summary of the invention
Technical matters to be solved by this invention is, for the deficiencies in the prior art, how to utilize Kinect to the support of speech recognition and triggering mode human skeleton location being increased to the registration of dummy model three-dimensional, by the recognition function of limb action for user provides more interactive mode, improve the experience of user, and how to utilize the d engine of Unity3D to carry out automatic business processing to model pose, greatly simplify the key issue of the required step of three-dimensional registration.
For this purpose, the present invention proposes a kind of many exchange methods based on Kinect and Unity3D, comprising:
S1: in adjustment Unity3D, camera parameters is consistent with Kinect valid analysing range;
S2: utilize Kinect to determine user coordinates and ground equation;
S3: according to relative position determination virtual analog coordinate, and register dummy model;
S4: design mutual posture and voice;
S5: determine Unity3D Controlling model displacement animation and Multimedia;
S6: the image that the picture get the video camera in Unity3D and the camera of Kinect obtain merges and shows.
Further, described step S1 comprises further: place the predeterminated position of Kinect to reality scene, and adjustment reality scene is in Kinect valid analysing range.
Further, described step S1 comprises further: video camera Field of view and Clipping Planes parameter in adjustment Unity3D.
Further, described step S2 comprises further:
S21: use SkeletonFrame.FloorClipPlane function to determine the plane equation representing ground, wherein, described plane equation under described Kinect coordinate system is: Ax+By+Cz+D=0, the planar process vector that (A, B, C) is described plane equation, described plane equation under described Unity3D coordinate system is: y+E=0, the planar process vector that (0,1,0) is described plane equation;
S22: (A, B, C) is rotated and overlaps to (0,1,0), complete the registration of Kinect coordinate system and Unity3D coordinate system.
Further, the registration of described Kinect coordinate system and Unity3D coordinate system comprises further: arbitrfary point (k under Kinect coordinate system
1, k
2, k
3) to Unity3D ordinate transform time, need be-arctan (B/C) around the X-axis anglec of rotation, be arctan (A/B) around the Z axis anglec of rotation, radius of turn be
rotation recoil is designated as: (k
1cos α-(k
2cos β-k
3sin β) sin α, k
1sin α+(k
2cos β-k
3sin β) cos α, k
2sin β+k
3cos β), wherein, α=arctan (A/B), β=-arctan (B/C).
Further, described step S6 comprises further:
S61: two width images are sampled or difference operation;
S62: two width images after operation are traveled through, compares the depth value with object image slices vegetarian refreshments corresponding point in two width images;
S63: object image corresponding point color value is set to the color value of depth value compared with statuette vegetarian refreshments.
Further, described registration dummy model can also move to by user the mode that specific position triggers default models.
Further, described registration dummy model can also trigger the mode of corresponding model registration by user speech.
For this purpose, the present invention proposes a kind of many interactive devices based on Kinect and Unity3D, comprising:
Adjusting module, consistent with Kinect valid analysing range for adjusting camera parameters in Unity3D;
Determining coordinate and ground equation module, determining user coordinates and ground equation for utilizing Kinect;
Dummy model Registering modules, for according to relative position determination virtual analog coordinate, and registers dummy model;
Design module, for designing mutual posture and voice;
Determine effects module, for determining Unity3D Controlling model displacement animation and Multimedia;
Image co-registration module, the image that the camera for the picture that gets the video camera in Unity3D and Kinect obtains merges and shows.
A kind of many exchange methods based on Kinect and Unity3D disclosed in this invention, first by arranging position and the attribute of video camera in Unity3D, simplify the conversion between real scene coordinate system and virtual scene coordinate system; Secondly the respective coordinates of user in Unity is obtained by Kinect, and represent the plane equation on ground, then can determine that three-dimensional registers coordinate according to the relative position relation of dummy model to be registered and ground and user, its mechanism triggering registration is more flexible, can trigger when user moves to ad-hoc location, sound identification module also can be used to trigger.Again enriched the interactive mode after model registration, can by limb action and voice operating model mutual with it; The Transform assembly in Unity3D and Mecanim animation system is finally utilized to simplify the realization of dummy model change in displacement and animation effect.The invention also discloses a kind of many interactive devices based on Kinect and Unity3D.
Accompanying drawing explanation
Can understanding the features and advantages of the present invention clearly by reference to accompanying drawing, accompanying drawing is schematic and should not be construed as and carry out any restriction to the present invention, in the accompanying drawings:
Fig. 1 shows the flow chart of steps of a kind of many exchange methods based on Kinect and Unity3D in the embodiment of the present invention;
Fig. 2 shows the structural drawing of a kind of many interactive devices based on Kinect and Unity3D in the embodiment of the present invention.
Embodiment
Below in conjunction with accompanying drawing, embodiments of the present invention is described in detail.
As shown in Figure 1, the invention provides a kind of many exchange methods based on Kinect and Unity3D, comprise concrete following steps:
Step S1: in adjustment Unity3D, camera parameters is consistent with Kinect valid analysing range.Particularly, place the predeterminated position of Kinect to reality scene, adjustment reality scene is in Kinect valid analysing range, and wherein, effective range is span camera 1.2-3.6 rice, level 57 degree, vertical 43 degree.
Further, in the coordinate system of Kinect return data, namely initial point is the sensor of Kinect, therefore video camera in Unity3D is positioned over true origin, calculates dummy model coordinate to facilitate during three-dimensional registration.Video camera Field of view and Clipping Planes parameter in adjustment Unity3D, by Field of view, the parameters such as Clipping Planes are arranged to the same numerical value with the effective range of Kinect.
Step S2: utilize Kinect to determine user coordinates and ground equation.
Particularly, SkeletonFrame.FloorClipPlane function is used to determine the plane equation representing ground, wherein, the plane equation under Kinect coordinate system is: Ax+By+Cz+D=0, (A, B, C) be the planar process vector of plane equation, the plane equation under Unity3D coordinate system is: y+E=0, (0,1,0) be the planar process vector of plane equation; (A, B, C) is rotated and overlaps to (0,1,0), complete the registration of Kinect coordinate system and Unity3D coordinate system.
Further, the registration of Kinect coordinate system and Unity3D coordinate system comprises further: arbitrfary point (k under Kinect coordinate system
1, k
2, k
3) to Unity3D ordinate transform time, need be-arctan (B/C) around the X-axis anglec of rotation, be arctan (A/B) around the Z axis anglec of rotation, radius of turn be
rotation recoil is designated as: (k
1cos α-(k
2cos β-k
3sin β) sin α, k
1sin α+(k
2cos β-k
3sin β) cos α, k
2sin β+k
3cos β), wherein, α=arctan (A/B), β=-arctan (B/C).
Step S3: according to relative position determination virtual analog coordinate, and register dummy model.
Particularly, carry out the conversion formula changed according to the Kinect coordinate system of above-mentioned steps to Unity3D coordinate system, the bone site point Skeleton Point returned by API in Kinect SDK is converted to Unity3D coordinate system.According to floor level under Unity3D coordinate system, the relative position of user coordinates and dummy model and user is by model orientation extremely required coordinate; Or select default models to register, or register to the sound bank interpolation word relevant to model, wherein, the corresponding model of some words, by the identification of Kinect Speech modular voice.After user says the word existed in sound bank, in scene, register model three-dimensional model corresponding to this word.
Step S4: design mutual posture and voice.
Particularly, design mutual posture, determine often kind of limb action set operated.Such as: use arm hovering to represent and select object or button click; Mobile arm represents sliding mouse or translation model; Two hands away from, near represent zoom model; Two hands are embraced ball and are rotated expression rotating model etc., and are realized simple mutual by voice.Such as: the display of model, disappearance, multimedia broadcasting, time-out etc.
Step S5: determine Unity3D Controlling model displacement animation and Multimedia.
Particularly, according to the limb action of user, corresponding operating is carried out to model.Utilize the Transform assembly in Unity3D SDK in GameObject object to carry out translation to model, rotate, the operations such as convergent-divergent; Use Mecanim animation system Controlling model to make user to follow, run, the interactive action that guiding etc. designs; Audio assembly and Movie Textures assembly is used to control Multimedia.
Step S6: the image that the picture get the video camera in Unity3D and the camera of Kinect obtain merges and shows.
Particularly, step S6 comprises further:
Step S61: sample or difference operation two width images, makes it to zoom to object image size.
Step S62: two width images after operation are traveled through, compares the depth value with object image slices vegetarian refreshments corresponding point in two width images;
Step S63: object image corresponding point color value is set to the color value of depth value compared with statuette vegetarian refreshments.
A kind of many exchange methods based on Kinect and Unity3D disclosed by the invention, for three-dimensional registers augmented reality simple to operate.Utilize Kinect to the support of speech recognition and triggering mode human skeleton location being increased to the registration of dummy model three-dimensional, provide more interactive mode by the recognition function of limb action for user, improve the experience of user; Utilize the d engine of Unity3D to carry out automatic business processing to model pose, greatly simplify the required step of three-dimensional registration.Namely fully utilize body sense interactive device and three-dimensional game engine, simplify three-dimensional register flow path, add three-dimensional registration triggering mode, enriched user interactions approach, perfect user operation experience.
As shown in Figure 2, the invention provides a kind of many interactive devices 10 based on Kinect and Unity3D, comprising: adjusting module 101, determine coordinate and ground equation module 102, dummy model Registering modules 103, design module 104, determine effects module 105 and image co-registration module 106.
Particularly, adjusting module 101 is consistent with Kinect valid analysing range for adjusting camera parameters in Unity3D; Determine that coordinate and ground equation module 102 determine user coordinates and ground equation for utilizing Kinect; Dummy model Registering modules 103 for according to relative position determination virtual analog coordinate, and registers dummy model; Design module 104 is for designing mutual posture and voice; Determine that effects module 105 is for determining Unity3D Controlling model displacement animation and Multimedia; The image that image co-registration module 106 obtains for the camera of the picture that gets the video camera in Unity3D and Kinect merges and shows.
A kind of many exchange methods based on Kinect and Unity3D disclosed in this invention, first by arranging position and the attribute of video camera in Unity3D, simplify the conversion between real scene coordinate system and virtual scene coordinate system; Secondly the respective coordinates of user in Unity is obtained by Kinect, and represent the plane equation on ground, then can determine that three-dimensional registers coordinate according to the relative position relation of dummy model to be registered and ground and user, its mechanism triggering registration is more flexible, can trigger when user moves to ad-hoc location, sound identification module also can be used to trigger.Again enriched the interactive mode after model registration, can by limb action and voice operating model mutual with it; The Transform assembly in Unity3D and Mecanim animation system is finally utilized to simplify the realization of dummy model change in displacement and animation effect.The invention also discloses a kind of many interactive devices based on Kinect and Unity3D.
Above embodiment is only for illustration of the present invention; and be not limitation of the present invention; the those of ordinary skill of relevant technical field; without departing from the spirit and scope of the present invention; can also make a variety of changes and modification; therefore all equivalent technical schemes also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.
Although describe embodiments of the present invention by reference to the accompanying drawings, but those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, such amendment and modification all fall into by within claims limited range.