如何在vb.net中将图像转换为矩阵

问题描述:

大家好吧

如何在vb.net中将图像转换为二维(数组)矩阵???

感谢您的关注。

hi everybody
how can I convert an image to 2 dimensional(array)matrix in vb.net???
thanks for your attention.

我看起来你的问题是从一些现有图像中提取位。好吧,你可以使用 System.Drawing.Bitmap 。配方的第一部分是:不要使用 GetPixel ,因为它会非常慢。您可以使用 System.Drawing.Bitmap.LockBits

http://msdn.microsoft.com/en-us/library/system.drawing。 bitmap.lockbits%28v = vs.110%29.aspx [ ^ ]。



这里可以找到一个简单的代码示例: http://msdn.microsoft.com/en-us/library /5ey6h79d%28v=vs.110%29.aspx [ ^ ]。



您需要获得每个步幅你应该解释为你的矩阵(或列;它取决于观点)的一行。



-SA
I looks like your problem is to extract bits from some existing image. Well, you can use System.Drawing.Bitmap. First part of the recipe is: don't use GetPixel, as it would be prohibitively slow. You can get quick yes reliable access to bits by using System.Drawing.Bitmap.LockBits:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.lockbits%28v=vs.110%29.aspx[^].

A simple code sample can be found here: http://msdn.microsoft.com/en-us/library/5ey6h79d%28v=vs.110%29.aspx[^].

You will need to get each stride which you should interpret as a row of your matrix (or column; it depends on point of view).

—SA