微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Kinect v2 for windows:调整颜色框架在c#

任何人都知道,如果可能的话,如何降低色彩stream动的动力帧分辨率? 因为全高清尺寸太高,我的范围。感谢我发现这个代码全高清帧:

private BitmapSource ToBitmap(ColorFrame frame) { int width = frame.FrameDescription.Width; int height = frame.FrameDescription.Height; PixelFormat format = PixelFormats.Bgr32; byte[] pixels = new byte[width * height * ((PixelFormats.Bgr32.BitsPerPixel + 7) / 8)]; if (frame.RawColorImageFormat == ColorImageFormat.Bgra) { frame.copyRawFrameDataToArray(pixels); } else { frame.copyConvertedFrameDataToArray(pixels,ColorImageFormat.Bgra); } int stride = width * format.BitsPerPixel / 8; return BitmapSource.Create(width,height,96,format,null,pixels,stride); }

API,框架和中间件有什么区别?

如何在Windows中读取video帧缓冲区

在Windows Server上部署最好的免费Web框架?

AIO(LinuxasynchronousI / O)是否等同于Windows操作系统(不是.NET Framework级别)?

SFML – 框架独立运动+拖动窗口

我已经解决了在最后添加这个代码

BitmapSource bitmap= BitmapSource.Create(width,stride); ScaleTransform scale=new ScaleTransform((Width / bitmap.PixelWidth),(Height / bitmap.PixelHeight)); TransformedBitmap tbBitmap = new TransformedBitmap(bitmap,scale); return tbBitmap;

所以完整的方法是:

private BitmapSource ToBitmap(ColorFrame frame) { int width = frame.FrameDescription.Width; int height = frame.FrameDescription.Height; PixelFormat format = PixelFormats.Bgr32; byte[] pixels = new byte[width * height * ((PixelFormats.Bgr32.BitsPerPixel + 7) / 8)]; if (frame.RawColorImageFormat == ColorImageFormat.Bgra) { frame.copyRawFrameDataToArray(pixels); } else { frame.copyConvertedFrameDataToArray(pixels,ColorImageFormat.Bgra); } int stride = width * format.BitsPerPixel / 8; BitmapSource bitmap= BitmapSource.Create(width,stride); ScaleTransform scale=new ScaleTransform((640.0 / bitmap.PixelWidth),(480.0 / bitmap.PixelHeight)); TransformedBitmap tbBitmap = new TransformedBitmap(bitmap,scale); return tbBitmap; }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