从 ushort[] 创建 BitmapImage
是否可以从 ushort 数组创建 BitmapImage?如果是这样怎么办?
目前我正在创建一个位图,将其转换为位图数组并显示它,但这太慢了,我需要不断更新图像(实时视频源),同时创建每个帧的 UI 填充,这当视频运行时,我的应用程序变得非常慢。所以我需要尽快将我的 ushort[] 转换为 BitmapImage
谢谢, 埃蒙
Is it possible to create a BitmapImage from a ushort array? and if so how?
At the minute I'm creating a Bitmap, converting it to a Bitmap array and displaying it, but this is too slow, I need to continuously update the image (live video feed), while each frame is being created the UI studders, this is making my app very slow when video is running. So I need to get my ushort[] into a BitmapImage as fast as possible
Thanks,
Eamonn
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有一个如何通过 MemoryStream 获取 BitmapImage 的示例,这可能会有所帮助你
可以使用 BitConverter 将 ushort 转换为字节以输入到 MemoryStream
here you have an example of how to get a BitmapImage through a MemoryStream, this might help you
you can use BitConverter to convert ushorts to byte for input to MemoryStream
假设您使用
0
和255
之间的值,您可以将其转换为字节数组,然后将其加载到MemoryStream
中:Assuming you're working with values between
0
and255
you could cast it into an array of bytes and then load it into aMemoryStream
: