本文整理汇总了C#中ColorImageFormat类的典型用法代码示例。如果您正苦于以下问题:C# ColorImageFormat类的具体用法?C# ColorImageFormat怎么用?C# ColorImageFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColorImageFormat类属于命名空间,在下文中一共展示了ColorImageFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FaceTracker
/// <summary>
/// Initializes a new instance of the FaceTracker class from a reference of the Kinect device.
/// <param name="sensor">Reference to kinect sensor instance</param>
/// </summary>
public FaceTracker(KinectSensor sensor)
{
if (sensor == null) {
throw new ArgumentNullException("sensor");
}
if (!sensor.ColorStream.IsEnabled) {
throw new InvalidOperationException("Color stream is not enabled yet.");
}
if (!sensor.DepthStream.IsEnabled) {
throw new InvalidOperationException("Depth stream is not enabled yet.");
}
this.operationMode = OperationMode.Kinect;
this.coordinateMapper = sensor.CoordinateMapper;
this.initializationColorImageFormat = sensor.ColorStream.Format;
this.initializationDepthImageFormat = sensor.DepthStream.Format;
var newColorCameraConfig = new CameraConfig(
(uint)sensor.ColorStream.FrameWidth,
(uint)sensor.ColorStream.FrameHeight,
sensor.ColorStream.NominalFocalLengthInPixels,
FaceTrackingImageFormat.FTIMAGEFORMAT_UINT8_B8G8R8X8);
var newDepthCameraConfig = new CameraConfig(
(uint)sensor.DepthStream.FrameWidth,
(uint)sensor.DepthStream.FrameHeight,
sensor.DepthStream.NominalFocalLengthInPixels,
FaceTrackingImageFormat.FTIMAGEFORMAT_UINT16_D13P3);
this.Initialize(newColorCameraConfig, newDepthCameraConfig, IntPtr.Zero, IntPtr.Zero, this.DepthToColorCallback);
}
开发者ID:ushadow,项目名称:handinput,代码行数:35,代码来源:FaceTracker.cs
示例2: ProcessData
public void ProcessData(KinectSensor kinectSensor, ColorImageFormat colorImageFormat,
byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage,
Skeleton[] skeletons, int skeletonFrameNumber)
{
if (skeletons == null)
{
return;
}
// Update the list of trackers and the trackers with the current frame information
foreach (Skeleton skeleton in skeletons)
{
if (skeleton.TrackingState == SkeletonTrackingState.Tracked ||
skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
{
// We want keep a record of any skeleton, tracked or untracked.
if (!this._trackedSkeletons.ContainsKey(skeleton.TrackingId))
{
this._trackedSkeletons.Add(skeleton.TrackingId, new SkeletonFaceTracker());
}
// Give each tracker the upated frame.
SkeletonFaceTracker skeletonFaceTracker;
if (this._trackedSkeletons.TryGetValue(skeleton.TrackingId, out skeletonFaceTracker))
{
skeletonFaceTracker.OnFrameReady(kinectSensor, colorImageFormat, colorImage, depthImageFormat,
depthImage, skeleton);
skeletonFaceTracker.LastTrackedFrame = skeletonFrameNumber;
}
}
}
RemoveOldTrackers(skeletonFrameNumber);
}
开发者ID:konni-arcadia,项目名称:kinect-data-transmitter,代码行数:34,代码来源:FaceTracker.cs
示例3: SkeletalTracker
public SkeletalTracker(Rectangle fullscreen, CoordinateMapper coordinateMapper, ColorImageFormat colorFormat)
{
_coordinateMapper = coordinateMapper;
_colorFormat = colorFormat;
_fullscreen = fullscreen;
_aspectRatio = _fullscreen.Width / (double)_fullscreen.Height;
}
开发者ID:NickVanderPyle,项目名称:KinectCamForConference,代码行数:7,代码来源:SkeletalTracker.cs
示例4: VideoShot
public VideoShot(ColorImageProcesser processer, MainWindow window, int videoNum,
KinectSensor kinectDevice,
int dWidht, int dHeight,
int cWidth, int cHeight,
DepthImageFormat dImageFormat, ColorImageFormat cImageFormat)
{
parentProcesser = processer;
videoName = PadLeft(videoNum);
_windowUI = window;
_kinectDevice = kinectDevice;
depthFrameWidth = dWidht;
depthFrameHeight = dHeight;
colorFrameWidth = cWidth;
colorFrameHeight = cHeight;
depthFrameStride = depthFrameWidth * BytesPerPixel;
colorFrameStride = colorFrameWidth * BytesPerPixel;
depthImageFormat = dImageFormat;
colorImageFormat = cImageFormat;
screenHeight = SystemParameters.PrimaryScreenHeight;
screenWidth = SystemParameters.PrimaryScreenWidth;
Start();
}
开发者ID:BillHuangg,项目名称:CMKinectImageProcess,代码行数:28,代码来源:VideoShot.cs
示例5: KinectManager
/*/////////////////////////////////////////
* CONSTRUCTOR(S)/DESTRUCTOR(S)
*/
///////////////////////////////////////
public KinectManager(ColorImageFormat p_colour_format,
DepthImageFormat p_depth_format,
KinectGame_WindowsXNA p_game)
{
// Initialise the Kinect selector...
this.colour_image_format = p_colour_format;
this.depth_image_format = p_depth_format;
this.root_game = p_game;
this.colour_stream = null;
this.depth_stream = null;
this.skeleton_stream = null;
this.debug_video_stream_dimensions = new Vector2(200, 150);
status_map = new Dictionary<KinectStatus, string>();
KinectSensor.KinectSensors.StatusChanged += this.KinectSensorsStatusChanged; // handler function for changes in the Kinect system
this.DiscoverSensor();
this.status_map.Add(KinectStatus.Undefined, "UNKNOWN STATUS MESSAGE");
this.status_map.Add(KinectStatus.Connected, "Connected.");//string.Empty);
this.status_map.Add(KinectStatus.DeviceNotGenuine, "Detected device is not genuine!");
this.status_map.Add(KinectStatus.DeviceNotSupported, "Detected device is not supported!");
this.status_map.Add(KinectStatus.Disconnected, "Disconnected/Device required!");
this.status_map.Add(KinectStatus.Error, "Error in Kinect sensor!");
this.status_map.Add(KinectStatus.Initializing, "Initialising Kinect sensor...");
this.status_map.Add(KinectStatus.InsufficientBandwidth, "Insufficient bandwidth for Kinect sensor!");
this.status_map.Add(KinectStatus.NotPowered, "Detected device is not powered!");
this.status_map.Add(KinectStatus.NotReady, "Detected device is not ready!");
// Load the status message font:
this.msg_font = this.root_game.Content.Load<SpriteFont>("Fonts/Segoe16");
this.msg_label_pos = new Vector2(4.0f, 2.0f);
}
开发者ID:nhunt93,项目名称:CS3013_GROUP_9_PROJECT,代码行数:38,代码来源:KinectManager.cs
示例6: 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();
}
}
开发者ID:TokisaSigure,项目名称:Kinectv2-Practice,代码行数:32,代码来源:MainWindow.xaml.cs
示例7: CoordinateConverter
public CoordinateConverter(IEnumerable<byte> kinectParams, ColorImageFormat cif,
DepthImageFormat dif)
{
mapper = new CoordinateMapper(kinectParams);
this.cif = cif;
this.dif = dif;
}
开发者ID:ushadow,项目名称:handinput,代码行数:7,代码来源:CoordinateConverter.cs
示例8: OnKinectSensorChanged
protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs<KinectSensor> args)
{
if (null == args)
{
throw new ArgumentNullException("args");
}
if (null != args.OldValue)
{
args.OldValue.ColorFrameReady -= this.ColorImageReady;
if (!this.RetainImageOnSensorChange)
{
kinectColorImage.Source = null;
this.lastImageFormat = ColorImageFormat.Undefined;
}
}
if ((null != args.NewValue) && (KinectStatus.Connected == args.NewValue.Status))
{
ResetFrameRateCounters();
if (ColorImageFormat.RawYuvResolution640x480Fps15 == args.NewValue.ColorStream.Format)
{
throw new NotImplementedException("RawYuv conversion is not yet implemented.");
}
else
{
args.NewValue.ColorFrameReady += this.ColorImageReady;
}
}
}
开发者ID:TrashTonyLin,项目名称:KinectCalAngle,代码行数:32,代码来源:KinectColorViewer.xaml.cs
示例9: KinectHelper
private KinectHelper(TransformSmoothParameters tsp, bool near = false,
ColorImageFormat colorFormat = ColorImageFormat.RgbResolution1280x960Fps12,
DepthImageFormat depthFormat = DepthImageFormat.Resolution640x480Fps30)
{
_kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected);
if (_kinectSensor == null)
{
throw new Exception("No Kinect-Sensor found.");
}
if (near)
{
_kinectSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
_kinectSensor.DepthStream.Range = DepthRange.Near;
_kinectSensor.SkeletonStream.EnableTrackingInNearRange = true;
}
DepthImageFormat = depthFormat;
ColorImageFormat = colorFormat;
_kinectSensor.SkeletonStream.Enable(tsp);
_kinectSensor.ColorStream.Enable(colorFormat);
_kinectSensor.DepthStream.Enable(depthFormat);
_kinectSensor.AllFramesReady += AllFramesReady;
_kinectSensor.Start();
_faceTracker = new FaceTracker(_kinectSensor);
}
开发者ID:rechc,项目名称:KinectMiniApps,代码行数:28,代码来源:KinectHelper.cs
示例10: KinectChooser
/// <summary>
/// Initializes a new instance of the KinectChooser class.
/// </summary>
/// <param name="game">The related game object.</param>
/// <param name="colorFormat">The desired color image format.</param>
/// <param name="depthFormat">The desired depth image format.</param>
public KinectChooser(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
: base(game)
{
this.colorImageFormat = colorFormat;
this.depthImageFormat = depthFormat;
this.nearMode = false;
this.seatedMode = false;
this.SimulateMouse = false;
if (!Game1.SIMULATE_NO_KINECT)
{
KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
this.DiscoverSensor();
}
this.statusMap.Add(KinectStatus.Undefined, "Not connected, or in use");
this.statusMap.Add(KinectStatus.Connected, string.Empty);
this.statusMap.Add(KinectStatus.DeviceNotGenuine, "Device Not Genuine");
this.statusMap.Add(KinectStatus.DeviceNotSupported, "Device Not Supported");
this.statusMap.Add(KinectStatus.Disconnected, "Required");
this.statusMap.Add(KinectStatus.Error, "Error");
this.statusMap.Add(KinectStatus.Initializing, "Initializing...");
this.statusMap.Add(KinectStatus.InsufficientBandwidth, "Insufficient Bandwidth");
this.statusMap.Add(KinectStatus.NotPowered, "Not Powered");
this.statusMap.Add(KinectStatus.NotReady, "Not Ready");
}
开发者ID:shadarath,项目名称:SpaceExplorer,代码行数:33,代码来源:KinectChooser.cs
示例11: 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;
}
开发者ID:syv2357,项目名称:FASystem,代码行数:30,代码来源:MainWindow.xaml.cs
示例12: KinectSensorOnAllFramesReady
private void KinectSensorOnAllFramesReady(object sender, AllFramesReadyEventArgs allFramesReadyEventArgs)
{
using (var colorImageFrame = allFramesReadyEventArgs.OpenColorImageFrame())
{
if (colorImageFrame == null)
{
return;
}
// Make a copy of the color frame for displaying.
var haveNewFormat = this.currentColorImageFormat != colorImageFrame.Format;
if (haveNewFormat)
{
this.currentColorImageFormat = colorImageFrame.Format;
this.colorImageData = new byte[colorImageFrame.PixelDataLength];
this.colorImageWritableBitmap = new WriteableBitmap(
colorImageFrame.Width, colorImageFrame.Height, 96, 96, PixelFormats.Bgr32, null);
ColorImage.Source = this.colorImageWritableBitmap;
}
colorImageFrame.CopyPixelDataTo(this.colorImageData);
this.colorImageWritableBitmap.WritePixels(
new Int32Rect(0, 0, colorImageFrame.Width, colorImageFrame.Height),
this.colorImageData,
colorImageFrame.Width * Bgr32BytesPerPixel,
0);
}
}
开发者ID:kalwanis,项目名称:Kinect--Face-Tracking--and-LEDs,代码行数:29,代码来源:MainWindow.xaml.cs
示例13: KinectSensorOnAllFramesReady
private void KinectSensorOnAllFramesReady(object sender, AllFramesReadyEventArgs allFramesReadyEventArgs)
{
using (var colorImageFrame = allFramesReadyEventArgs.OpenColorImageFrame())
{
if (colorImageFrame == null)
{
return;
}
// Make a copy of the color frame for displaying.
var haveNewFormat = this.currentColorImageFormat != colorImageFrame.Format;
if (haveNewFormat)
{
this.currentColorImageFormat = colorImageFrame.Format;
this.colorImageData = new byte[colorImageFrame.PixelDataLength];
this.colorImageWritableBitmap = new WriteableBitmap(
colorImageFrame.Width, colorImageFrame.Height, 96, 96, PixelFormats.Bgr32, null);
ColorImage.Source = this.colorImageWritableBitmap;
}
colorImageFrame.CopyPixelDataTo(this.colorImageData);
this.colorImageWritableBitmap.WritePixels(
new Int32Rect(0, 0, colorImageFrame.Width, colorImageFrame.Height),
this.colorImageData,
colorImageFrame.Width * Bgr32BytesPerPixel,
0);
/*
double length = Point.Subtract(faceTrackingViewer.ppLeft, faceTrackingViewer.ppRight).Length;
tB.Text = length.ToString();
if (length > 19)
{
elp.Fill = Brushes.Red;
}
else
{
elp.Fill = Brushes.Green;
}
*/
double mouthWidth = faceTrackingViewer.mouthWidth;
double noseWidth = faceTrackingViewer.noseWidth;
double threshold = noseWidth * modifyValue;
tBMouthDistance.Text = mouthWidth.ToString();
tbThreshold.Text = threshold.ToString();
if (mouthWidth > threshold)
{
elp.Fill = Brushes.Red;
}
else
{
elp.Fill = Brushes.Green;
}
}
}
开发者ID:TangoChen,项目名称:KinectSmileTracking,代码行数:58,代码来源:MainWindow.xaml.cs
示例14: Kinect
public Kinect(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
: base(game)
{
this.colorImageFormat = colorFormat;
this.depthImageFormat = depthFormat;
KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
this.DiscoverSensor();
}
开发者ID:kira333,项目名称:MyProjects,代码行数:9,代码来源:Kinect.cs
示例15: MapSkeletonPointToColorPoint
/// <summary>
/// Map PointSkeleton3D to Point2D
/// </summary>
/// <param name="pointSkleton3D"></param>
/// <param name="colorImageFormat"></param>
/// <returns></returns>
public Point2D MapSkeletonPointToColorPoint(PointSkeleton3D pointSkleton3D, ColorImageFormat colorImageFormat)
{
SkeletonPoint point = new SkeletonPoint();
point.X = pointSkleton3D.X;
point.Y = pointSkleton3D.Y;
point.Z = pointSkleton3D.Z;
ColorImagePoint ImgPoint = mapper.MapSkeletonPointToColorPoint(point, colorImageFormat);
return new Point2D(ImgPoint.X, ImgPoint.Y);
}
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:15,代码来源:CoordinateMapperPlus.cs
示例16: MapSkeletonPointsToColorPoints
/// <summary>
/// Map PointSkeleton3D List to Point2 List
/// </summary>
/// <param name="pointSkeleton3D"></param>
/// <param name="colorImageFormat"></param>
/// <returns></returns>
public List<Point2D> MapSkeletonPointsToColorPoints(List<PointSkeleton3D> pointSkeleton3D, ColorImageFormat colorImageFormat)
{
List<Point2D> ret = new List<Point2D>();
foreach (var element in pointSkeleton3D)
{
ret.Add(MapSkeletonPointToColorPoint(element, colorImageFormat));
}
return ret;
}
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:15,代码来源:CoordinateMapperPlus.cs
示例17: GetHeight
public static int GetHeight(ColorImageFormat format)
{
switch (format)
{
case ColorImageFormat.RgbResolution1280x960Fps12:
return 960;
case ColorImageFormat.RawYuvResolution640x480Fps15:
case ColorImageFormat.RgbResolution640x480Fps30:
case ColorImageFormat.YuvResolution640x480Fps15:
return 480;
default:
return 480;
}
}
开发者ID:lomelina,项目名称:Biosandbox,代码行数:14,代码来源:BiometricEngine.cs
示例18: MainWindow
public MainWindow()
{
InitializeComponent();
faceTrackingViewerBinding = new Binding("Kinect") {Source = sensorChooser};
CurrentColorImageFormat = ColorImageFormat.Undefined;
Bgr32BytesPerPixel = (PixelFormats.Bgr32.BitsPerPixel + 7) / 8;
sensorChooser = new KinectSensorChooser();
sensorChooser.KinectChanged += SensorChooserOnKinectChanged;
sensorChooser.Start();
faceTrackingViewer.SetBinding(FaceTrackingViewer.KinectProperty, faceTrackingViewerBinding);
GetDirectory();
}
开发者ID:klikkamongo,项目名称:Kinect_Stemplingsur,代码行数:15,代码来源:MainWindow.xaml.cs
示例19: KinectChooser
/// <summary>
/// Initializes a new instance of the KinectChooser class.
/// </summary>
/// <param name="game">The related game object.</param>
/// <param name="colorFormat">The desired color image format.</param>
/// <param name="depthFormat">The desired depth image format.</param>
public KinectChooser(Game game, ColorImageFormat colorFormat, DepthImageFormat depthFormat)
: base(game)
{
this.colorImageFormat = colorFormat;
this.depthImageFormat = depthFormat;
KinectSensor.KinectSensors.StatusChanged += this.KinectSensors_StatusChanged;
this.DiscoverSensor();
this.statusMap.Add(KinectStatus.Connected, string.Empty);
this.statusMap.Add(KinectStatus.DeviceNotGenuine, "Device Not Genuine");
this.statusMap.Add(KinectStatus.DeviceNotSupported, "Device Not Supported");
this.statusMap.Add(KinectStatus.Disconnected, "Required");
this.statusMap.Add(KinectStatus.Error, "Error");
this.statusMap.Add(KinectStatus.Initializing, "Initializing...");
this.statusMap.Add(KinectStatus.InsufficientBandwidth, "Insufficient Bandwidth");
this.statusMap.Add(KinectStatus.NotPowered, "Not Powered");
this.statusMap.Add(KinectStatus.NotReady, "Not Ready");
}
开发者ID:KinAudio,项目名称:Master,代码行数:25,代码来源:KinectChooser.cs
示例20: OnKinectChanged
protected override void OnKinectChanged(KinectSensor oldKinectSensor, KinectSensor newKinectSensor)
{
if (oldKinectSensor != null) {
oldKinectSensor.ColorFrameReady -= ColorImageReady;
kinectColorImage.Source = null;
lastImageFormat = ColorImageFormat.Undefined;
}
if (newKinectSensor != null && newKinectSensor.Status == KinectStatus.Connected) {
ResetFrameRateCounters();
if (newKinectSensor.ColorStream.Format == ColorImageFormat.RawYuvResolution640x480Fps15) {
throw new NotImplementedException("RawYuv conversion is not yet implemented.");
}
else {
newKinectSensor.ColorFrameReady += ColorImageReady;
}
}
}
开发者ID:fatihboy,项目名称:Robosapien,代码行数:19,代码来源:KinectColorViewer.xaml.cs
注:本文中的ColorImageFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论