Pleora Technologies Inc. eBUS SDK v6.2.8.5877 API



PvBufferConverter Class Reference

Used to convert a PvBuffer to another pixel type. More...

Public Member Functions

 PvBufferConverter (int32_t aMaxNumberOfThreads=-1)
 Constructor. More...
 
virtual ~PvBufferConverter ()
 Destructor.
 
PvResult Convert (const PvBuffer *aSource, PvBuffer *aDestination, bool aReallocIfNeeded=true, bool aFlipY=false)
 Convert a buffer from one format to another. More...
 
PvResult Convert (const IPvImage *aSource, PvBuffer *aDestination, bool aReallocIfNeeded=true, bool aFlipY=false)
 Convert a buffer from one format to another. More...
 
PvBayerFilterType GetBayerFilter () const
 Retrieves current optional Bayer filtering. More...
 
PvResult SetBayerFilter (PvBayerFilterType aFilter)
 Set the optional Bayer filtering for this converter. More...
 
PvResult ResetRGBFilter ()
 Resets the RGB filter used for conversion (if any) More...
 
PvResult SetRGBFilter (PvBufferConverterRGBFilter &aFilter)
 Assigns a RGB filter to be used during conversion. More...
 
uint32_t GetConversionThreadsPriority () const
 Get the priority of the threads doing the conversion in background. More...
 
PvResult SetConversionThreadsPriority (uint32_t aPriority)
 Set the priority of the threads doing the conversion. More...
 

Static Public Member Functions

static bool IsConversionSupported (PvPixelType aSource, PvPixelType aDestination)
 Test if a pixel type can be converted to another type. More...
 

Detailed Description

Used to convert a PvBuffer to another pixel type.

To change an image's format:

  1. Acquire an image. See PvStream::RetrieveBuffer.
  2. Create an image-format converter (PvBufferConverter object). Use PvBufferConverter::PvBufferConverter.
  3. Test if you can convert your image to your preferred pixel type. Use IsConversionSupported. For your source pixel type, use PvImage::GetPixelType; for your destination, select an enumeration from PvPixelType.h.
  4. Create a destination buffer. See PvBuffer (you define the destination image's pixel type during this step).
  5. Optionally, configure options like Bayer filtering, use SetBayerFilter.
  6. Convert the image to the new pixel type. Use Convert.

Consult the PvPixelType documentation in order to find which pixel types are supported as conversion destinations.

Constructor & Destructor Documentation

◆ PvBufferConverter()

PvBufferConverter::PvBufferConverter ( int32_t  aMaxNumberOfThreads = -1)

Constructor.

Parameters
[in]aMaxNumberOfThreadsMaximum number of threads the buffer converter is allowed to use in order to speed up conversion. If 0 or smaller than 0, one thread per processor is assumed. Threads have no specific processor affinity.

Member Function Documentation

◆ Convert() [1/2]

PvResult PvBufferConverter::Convert ( const IPvImage aSource,
PvBuffer aDestination,
bool  aReallocIfNeeded = true,
bool  aFlipY = false 
)

Convert a buffer from one format to another.

Parameters
[in]aSourceThe original image.
[out]aDestinationThe new image/buffer.
[in]aReallocIfNeededDepending on the conversion, the memory footprint of the new image may be greater than aDestination current size. By setting this parameter to true, the buffer is re-allocated if aDestination is too small. If aDestination memory buffer is not owned by the PvBuffer and is too small, Convert fails.
[in]aFlipYWhen performing the conversion, flips the image on its Y axis.
Returns
Includes:

◆ Convert() [2/2]

PvResult PvBufferConverter::Convert ( const PvBuffer aSource,
PvBuffer aDestination,
bool  aReallocIfNeeded = true,
bool  aFlipY = false 
)

Convert a buffer from one format to another.

Parameters
[in]aSourceThe original image/buffer.
[out]aDestinationThe new image/buffer.
[in]aReallocIfNeededDepending on the conversion, the memory footprint of the new image may be greater than aDestination current size. By setting this parameter to true, the buffer is re-allocated if aDestination is too small. If aDestination memory buffer is not owned by the PvBuffer and is too small, Convert fails.
[in]aFlipYWhen performing the conversion, flips the image on its Y axis.
Returns
Includes:

◆ GetBayerFilter()

PvBayerFilterType PvBufferConverter::GetBayerFilter ( ) const

Retrieves current optional Bayer filtering.

See SetBayerFilter

Returns
The Bayer filter's type; a PvBayerFilterType enumeration.

◆ GetConversionThreadsPriority()

uint32_t PvBufferConverter::GetConversionThreadsPriority ( ) const

Get the priority of the threads doing the conversion in background.

See SetConversionThreadsPriority for details about the meaning of the values returned

Returns
The priority of the thread

◆ IsConversionSupported()

bool PvBufferConverter::IsConversionSupported ( PvPixelType  aSource,
PvPixelType  aDestination 
)
static

Test if a pixel type can be converted to another type.

Converting from one pixel type to another isn't a trivial mathematical calculation - all conversions require specialized, dedicated algorithms.

The IsConversionSupported method tests if the Convert method has an available conversion algorithm.

Parameters
[in]aSourceThe original pixel type. For available pixel types, see PvPixelType.h.
[in]aDestinationThe new pixel type. See aSource.
Returns
True if Convert has an available conversion algorithm; otherwise, false.

◆ ResetRGBFilter()

PvResult PvBufferConverter::ResetRGBFilter ( )

Resets the RGB filter used for conversion (if any)

Returns
Includes:

◆ SetBayerFilter()

PvResult PvBufferConverter::SetBayerFilter ( PvBayerFilterType  aFilter)

Set the optional Bayer filtering for this converter.

Of course, only applies if the Convert method uses a PvBuffer having a Bayer pixel type. Simply ignored otherwise.

Parameters
[in]aFilterThe new filter settings; a PvBayerFilterType enumeration.
Returns
Includes:

◆ SetConversionThreadsPriority()

PvResult PvBufferConverter::SetConversionThreadsPriority ( uint32_t  aPriority)

Set the priority of the threads doing the conversion.

By default one conversion thread is created for each processing core of the system. We only allow setting priority for the threads of one converter object as a group.

If you change the thread priorities, it may alterate the stability of the system. For this reason, if you report a bug to Pleora, ensure to clearly mention that you change threads priorities.

See GetConversionThreadsPriority

Parameters
[in]aPrioritySee PvPipeline::SetBufferHandlingThreadPriority for description of the supported values
Returns
Includes:

◆ SetRGBFilter()

PvResult PvBufferConverter::SetRGBFilter ( PvBufferConverterRGBFilter aFilter)

Assigns a RGB filter to be used during conversion.

Parameters
[in]aFilterThe RGB filter to be used during conversion.
Returns
Includes:

The documentation for this class was generated from the following files:

Copyright (c) 2002-2021 Pleora Technologies Inc.
www.pleora.com