Skip to content

PixelTypeExtensions Class#

Extension class for the PixelType enum class.

Inheritance Hierarchy#

System.Object
  Basler.Pylon.PixelTypeExtensions

Syntax#

C#

public static class PixelTypeExtensions

VB

<ExtensionAttribute>
Public NotInheritable Class PixelTypeExtensions

The PixelTypeExtensions type exposes the following members.

Methods#

 NameDescription
Public methodStatic memberBitDepth Returns the bit depth of a pixel value in bits.
Public methodStatic memberBitPerPixel Returns the bits needed to store a pixel.
Public methodStatic memberComputeBufferSize Computes the buffer size in byte.
Public methodStatic memberHasAlpha Returns true when an the image using the given pixel type has an alpha channel.
Public methodStatic memberIsBayer Returns true when the pixel type represents a Bayer format.
Public methodStatic memberIsBayerPacked Returns true if the pixel type is Bayer and the pixel values are not byte aligned.
Public methodStatic memberIsBGR Returns true when the pixel type represents a BGR or BGRA format.
Public methodStatic memberIsBGRA Returns true when the pixel type represents a BGRA format.
Public methodStatic memberIsBGRPacked Returns true if the pixel type is BGR and the pixel values are not byte aligned.
Public methodStatic memberIsColorImage Returns true when an image using the given pixel type is a color image (RGB/BGR/RGBA/BGRA etc.) or Bayer.
Public methodStatic memberIsFloatingPoint Returns true if a given pixel type represents a floating point number.
Public methodStatic memberIsMono Returns true when a given pixel is monochrome, e.g. Mono8 or BayerGR8.
Public methodStatic memberIsMonoImage Returns true when an image using the given pixel type is monochrome, e.g. Mono8.
Public methodStatic memberIsMonoPacked Returns true if the pixel type is Mono and the pixel values are not byte aligned.
Public methodStatic memberIsPacked Returns true if the pixels of the given pixel type are not byte aligned.
Public methodStatic memberIsPackedInLsbFormat Returns true if the pixel type is packed in lsb packed format.
Public methodStatic memberIsPlanar Returns true if images of the pixel type are divided into multiple planes.
Public methodStatic memberIsRGB Returns true when the pixel type represents an RGB or RGBA format.
Public methodStatic memberIsRGBA Returns true when the pixel type represents an RGBA format.
Public methodStatic memberIsRGBPacked Returns true if the pixel type is RGB and the pixel values are not byte aligned.
Public methodStatic memberIsYUV Returns true when the pixel type represents a YUV format.
Public methodStatic memberPixelColorFilterValue Returns the Bayer color filter type.
Public methodStatic memberPixelIncrementX Returns the minimum step size expressed in pixels for extracting an AOI.
Public methodStatic memberPixelIncrementY Returns the minimum step size expressed in pixels for extracting an AOI.
Public methodStatic memberPlaneCount Returns number of planes in the image composed of the pixel type.
Public methodStatic memberPlanePixelType Returns the pixel type of a plane.
Public methodStatic memberSamplesPerPixel Returns the number of values measured per pixel.
Public methodStatic memberToPixelType Converts a String to a PixelType using pylons CPixelTypeMapper.
 

PixelTypeExtensions.BitDepth Method#

Returns the bit depth of a pixel value in bits.

Syntax#

C#

