Vimba Image Transform Manual
User Manual:
Open the PDF directly: View PDF .
Page Count: 36
Vimba
Vimba Image Transform
Manual
1.5
Vimba Image Transform Manual 1.5 2016-02-27
Legal Noce
Legal Notice
Trademarks
Unless stated otherwise, all trademarks appearing in this document of Allied Vision Technologies are
brands protected by law.
Warranty
The informaon provided by Allied Vision is supplied without any guarantees or warranty whatsoever, be
it specific or implicit. Also excluded are all implicit warranes concerning the negoability, the suitability
for specific applicaons or the non-breaking of laws and patents. Even if we assume that the informaon
supplied to us is accurate, errors and inaccuracy may sll occur.
Copyright
All texts, pictures and graphics are protected by copyright and other laws protecng intellectual property.
It is not permied to copy or modify them for trade use or transfer, nor may they be used on websites.
Allied Vision Technologies GmbH 02/2016
All rights reserved.
Managing Director: Mr. Frank Grube
Tax ID: DE 184383113
Headquarters:
Taschenweg 2a
D-07646 Stadtroda, Germany
Tel.: +49 (0)36428 6770
Fax: +49 (0)36428 677-28
e-mail: info@alliedvision.com
Vimba Image Transform Manual 1.5 2
Contents
Contents
1 Contacng Allied Vision 6
2 Document history and convenons 7
2.1 Documenthistory...................................... 8
2.2 Convenons used in this manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 Styles........................................ 8
2.2.2 Symbols....................................... 9
3 General aspects of the library 10
3.1 Variants ........................................... 11
3.1.1 Opmizing OpenMP performance . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Supported image data formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Supportedtransformaons................................. 15
4 API usage 17
4.1 General ........................................... 18
4.2 FillingImageInformaon .................................. 18
4.3 Specifying Transformaon Opons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3.1 Adding color transformaons . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.3.2 Changing the debayering algorithm . . . . . . . . . . . . . . . . . . . . . . . . 19
4.4 Transformingimages .................................... 20
5 Transformaon examples 21
5.1 Debayering into an Rgb8 image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2 Debayering into a Mono8 image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.3 Applying a color correcon to an Rgb8 image . . . . . . . . . . . . . . . . . . . . . . . 23
5.4 Debayering a 12-bit image into a Mono16 image with addional color correcon . . . . 24
6 Funcon reference 26
6.1 Informaon ......................................... 27
6.1.1 VmbGetVersion().................................. 27
6.1.2 VmbGetErrorInfo() ................................. 27
6.1.3 VmbGetApiInfoString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.2 Transformaon ....................................... 28
6.2.1 VmbImageTransform() ............................... 28
6.3 Helperfuncons ...................................... 29
6.3.1 VmbSetImageInfoFromInputImage() . . . . . . . . . . . . . . . . . . . . . . . . 29
6.3.2 VmbSetImageInfoFromInputParameters() . . . . . . . . . . . . . . . . . . . . . 30
6.3.3 VmbSetImageInfoFromPixelFormat() . . . . . . . . . . . . . . . . . . . . . . . . 30
6.3.4 VmbSetImageInfoFromString() . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Vimba Image Transform Manual 1.5 3
Contents
6.3.5 VmbSetDebayerMode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.3.6 VmbSetColorCorreconMatrix3x3() . . . . . . . . . . . . . . . . . . . . . . . . 32
7 Structs 33
7.1 VmbImage.......................................... 34
7.2 VmbImageInfo........................................ 34
7.3 VmbPixelInfo ........................................ 35
7.4 VmbTransformInfo ..................................... 35
A Supported PFNC transformaons 36
Vimba Image Transform Manual 1.5 4
List of Tables
List of Tables
1 Vimba pixel formats and their counterparts in interface standards (1/2) . . . . . . . . . 13
2 Vimba pixel formats and their counterparts in interface standards (2/2) . . . . . . . . . 14
3 Minimum sizes for certain pixel formats . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Supported transformaon formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 Supported PFNC transformaons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Vimba Image Transform Manual 1.5 5
1 Contacng Allied Vision
1 Contacting Allied Vision
Connect with Allied Vision by funcon
hps://www.alliedvision.com/en/meta-header/contact
Find an Allied Vision office or distributor
hps://www.alliedvision.com/en/about-us/where-we-are
Email
info@alliedvision.com
support@alliedvision.com
Telephone
EMEA: +49 36428-677-0
The Americas: +1 978-225-2030
Asia-Pacific: +65 6634-9027
China: +86 (21) 64861133
Headquarters
Allied Vision Technologies GmbH
Taschenweg 2a
07646 Stadtroda
Germany
Tel: +49 (0)36428 677-0
Fax: +49 (0)36428 677-28
President/CEO: Frank Grube
Registraon Office: AG Jena HRB 208962
Vimba Image Transform Manual 1.5 6
2 Document history and convenons
2.1 Document history
Version Date Changes
1.0 2013-03-22 Inial version
1.2 2013-06-18 Small correcons, layout changes
1.3 2014-08-12 Rework of the whole document
1.4 2015-11-09 Renamed several Vimba components and documents (”AVT” no longer in
use), added table for pixel formats and chapter for OpenMP, added return
value descripons for funcons
1.5 2016-02-27 Rework of examples and supported transformaon table
2.2 Convenons used in this manual
To give this manual an easily understood layout and to emphasize important informaon, the following
typographical styles and symbols are used:
2.2.1 Styles
Style Funcon Example
Emphasis Programs, or highlighng important things Emphasis
Publicaon tle Publicaon tles Title
Web reference Links to web pages Link
Document reference Links to other documents Document
Output Outputs from soware GUI Output
Input Input commands, modes Input
Feature Feature names Feature
Vimba Image Transform Manual 1.5 8
2 Document history and convenons
2.2.2 Symbols
Praccal Tip
Safety-related instrucons to avoid malfuncons
Instrucons to avoid malfuncons
i
Further informaon available online
Vimba Image Transform Manual 1.5 9
3 General aspects of the library
This chapter includes:
3.1 Variants .......................... 11
3.1.1 Opmizing OpenMP performance . . . . . . . . 11
3.2 Supported image data formats . . . . . . . . . . . . . . 12
3.3 Supported transformaons . . . . . . . . . . . . . . . . 15
Vimba Image Transform Manual 1.5 10
3 General aspects of the library
The purpose of the Vimba Image Transform library is to transform images received via Vimba APIs into
common image formats. It is part of Vimba and doesn’t require a separate installaon.
Applicaons using Vimba C or C++ API may need to integrate Vimba Image Transform library as an ad-
dional library, whereas a subset of it is seamlessly integrated into the Vimba .NET API via method
Frame.Fill() (See the Vimba.NET Manual if installed). As of Vimba 2.0, two addional funcons enable
seng a compable desnaon format without knowing the PFNC naming scheme.
3.1 Variants
The Vimba Image Transform Library is available in two variants:
• The standard variant executes a funcon call in a single thread.
• The OpenMP variant distributes the funcon calls over mulple processor cores (parallel comput-
ing).
The OpenMP variant is recommended for achieving a high performance with mul-core PCs: Although
addional me is required to schedule the sub tasks, its performance roughly scales by the number of
free cores.
Both library variants have the same interface and the same name, but are delivered in different folders in
the Vimba installaon, allowing you to use the variant you want.
The OpenMP variant of the library can be found in the subdirectory OpenMP beneath the single-threaded
library variant.
Windows supports OpenMP V2.0, whereas Unix-based systems support OpenMP V4.0.
3.1.1 Opmizing OpenMP performance
The movaon behind OpenMP is to speed up computaons by distribung them to the available com-
pung cores (hyper-threading or real ones).
To minimize the addional cost of thread management (starng/stopping threads), the OpenMP runme
environment tries to reuse threads as much as possible.
Since the default values are not adjusted to your parcular use case, we recommend opmizing them to
achieve high performance with low CPU load.
Acve waing tasks and CPU load
Ideally, threads are created when OpenMP is first used in an applicaon, and they are always reused
without being interrupted by the system. In cases where the applicaon has no work items ready when
tasks finish, the waing tasks consume CPU power for a certain me and then become passive.
During acve waing, OpenMP uses high CPU load while no real work is done. This may lead to situa-
ons where OpenMP consumes too many resources although the use case isn’t demanding (low image
resoluon, slow frame rate).
Vimba Image Transform Manual 1.5 11
3 General aspects of the library
Example
If frames arrive at 10 frames per second, there is one work item every 100 ms. Even if image transfor-
maon only takes 10 ms, the threads are acve for about 100 ms. OpenMP is underulized in this case
because 90% of what it’s doing is waing for new work.
If frames arrive at 100 frames per second (frames arrive at 10 ms intervals), OpenMP is working to capac-
ity, and all threads can take on new work directly aer they have finished the previous one.
It is recommended to use the same OpenMP runme environment that the Vimba
Image Transform library uses (Windows: Visual Studio 2010 or higher; Linux:
gomp). In this case, Vimba Image Transform and the applicaon share OpenMP
threads, workload is opmally distributed between worker tasks, and waing
threads get new work fast.
Seng up environment variables
To opmize OpenMP, set up environment variables that determine the number of threads used and
OpenMP’s waing me behavior.
• Linux and Windows
–OMP_NUM_THREADS=[number of threads for OpenMP usage]
Limits the number of threads that are ulized by OpenMP. Lower this value to reduce the CPU
load that OpenMP is taking away from other applicaon threads.
–OMP_WAIT_POLICY=[ACTIVE|PASSIVE]
Changes the policy OpenMP uses when threads wait for new work to arrive. ACTIVE is the
default seng. Under Windows, you can change it only aer installing Microso KB2686593
Hoix. If a too long acve waing me causes high CPU load, change the environment variable
to PASSIVE. Then threads don’t consume CPU power while waing for new work.
• Linux
–GOMP_SPINCOUNT=[number of spins for acve waing]
If OpenMP is set to OMP_WAIT_POLICY=ACTIVE, this variable determines how long a thread
waits acvely with consuming CPU power before waing passively without consuming CPU
power. If work items arrive at a high rate, it is best to let the thread’s spin wait acvely for the
next work load. If work items arrive sporadically, a high spin count leads to unnecessary high
CPU load.
Seng GOMP_SPINCOUNT to 0 is the same as seng OMP_WAIT_POLICY to PASSIVE.
Further reading
•GCC Environment Variables
•Visual Studio OpenMP Environment Variables
3.2 Supported image data formats
In contrast to image file formats, image data formats contain no embedded meta-data, but only pure
images as rectangular arrays of pixels. These pixels have certain characteriscs, e.g. a certain color or bit
Vimba Image Transform Manual 1.5 12
3 General aspects of the library
depth and the endianness for a bit depth of more than eight, and they may appear in a certain order. All
this is described in a pixel format name.
All implemented image transformaons only accept mul-byte pixel formats in
lile-endian byte order.
For this library, pixel formats from the IIDC and GigE Vision interface specificaon, from the Pixel For-
mat Naming Convenon as well as common display formats on Windows and Linux plaorms have been
selected.
The names of the pixel formats mainly match the list of values of the ”PixelFormat” feature in the Standard
Features Naming Convenon of GenICam, but the concrete name depends on the interface standard
according to the following table:
Vimba Pixel format
(VmbPixelFormat...)
GigE Vision<2.0¹
FireWire
PFNC (USB3 Vision,
GigE Vision>=2.0)
Mono8 Mono8 Mono8
Mono10 Mono10 Mono10
Mono10p - Mono10p
Mono12 Mono12 Mono12
Mono12p - Mono12p
Mono12Packed Mono12Packed -
Mono14 Mono14 Mono14
Mono16 Mono16 Mono16
BayerXY²8BayerXY²8 BayerXY²8
BayerXY²10 BayerXY²10 BayerXY²10
BayerXY²10p - BayerXY²10p
BayerXY²12 BayerXY²12 BayerXY²12
BayerXY²12p - BayerXY²12p
BayerXY²12Packed BayerXY²12Packed -
BayerXY²16 BayerXY²16 BayerXY²16
Table 1: Vimba pixel formats and their counterparts in interface standards (1/2)
Vimba Image Transform Manual 1.5 13
3 General aspects of the library
Vimba Pixel format
(VmbPixelFormat...)
GigE Vision<2.0¹
FireWire
PFNC (USB3 Vision,
GigE Vision>=2.0)
Rgb8 RGB8Packed RGB8
Bgr8 BGR8Packed BGR8
Rgba8 RGBA8Packed RGBa8
Bgra8 BGRA8Packed BGRa8
Rgb10 RGB10Packed RGB10
Bgr10 BGR10Packed BGR10
Rgba10 - RGBa10
Bgra10 - BGRa10
Rgb12 RGB12Packed RGB12
Bgr12 BGR12Packed BGR12
Rgba12 - RGBa12
Bgra12 - BGRa12
Rgb16 RGB16Packed RGB16
Bgr16 - BGR16
Rgba16 - RGBa16
Bgra16 - BGRa16
Yuv411 YUV411Packed YUV411_8_UYYVYY
Yuv422 YUV422Packed YUV422_8_UYVY
Yuv444 YUV444Packed YUV8_UYV
YCbCr411_8_CbYYCrYY - YCbCr411_8_CbYYCrYY (layout/values same as Yuv411)
YCbCr422_8_CbYCrY - YCbCr422_8_CbYCrY (layout/values same as Yuv422)
YCbCr8_CbYCr - YCbCr8_CbYCr (layout/values same as Yuv444)
Table 2: Vimba pixel formats and their counterparts in interface standards (2/2)
¹Allied Vision GigE cameras comply with GigE Vision 1.2
²BayerXY is any of BayerGR, BayerRG, BayerGB or BayerBG
Vimba Image Transform Manual 1.5 14
3 General aspects of the library
Since the following pixel formats span a few bytes, or in some cases several lines, their width and height
or size (in pixels) must be divisible by the following values:
Pixel format Width Height Size
Mono12Packed,Mono12p 112
BayerXY¹... 221
Yuv411/YCbCr411_8_CbYYCrYY 411
Yuv422/YCbCr422_8_CbYCrY 211
Table 3: Minimum sizes for certain pixel formats
3.3 Supported transformaons
The ”Target” values from table 4 can be used within the helper funcons 6.3.1 and 6.3.2. Please see an
example in secon 5.1 for the applicaon of a transformaon operaon.
Converng an image from a lower to a higher bit depth aligns the image data to
the least significant bit.
¹BayerXY is any of BayerGR, BayerRG, BayerGB or BayerBG
Vimba Image Transform Manual 1.5 15
3 General aspects of the library
Source Target Mono
8Bit
Mono
16Bit
Color²
8Bit
Color²
16Bit
Mono8 D-D-
Mono10 D-D-
Mono10p D-D-
Mono12 D-D-
Mono12p D-D-
Mono12Packed D-D-
Mono14 D-D-
Mono16 DDD-
BayerXY¹8D-D-
BayerXY¹10 D D D D
BayerXY¹10p D D D D
BayerXY¹12 D D D D
BayerXY¹12p D D D D
BayerXY¹12Packed D D D D
BayerXY¹16 D D D D
Rgb8 D-D-
Bgr8 D-D-
Rgba8 D-D-
Bgra8 D-D-
Yuv411/YCbCr411_8_CbYYCrYY D-D-
Yuv422/YCbCr422_8_CbYCrY D-D-
Yuv444/YCbCr8_CbYCr D-D-
Table 4: Supported transformaon formats
¹BayerXY is any of BayerGR, BayerRG, BayerGB or BayerBG
²Color is any of RGB, RGBA, BGR or BGRA format
Vimba Image Transform Manual 1.5 16
4 API usage
This chapter includes:
4.1 General .......................... 18
4.2 Filling Image Informaon . . . . . . . . . . . . . . . . . 18
4.3 Specifying Transformaon Opons . . . . . . . . . . . . 18
4.3.1 Adding color transformaons . . . . . . . . . . 19
4.3.2 Changing the debayering algorithm . . . . . . . 19
4.4 Transforming images . . . . . . . . . . . . . . . . . . . 20
Vimba Image Transform Manual 1.5 17
4 API usage
4.1 General
Every concrete image transformaon must specify its three parameters:
• The fully-qualified input image (including complete format specificaon)
• The complete output format (plus a pointer to enough memory to hold the transformed image)
• The transformaon itself (including transformaon opons if there is more than one possible way
from the input format to the output format)
VmbImageTransform() is the main funcon, which covers all three transformaon parameters. It uses
two VmbImage pointers to specify the source and desnaon image and a list of VmbTransformInfo
structs to specify the transformaon.
To ease filling the structs that are needed for a successful call of VmbImageTransform(), several helper
funcons for inializing them are available:
• Methods for filling the necessary format informaon of either the input or the output image (de-
scribed in chapter Filling Image Informaon).
• Methods for filling oponal transformaon parameters to invoke special and addional funconality,
as can be seen in chapter Specifying Transformaon Opons.
4.2 Filling Image Informaon
The transformaon library in Vimba 2.0 offers an easy way of seng the appropriate compable des-
naon format. The first two funcons, also described in secon 6.3.1 and 6.3.2, set a compable output
format and relieves the programmer from learning the PFNC naming scheme.
Inialize the VmbImage with:
1. VmbSetImageInfoFromIputImage() by providing an vimba input image, the output layout and
bit depth
2. VmbSetImageInfoFromInputParameters() by providing the input format, the input image size,
the output layout and bit depth
3. VmbSetImageInfoFromPixelFormat() by providing a VmbPixelFormat_t value and the size
4. VmbSetImageInfoFromString() by providing a string that describes the pixel format and the size
(expert)
5. Filling the fields explicitly one by one (not recommended)
4.3 Specifying Transformaon Opons
Depending on your applicaon and the desired image characteriscs, you can choose between several
transformaon opons.
Vimba Image Transform Manual 1.5 18
4 API usage
4.3.1 Adding color transformaons
A common way to transform color images is using a 3x3 matrix with method
VmbSetColorCorrectionMatrix3x3(). The matrix you have to specify is a 3x3 row order float
matrix.
rr rg rb
gr gg gb
br bg bb
4.3.2 Changing the debayering algorithm
Every transformaon of a Bayer image requires defining how to interpolate or combine the color pixels.
Because of beer system performance, a simple 2x2 demosaicing algorithm is the default. Changing this
algorithm is possible with the help of an addional transformaon parameter to VmbImageTransform(),
which can be filled with the help of funcon VmbSetDebayerMode() (using a VmbDebayerMode as in-
put).
VmbDebayerMode can be one of the following values:
Value Descripon
VmbDebayerMode2x2 2x2 with green averaging (this is the default if no debayering algorithm is
added as transformaon opon)
VmbDebayerMode3x3 3x3 with equal green weighng per line
VmbDebayerModeLCAA Debayering with horizontal local color an-aliasing¹
VmbDebayerModeLCAAV Debayering with horizontal and vercal local color an-aliasing¹
VmbDebayerModeYUV422 Debayering with YUV422-alike sub-sampling¹
If one of VmbDebayerModeLCAA,VmbDebayerModeLCAAV, or
VmbDebayerModeYUV422 is used, the input buffers are used as intermedi-
ate buffers for the transformaon for performance reasons. If you intend to
use the input buffer for another purpose, debayer aerwards or copy the input
buffer beforehand.
¹For 8-bit images only
Vimba Image Transform Manual 1.5 19
4 API usage
4.4 Transforming images
When you’ve prepared all the parameters of a transformaon, use the pre-filled structs and call
VmbImageTransform().
Inapplicable transformaon opons are ignored (e.g. debayering opons to a
monochrome input image).
Vimba Image Transform Manual 1.5 20
5 Transformation examples
This chapter includes:
5.1 Debayering into an Rgb8 image . . . . . . . . . . . . . 22
5.2 Debayering into a Mono8 image . . . . . . . . . . . . . 22
5.3 Applying a color correcon to an Rgb8 image . . . . . 23
5.4 Debayering a 12-bit image into a Mono16 image
with addional color correcon . . . . . . . . . . . . . 24
Vimba Image Transform Manual 1.5 21
5 Transformaon examples
5.1 Debayering into an Rgb8 image
Example for a transformaon of a BayerGR8 image with 640x480 pixels into an Rgb8 image of the same
size:
VmbImage sourceImage;
VmbImage destinationImage ;
VmbTransformInfo info;
// set size member for verification inside API
sourceImage .Size = sizeof ( sourceImage );
destinationImage. Size = sizeof ( destinationImage );
// attach the data buffers
sourceImage .Data = pInBuffer;
destinationImage. Data = pOutBuffer;
// fill image info from pixel format
VmbSetImageInfoFromPixelFormat ( VmbPixelFormatBayerGR8 ,
640,
480,
&sourceImage);
// fill destination image info from input image
VmbSetImageInfoFromInputImage ( &sourceImage ,
VmbPixelLayoutRGB,
8,
& destin ationIma ge );
// set the debayering algorithm to simple 2 by 2
VmbSetDebayerMode ( VmbDebayerMode2x2 , &info );
// perform the transformation
VmbImageTransform ( & sourceImage , &destinationImage , &info , 1 );
5.2 Debayering into a Mono8 image
Example for preparing a transformaon of a BayerRG8 image with 640x480 pixels into a Mono8 image of
the same size:
VmbImage sourceImage;
VmbImage destinationImage ;
VmbTransformInfo info;
// set size member for verification inside API
sourceImage .Size = sizeof ( sourceImage );
destinationImage. Size = sizeof ( destinationImage );
// attach the data buffers
sourceImage .Data = pInBuffer;
Vimba Image Transform Manual 1.5 22
5 Transformaon examples
destinationImage. Data = pOutBuffer;
// fill image info from pixel format string
std ::string name ( " PixelFormatBayerRG8 " );
VmbSetImageInfoFromString ( name.c_str(),
static_cast< VmbUint32_t >( name. size() ),
640,
480,
&sourceImage );
// fill image info from pixel known input parameters
VmbSetImageInfoFromInputParameters ( VmbPixelFormatBayerRG8 ,
640,
480,
VmbPixelLayoutMono ,
8
&destinationImage );
// set the debayering algorithm to 3 by 3
VmbSetDebayerMode ( VmbDebayerMode3x3 , &info );
// perform the transformation
VmbImageTransform ( & sourceImage , &destinationImage , &info , 1 );
5.3 Applying a color correcon to an Rgb8
image
Example for applying a color correcon to an Rgb8 image with 640x480 pixels:
VmbImage sourceImage;
VmbImage destinationImage ;
VmbTransformInfo info;
const VmbFloat_t mat [] = { 1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f };
// set size member for verification inside API
sourceImage .Size = sizeof ( sourceImage );
destinationImage. Size = sizeof ( destinationImage );
// attach the data buffers
sourceImage .Data = pInBuffer;
destinationImage. Data = pOutBuffer;
// fill image info from pixel format
VmbSetImageInfoFromPixelFormat ( VmbPixelFormatRgb8 ,
640,
480,
&sourceImage );
Vimba Image Transform Manual 1.5 23
5 Transformaon examples
// fill destination image info from input image
VmbSetImageInfoFromInputImage ( &sourceImage ,
VmbPixelLayoutRGB,
8,
& destin ationIma ge );
// set the transformation matrix
VmbSetColorCorrectionMatrix3x3 ( mat , &info );
// perform the transformation
VmbImageTransform ( & sourceImage , &destinationImage , &info , 1 );
5.4 Debayering a 12-bit image into a
Mono16 image with addional color
correcon
Example for preparing a transformaon of a BayerGR12 image with 640x480 pixels into a Mono16 image
of the same size:
VmbImage sourceImage;
VmbImage destinationImage ;
Vm bTran sfo rmI nfo info [2];
const VmbFloat_t mat [] = { 1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f };
// set size member for verification inside API
sourceImage .Size = sizeof ( sourceImage );
destinationImage. Size = sizeof ( destinationImage );
// attach the data buffers
sourceImage .Data = pInBuffer;
destinationImage. Data = pOutBuffer;
// fill image info from pixel format
VmbSetImageInfoFromPixelFormat ( VmbPixelFormatBayerGR12Packed ,
640,
480,
&sourceImage );
// fill destination image info from input image
VmbSetImageInfoFromInputImage ( &sourceImage ,
VmbPixelLayoutMono ,
16,
& destin ationIma ge );
// set the debayering algorithm to 2 by 2
Vimba Image Transform Manual 1.5 24
5 Transformaon examples
Vm bSe tDe bayerM ode ( Vm bDebayerMode2x2 , & info [0] );
// set the transformation matrix
Vm bSet Col orCo rre ctio nMatri x3x3 ( mat , & info [1] );
// perform the transformation
VmbImageTransform ( & sourceImage , &destinationImage , &info , 2 );
Vimba Image Transform Manual 1.5 25
6 Functionreference
This chapter includes:
6.1 Informaon ........................ 27
6.1.1 VmbGetVersion() . . . . . . . . . . . . . . . . . 27
6.1.2 VmbGetErrorInfo() . . . . . . . . . . . . . . . . 27
6.1.3 VmbGetApiInfoString() . . . . . . . . . . . . . . 27
6.2 Transformaon . . . . . . . . . . . . . . . . . . . . . . 28
6.2.1 VmbImageTransform() . . . . . . . . . . . . . . 28
6.3 Helper funcons . . . . . . . . . . . . . . . . . . . . . 29
6.3.1 VmbSetImageInfoFromInputImage() . . . . . . . 29
6.3.2 VmbSetImageInfoFromInputParameters() . . . . . 30
6.3.3 VmbSetImageInfoFromPixelFormat() . . . . . . . 30
6.3.4 VmbSetImageInfoFromString() . . . . . . . . . . 31
6.3.5 VmbSetDebayerMode() . . . . . . . . . . . . . . 31
6.3.6 VmbSetColorCorreconMatrix3x3() . . . . . . . . 32
Vimba Image Transform Manual 1.5 26
6 Funcon reference
6.1 Informaon
6.1.1 VmbGetVersion()
Inquire the library version. This funcon can be called at anyme, even before the library is inialized.
Type Name Descripon
out VmbUint32_t* pValue Contains the library version (Major,Minor,Sub,Build)
•VmbErrorBadParameter: if the given pointer is NULL
6.1.2 VmbGetErrorInfo()
Translate Vimba error codes into a human-readable string.
Type Name Descripon
in VmbError_t errorCode The error code to get a readable string for
out VmbANSIChar_t* pInfo Pointer to a zero terminated string that will contain the
error informaon on return
in VmbUint32_t maxInfoLength The length of the pInfo buffer
•VmbErrorBadParameter: if the given pointer is NULL, or if maxInfoLength is 0
•VmbErrorMoreData: if maxInfoLength is too small to hold the complete error informaon
6.1.3 VmbGetApiInfoString()
Get informaon about the currently loaded Vimba ImageTransform API.
Type Name Descripon
in VmbAPIInfo_t infoType Type of informaon to return
out VmbANSIChar_t* pInfo Pointer to a zero terminated string that will contain the
informaon on return
in VmbUint32_t maxInfoLength The length of the info buffer
•VmbErrorBadParameter: if the given pointer is NULL
Vimba Image Transform Manual 1.5 27
6 Funcon reference
•VmbErrorMoreData: if maxInfoLength is too small to hold the complete informaon
Parameter infoType may be one of the following values:
Value Descripon
VmbAPIInfoAll Return all informaon about the API
VmbAPIInfoPlatform Return informaon about the plaorm the API was built for (x86 or x64)
VmbAPIInfoBuild Return info about the API build (debug or release)
VmbApiInfoTechnology Return info about the supported technologies the API was built for (e.g.
OpenMP)
6.2 Transformaon
6.2.1 VmbImageTransform()
Transform images from one pixel format to another with possible transformaon opons. The transfor-
maon is defined by the provided images and the desired transformaon.
Type Name Descripon
in const VmbImage* pSource Image to transform
in/out VmbImage* pDesnaon Desnaon image
in const VmbTransformInfo* pParameter Oponal transform parameters
in VmbUint32_t parameterCount Number of transform parameters
•VmbErrorBadParameter:
–if any image pointer or their ”Data” members is NULL
–if Width or Height don’t match between source and desnaon
–if one of the parameters for the conversion does not fit
•VmbErrorStructSize: if the image structs size don’t match their ”Size” member
•VmbErrorNotImplemented: if there is no transformaon between source and desnaon format
Fill source and desnaon image info structure with
VmbSetImageInfoFromPixelFormat() or VmbSetImageInfoFromString()
and keep those structures as template. For calls to transform, aach the image
to the ”Data” member. When set, the oponal parameters are constraints on
the transform.
Vimba Image Transform Manual 1.5 28
6 Funcon reference
6.3 Helper funcons
6.3.1 VmbSetImageInfoFromInputImage()
Set image info member values in VmbImage from input VmbImage. Use simple target layout and bit per
pixel values to set the desired target format.
Type Name Descripon
in const VmbImage* pInputmage Source image for transformaon operaon
in VmbPixelLayout_t OutputPixelLayout Pixel layout of the target image
in VmbUint32_t BitPerPixel Bits per pixel of the target image
in/out VmbImage* pOutputImage Pointer to Vimba image to set the info to
•VmbErrorBadParameter:
–if the given pointer is NULL
–if one of the parameters for the conversion does not fit
•VmbErrorNotImplemented: transformaon is not supported
Vimba Image Transform Manual 1.5 29
6 Funcon reference
6.3.2 VmbSetImageInfoFromInputParameters()
Set image info member values in VmbImage from pixel format. Use simple target layout and bit per pixel
values to set the desired target format.
Type Name Descripon
in VmbPixelFormat_t InputPixelFormat PixelFormat describes the pixel format used by
the image data member
in VmbUint32_t Width Width of the image in pixels
in VmbUint32_t Height Height of the image in pixels
in VmbPixelLayout_t OutputPixelLayout Pixel layout of the target image
in VmbUint32_t BitsPerPixel Bits per pixel of the target image
in/out VmbImage* pOutputImage Pointer to Vimba image to set the info to
•VmbErrorBadParameter: if the given pointer is NULL or one of the image struct members is invalid
•VmbErrorNotImplemented: transformaon is not supported
6.3.3 VmbSetImageInfoFromPixelFormat()
This is an expert funcon. Set image info member values in VmbImage from pixel format. Please use table
5 from appendix as reference.
Type Name Descripon
in VmbPixelFormat_t PixelFormat PixelFormat describes the pixel format used by the im-
age data member.
in VmbUint32_t Width Width of the image in pixels
in VmbUint32_t Height Height of the image in pixels
in/out VmbImage* pImage Pointer to Vimba image to set the info to
•VmbErrorBadParameter: if the given pointer is NULL or one of the image struct members is invalid
•VmbErrorStructSize: if the image struct size doesn’t match its ”Size” member
VmbPixelFormat_t can be obtained from Vimba C/C++ APIs frame or from
the PixelFormat feature. For displaying images, it is suggested to use
VmbSetImageInfoFromString() or to look up a matching VmbPixelFormat.
Vimba Image Transform Manual 1.5 30
6 Funcon reference
6.3.4 VmbSetImageInfoFromString()
This is an expert funcon. Set image info member values in VmbImage from string.
Type Name Descripon
in const VmbANSIChar_t* imageFormat Image format as a (const) case insensive string
that is either a PixelFormat (Vmb is oponal) or
a pixel struct name
in VmbUint32_t StringLength The length of the pixel format string
in VmbUint32_t Width Width of the image in pixels
in VmbUint32_t Height Height of the image in pixels
in/out VmbImage* pImage Pointer to Vimba image to set the info to
•VmbErrorBadParameter:
–if one of the given pointers or the ”Data” member in the image is NULL
–if Width or Height don’t match between source and desnaon
–if one of the parameters for the conversion does not fit
•VmbErrorStructSize: if the image struct size does not match its ”Size” member
•VmbErrorResources: if the there was a memory fault during processing
6.3.5 VmbSetDebayerMode()
Set transformaon opons to a predefined debayering mode.
Type Name Descripon
in VmbDebayerMode_t DebayerMode The mode used for debayering the source raw
image, default mode is 2x2 debayering. Debay-
ering modes only work for image widths and
heights divisible by two.
in/out VmbTransformInfo_t* pTransformInfo Parameter that contains informaon about
special transform funconality.
•VmbErrorBadParameter: if the given pointer is NULL
Debayering is only applicable to image formats with both an even width and an
even height.
Vimba Image Transform Manual 1.5 31
6 Funcon reference
6.3.6 VmbSetColorCorreconMatrix3x3()
Set transformaon opons to a 3x3 color matrix transformaon.
Type Name Descripon
in const VmbFloat_t* pMatrix Color correcon matrix
in/out VmbTransformInfo_t* pTransformInfo Parameter that is filled with informaon about
special transform funconality.
•VmbErrorBadParameter: if one of the given pointers is NULL
Vimba Image Transform Manual 1.5 32
7 Structs
This chapter includes:
7.1 VmbImage......................... 34
7.2 VmbImageInfo . . . . . . . . . . . . . . . . . . . . . . . 34
7.3 VmbPixelInfo . . . . . . . . . . . . . . . . . . . . . . . . 35
7.4 VmbTransformInfo . . . . . . . . . . . . . . . . . . . . . 35
Vimba Image Transform Manual 1.5 33
7 Structs
7.1 VmbImage
VmbImage encapsulates image data for the transformaon funcon.
Struct entry Purpose
VmbUint32_t Size Size of the structure
void* Data Pointer to the payload received from Vimba C/C++ API or to the display
image data
VmbImageInfo ImageInfo Internal informaon data used for mapping the images to the correct
transformaon, imageInfo data can be set with VmbSetImageInfo()
helper funcons from VmbPixelFormat_t or format string
7.2 VmbImageInfo
VmbImageInfo contains image informaon needed for the transformaon funcon.
Struct entry Purpose
VmbUint32_t Width The width of the image in pixels. For macro pixel formats like YUV, it is
the width in sub pixels
VmbUint32_t Height The height of the image in pixels
VmbInt32_t Stride The offset from the current line to the next line, a value not equal to
Width is currently not supported
VmbPixelInfo PixelInfo Informaon about the pixel format
Vimba Image Transform Manual 1.5 34
7 Structs
7.3 VmbPixelInfo
VmbPixelInfo describes the pixel format of an image.
Struct entry Purpose
VmbUint32_t BitsPerPixel Number of bits for one image pixel, or sub pixel in macro pixel
formats
VmbUint32_t BitsUsed Number of bits used per pixel, e.g. RGB12 has 48 bits per
pixel and 36 bits used
VmbAlignment_t Alignment For image formats where BitsPerPixel is not equal to bitsUsed,
the alignment specifies the bit layout of the pixel
VmbEndianness_t Endianness Specifies the endianness of pixels that are larger than one
byte
VmbPixelLayout_t PixelLayout Describes the layout of the pixel component, e.g., RGB or BGR
layout
VmbBayerPattern_t BayerPaern For raw image data, this field specifies the color filter array
layout of the sensor
7.4 VmbTransformInfo
Transformaon parameters given as a pointer to a VmbTransformInfo struct are used to invoke special
and addional funconality, which is applied while interpreng the source image (debayering) or trans-
forming the images (color correcon).
Struct entry Purpose
VmbTransformType_t TransformType Transform info type, may be VmbTransformTypeDe-
bayerMode or VmbTransformTypeColorCorrecon-
Matrix
VmbTransformParameter Parameter Transform info variant, may be VmbTransformParam-
eterDebayer or VmbTransformParameterMatrix3x3
Vimba Image Transform Manual 1.5 35
A Supported PFNC transformaons
A Supported PFNC transformations
Source
Target
Mono8
Mono10
Mono12
Mono16
Rgb/Bgr8
Rgba/Bgra8
Rgb/Bgr10
Rgba/Bgra10
Rgb/Bgr12
Rgba/Bgra12
Rgb/Bgr16
Rgba/Bgra16
Yuv422
Mono8 D---D D ------D
Mono10 D---D D -------
Mono10p D---D D -------
Mono12 D---D D -------
Mono12p D---D D -------
Mono12Packed D---D D -------
Mono14 D---D D -------
Mono16 D- - DDD-------
BayerXY¹8D---D D ------D
BayerXY¹10 DD- - D D D D -----
BayerXY¹10p DD- - D D D D -----
BayerXY¹12 D-D-D D - - D D ---
BayerXY¹12p D-D-D D - - D D ---
BayerXY¹12Packed D-D-D D - - D D ---
BayerXY¹16 D- - DDD- - - - DD-
Rgb8 D---D D -------
Bgr8 D---D D -------
Rgba8 / Argb8 D---D D -------
Bgra8 D---D D -------
Yuv411/YCbCr411_8_CbYYCrYY D---D D -------
Yuv422/YCbCr422_8_CbYCrY D---D D ------D
Yuv444/YCbCr8_CbYCr D---D D -------
Table 5: Supported PFNC transformaons
¹BayerXY is any of BayerGR, BayerRG, BayerGB or BayerBG
Vimba Image Transform Manual 1.5 36