Create a byte buffer with the serialized image pixel data.
Namespace: Stemmer.Cvb.Extensions
Assembly: Stemmer.Cvb.Extensions (in Stemmer.Cvb.Extensions.dll) Version: 14.0.0.0
Syntax
public static TPixel[] ToPixelBuffer<TPixel>( this Image image, RawPixelBufferLayout layout ) where TPixel : struct, new()
Parameters
- image
- Type: Stemmer.CvbImage
Image object for which the pixels are to be serialized. Note that the input image must have the same data type on all input planes and that the data type must be mappable to one of the native CLR types. - layout
- Type: Stemmer.Cvb.ExtensionsRawPixelBufferLayout
Plane layout to use when serializing the image's pixel data (actual setting will not have an effect on images with only one plane).
Type Parameters
- TPixel
- Type of the pixel array to produce. Must match the type of the pixels as described by the image's data type descriptor.
Return Value
Type: TPixelArray with the serialized pixel data
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Image. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Exceptions
Exception | Condition |
---|---|
ArgumentNullException | if the image parameter is null |
InvalidOperationException | if the image is multi-planar and the different planes have different data type(s) or if the data type of the plane(s) of the image is/are not compatible with the TPixel generic parameter |
Exception | if serialization failed |
See Also