本文整理汇总了C#中CoordinateMapper.MapCameraPointToColorSpace方法的典型用法代码示例。如果您正苦于以下问题:C# CoordinateMapper.MapCameraPointToColorSpace方法的具体用法?C# CoordinateMapper.MapCameraPointToColorSpace怎么用?C# CoordinateMapper.MapCameraPointToColorSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoordinateMapper
的用法示例。
在下文中一共展示了CoordinateMapper.MapCameraPointToColorSpace方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ColorSpaceKinectJoints
/// <summary>
/// Constructor
/// </summary>
/// <param name="body">Kinect body</param>
/// <param name="coordinateMapper">Coordinate mapper</param>
public ColorSpaceKinectJoints(KinectBody body, CoordinateMapper coordinateMapper)
{
if (body == null)
throw new ArgumentNullException("body");
if (coordinateMapper == null)
throw new ArgumentNullException("coordinateMapper");
this.jointPositions = new Dictionary<JointType,ColorSpacePoint>();
foreach (Joint joint in body.Joints.Values)
{
this.jointPositions.Add(joint.JointType, coordinateMapper.MapCameraPointToColorSpace(joint.Position));
}
}
示例2: Scale
public static Point Scale(this Joint joint, CoordinateMapper mapper)
{
Point point = new Point();
ColorSpacePoint colorPoint = mapper.MapCameraPointToColorSpace(joint.Position);
point.X = float.IsInfinity(colorPoint.X) ? 0.0 : colorPoint.X;
point.Y = float.IsInfinity(colorPoint.Y) ? 0.0 : colorPoint.Y;
return point;
}
示例3: ToPoint
/// <summary>
/// Converts the specified CameraSpacePoint into a 2-D point.
/// </summary>
/// <param name="position">The CameraSpacePoint to convert.</param>
/// <param name="visualization">The type of the conversion (color, depth, or infrared).</param>
/// <param name="coordinateMapper">The CoordinateMapper to make the conversion.</param>
/// <returns>The corresponding 2-D point.</returns>
public static Point ToPoint(this CameraSpacePoint position, Visualization visualization, CoordinateMapper coordinateMapper)
{
Point point = new Point();
switch (visualization)
{
case Visualization.Color:
{
ColorSpacePoint colorPoint = coordinateMapper.MapCameraPointToColorSpace(position);
point.X = float.IsInfinity(colorPoint.X) ? 0.0 : colorPoint.X;
point.Y = float.IsInfinity(colorPoint.Y) ? 0.0 : colorPoint.Y;
}
break;
case Visualization.Depth:
case Visualization.Infrared:
{
DepthSpacePoint depthPoint = coordinateMapper.MapCameraPointToDepthSpace(position);
point.X = float.IsInfinity(depthPoint.X) ? 0.0 : depthPoint.X;
point.Y = float.IsInfinity(depthPoint.Y) ? 0.0 : depthPoint.Y;
}
break;
default:
break;
}
return point;
}
示例4: DrawBone
internal static void DrawBone(DrawingContext drawingContext, System.Windows.Media.Brush brush, JointType startJoint, JointType endJoint, IReadOnlyDictionary<JointType, Joint> joints, System.Windows.Rect rect, CoordinateMapper coordinateMapper, bool useDepthSpace = true, double line = 0.8F)
{
if (joints[startJoint].TrackingState != TrackingState.Tracked
&& joints[endJoint].TrackingState != TrackingState.Tracked)
{
return;
}
System.Windows.Point startPoint;
System.Windows.Point endPoint;
if (useDepthSpace)
{
startPoint = coordinateMapper.MapCameraPointToDepthSpace(joints[startJoint].Position).GetPoint();
endPoint = coordinateMapper.MapCameraPointToDepthSpace(joints[endJoint].Position).GetPoint();
}
else
{
startPoint = coordinateMapper.MapCameraPointToColorSpace(joints[startJoint].Position).GetPoint();
endPoint = coordinateMapper.MapCameraPointToColorSpace(joints[endJoint].Position).GetPoint();
}
if (rect.Contains(startPoint) && rect.Contains(endPoint))
drawingContext.DrawLine(new System.Windows.Media.Pen(brush, line), startPoint, endPoint);
}
开发者ID:andreasassetti,项目名称:Kinect-v2-Visual-Studio-Visualizer,代码行数:25,代码来源:ExtensionMethodsBodyFrame.cs
示例5: MainWindow
/// <summary>
/// Initializes a new instance of the MainWindow class.
/// </summary>
public MainWindow()
{
//Depth pixe> FILE
string winDir = System.Environment.GetEnvironmentVariable("windir");
writer.WriteLine("START");
// get the kinectSensor object
this.kinectSensor = KinectSensor.GetDefault();
// get the coordinate mapper
coordinateMapper = this.kinectSensor.CoordinateMapper;
// open the reader for the depth frames
this.depthFrameReader = this.kinectSensor.DepthFrameSource.OpenReader();
this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader();
// wire handler for frame arrival
this.depthFrameReader.FrameArrived += this.Depth_Reader_FrameArrived;
if (this.bodyFrameReader != null)
{
Console.Write("yO");
this.bodyFrameReader.FrameArrived += this.Body_Reader_FrameArrived;
}
// get FrameDescription from DepthFrameSource
this.depthFrameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;
// get size of joint space
this.displayWidth = depthFrameDescription.Width;
this.displayHeight = depthFrameDescription.Height;
// open the reader for the body frames
this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader();
// allocate space to put the pixels being received and converted
this.depthPixels = new byte[this.depthFrameDescription.Width * this.depthFrameDescription.Height];
this.hist = new int[this.depthPixels.Length];
// create the bitmap to display
this.depthBitmap = new WriteableBitmap(this.depthFrameDescription.Width, this.depthFrameDescription.Height, 96.0, 96.0, PixelFormats.Gray8, null);
// set IsAvailableChanged event notifier
this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;
// open the sensor
this.kinectSensor.Open();
// set the status text
this.StatusText = this.kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText
: Properties.Resources.NoSensorStatusText;
// use the window object as the view model in this simple example
this.DataContext = this;
this.ctr = 0;
this.handpoint = coordinateMapper.MapCameraPointToColorSpace(lefthandpoint);
this.lefthandpoint = this.lefthand.Position;
// initialize the components (controls) of the window
this.InitializeComponent();
}
示例6: TranslatePoint
/// <summary>
/// Translates between kinect and drawing points
/// </summary>
private System.Drawing.Point TranslatePoint(CameraSpacePoint point, CoordinateMapper mapper)
{
var colorPoint = mapper.MapCameraPointToColorSpace(point);
return new System.Drawing.Point((int)colorPoint.X, (int)colorPoint.Y);
}
示例7: ProjectCameraPoint
/// <summary>
/// Project the camera space point using the given sensor coordinate mapper.
/// </summary>
/// <param name="inPoint"></param>
/// <param name="coordinateMapper"></param>
/// <returns></returns>
public Point ProjectCameraPoint(CameraSpacePoint inPoint, CoordinateMapper coordinateMapper)
{
if (_useDepthMapper)
{
DepthSpacePoint depthPoint = coordinateMapper.MapCameraPointToDepthSpace(inPoint);
return new Point(depthPoint.X, depthPoint.Y);
}
else
{
ColorSpacePoint colorPoint = coordinateMapper.MapCameraPointToColorSpace(inPoint);
return new Point(colorPoint.X, colorPoint.Y);
}
}
示例8: DrawAxis
//--------------------------------------------------------------------------------------
//Helper functions for imaging and debuging
//--------------------------------------------------------------------------------------
public void DrawAxis(CoordinateMapper coordinateMapper, DrawingContext drawingContext)
{
Matrix3D t = RightPHIZTransform();
ColorSpacePoint p = coordinateMapper.MapCameraPointToColorSpace(PHIZTracker.ToVectorCS(GetOffset(t)));
ColorSpacePoint px = coordinateMapper.MapCameraPointToColorSpace(ToVectorCS(Vector3D.Add(GetOffset(t),
Vector3D.Multiply(.5,GetAxisDir(new Vector3D(1, 0, 0), t)))));
ColorSpacePoint py = coordinateMapper.MapCameraPointToColorSpace(ToVectorCS(Vector3D.Add(GetOffset(t),
Vector3D.Multiply(.5, GetAxisDir(new Vector3D(0, 1, 0), t)))));
ColorSpacePoint pz = coordinateMapper.MapCameraPointToColorSpace(ToVectorCS(Vector3D.Add(GetOffset(t),
Vector3D.Multiply(.5, GetAxisDir(new Vector3D(0, 0, 1), t)))));
drawingContext.DrawEllipse(Brushes.Aqua, null, new Point(p.X, p.Y), 30, 30);
drawingContext.DrawLine(new Pen(Brushes.Red, 15), new Point(p.X, p.Y), new Point(px.X, px.Y));
drawingContext.DrawLine(new Pen(Brushes.Green, 15), new Point(p.X, p.Y), new Point(py.X, py.Y));
drawingContext.DrawLine(new Pen(Brushes.Blue, 15), new Point(p.X, p.Y), new Point(pz.X, pz.Y));
}