|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Research.Kinect.Nui;
namespace JK.KinectExperiments.InfoTool
{
class Program
{
static void Main(string[] args)
{
foreach (Runtime CurrentRuntime in Runtime.Kinects)
{
string DefaultVideo = "";
string DefaultDepth = "";
if (CurrentRuntime.Status == KinectStatus.Connected)
{
CurrentRuntime.Initialize(
RuntimeOptions.UseDepthAndPlayerIndex // RuntimeOptions.UseDepth
| RuntimeOptions.UseSkeletalTracking
| RuntimeOptions.UseColor
);
DefaultVideo = CurrentRuntime.VideoStream.StreamType.ToString() + " / "
+ CurrentRuntime.VideoStream.Resolution.ToString() + " / "
+ CurrentRuntime.VideoStream.Type.ToString();
DefaultDepth = CurrentRuntime.DepthStream.StreamType.ToString() + " / "
+ CurrentRuntime.DepthStream.Resolution.ToString() + " / "
+ CurrentRuntime.DepthStream.Type.ToString();
CurrentRuntime.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution1280x1024, ImageType.Color);
CurrentRuntime.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
}
Console.WriteLine();
Console.WriteLine("Kinect ID: " + CurrentRuntime.InstanceIndex + " (" + CurrentRuntime.InstanceName + ")");
Console.WriteLine(" Status: " + CurrentRuntime.Status.ToString());
if (CurrentRuntime.Status == KinectStatus.Connected)
{
Console.WriteLine(" Camera: Device: " + CurrentRuntime.NuiCamera.UniqueDeviceName);
Console.WriteLine(" Angle: " + CurrentRuntime.NuiCamera.ElevationAngle.ToString());
string CurrentVideo = CurrentRuntime.VideoStream.StreamType.ToString() + " / "
+ CurrentRuntime.VideoStream.Resolution.ToString() + " / "
+ CurrentRuntime.VideoStream.Type.ToString();
string CurrentDepth = CurrentRuntime.DepthStream.StreamType.ToString() + " / "
+ CurrentRuntime.DepthStream.Resolution.ToString() + " / "
+ CurrentRuntime.DepthStream.Type.ToString();
Console.WriteLine(" Streams: Video Current: " + CurrentVideo);
Console.WriteLine(" Video Default: " + DefaultVideo);
Console.WriteLine(" Depth Current: " + CurrentDepth);
Console.WriteLine(" Depth Default: " + DefaultDepth);
Console.WriteLine(" SkeletonEngine: " + (CurrentRuntime.SkeletonEngine.IsEnabled ? "Enabled" : "Disabled"));
ImageFrame Frame=CurrentRuntime.VideoStream.GetNextFrame(1000);
Console.WriteLine(" Frame: Video: " + Frame.Image.Width + "x" + Frame.Image.Height + "x" + Frame.Image.BytesPerPixel*8 + "bpp");
Frame = CurrentRuntime.DepthStream.GetNextFrame(1000);
Console.WriteLine(" Depth: " + Frame.Image.Width + "x" + Frame.Image.Height + "x" + Frame.Image.BytesPerPixel * 8 + "bpp");
}
CurrentRuntime.Uninitialize();
}
Console.WriteLine("Press Enter to continue...");
Console.ReadLine();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Programming since 10 years old with first commercial app sold in age of 16.
In past got Bachelor's degree in Computer Sciences and worked as Linux administrator and software developer.
Currently slightly over 30 and working as IT Project Manager for Flextronics.
Still coding for fun and/or money.