简体   繁体   English

UInt16 []到C#中的EMGU图像

[英]UInt16[] to EMGU image in C#

I have an UInt16 array representing an image and width/height for it, and I would like to turn this into an EMGU image in the least painful way possible. 我有一个UInt16数组,用于表示图像和宽度/高度,并且我希望以最小的痛苦将其转换为EMGU图像。

EMGU has an Image constructor that looks promising, which is described here . EMGU有一个Image的构造,看起来很有希望,这是描述在这里

But I can't understand how to format my data, it says that the first dimension is height, but why would I need a whole dimension to describe ONE number? 但是我不明白如何格式化数据,它说第一个维度是高度,但是为什么我需要一个完整的维度来描述一个数字? Clearly there is something I don't understand. 显然有些事情我不理解。 Something like Image(ushort[], height, width) makes more sense to me. Image(ushort[], height, width)东西对我来说更有意义。

According to the documentation, you need to provide: 根据文档,您需要提供:

data
Type: TDepth[,,]
The multi-dimensional data

where the 1st dimension is # of rows (height), 其中第一维是行数(高度),
the 2nd dimension is # cols (width) and 第二维是#列(宽度)和
the 3rd dimension is the channel. 第三维是通道。

So you only need to create a TDepth[,,] object (say Multidimensional Array ), and set the three properties: height, width, channel. 因此,您只需要创建一个TDepth[,,]对象(例如TDepth[,,] Array ),并设置三个属性:height,width,channel。 Something like this: 像这样:

UInt16[,,] depth = new UInt16[, , ] { { height }, { width }, { data } };

and data - your array with Image data. data -具有图像数据的数组。

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

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