简体   繁体   English

C#中pixelgrabber(Java)的等效函数是什么

[英]What is the equivalent function for pixelgrabber (Java) in C#

I want to grab all pixel values of a Bitmap image in C# and push it into a two-dimensional array.我想在 C# 中获取 Bitmap 图像的所有像素值并将其推送到二维数组中。 In Java, it's easy to do with the pixelgrabber function.在 Java 中,使用 pixelgrabber 函数很容易做到。

What is the equivalent function to pixelgrabber (Java) in C#? C# 中 pixelgrabber (Java) 的等效函数是什么?

It's GetPixel .它是GetPixel

BitmapImage image;
image.GetPixel (0, 0);

This will work, but it's not meant for parsing the whole image (it might be slow).这会起作用,但它并不意味着解析整个图像(它可能很慢)。 You need to get into unmanaged code and get a pointer to the raw data if you want the performance.如果您想要性能,您需要进入非托管代码并获取指向原始数据的指针。 A sample is in Using the LockBits method to access image data .示例位于使用 LockBits 方法访问图像数据中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM