This feature is useful if you want to align your image data to fixed-size groups of digits, e.g., to 4-byte (32-bit) or 8-byte (64-bit) words. Data alignment can improve performance.
Using the Feature#
The pixel format can be set to any format except packed 12-bit pixel formats (e.g., Mono 12p or Bayer 12p).
How It Works#
The Line Pitch feature allows you to increase the number of bytes transmitted per line. To increase the line pitch, the camera appends zeroed bytes to each line. This allows you to align the image data to, e.g., 4-byte or 8-byte words.
Example: If you set the image ROI to a width of 250 pixels and the pixel format to Mono 8, the amount of transmitted pixel data per line is 250 bytes (250 pixels x 8 bit depth = 250 bytes).
This data cannot be aligned to 4-byte or 8-byte words because 250 is not a multiple of 4 or 8. To align the image data to 4-byte words, you must increase the line pitch from 250 bytes to at least 252 bytes (252 is the next multiple of 4). To align the image data to 8-byte words, you must increase the line pitch to at least 256 bytes.
If data chunks are enabled, adjusting the line pitch will not affect the chunk data. Zeros will only be added to the image data, not to the chunk data.
Determining the Line Pitch#
To determine the current line pitch, get the value of the
This always returns the current line pitch in bytes, regardless of the
LinePitchEnable parameter setting.
Setting the Line Pitch, Aligning Image Data to 4-Byte Words#
To align image data to 4-byte words, set the
LinePitchEnable parameter to
If the current line pitch is not a multiple of four, the line pitch is automatically set to the next multiple of four. The image data is now aligned to 4-byte words (32-bit words).
Setting the Line Pitch, Aligning Image Data to Any Word Size#
To set the line pitch and align image data to any word size:
- Set the
true. If the current line pitch is not a multiple of four, the line pitch is automatically set to the next multiple of four.
- Get the value of the
LinePitchparameter. This returns the minimum possible value for the line pitch adjustment.
- Set the
LinePitchparameter to the desired value. For a 4-byte, 8-byte, 16-byte, etc. word alignment, set the parameter value to the next multiple of 4, 8, 16, etc., starting at the minimum possible value determined in step 2. Example: If the value determined in step 2 is 252 and you want to align the image data to 8-byte words, set the
LinePitchparameter to 256 (= the next multiple of 8).
// Enable the line pitch feature camera.LinePitchEnable.SetValue(true); // Get the current line pitch int64_t i = camera.LinePitch.GetValue(); // Set the Line Pitch parameter value to the next multiple of 8 camera.LinePitch.SetValue(((i+7)/8)*8);
This sample code is only available in C++ language.
You can also use the pylon Viewer to easily set the parameters.