本文整理汇总了C#中BodyFrameReader类的典型用法代码示例。如果您正苦于以下问题:C# BodyFrameReader类的具体用法?C# BodyFrameReader怎么用?C# BodyFrameReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BodyFrameReader类属于命名空间,在下文中一共展示了BodyFrameReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RelativeTime
public void RelativeTime()
{
bodyReader = GetBodyFrameReader();
using ( var bodyFrame = bodyReader.AcquireLatestFrame() ) {
Assert.AreNotEqual( 0, bodyFrame.RelativeTime() );
}
}
示例2: AcquireLatestFrame
public void AcquireLatestFrame()
{
bodyReader = GetBodyFrameReader();
using ( var bodyFrame = bodyReader.AcquireLatestFrame() ) {
}
using ( var bodyFrame = bodyReader.AcquireLatestFrame() ) {
}
}
示例3: GetAndRefreshBodyData
public void GetAndRefreshBodyData()
{
bodyReader = GetBodyFrameReader();
using ( var bodyFrame = bodyReader.AcquireLatestFrame() ) {
Body[] bodies = new Body[6];
bodyFrame.GetAndRefreshBodyData( bodies );
foreach ( var body in bodies ) {
}
}
}
示例4: DebugWindow
public DebugWindow(Controller.GameController GameController)
{
InitializeComponent();
db = new Helpers.DBHelper();
attGameController = GameController;
attks = KinectSensor.GetDefault();
attks.Open();
attBodyFrameReader = attks.BodyFrameSource.OpenReader();
attBodyFrameReader.FrameArrived += this.Reader_BodyFrameArrived;
}
示例5: Window_Loaded
// Primary function. Runs when the window loads in.
private void Window_Loaded(object sender, RoutedEventArgs e)
{
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_bodies = new Body[_sensor.BodyFrameSource.BodyCount];
_reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);
_reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
_bodyReader = _sensor.BodyFrameSource.OpenReader();
_bodyReader.FrameArrived += BodyReader_FrameArrived;
// 2) Initialize the face source with the desired features
_faceSource = new FaceFrameSource(_sensor, 0, FaceFrameFeatures.BoundingBoxInColorSpace |
FaceFrameFeatures.FaceEngagement |
FaceFrameFeatures.Glasses |
FaceFrameFeatures.Happy |
FaceFrameFeatures.LeftEyeClosed |
FaceFrameFeatures.MouthOpen |
FaceFrameFeatures.PointsInColorSpace |
FaceFrameFeatures.RightEyeClosed);
_faceReader = _faceSource.OpenReader();
_faceReader.FrameArrived += FaceReader_FrameArrived;
}
}
示例6: MainWindow
public MainWindow()
{
InitializeComponent();
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_bodies = new Body[_sensor.BodyFrameSource.BodyCount];
_colorReader = _sensor.ColorFrameSource.OpenReader();
_colorReader.FrameArrived += ColorReader_FrameArrived;
_bodyReader = _sensor.BodyFrameSource.OpenReader();
_bodyReader.FrameArrived += BodyReader_FrameArrived;
// 2) Initialize the face source with the desired features
_faceSource = new FaceFrameSource(_sensor, 0, FaceFrameFeatures.BoundingBoxInColorSpace |
FaceFrameFeatures.FaceEngagement |
FaceFrameFeatures.Glasses |
FaceFrameFeatures.Happy |
FaceFrameFeatures.LeftEyeClosed |
FaceFrameFeatures.MouthOpen |
FaceFrameFeatures.PointsInColorSpace |
FaceFrameFeatures.RightEyeClosed |
FaceFrameFeatures.LookingAway);
_faceReader = _faceSource.OpenReader();
_faceReader.FrameArrived += FaceReader_FrameArrived;
}
}
示例7: RunAsync
//Run the application async
static async Task RunAsync()
{
//Get the default Kinect Sensor
_kinectSensor = KinectSensor.GetDefault();
// open the reader for the body frames
_bodyFrameReader = _kinectSensor.BodyFrameSource.OpenReader();
// Set the coordinate Mapper
_coordinateMapper = _kinectSensor.CoordinateMapper;
//open the sensor
_kinectSensor.Open();
//Check if the Sensor is available
Console.WriteLine("Kinect sensor is " + (_kinectSensor.IsAvailable ? "available " : "missing. Waiting for sensor: press ctrl + c to abort"));
while (!_kinectSensor.IsAvailable)
{
//wait for sensor
}
Console.WriteLine("Kinect sensor is " + (_kinectSensor.IsAvailable ? "available " : "missing. Waiting for sensor: press ctrl + c to abort"));
//Init gesture
_handOverHeadDetector = new HandOverHeadDetector(HandDetectionType.BothHands, HandState.Open);
//Subscribe to completed event
_handOverHeadDetector.GestureCompleteEvent += HandOverHeadDetectorOnGestureCompleteEvent;
//Start reciving kinect Frames
if (_bodyFrameReader != null)
{
_bodyFrameReader.FrameArrived += Reader_FrameArrived;
}
}
示例8: MainWindow
/// <summary>
/// コンストラクタ
/// </summary>
public MainWindow()
{
InitializeComponent();
// Init Kinect Sensors
this.kinect = KinectSensor.GetDefault();
if (kinect == null)
{
this.showCloseDialog("Kinectが接続されていないか、利用できません。アプリケーションを終了します。");
}
this.colorImageFormat = ColorImageFormat.Bgra;
this.colorFrameDescription = this.kinect.ColorFrameSource.CreateFrameDescription(this.colorImageFormat);
this.colorFrameReader = this.kinect.ColorFrameSource.OpenReader();
this.colorFrameReader.FrameArrived += ColorFrameReader_FrameArrived;
bodyFrameReader = kinect.BodyFrameSource.OpenReader();
bodyFrameReader.FrameArrived += bodyFrameReader_FrameArrived;
this.kinect.Open();
this.bodies = this.bodies = new Body[kinect.BodyFrameSource.BodyCount];
KinectRegion.SetKinectRegion(this, kinectRegion);
this.kinectRegion.KinectSensor = KinectSensor.GetDefault();
this.isTraining = false;
}
示例9: Recorder
public Recorder(string filename, Dispatcher dispatcher)
{
if (!sensor.IsOpen)
{
sensor.Open();
}
if (sensor.IsOpen)
{
bodyReader = sensor.BodyFrameSource.OpenReader();
colorReader = sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Body | FrameSourceTypes.Depth | FrameSourceTypes.Color);
logger.Trace("Kinect sensor is open");
}
else
{
logger.Error("Kinect sensor is not open");
}
metadata = MetadataFactory.Create();
fileStream = new FileStream(filename, FileMode.Create);
AppendMessageToFileStream(metadata.Serialize());
this.dispatcher = dispatcher;
}
示例10: MainWindow
public MainWindow()
{
// Get the sensor
sensor = KinectSensor.GetDefault();
sensor.Open();
// Setup readers for each source of data we want to use
colorFrameReader = sensor.ColorFrameSource.OpenReader();
bodyFrameReader = sensor.BodyFrameSource.OpenReader();
// Setup event handlers that use what we get from the readers
colorFrameReader.FrameArrived += this.Reader_ColorFrameArrived;
bodyFrameReader.FrameArrived += this.Reader_BodyFrameArrived;
// Get ready to draw graphics
drawingGroup = new DrawingGroup();
// Initialize the components (controls) of the window
InitializeComponent();
// Initialize color components
// create the bitmap to display
colorBitmap = new WriteableBitmap(1920, 1080, 96.0, 96.0, PixelFormats.Bgr32, null);
ColorImage.Source = colorBitmap;
// Initialize the game components
birdHeight = this.Height / 2; // put the bird in the middle of the screen
prevRightHandHeight = 0;
prevLeftHandHeight = 0;
pipeX = -1;
pipeGapY = 250;
pipeGapLength = 170;
randomGenerator = new Random();
}
示例11: MainWindow
public MainWindow()
{
InitializeComponent();
network.init();
_sensor = KinectSensor.GetDefault();
if(_sensor != null)
{
_sensor.Open();
// Identify the bodies
_bodies = new Body[_sensor.BodyFrameSource.BodyCount];
_colorReader = _sensor.ColorFrameSource.OpenReader();
_colorReader.FrameArrived += ColorReader_FrameArrived;
_bodyReader = _sensor.BodyFrameSource.OpenReader();
_bodyReader.FrameArrived += BodyReader_FrameArrived;
// Initialize the face source with the desired features, some are commented out, include later.
_faceSource = new FaceFrameSource(_sensor, 0, FaceFrameFeatures.BoundingBoxInColorSpace);// |
/*
FaceFrameFeatures.FaceEngagement |
FaceFrameFeatures.Glasses |
FaceFrameFeatures.Happy |
FaceFrameFeatures.LeftEyeClosed |
FaceFrameFeatures.MouthOpen |
FaceFrameFeatures.PointsInColorSpace |
FaceFrameFeatures.RightEyeClosed);
*/
_faceReader = _faceSource.OpenReader();
_faceReader.FrameArrived += FaceReader_FrameArrived;
}
}
示例12: MainWindow
public MainWindow()
{
InitializeComponent();
var hubConnection = new HubConnection("http://divewakeweb.azurewebsites.net/");
stockTickerHubProxy = hubConnection.CreateHubProxy("WakeHub");
hubConnection.Start().Wait();
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_sensor.Open();
_bodies = new Body[_sensor.BodyFrameSource.BodyCount];
_colorReader = _sensor.ColorFrameSource.OpenReader();
_colorReader.FrameArrived += ColorReader_FrameArrived;
_bodyReader = _sensor.BodyFrameSource.OpenReader();
_bodyReader.FrameArrived += BodyReader_FrameArrived;
// 2) Initialize the face source with the desired features
_faceSource = new FaceFrameSource(_sensor, 0, FaceFrameFeatures.BoundingBoxInColorSpace |
FaceFrameFeatures.FaceEngagement |
FaceFrameFeatures.Glasses |
FaceFrameFeatures.LeftEyeClosed |
FaceFrameFeatures.PointsInColorSpace |
FaceFrameFeatures.RightEyeClosed);
_faceReader = _faceSource.OpenReader();
_faceReader.FrameArrived += FaceReader_FrameArrived;
}
}
示例13: MainWindow
/// <summary>
/// The main window of the app.
/// </summary>
public MainWindow()
{
InitializeComponent();
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
_depthReader = _sensor.DepthFrameSource.OpenReader();
_depthReader.FrameArrived += DepthReader_FrameArrived;
_infraredReader = _sensor.InfraredFrameSource.OpenReader();
_infraredReader.FrameArrived += InfraredReader_FrameArrived;
_bodyReader = _sensor.BodyFrameSource.OpenReader();
_bodyReader.FrameArrived += BodyReader_FrameArrived;
_bodies = new Body[_sensor.BodyFrameSource.BodyCount];
// Initialize the HandsController and subscribe to the HandsDetected event.
_handsController = new HandsController();
_handsController.HandsDetected += HandsController_HandsDetected;
_sensor.Open();
}
}
示例14: MainWindow
public MainWindow()
{
InitializeComponent();
try
{
///キネクト本体の接続を確保、たしか接続されてない場合はfalseとかになった記憶
this.kinect = KinectSensor.GetDefault();
///読み込む画像のフォーマット(rgbとか)を指定、どうやって読み込むかのリーダの設定も
this.colorImageFormat = ColorImageFormat.Bgra;
this.colorFrameDescription = this.kinect.ColorFrameSource.CreateFrameDescription(this.colorImageFormat);
this.colorFrameReader = this.kinect.ColorFrameSource.OpenReader();
this.colorFrameReader.FrameArrived += colorFrameReader_FrameArrived;
this.kinect.Open();//キネクト起動!!
if (!kinect.IsOpen)
{
this.errorLog.Visibility = Visibility.Visible;
this.errorLog.Content = "キネクトが見つからないよ!残念!";
throw new Exception("キネクトが見つかりませんでした!!!");
}
///bodyを格納するための配列作成
bodies = new Body[kinect.BodyFrameSource.BodyCount];
///ボディリーダーを開く
bodyFrameReader = kinect.BodyFrameSource.OpenReader();
bodyFrameReader.FrameArrived += bodyFrameReader_FrameArrived;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Close();
}
}
示例15: MainWindow
public MainWindow()
{
InitializeComponent();
_sensor = KinectSensor.GetDefault();
if (_sensor != null)
{
// Listen for body data.
_bodySource = _sensor.BodyFrameSource;
_bodyReader = _bodySource.OpenReader();
_bodyReader.FrameArrived += BodyReader_FrameArrived;
_colorReader = _sensor.ColorFrameSource.OpenReader();
_colorReader.FrameArrived += ColorReader_FrameArrived;
// Listen for HD face data.
_faceSource = new HighDefinitionFaceFrameSource(_sensor);
_faceSourceSub = new HighDefinitionFaceFrameSource(_sensor);
// _faceSource.TrackingIdLost += OnTrackingIdLost;
_faceReader = _faceSource.OpenReader();
_faceReaderSub = _faceSourceSub.OpenReader();
_faceReader.FrameArrived += FaceReader_FrameArrived;
_faceReaderSub.FrameArrived += FaceReaderSub_FrameArrived;
_faceModel = new FaceModel();
_faceAlignment = new FaceAlignment();
_faceAlignmentSub = new FaceAlignment();
// Start tracking!
_sensor.Open();
}
}