PixelDataConverter Class#
Inheritance Hierarchy#
System.Object
Basler.Pylon.PixelDataConverter
Syntax#
C#
VB
The PixelDataConverter type exposes the following members.
Constructors#
Name | Description | |
---|---|---|
PixelDataConverter | Initializes a new instance of the PixelDataConverter class |
Properties#
Name | Description | |
---|---|---|
OutputPixelFormat | Sets or gets the output pixel format. | |
Parameters | The parameter collection of the camera object. |
Methods#
Name | Description | |
---|---|---|
Convert(IntPtr, Int64, IImage) | Creates a new image by converting an image to a different format. | |
Convert(IntPtr, Int64, IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. | |
Convert(T)(T[], IImage) | Creates a new image by converting an image to a different format. | |
Convert(T)(T[], IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. | |
Convert(T)(IntPtr, Int64, T[], PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. | |
Convert(T, U)(T[], U[], PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. | |
Dispose | Releases all resources used by the PixelDataConverter | |
GetBufferSizeForConversion(IImage) | Computes the size of the destination image buffer in byte. Use ToInt32(Int64) to convert to 32 bit if necessary. | |
GetBufferSizeForConversion(PixelType, Int32, Int32) | Computes the size of the destination image buffer in byte. Use ToInt32(Int64) to convert to 32 bit if necessary. | |
IsSupportedInputFormat | Indicates if the given pixel format is a supported input format. | |
IsSupportedOutputFormat | Indicates if the given pixel format is a supported output format. |
Remarks#
Supported input image formats defined by the pixel type:
- Mono1packed
- Mono2packed
- Mono4packed
- Mono8
- Mono10
- Mono10packed
- Mono10p
- Mono12
- Mono12packed
- Mono12p
- Mono16
- BayerGR8
- BayerRG8
- BayerGB8
- BayerBG8
- BayerGR10
- BayerRG10
- BayerGB10
- BayerBG10
- BayerGR12
- BayerRG12
- BayerGB12
- BayerBG12
- BayerGR12Packed
- BayerRG12Packed
- BayerGB12Packed
- BayerBG12Packed
- BayerGR12p
- BayerRG12p
- BayerGB12p
- BayerBG12p
- BayerGR16
- BayerRG16
- BayerGB16
- BayerBG16
- RGB8packed
- BGR8packed
- RGBA8packed
- BGRA8packed
- GB10packed
- BGR10packed
- RGB12packed
- BGR12packed
- RGB12V1packed
- RGB16packed
- RGB8planar
- RGB16planar
- YUV422packed
- YUV422_YUYV_Packed
- BGRA8packed - This pixel type can be used in Windows bitmaps.
- BGR8packed - This pixel type can be used in Windows bitmaps.
- RGB8packed
- RGB16packed
- RGB8planar
- RGB16planar
- Mono8
- Mono16
RGB, BGR and Bayer image formats are converted to monochrome formats by using the following formula: C++
Limitations: The last column of an YUV input image with odd width cannot be converted. The last column and the last row of a Bayer input image cannot be converted. The default treatment of rows and columns that cannot be converted due to their location on edges can be controlled using the @PixelDataConverter/InconvertibleEdgeHandling parameter. For more information, see the Convert() method description.
Thread Safety: The PixelDataConverter class is not thread-safe.
PixelDataConverter.Convert Method (IntPtr, Int64, IImage)#
Creates a new image by converting an image to a different format.
Syntax#
C#
public virtual void Convert(
IntPtr pDestinationBuffer,
long destinationBufferSizeBytes,
IImage sourceImage
)
VB
Public Overridable Sub Convert (
pDestinationBuffer As IntPtr,
destinationBufferSizeBytes As Long,
sourceImage As IImage
)
Parameters#
- pDestinationBuffer
- Type: System.IntPtr
The pointer to the buffer of the destination image. - destinationBufferSizeBytes
- Type: System.Int64
The size of the buffer of the destination image. - sourceImage
- Type: Basler.Pylon.IImage
The source image.
Remarks#
The image is converted to the destination image according to the current converter settings. The padding area of a row in the destination image is set to zero.
Preconditions:
- The format of the source image must be supported by the converter.
- The destination image buffer must be large enough to hold the destination image.
- The source image buffer and the destination image buffer must not be identical.
Error Safety: Throws an exception if the passed parameters are not valid. The converter object is still valid after an error.
PixelDataConverter.Convert Method (IntPtr, Int64, IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation)#
Creates a new image by converting an image to a different format.
Syntax#
C#
public virtual void Convert(
IntPtr pDestinationBuffer,
long destinationBufferSizeBytes,
IntPtr pSourceBuffer,
long sourceBufferSizeBytes,
PixelType sourcePixelType,
int sourceWidth,
int sourceHeight,
int sourcePaddingX,
ImageOrientation sourceOrientation
)
VB
Public Overridable Sub Convert (
pDestinationBuffer As IntPtr,
destinationBufferSizeBytes As Long,
pSourceBuffer As IntPtr,
sourceBufferSizeBytes As Long,
sourcePixelType As PixelType,
sourceWidth As Integer,
sourceHeight As Integer,
sourcePaddingX As Integer,
sourceOrientation As ImageOrientation
)
Parameters#
- pDestinationBuffer
- Type: System.IntPtr
The pointer to the buffer of the destination image. - destinationBufferSizeBytes
- Type: System.Int64
The size of the buffer of the destination image. - pSourceBuffer
- Type: System.IntPtr
The pointer to the buffer of the source image. - sourceBufferSizeBytes
- Type: System.Int64
The size of the buffer of the source image. - sourcePixelType
- Type: Basler.Pylon.PixelType
The pixel type of the source image. - sourceWidth
- Type: System.Int32
The number of pixels in a row in the source image. - sourceHeight
- Type: System.Int32
The number of rows in the source image. - sourcePaddingX
- Type: System.Int32
The number of extra data bytes at the end of each row. The default value is usually 0. - sourceOrientation
- Type: Basler.Pylon.ImageOrientation
The vertical orientation of the source image in the image buffer. The default value is usually ImageOrientation.TopDown.
Remarks#
The image is converted to the destination image according to the current converter settings. The padding area of a row in the destination image is set to zero.
Preconditions:
- The source buffer parameters must point to a valid image.
- The format of the source image must be supported by the converter.
- The destination image buffer must be large enough to hold the destination image.
- The source image buffer and the destination image buffer must not be identical.
- The sourceWidth value must be >= 0.
- The sourceHeight value must be >= 0.
- The sourcePaddingX value must be >= 0.
Error Safety: Throws an exception if the passed parameters are not valid. The converter object is still valid after an error.
PixelDataConverter.Convert(T) Method (IntPtr, Int64, T[], PixelType, Int32, Int32, Int32, ImageOrientation)#
Creates a new image by converting an image to a different format.
Syntax#
C#
public virtual void Convert<T>(
IntPtr pDestinationBuffer,
long destinationBufferSizeBytes,
T[] sourceBuffer,
PixelType sourcePixelType,
int sourceWidth,
int sourceHeight,
int sourcePaddingX,
ImageOrientation sourceOrientation
)
VB
Public Overridable Sub Convert(Of T) (
pDestinationBuffer As IntPtr,
destinationBufferSizeBytes As Long,
sourceBuffer As T(),
sourcePixelType As PixelType,
sourceWidth As Integer,
sourceHeight As Integer,
sourcePaddingX As Integer,
sourceOrientation As ImageOrientation
)
Parameters#
- pDestinationBuffer
- Type: System.IntPtr
The pointer to the buffer of the destination image. - destinationBufferSizeBytes
- Type: System.Int64
The size of the buffer of the destination image. - sourceBuffer
- Type: T[]
The array providing the buffer of the source image. - sourcePixelType
- Type: Basler.Pylon.PixelType
The pixel type of the source image. - sourceWidth
- Type: System.Int32
The number of pixels in a row in the source image. - sourceHeight
- Type: System.Int32
The number of rows in the source image. - sourcePaddingX
- Type: System.Int32
The number of extra data bytes at the end of each row. The default value is usually 0. - sourceOrientation
- Type: Basler.Pylon.ImageOrientation
The vertical orientation of the source image in the image buffer. The default value is usually ImageOrientation.TopDown.
Type Parameters#
- T
- The array item value type of the source buffer array.
Remarks#
The image is converted to the destination image according to the current converter settings. The padding area of a row in the destination image is set to zero.
Preconditions:
- The source buffer parameters must point to a valid image.
- The format of the source image must be supported by the converter.
- The destination image buffer must be large enough to hold the destination image.
- The source image buffer and the destination image buffer must not be identical.
- The sourceWidth value must be >= 0.
- The sourceHeight value must be >= 0.
- The sourcePaddingX value must be >= 0.
Error Safety: Throws an exception if the passed parameters are not valid. The converter object is still valid after an error.
PixelDataConverter.Convert(T) Method (T[], IImage)#
Creates a new image by converting an image to a different format.
Syntax#
C#
VB
Parameters#
- destinationBuffer
- Type: T[]
The array providing the buffer of the destination image. - sourceImage
- Type: Basler.Pylon.IImage
The source image.
Type Parameters#
- T
- The array item value type of the destination buffer array.
Remarks#
The image is converted to the destination image according to the current converter settings. The padding area of a row in the destination image is set to zero.
Preconditions:
- The format of the source image must be supported by the converter.
- The destination image buffer must be large enough to hold the destination image.
- The source image buffer and the destination image buffer must not be identical.
Error Safety: Throws an exception if the passed parameters are not valid. The converter object is still valid after an error.
PixelDataConverter.Convert(T) Method (T[], IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation)#
Creates a new image by converting an image to a different format.
Syntax#
C#
public virtual void Convert<T>(
T[] destinationBuffer,
IntPtr pSourceBuffer,
long sourceBufferSizeBytes,
PixelType sourcePixelType,
int sourceWidth,
int sourceHeight,
int sourcePaddingX,
ImageOrientation sourceOrientation
)
VB
Public Overridable Sub Convert(Of T) (
destinationBuffer As T(),
pSourceBuffer As IntPtr,
sourceBufferSizeBytes As Long,
sourcePixelType As PixelType,
sourceWidth As Integer,
sourceHeight As Integer,
sourcePaddingX As Integer,
sourceOrientation As ImageOrientation
)
Parameters#
- destinationBuffer
- Type: T[]
The array providing the buffer of the destination image. - pSourceBuffer
- Type: System.IntPtr
The pointer to the buffer of the source image. - sourceBufferSizeBytes
- Type: System.Int64
The size of the buffer of the source image. - sourcePixelType
- Type: Basler.Pylon.PixelType
The pixel type of the source image. - sourceWidth
- Type: System.Int32
The number of pixels in a row in the source image. - sourceHeight
- Type: System.Int32
The number of rows in the source image. - sourcePaddingX
- Type: System.Int32
The number of extra data bytes at the end of each row. The default value is usually 0. - sourceOrientation
- Type: Basler.Pylon.ImageOrientation
The vertical orientation of the source image in the image buffer. The default value is usually ImageOrientation.TopDown.
Type Parameters#
- T
- The array item value type of the destination buffer array.
Remarks#
The image is converted to the destination image according to the current converter settings. The padding area of a row in the destination image is set to zero.
Preconditions:
- The source buffer parameters must point to a valid image.
- The format of the source image must be supported by the converter.
- The destination image buffer must be large enough to hold the destination image.
- The source image buffer and the destination image buffer must not be identical.
- The sourceWidth value must be >= 0.
- The sourceHeight value must be >= 0.
- The sourcePaddingX value must be >= 0.
Error Safety: Throws an exception if the passed parameters are not valid. The converter object is still valid after an error.
PixelDataConverter.Convert(T, U) Method (T[], U[], PixelType, Int32, Int32, Int32, ImageOrientation)#
Creates a new image by converting an image to a different format.
Syntax#
C#
public virtual void Convert<T, U>(
T[] destinationBuffer,
U[] sourceBuffer,
PixelType sourcePixelType,
int sourceWidth,
int sourceHeight,
int sourcePaddingX,
ImageOrientation sourceOrientation
)
VB
Public Overridable Sub Convert(Of T, U) (
destinationBuffer As T(),
sourceBuffer As U(),
sourcePixelType As PixelType,
sourceWidth As Integer,
sourceHeight As Integer,
sourcePaddingX As Integer,
sourceOrientation As ImageOrientation
)
Parameters#
- destinationBuffer
- Type: T[]
The array providing the buffer of the destination image. - sourceBuffer
- Type: U[]
The array providing the buffer of the source image. - sourcePixelType
- Type: Basler.Pylon.PixelType
The pixel type of the source image. - sourceWidth
- Type: System.Int32
The number of pixels in a row in the source image. - sourceHeight
- Type: System.Int32
The number of rows in the source image. - sourcePaddingX
- Type: System.Int32
The number of extra data bytes at the end of each row. The default value is usually 0. - sourceOrientation
- Type: Basler.Pylon.ImageOrientation
The vertical orientation of the source image in the image buffer. The default value is usually ImageOrientation.TopDown.
Type Parameters#
- T
- The array item value type of the destination buffer array.
- U
- The array item value type of the source buffer array.
Remarks#
The image is converted to the destination image according to the current converter settings. The padding area of a row in the destination image is set to zero.
Preconditions:
- The source buffer parameters must point to a valid image.
- The format of the source image must be supported by the converter.
- The destination image buffer must be large enough to hold the destination image.
- The source image buffer and the destination image buffer must not be identical.
- The sourceWidth value must be >= 0.
- The sourceHeight value must be >= 0.
- The sourcePaddingX value must be >= 0.
Error Safety: Throws an exception if the passed parameters are not valid. The converter object is still valid after an error.
PixelDataConverter.Dispose Method#
Releases all resources used by the PixelDataConverter
Syntax#
C#
VB
Implements#
IDisposable.Dispose()
PixelDataConverter.GetBufferSizeForConversion Method (IImage)#
Computes the size of the destination image buffer in byte. Use ToInt32(Int64) to convert to 32 bit if necessary.
Syntax#
C#
VB
Parameters#
- sourceImage
- Type: Basler.Pylon.IImage
The source image.
Return Value#
Type: Int64
The size of the destination image when converting the given source image using current converter settings. Use ToInt32(Int64) to convert to 32 bit if necessary.
Remarks#
Thread Safety: This method is not thread-safe.
Error Safety: Throws an exception if the destination image size for the input cannot be computed. The converter object is still valid after an error.
PixelDataConverter.GetBufferSizeForConversion Method (PixelType, Int32, Int32)#
Computes the size of the destination image buffer in byte. Use ToInt32(Int64) to convert to 32 bit if necessary.
Syntax#
C#
public virtual long GetBufferSizeForConversion(
PixelType sourcePixelType,
int sourceWidth,
int sourceHeight
)
VB
Public Overridable Function GetBufferSizeForConversion (
sourcePixelType As PixelType,
sourceWidth As Integer,
sourceHeight As Integer
) As Long
Parameters#
- sourcePixelType
- Type: Basler.Pylon.PixelType
The pixel type of the source image. - sourceWidth
- Type: System.Int32
The number of pixels in a row in the source image. - sourceHeight
- Type: System.Int32
The number of rows in the source image.
Return Value#
Type: Int64
The size of the destination image when converting the source image using current converter settings. Use ToInt32(Int64) to convert to 32 bit if necessary.
Remarks#
Preconditions:
- The
sourceWidth
value must be >= 0. - The
sourceHeight
value must be >= 0.
Error Safety: Throws an exception if the destination image size for the input cannot be computed. The converter object is still valid after an error.
PixelDataConverter.IsSupportedInputFormat Method#
Indicates if the given pixel format is a supported input format.
Syntax#
C#
VB
Parameters#
- sourcePixelType
- Type: Basler.Pylon.PixelType
The pixel format of the source image.
Return Value#
Type: Boolean
Returns true if the given pixel format is supported.
Remarks#
Thread Safety: This method is not thread-safe.
Error Safety: Does not throw C++ exceptions.
PixelDataConverter.IsSupportedOutputFormat Method#
Indicates if the given pixel format is a supported output format.
Syntax#
C#
VB
Parameters#
- destinationPixelType
- Type: Basler.Pylon.PixelType
The pixel format of the destination image.
Return Value#
Type: Boolean
Returns true if the given pixel format is supported.
Remarks#
Thread Safety: This method is not thread-safe.
Error Safety: Does not throw C++ exceptions.
PixelDataConverter Constructor#
Initializes a new instance of the PixelDataConverter class
Syntax#
C#
VB
PixelDataConverter.Convert Method#
Overload List#
Name | Description | |
---|---|---|
Convert(T)(T[], IImage) | Creates a new image by converting an image to a different format. | |
Convert(IntPtr, Int64, IImage) | Creates a new image by converting an image to a different format. | |
Convert(T, U)(T[], U[], PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. | |
Convert(T)(T[], IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. | |
Convert(T)(IntPtr, Int64, T[], PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. | |
Convert(IntPtr, Int64, IntPtr, Int64, PixelType, Int32, Int32, Int32, ImageOrientation) | Creates a new image by converting an image to a different format. |
PixelDataConverter.GetBufferSizeForConversion Method#
Overload List#
Name | Description | |
---|---|---|
GetBufferSizeForConversion(IImage) | Computes the size of the destination image buffer in byte. Use ToInt32(Int64) to convert to 32 bit if necessary. | |
GetBufferSizeForConversion(PixelType, Int32, Int32) | Computes the size of the destination image buffer in byte. Use ToInt32(Int64) to convert to 32 bit if necessary. |
PixelDataConverter.OutputPixelFormat Property#
Sets or gets the output pixel format.
Syntax#
C#
VB
Property Value#
Type: PixelType
Remarks#
Thread Safety: This property is not thread-safe.
Error Safety: Throws an exception if OutputPixelFormat is set to an unsupported or invalid PixelFormat. The converter object is still valid after an error.
PixelDataConverter.Parameters Property#
The parameter collection of the camera object.
Syntax#
C#
VB
Return Value#
Type: IParameterCollection
Returns the parameter collection of the camera object.
Remarks#
You can access parameters by passing a key from a parameter list to the index operator, e.g. key from a parameter list, e.g. C++
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.