public static uint BitDepth(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function BitDepth ( 
    pixelType As PixelType
) As UInteger

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: UInt32
Returns the bit depth of a pixel value in bits.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.BitPerPixel Method#

Returns the bits needed to store a pixel.

Syntax#

C#

public static uint BitPerPixel(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function BitPerPixel ( 
    pixelType As PixelType
) As UInteger

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: UInt32
Returns the bits needed to store a pixel.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.ComputeBufferSize Method#

Computes the buffer size in byte.

Syntax#

C#

public static ulong ComputeBufferSize(
    this PixelType pixelType,
    int width,
    int height,
    int paddingX
)

VB

<ExtensionAttribute>
Public Shared Function ComputeBufferSize ( 
    pixelType As PixelType,
    width As Integer,
    height As Integer,
    paddingX As Integer
) As ULong

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
width
Type: System.Int32
The width of the image in pixel.
height
Type: System.Int32
The height of the image in pixel.
paddingX
Type: System.Int32
The line end padding in byte.
Return Value#

Type: UInt64
the buffer size in bytes needed by the given image dimensions.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

Remarks#

Preconditions for calculating the buffer size:
 

  • The pixelType is not PixelType.Undefined.
  • The width is positive.
  • The height is positive.
  • The paddingX is positive.

PixelTypeExtensions.HasAlpha Method#

Returns true when an the image using the given pixel type has an alpha channel.

Syntax#

C#

public static bool HasAlpha(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function HasAlpha ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when an the image using the given pixel type has an alpha channel.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsBayer Method#

Returns true when the pixel type represents a Bayer format.

Syntax#

C#

public static bool IsBayer(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsBayer ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when the pixel type represents a Bayer format.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsBayerPacked Method#

Returns true if the pixel type is Bayer and the pixel values are not byte aligned.

Syntax#

C#

public static bool IsBayerPacked(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsBayerPacked ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if the pixel type is Bayer and the pixel values are not byte aligned.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsBGR Method#

Returns true when the pixel type represents a BGR or BGRA format.

Syntax#

C#

public static bool IsBGR(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsBGR ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when the pixel type represents a BGR or BGRA format.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsBGRA Method#

Returns true when the pixel type represents a BGRA format.

Syntax#

C#

public static bool IsBGRA(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsBGRA ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when the pixel type represents a BGRA format.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsBGRPacked Method#

Returns true if the pixel type is BGR and the pixel values are not byte aligned.

Syntax#

C#

public static bool IsBGRPacked(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsBGRPacked ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if the pixel type is BGR and the pixel values are not byte aligned.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsColorImage Method#

Returns true when an image using the given pixel type is a color image (RGB/BGR/RGBA/BGRA etc.) or Bayer.

Syntax#

C#

public static bool IsColorImage(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsColorImage ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when an image using the given pixel type is a color image (RGB/BGR/RGBA/BGRA etc.) or Bayer.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsFloatingPoint Method#

Returns true if a given pixel type represents a floating point number.

Syntax#

C#

public static bool IsFloatingPoint(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsFloatingPoint ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if a given pixel type represents a floating point number.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsMono Method#

Returns true when a given pixel is monochrome, e.g. Mono8 or BayerGR8.

Syntax#

C#

public static bool IsMono(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsMono ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when a given pixel is monochrome, e.g. Mono8 or BayerGR8.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsMonoImage Method#

Returns true when an image using the given pixel type is monochrome, e.g. Mono8.

Syntax#

C#

public static bool IsMonoImage(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsMonoImage ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when an image using the given pixel type is monochrome, e.g. Mono8.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsMonoPacked Method#

Returns true if the pixel type is Mono and the pixel values are not byte aligned.

Syntax#

C#

public static bool IsMonoPacked(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsMonoPacked ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if the pixel type is Mono and the pixel values are not byte aligned.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsPacked Method#

Returns true if the pixels of the given pixel type are not byte aligned.

Syntax#

C#

public static bool IsPacked(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsPacked ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if the pixels of the given pixel type are not byte aligned.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsPackedInLsbFormat Method#

Returns true if the pixel type is packed in lsb packed format.

Syntax#

C#

public static bool IsPackedInLsbFormat(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsPackedInLsbFormat ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if the pixel type is packed in lsb packed format.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsPlanar Method#

Returns true if images of the pixel type are divided into multiple planes.

Syntax#

C#

public static bool IsPlanar(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsPlanar ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if images of the pixel type are divided into multiple planes.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsRGB Method#

Returns true when the pixel type represents an RGB or RGBA format.

Syntax#

C#

public static bool IsRGB(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsRGB ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when the pixel type represents an RGB or RGBA format.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsRGBA Method#

Returns true when the pixel type represents an RGBA format.

Syntax#

C#

public static bool IsRGBA(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsRGBA ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when the pixel type represents an RGBA format.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsRGBPacked Method#

Returns true if the pixel type is RGB and the pixel values are not byte aligned.

Syntax#

C#

public static bool IsRGBPacked(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsRGBPacked ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true if the pixel type is RGB and the pixel values are not byte aligned.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.IsYUV Method#

Returns true when the pixel type represents a YUV format.

Syntax#

C#

public static bool IsYUV(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function IsYUV ( 
    pixelType As PixelType
) As Boolean

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: Boolean
Returns true when the pixel type represents a YUV format.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.PixelColorFilterValue Method#

Returns the Bayer color filter type.

Syntax#

C#

public static PixelColorFilter PixelColorFilterValue(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function PixelColorFilterValue ( 
    pixelType As PixelType
) As PixelColorFilter

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: PixelColorFilter
Returns the Bayer color filter type.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.PixelIncrementX Method#

Returns the minimum step size expressed in pixels for extracting an AOI.

Syntax#

C#

public static uint PixelIncrementX(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function PixelIncrementX ( 
    pixelType As PixelType
) As UInteger

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: UInt32
Returns the minimum step size expressed in pixels for extracting an AOI.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.PixelIncrementY Method#

Returns the minimum step size expressed in pixels for extracting an AOI.

Syntax#

C#

public static uint PixelIncrementY(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function PixelIncrementY ( 
    pixelType As PixelType
) As UInteger

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: UInt32
Returns the minimum step size expressed in pixels for extracting an AOI.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.PlaneCount Method#

Returns number of planes in the image composed of the pixel type.

Syntax#

C#

public static uint PlaneCount(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function PlaneCount ( 
    pixelType As PixelType
) As UInteger

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: UInt32
Returns number of planes in the image composed of the pixel type.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.PlanePixelType Method#

Returns the pixel type of a plane.

Syntax#

C#

public static PixelType PlanePixelType(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function PlanePixelType ( 
    pixelType As PixelType
) As PixelType

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: PixelType
Returns the pixel type of a plane.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.SamplesPerPixel Method#

Returns the number of values measured per pixel.

Syntax#

C#

public static uint SamplesPerPixel(
    this PixelType pixelType
)

VB

<ExtensionAttribute>
Public Shared Function SamplesPerPixel ( 
    pixelType As PixelType
) As UInteger

Parameters#
pixelType
Type: Basler.Pylon.PixelType
The pixel type tested.
Return Value#

Type: UInt32
Returns the number of values measured per pixel.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type PixelType. 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).

PixelTypeExtensions.ToPixelType Method#

Converts a String to a PixelType using pylons CPixelTypeMapper.

Syntax#

C#

public static PixelType ToPixelType(
    this string value
)

VB

<ExtensionAttribute>
Public Shared Function ToPixelType ( 
    value As String
) As PixelType

Parameters#
value
Type: System.String
The value to be converted.
Return Value#

Type: PixelType
Returns the converted pixel type.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type String. 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).

Remarks#

PixelType a = "Mono8".ToPixelType();