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... | |
PvBuffer * | GetBuffer () |
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 |
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.
To determinate the payload type and access image specific data:
|
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.
[in] | aImage | Pointer to internal eBUS SDK class. |
|
protectedvirtual |
Destructor.
Declared as protected as the user does no need (or can) delete a PvImage directly.
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
[in] | aSizeX | The width of the image, in pixels. See GetWidth. |
[in] | aSizeY | The height of the image, in pixels. See GetHeight. |
[in] | aPixelType | The GEV pixel type from which the pixel depth is extracted. For supported pixel types, see PvPixelType.h. |
[in] | aPaddingX | The horizontal padding of the image, in pixels. See GetPaddingX. |
[in] | aPaddingY | The vertical padding of the image, in pixels. See GetPaddingY. |
[in] | aMaximumChunkLength | The chunk size in bytes. |
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:
[in] | aRawBuffer | A pointer to the buffer. |
[in] | aSizeX | See Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t). |
[in] | aSizeY | See Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t). |
[in] | aPixelType | See Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t). |
[in] | aPaddingX | See Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t). |
[in] | aPaddingY | See Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t). |
[in] | aMaximumChunkLength | See Alloc(uint32_t,uint32_t,PvPixelType,uint16_t,uint16_t,uint32_t). |
uint8_t * PvImage::Detach | ( | ) |
Releases an attached memory buffer.
Does nothing other then resetting the memory buffer pointer to NULL.
void PvImage::Free | ( | ) |
Frees (de-allocates) the buffer's internal memory.
|
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.
[in] | aPixelType | Pixel type. |
uint32_t PvImage::GetBitsPerPixel | ( | ) | const |
Returns how many bits are required to hold a pixel using the current buffer's pixel type.
PvBuffer * PvImage::GetBuffer | ( | ) |
const uint8_t * PvImage::GetDataPointer | ( | ) | const |
Get the buffer's data pointer.
uint8_t * PvImage::GetDataPointer | ( | ) |
Get the buffer's data pointer.
Const version.
uint32_t PvImage::GetEffectiveImageSize | ( | ) | const |
Effective image size.
Uses same size x and y as GetImageSize() but excludes all padding.
uint32_t PvImage::GetHeight | ( | ) | const |
Get the image's height.
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.
uint32_t PvImage::GetOffsetX | ( | ) | const |
Get the image's horizontal offset.
uint32_t PvImage::GetOffsetY | ( | ) | const |
Get the image's vertical offset.
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.
uint16_t PvImage::GetPaddingY | ( | ) | const |
Get the vertical image padding.
Additional bytes appended at the end of an image.
See GetPaddingX.
|
static |
Static method returning the pixel size in bits for a specific pixel type.
[in] | aPixelType | Pixel type. |
PvPixelType PvImage::GetPixelType | ( | ) | const |
The buffer's pixel type.
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.
uint32_t PvImage::GetWidth | ( | ) | const |
Get the image's width.
bool PvImage::IsDataOverrun | ( | ) | const |
Data overrun status bit.
bool PvImage::IsEOFByLineCount | ( | ) | const |
End of Frame by Line Count status bit.
bool PvImage::IsFullLineMissing | ( | ) | const |
If true, the grabber (on the device) was missing at least one line when the frame was grabbed.
bool PvImage::IsImageDropped | ( | ) | const |
Image dropped status bit.
bool PvImage::IsInterlacedEven | ( | ) | const |
The image contained in the PvImage is an interlaced Even field.
bool PvImage::IsInterlacedOdd | ( | ) | const |
The image contained in the PvImage is an interlaced Odd field.
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.
|
static |
Static method returning whether a pixel type is color or not.
[in] | aPixelType | Pixel type. |
|
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.
[in] | aPixelType | Pixel type. |
|
static |
Static method returning a string representation of a pixel type.
[in] | aPixelType | Pixel type. |
void PvImage::SetEOFByLineCount | ( | bool | aValue = true | ) |
Simulates the EOFByLineCount used by Pleora video interfaces.
[in] | aValue | True to enable, false to disable |
void PvImage::SetOffsetX | ( | uint32_t | aValue | ) |
Sets the Offset X attribute of the image.
[in] | aValue | New value. |
void PvImage::SetOffsetY | ( | uint32_t | aValue | ) |
Sets the Offset X attribute of the image.
[in] | aValue | New value. |
Copyright (c) 2002-2018 Pleora Technologies Inc.
www.pleora.com