本文整理汇总了C#中BodyFrameArrivedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# BodyFrameArrivedEventArgs类的具体用法?C# BodyFrameArrivedEventArgs怎么用?C# BodyFrameArrivedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BodyFrameArrivedEventArgs类属于命名空间,在下文中一共展示了BodyFrameArrivedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Calibration_FrameArrived
private void Calibration_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
kc.Controller_FrameArrived(sender, e);
if (kc.Arm != ArmPointing.Nothing)
{
float pointedX = kc.GetPointedX();
float pointedY = kc.GetPointedY();
DataLog.Log(DataLog.DebugLevel.Message, "Calibrated with X=" + pointedX.ToString() +
" Y=" + pointedY.ToString());
if (!File.Exists(OPT_FILE))
File.Create(OPT_FILE).Close();
List<float> l = new List<float>();
l.Add(pointedX);
l.Add(pointedY);
StreamWriter cal_file = File.CreateText(OPT_FILE);
JsonTextWriter cal_writer = new JsonTextWriter(cal_file);
string data = JsonConvert.SerializeObject(l);
cal_writer.WriteRaw(data);
cal_file.Close();
this.Close();
}
}
示例2: Reader_FrameArrived
public void Reader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
bool dataReceived = false;
Body[] bodies = null;
using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
{
if (bodyFrame != null)
{
bodies = new Body[bodyFrame.BodyCount];
bodyFrame.GetAndRefreshBodyData(bodies);
dataReceived = true;
}
}
if (dataReceived)
{
foreach (Body body in bodies)
{
gestureCollectionManager.DetectGestures(body);
//BasicHandGesture(body);
}
}
}
示例3: Reader_FrameArrived
public void Reader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
kc.Controller_FrameArrived(sender, e);
// Fill all text boxes
FillBoxes();
arm.Text = kc.Arm.ToString();
if (kc.Arm == ArmPointing.Right)
{
float pointedX = kc.GetPointedX();
float pointedY = kc.GetPointedY();
pointedPoint.Text = "X= " + pointedX.ToString() + "\nY= " + pointedY.ToString();
zoneBox.Text = kc.GetPointedZone().ToString();
}
else if (kc.Arm == ArmPointing.Left)
{
float pointedX = kc.GetPointedX();
float pointedY = kc.GetPointedY();
pointedPoint.Text = "X= " + pointedX.ToString() + "\nY= " + pointedY.ToString();
zoneBox.Text = kc.GetPointedZone().ToString();
}
else
{
this.pointedPoint.Text = "notPointing";
zoneBox.Text = "0";
}
}
示例4: BodyFrame_Arrived
void BodyFrame_Arrived(object sender, BodyFrameArrivedEventArgs e)
{
var frameReference = e.FrameReference;
if (frameReference == null)
return;
var frame = frameReference.AcquireFrame();
if (frame == null)
return;
using (frame) {
frame.GetAndRefreshBodyData(bodies);
using (var dc = drawingGroup.Open()) {
dc.DrawRectangle(Brushes.Transparent, null, new Rect(0.0, 0.0, colorSpaceWidth, colorSpaceHeight));
foreach (var body in bodies) {
if (body.IsTracked) {
var rShoulder = body.Joints[JointType.ShoulderRight];
var rElbow = body.Joints[JointType.ElbowRight];
var rWrist = body.Joints[JointType.HandRight];
DrawBone(rShoulder, rElbow, dc);
DrawBone(rElbow, rWrist, dc);
UpdateAngle(rShoulder, rElbow, rWrist);
}
}
}
}
}
示例5: UpdateBodyFrame
// ボディの更新
private void UpdateBodyFrame( BodyFrameArrivedEventArgs e )
{
using ( var bodyFrame = e.FrameReference.AcquireFrame() ) {
if ( bodyFrame == null ) {
return;
}
// ボディデータを取得する
bodyFrame.GetAndRefreshBodyData( bodies );
}
}
示例6: BodyReader_FrameArrived
private void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
using (var bodyFrame = e.FrameReference.AcquireFrame())
{
if (bodyFrame != null)
{
bodyFrame.GetAndRefreshBodyData(_bodies);
_body = _bodies.Where(b => b.IsTracked).FirstOrDefault();
}
}
}
示例7: bosyReader_FrameArrived
void bosyReader_FrameArrived( object sender, BodyFrameArrivedEventArgs e )
{
try {
using ( var bodyFrame = e.FrameReference.AcquireFrame() ) {
if ( bodyFrame != null ) {
ShowBody( bodyFrame );
}
}
}
catch ( Exception ex ) {
Trace.WriteLine( ex.Message );
}
}
示例8: Reader_BodyFrameArrived
private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
if (recordMode != RecordMode.Playingback)
{
bool dataReceived = false;
Body[] tempo = null;
using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
{
if (bodyFrame != null)
{
if (this.recordingBodies == null)
{
this.recordingBodies = new Body[bodyFrame.BodyCount];
}
tempo = new Body[bodyFrame.BodyCount];
// The first time GetAndRefreshBodyData is called, Kinect will allocate each Body in the array.
// As long as those body objects are not disposed and not set to null in the array,
// those body objects will be re-used.
bodyFrame.GetAndRefreshBodyData(this.recordingBodies);
bodyFrame.GetAndRefreshBodyData(tempo);
dataReceived = true;
}
}
if (dataReceived)
{
rgbBoard.Invalidate();
if (recordMode == RecordMode.Recording && this.rigWriter != null)
{
if (tmspStartRecording.HasValue)
{
// Save a copy of rig for later replay
recordedRigs.Add(tempo.Where(body => body.IsTracked).ToArray());
var currentTime = DateTime.Now.TimeOfDay;
TimeSpan elapse = currentTime - tmspStartRecording.Value;
recordedRigTimePoints.Add((int)elapse.TotalMilliseconds);
WriteRig(elapse);
}
}
}
}
}
示例9: FrameArrived
public void FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
try
{
using (var frame = e.FrameReference.AcquireFrame())
{
if (frame == null) return;
frame.GetAndRefreshBodyData(Bodies);
}
AnalyzeNewBodyData();
}
catch (Exception ex)
{
Logger.ErrorFormat("An error occured during processing of gesture: {0}", ex.Message);
}
}
示例10: FrameArrived
private void FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
var frame = e.FrameReference.AcquireFrame();
if (frame != null)
{
frame.GetAndRefreshBodyData(this.bodies);
frame.Dispose();
KinectBody[] newFrame = this.bodies.Select(body => new KinectBody(body)).ToArray();
if (this.FrameReceived != null)
{
this.FrameReceived(this, new KinectBodyFrameDataEventArgs(newFrame));
}
}
}
示例11: BodyFrameReaderOnFrameArrived
private void BodyFrameReaderOnFrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
bool dataReceived = false;
using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
{
if (bodyFrame != null)
{
if (this.bodies == null)
{
// creates an array of 6 bodies, which is the max number of bodies that Kinect can track simultaneously
this.bodies = new Body[bodyFrame.BodyCount];
}
// The first time GetAndRefreshBodyData is called, Kinect will allocate each Body in the array.
// As long as those body objects are not disposed and not set to null in the array,
// those body objects will be re-used.
bodyFrame.GetAndRefreshBodyData(this.bodies);
dataReceived = true;
}
}
if (dataReceived)
{
// we may have lost/acquired bodies, so update the corresponding gesture detectors
if (this.bodies != null)
{
// loop through all bodies to see if any of the gesture detectors need to be updated
int maxBodies = this.kinectSensor.BodyFrameSource.BodyCount;
for (int i = 0; i < maxBodies; ++i)
{
Body body = this.bodies[i];
ulong trackingId = body.TrackingId;
// if the current body TrackingId changed, update the corresponding gesture detector with the new value
if (trackingId != this.gestureDetectorList[i].TrackingId)
{
this.gestureDetectorList[i].TrackingId = trackingId;
// if the current body is tracked, unpause its detector to get VisualGestureBuilderFrameArrived events
// if the current body is not tracked, pause its detector so we don't waste resources trying to get invalid gesture results
this.gestureDetectorList[i].IsPaused = trackingId == 0;
}
}
}
}
}
示例12: BodyReader_FrameArrived
void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
using (var frame = e.FrameReference.AcquireFrame())
{
if (frame != null)
{
frame.GetAndRefreshBodyData(_bodies);
Body body = _bodies.Where(b => b != null && b.IsTracked).FirstOrDefault();
if (body != null)
{
_recorder.Update(body);
}
}
}
}
示例13: bfr_FrameArrived
private void bfr_FrameArrived(object o, BodyFrameArrivedEventArgs args)
{
using (var bodyFrame = args.FrameReference.AcquireFrame())
{
if (bodyFrame == null)
{
return;
}
bodyFrame.GetAndRefreshBodyData(bodies);
bodyCanvas.Children.Clear();
engagerCanvas.Children.Clear();
foreach (var body in Bodies)
{
if (!eManager.users.Contains(body))
{
eManager.users.Add(body);
}
// Multithreading maybe
drawer.CurrentCanvas = bodyCanvas;
drawer.drawSkeleton(body);
}
if (!eManager.IsEngage)
{
return;
}
eTracker.Engager = eManager.Engager;
// Multithreading maybe
drawer.CurrentCanvas = engagerCanvas;
eManager.IsEngage = drawer.drawSkeleton(eTracker);
if (eManager.DisablingEngagement)
{
return;
}
var recognisedGestures = recogniser.recognise();
man.reactGesture(recognisedGestures);
}
}
示例14: BodyReader_FrameArrived
private void BodyReader_FrameArrived(object sender, BodyFrameArrivedEventArgs args)
{
bool gotData = false;
using (var frame = args.FrameReference.AcquireFrame())
{
if (frame != null)
{
frame.GetAndRefreshBodyData(bodies);
gotData = true;
}
}
if (gotData && !stopped)
{
this.TrackEngagedPlayersViaHandOverHead();
}
}
示例15: Reader_BodyFrameArrived
private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
using(BodyFrame frame = e.FrameReference.AcquireFrame())
{
if (frame != null)
{
Vector4 temp = frame.FloorClipPlane;
if (((temp.X - up.X) * (temp.X - up.X) + (temp.Y - up.Y) * (temp.Y - up.Y)
+ (temp.Z - up.Z) * (temp.Z - up.Z)) > .1)
{
this.needsCal = true;
}
up = temp;
}
}
}