[UWP] [VB]查看SoftwareBitmap的像素 [英] [UWP][VB]View Pixels of a SoftwareBitmap

查看:75
本文介绍了[UWP] [VB]查看SoftwareBitmap的像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有从MediaCapture获得的SoftwareBitmap,我想查看各个像素。我该怎么做呢?谢谢。



Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

< blockquote>

你好,


阅读
SoftwareBitmap   first:  使用CopyToBuffer和CopyFromBuffer在SoftwareBitmap和WriteableBitmap的PixelBuffer之间来回复制像素数据。


然后参见
WriteableBitmap
: 


WriteableBitmap的图像源数据是基础像素缓冲。 WriteableBitmap.PixelBuffer不能直接写入,但是,您可以使用特定于语言的技术来访问缓冲区并更改其内容。

要从C#或Microsoft Visual Basic访问像素内容,您可以使用AsStream扩展方法以流的形式访问底层缓冲区。


对于特定像素,请参阅此主题的答案:  https://social.msdn.microsoft.com/论坛/ zh-CN / 6b7a7beb-0e18-484f-8e9c-5fad3482485d / uwp-bitmap-class-access-raw-pixel-data?forum = wpdevelop 


Rob在哪里提供了回答如何计算像素在数组中的位置。并且
你可以
找个样子。


祝你好运,


Barry


I have a SoftwareBitmap obtained from MediaCapture, and I would like to view the individual pixels. How do I do this? Thanks.


Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

解决方案

Hello,

Read SoftwareBitmap first: Use CopyToBuffer and CopyFromBuffer to copy pixel data back and forth between a SoftwareBitmap and the PixelBuffer of a WriteableBitmap.

Then see WriteableBitmap

The image source data of a WriteableBitmap is an underlying pixel buffer. WriteableBitmap.PixelBuffer cannot be written to directly, however, you can use language-specific techniques to access the buffer and change its contents.
To access the pixel content from C# or Microsoft Visual Basic, you can use the AsStream extension method to access the underlying buffer as a stream.

And to specific pixel, see the answer from this thread: https://social.msdn.microsoft.com/Forums/en-US/6b7a7beb-0e18-484f-8e9c-5fad3482485d/uwp-bitmap-class-access-raw-pixel-data?forum=wpdevelop 

Where Rob has provided the answer for how to caculate the a pixel's position in the array. And here you can find a sample.

Best regards,

Barry


这篇关于[UWP] [VB]查看SoftwareBitmap的像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