Pleora Technologies Inc. eBUS SDK v5.1.10.4642 API



PvImage Class Reference

Image interface to a PvBuffer. More...

Public Member Functions

const uint8_t * GetDataPointer () const
 Get the buffer's data pointer. More...
 
uint8_t * GetDataPointer ()
 Get the buffer's data pointer. More...
 
uint32_t GetWidth () const
 Get the image's width. More...
 
uint32_t GetHeight () const
 Get the image's height. More...
 
PvPixelType GetPixelType () const
 The buffer's pixel type. More...
 
uint32_t GetBitsPerPixel () const
 Returns how many bits are required to hold a pixel using the current buffer's pixel type. More...
 
uint32_t GetRequiredSize () const
 Gets the size of buffer required to hold the acquired image. More...
 
uint32_t GetImageSize () const
 Actual image size within the payload or buffer. More...
 
uint32_t GetEffectiveImageSize () const
 Effective image size. More...
 
uint32_t GetOffsetX () const
 Get the image's horizontal offset. More...
 
uint32_t GetOffsetY () const
 Get the image's vertical offset. More...
 
uint16_t GetPaddingX () const
 Get the horizontal image padding. More...
 
uint16_t GetPaddingY () const
 Get the vertical image padding. More...
 
void SetOffsetX (uint32_t aValue)
 Sets the Offset X attribute of the image. More...
 
void SetOffsetY (uint32_t aValue)
 Sets the Offset X attribute of the image. More...
 
PvResult Alloc (uint32_t aSizeX, uint32_t aSizeY, PvPixelType aPixelType, uint16_t aPaddingX=0, uint16_t aPaddingY=0, uint32_t aMaximumChunkLength=0)
 Allocates memory for this PvImage. More...
 
void Free ()
 Frees (de-allocates) the buffer's internal memory. More...
 
PvResult Attach (void *aRawBuffer, uint32_t aSizeX, uint32_t aSizeY, PvPixelType aPixelType, uint16_t aPaddingX=0, uint16_t aPaddingY=0, uint32_t aMaximumChunkLength=0)
 Attach this PvImage to an external memory buffer. More...
 
uint8_t * Detach ()
 Releases an attached memory buffer. More...
 
bool IsPartialLineMissing () const
 If true, the grabber (on the device) was missing at least one pixel in at least one of the lines when the frame was grabbed. More...
 
bool IsFullLineMissing () const
 If true, the grabber (on the device) was missing at least one line when the frame was grabbed. More...
 
void SetEOFByLineCount (bool aValue=true)
 Simulates the EOFByLineCount used by Pleora video interfaces. More...
 
bool IsEOFByLineCount () const
 End of Frame by Line Count status bit. More...
 
bool IsInterlacedEven () const
 The image contained in the PvImage is an interlaced Even field. More...
 
bool IsInterlacedOdd () const
 The image contained in the PvImage is an interlaced Odd field. More...
 
bool IsImageDropped () const
 Image dropped status bit. More...
 
bool IsDataOverrun () const
 Data overrun status bit. More...
 
PvBufferGetBuffer ()
 Returns the PvBuffer this PvImage belongs to. More...
 

Static Public Member Functions

static uint32_t GetPixelSize (PvPixelType aPixelType)
 Static method returning the pixel size in bits for a specific pixel type. More...
 
static bool IsPixelColor (PvPixelType aPixelType)
 Static method returning whether a pixel type is color or not. More...
 
static bool IsPixelHighRes (PvPixelType aPixelType)
 Static method returning whether a pixel type is higher than 8-bit per channel or not. More...
 
static uint32_t GetBitsPerComponent (PvPixelType aPixelType)
 Static method returning the number of bit per components for a pixel type. More...
 
static PvString PixelTypeToString (PvPixelType aPixelType)
 Static method returning a string representation of a pixel type. More...
 

Protected Member Functions

 PvImage (PvBufferLib::Image *aImage)
 Constructor. More...
 
virtual ~PvImage ()
 Destructor. More...
 

Friends

class PvTruesenseConverter
 

Detailed Description

Image interface to a PvBuffer.

A PvBuffer represents a generic buffer with no specific payload type. If the payload type is image, the user can obtain a pointer to a PvImage buffer interface through PvBuffer::GetImage.

This PvImage pointer is owned by the PvBuffer and does not need to be released after use. It is valid as long as the PvBuffer exists.

Accessing image specific data

