1

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.

EMGU has an Image constructor that looks promising, which is described here.

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.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Mårten
  • 231
  • 2
  • 14
  • This is the wrapper of a C lib, thus the arguments are the same. In C arrays are pointers without length information. – weismat Mar 28 '12 at 12:40
  • No the arguments are not the same, C doesn't even have constructors so how could they be? – Mårten Mar 28 '12 at 14:23

1 Answers1

0

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. Something like this:

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

and data - your array with Image data.

VMAtm
  • 27,943
  • 17
  • 79
  • 125