Skip to content

How To: Find Valid Values for the PixelFormat Node#

If you are using the CInstantCamera pylon camera class and want to access camera features, you'll need to obtain a node map from the camera. This node map contains a node for every implemented camera feature. This approach is defined by the Generic Interface for Cameras Standard (GenICam). The GenICam standard can be downloaded here.

According to the GenICam standard, all public features of a camera device must be included in the camera's GenICam XML file and must use the GenICam Standard Feature Naming Convention (SFNC), that means, they must use the SFNC name and interface type for those features if they exist. The Standard Feature Naming Convention can be downloaded here.

The PixelFormat feature is one of those standard features listed in the SFNC as a recommended feature, and the interface type is defined as IEnumeration.

Common to all nodes that contain a value are the ToString() and FromString() (inherited through the base interface IValue). This means that a node's value can be read and written as string.

Specific nodes offer additional specific access methods, e.g. the Enumeration interface type offers SetIntValue() and GetIntValue() in addition to ToString() and FromString().

The GenICam GenApi Reference Implementation defines the interfaces, but it does not define any valid value range nor any enumeration values to be used for a specific feature, e.g., PixelFormat. The GenICam GenApi Reference Implementation can be downloaded here.

So, how do we know which PixelFormat string corresponds to which IntValue?

GenICam (as a collection of standards) also defines GenICam Pixel Format Names and Values, where the Pixel Format Name is the string (Symbolic Name) to be used with ToString() and FromString(), and the 32-bit value is the IntValue to be used with SetIntValue() and GetIntValue(). The complete list of defined pixel formats can be downloaded here.

The pylon API comes with its own, Basler-specific enumeration for common pixel formats, EPixelType (PixelType.h). In addition, there's a helper class CPixelTypeMapper (PixelTypeMapper.h). This helper class can be used to map between GenICam values (string or IntValue) and pylon's EPixelType enumeration.

The following mapping functions are available:

EPixelType GetPylonPixelTypeFromNodeValue(int64_t nodeValue) const;
static EPixelType GetPylonPixelTypeByName(const char* pszSymbolicName);
static EPixelType GetPylonPixelTypeByName(const String_t& symbolicName)
static const char* GetNameByPixelType(EPixelType pixelType, SFNCVersion sfncVer = SFNCVersion\_pre2\_0);

The latter function mapping from EPixelType to the GenICam Symbolic Name needs a SFNC Version hint. That is because some pixel format names have been changed in SFNC Version 2.0.0.

Which SFNC version the camera is compatible with can be obtained by calling camera.GetSFNCVersion().

This sample code shows those different ways of accessing the PixelFormat feature.

If one of the above-mentioned links doesn't work and for an overview of all available downloads, go to:

Back to Knowledge Articles