To determinate the payload type and access image specific data:

  1. Retrieve the PvPayloadType using PvBuffer::GetPayloadType
  2. If PvPayloadType is PvPayloadTypeImage, retrieve PvImage pointer from your PvBuffer
  3. Access image specific data through the PvImage pointer, like PvImage::GetWidth, PvImage::GetHeight, etc.
  4. There is no need to release or delete the PvImage pointer. It is valid as long as the PvBuffer exists.

Constructor & Destructor Documentation

PvImage::PvImage ( PvBufferLib::Image *  aImage)
protected

Constructor.

Declared as protected as PvImage cannot be instantiated by the user.

A pointer to the PvImage interface can be obtained from a PvBuffer using PvBuffer::GetImage.

Parameters
[in]aImagePointer to internal eBUS SDK class.
PvImage::~PvImage ( )
protectedvirtual

Destructor.

Declared as protected as the user does no need (or can) delete a PvImage directly.

Member Function Documentation

PvResult PvImage::Alloc ( uint32_t  aSizeX,
uint32_t  aSizeY,
PvPixelType  aPixelType,
uint16_t  aPaddingX = 0,
uint16_t  aPaddingY = 0,
uint32_t  aMaximumChunkLength = 0 
)

Allocates memory for this PvImage.

Allocs a PvImage of specific width, height and pixel format

Parameters
[in]aSizeXThe width of the image, in pixels. See GetWidth.
[in]aSizeYThe height of the image, in pixels. See GetHeight.
[in]aPixelTypeThe GEV pixel type from which the pixel depth is extracted. For supported pixel types, see PvPixelType.h.
[in]aPaddingXThe horizontal padding of the image, in pixels. See GetPaddingX.
[in]aPaddingYThe vertical padding of the image, in pixels. See GetPaddingY.
[in]aMaximumChunkLengthThe chunk size in bytes.
Returns
Includes:
PvResult PvImage::Attach ( void *  aRawBuffer,
uint32_t  aSizeX,
uint32_t  aSizeY,
PvPixelType  aPixelType,
uint16_t  aPaddingX = 0,
uint16_t  aPaddingY = 0,
uint32_t  aMaximumChunkLength = 0 
)

Attach this PvImage to an external memory buffer.

This method is identical to Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t), with the following exceptions:

  • This method uses an external memory buffer, controlled by the caller.
Parameters
[in]aRawBufferA pointer to the buffer.
[in]aSizeXSee Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t).
[in]aSizeYSee Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t).
[in]aPixelTypeSee Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t).
[in]aPaddingXSee Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t).
[in]aPaddingYSee Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t).
[in]aMaximumChunkLengthSee Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t).
Returns
Includes:
uint8_t * PvImage::Detach ( )

Releases an attached memory buffer.

Does nothing other then resetting the memory buffer pointer to NULL.

Returns
The buffer's location in memory.
See also
Attach
void PvImage::Free ( )

Frees (de-allocates) the buffer's internal memory.

See also
Alloc
uint32_t PvImage::GetBitsPerComponent ( PvPixelType  aPixelType)
static

Static method returning the number of bit per components for a pixel type.

PvPixelMono8 and PvPixelRGBa8 would be 8. Mono16, PvPixelRGB16, PvPixelBayerRG16 would be 16, etc.

Parameters
[in]aPixelTypePixel type.
Returns
True if higher than 8 bit per channel.
uint32_t PvImage::GetBitsPerPixel ( ) const

Returns how many bits are required to hold a pixel using the current buffer's pixel type.

Returns
Bits per pixel for the current buffer's pixel type.
PvBuffer * PvImage::GetBuffer ( )

Returns the PvBuffer this PvImage belongs to.

Returns
Pointer to a PvBuffer.
const uint8_t * PvImage::GetDataPointer ( ) const

Get the buffer's data pointer.

Returns
A pointer to the memory pointer.
uint8_t * PvImage::GetDataPointer ( )

Get the buffer's data pointer.

Const version.

Returns
A pointer to the memory pointer.
uint32_t PvImage::GetEffectiveImageSize ( ) const

Effective image size.

Uses same size x and y as GetImageSize() but excludes all padding.

Returns
The effective image size
uint32_t PvImage::GetHeight ( ) const

Get the image's height.

Returns
The image's height, in pixels.
uint32_t PvImage::GetImageSize ( ) const

Actual image size within the payload or buffer.

Uses the GEV leader for the actual width. Uses the GEV trailer for line count which is the actual height.

Returns
The actual image size within the payload or buffer
uint32_t PvImage::GetOffsetX ( ) const

Get the image's horizontal offset.

Returns
The image's horizontal offset, in pixels.
uint32_t PvImage::GetOffsetY ( ) const

Get the image's vertical offset.

Returns
The image's vertical offset, in pixels.
uint16_t PvImage::GetPaddingX ( ) const

Get the horizontal image padding.

Images lines could be grabbed in increments of, let's say, 32 bytes. For an image 511 bytes across, the video interface adds a meaningless byte to make the line total 512 bytes (divisible by 32). In this case, the paddingX value would be 1 (byte).

Other devices may have different requirements on line length. Divible by 4, 8, 16, etc. or no specific limitations or requirements.

Returns
The horizontal image padding, in bytes; the number of bytes at the end of an image's line that contain meaningless data.
uint16_t PvImage::GetPaddingY ( ) const

Get the vertical image padding.

Additional bytes appended at the end of an image.

See GetPaddingX.

Returns
The vertical image padding, in bytes.
See also
GetPaddingX
uint32_t PvImage::GetPixelSize ( PvPixelType  aPixelType)
static

Static method returning the pixel size in bits for a specific pixel type.

Parameters
[in]aPixelTypePixel type.
Returns
Pixel size, in bits.
PvPixelType PvImage::GetPixelType ( ) const

The buffer's pixel type.

Returns
The pixel type. The pixel depth, colorspace, and other information are coded into the value.
uint32_t PvImage::GetRequiredSize ( ) const

Gets the size of buffer required to hold the acquired image.

This attribute is valid if the last image acquisition was successful or if it failed because the buffer was too small. It can be used to re-allocate the acquisition buffers if the acquisition failed because the buffer was too small.

The required size is only computed for the last image - based on the number of lines as provided in the GigE Vision or USB3 Vision streaming protocol trailer.

It is possible that with devices outputting images of varying length (like line scan cameras) that the last image required size may be smaller than the maximum possible size.

In order to be 100% sure of allocating buffers correctly, you should either hard code the buffer size to known big enough sizes or use the device GenICam GevPayloadSize parameter for dynamic cases.

Returns
The size, in bytes, required to hold the image in this buffer.
uint32_t PvImage::GetWidth ( ) const

Get the image's width.

Returns
The image's width in pixels.
bool PvImage::IsDataOverrun ( ) const

Data overrun status bit.

Returns
True if there was a data overrun. False otherwise.
bool PvImage::IsEOFByLineCount ( ) const

End of Frame by Line Count status bit.

Returns
True if previous frame was NOT the last one of a sequence of sub frames. False otherwise.
bool PvImage::IsFullLineMissing ( ) const

If true, the grabber (on the device) was missing at least one line when the frame was grabbed.

Returns
True if full lines were missing, false otherwise
bool PvImage::IsImageDropped ( ) const

Image dropped status bit.

Returns
True if the previous frame was dropped. False otherwise.
bool PvImage::IsInterlacedEven ( ) const

The image contained in the PvImage is an interlaced Even field.

Returns
True interlaced Even field. False otherwise.
bool PvImage::IsInterlacedOdd ( ) const

The image contained in the PvImage is an interlaced Odd field.

Returns
True interlaced Odd field. False otherwise.
bool PvImage::IsPartialLineMissing ( ) const

If true, the grabber (on the device) was missing at least one pixel in at least one of the lines when the frame was grabbed.

Returns
True if at least one pixel was missing, false otherwise
bool PvImage::IsPixelColor ( PvPixelType  aPixelType)
static

Static method returning whether a pixel type is color or not.

Parameters
[in]aPixelTypePixel type.
Returns
True if color.
bool PvImage::IsPixelHighRes ( PvPixelType  aPixelType)
static

Static method returning whether a pixel type is higher than 8-bit per channel or not.

10, 12, 14 and 16-bit pixel type are considered high resolution. RGB8 counts as 8 so high resolution here means per channel.

Parameters
[in]aPixelTypePixel type.
Returns
True if higher than 8 bit per channel.
PvString PvImage::PixelTypeToString ( PvPixelType  aPixelType)
static

Static method returning a string representation of a pixel type.

Parameters
[in]aPixelTypePixel type.
Returns
String representation of the pixel type.
void PvImage::SetEOFByLineCount ( bool  aValue = true)

Simulates the EOFByLineCount used by Pleora video interfaces.

Parameters
[in]aValueTrue to enable, false to disable
void PvImage::SetOffsetX ( uint32_t  aValue)

Sets the Offset X attribute of the image.

Parameters
[in]aValueNew value.
void PvImage::SetOffsetY ( uint32_t  aValue)

Sets the Offset X attribute of the image.

Parameters
[in]aValueNew value.

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

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