![]() |
![]() |
Provides convenient access to cameras that support image compression and helps with decompressing these images. More...
#include <pylon/ImageDecompressor.h>
Public Member Functions | |
CImageDecompressor () | |
Creates an empty decompressor without compression descriptor. More... | |
CImageDecompressor (const CImageDecompressor &imageDecompressor) | |
Creates a decompressor by copying from another decompressor. More... | |
CImageDecompressor (const void *pCompressionDescriptor, size_t sizeCompressionDescriptor) | |
Creates a decompressor and initializes it with the compression descriptor provided. More... | |
CImageDecompressor (GenApi::INodeMap &nodeMap) | |
Creates a decompressor and initializes it with a compression descriptor that is retrieved from the camera's node map. More... | |
~CImageDecompressor () | |
Destroys the decompressor instance. More... | |
bool | HasCompressionDescriptor () const |
Determines whether the decompressor already has a compression descriptor. More... | |
void | ResetCompressionDescriptor () |
Resets the compression descriptor in the decompressor. More... | |
void | SetCompressionDescriptor (const void *pCompressionDescriptor, size_t sizeCompressionDescriptor) |
Initializes a decompressor with the compression descriptor provided. More... | |
void | SetCompressionDescriptor (GenApi::INodeMap &nodeMap) |
Initializes a decompressor with a compression descriptor that is retrieved from the camera's node map. More... | |
void | GetCompressionDescriptor (void *pCompressionDescriptor, size_t *pSizeCompressionDescriptor) const |
Gets the currently set compression descriptor. More... | |
void | GetCompressionDescriptorHash (void *pHash, size_t *pSizeHash) const |
Gets the hash of the currently set compression descriptor. More... | |
CompressionInfo_t | DecompressImage (void *pOutputBuffer, size_t *pSizeOutputBuffer, const void *pGrabBuffer, size_t payloadSize) const |
Decompresses the image of the grab buffer provided. More... | |
CompressionInfo_t | DecompressImage (void *pOutputBuffer, size_t *pSizeOutputBuffer, const Pylon::GrabResult &grabResult) const |
Decompresses the image of the grab result provided. More... | |
CompressionInfo_t | DecompressImage (void *pOutputBuffer, size_t *pSizeOutputBuffer, const Pylon::CGrabResultPtr grabResultPtr) const |
Decompresses the image of the grab result provided. More... | |
CompressionInfo_t | DecompressImage (IReusableImage &destinationImage, const void *pGrabBuffer, size_t payloadSize) const |
Decompresses the image of the grab buffer provided. More... | |
CompressionInfo_t | DecompressImage (IReusableImage &destinationImage, const Pylon::GrabResult &grabResult) const |
Decompresses the image of the grab result provided. More... | |
CompressionInfo_t | DecompressImage (IReusableImage &destinationImage, const Pylon::CGrabResultPtr grabResultPtr) const |
Decompresses the image of the grab result provided. More... | |
CImageDecompressor & | operator= (const CImageDecompressor &imageDecompressor) |
Copies the decompressor. More... | |
bool | operator== (const CImageDecompressor &imageDecompressor) |
Compares this instance with another decompressor. More... | |
Static Public Member Functions | |
static ECompressionMode | GetCompressionMode (GenApi::INodeMap &nodeMap) |
Retrieves the current compression mode from the camera's node map. More... | |
static void | GetCompressionDescriptor (void *pCompressionDescriptor, size_t *pSizeCompressionDescriptor, GenApi::INodeMap &nodeMap) |
Gets the current compression descriptor from the camera's node map. More... | |
static bool | GetCompressionInfo (CompressionInfo_t &compressionInfo, const void *pGrabBuffer, size_t payloadSize, EEndianness endianness=Endianness_Auto) |
Gets compression information about a grab buffer. More... | |
static bool | GetCompressionInfo (CompressionInfo_t &compressionInfo, const Pylon::GrabResult &grabResult, EEndianness endianness=Endianness_Auto) |
Gets compression information about a grab result. More... | |
static bool | GetCompressionInfo (CompressionInfo_t &compressionInfo, const Pylon::CGrabResultPtr grabResultPtr, EEndianness endianness=Endianness_Auto) |
Gets compression information about a grab result. More... | |
static void | ComputeCompressionDescriptorHash (void *pHash, size_t *pSizeHash, const void *pCompressionDescriptor, size_t sizeCompressionDescriptor) |
Computes the hash for a given compression descriptor. More... | |
static void | GetCompressionDescriptorHash (void *pHash, size_t *pSizeHash, GenApi::INodeMap &nodeMap) |
Gets the hash of the current compression descriptor from the camera's node map. More... | |
static void | GetCompressionDescriptorHash (void *pHash, size_t *pSizeHash, const void *pGrabBuffer, size_t payloadSize, EEndianness endianness=Endianness_Auto) |
Gets the hash of the compression descriptor that is required for decompressing the grab buffer provided. More... | |
static void | GetCompressionDescriptorHash (void *pHash, size_t *pSizeHash, const Pylon::GrabResult &grabResult, EEndianness endianness=Endianness_Auto) |
Gets the hash of the compression descriptor that is required for decompressing the grab result provided. More... | |
static void | GetCompressionDescriptorHash (void *pHash, size_t *pSizeHash, const Pylon::CGrabResultPtr grabResultPtr, EEndianness endianness=Endianness_Auto) |
Gets the hash of the compression descriptor that is required for decompressing the grab result provided. More... | |
static size_t | GetImageSizeForDecompression (GenApi::INodeMap &nodeMap) |
Gets size (in bytes) required for allocating buffers for decompressing the images during streaming. More... | |
Provides convenient access to cameras that support image compression and helps with decompressing these images.
A decompressor requires a compression descriptor in order to be able to decompress images. You can set a compression descriptor via the constructor or the SetCompressionDescriptor methods (in both cases, either using the node map or manually).
A compression descriptor can be identified via a hash. This hash can be used to identify the matching compression descriptor for a particular compressed image. It can be computed using the ComputeCompressionDescriptorHash method or retrieved from the camera, decompressor, or a grab buffer/result using one of the GetCompressionDescriptorHash methods.
Grab buffers/results may contain different kinds of data. You can use the decompressor's GetCompressionInfo methods to distinguish between them. For that to work, a grab buffer/result must have been received successfully and it must contain the payload type chunk (for grab results you can get the payload type using the GetPayloadType method).
If compression info for the grab buffer/result provided is available, GetCompressionInfo returns true and you will receive the compression info via the CompressionInfo_t struct. If the field hasCompressedImage in the struct is true, the grab buffer/result contains a compressed image. In this case, you should check the compressionStatus field in the struct to check whether the camera was able to compress the image properly. The camera can't compress an image if the amount of data required for compressing the image exceeds the desired compression ratio. The image can be decompressed if compressionStatus is CompressionStatus_Ok. If the field hasCompressedImage in the struct is false, the grab buffer/result contains an already decompressed image. In this case, the decompressedImageSize and decompressedPayloadSize fields will not be used. All other fields contain information about the decompressed data.
Pylon::CImageDecompressor::CImageDecompressor | ( | ) |
Creates an empty decompressor without compression descriptor.
This constructor does not initialize the decompressor with a compression descriptor. You will have to initialize the decompressor first by using one of the SetCompressionDescriptor methods in order to be able to decompress images. You will get an exception if you access methods that require the decompressor to be initialized (see method descriptions for which methods are affected by that precondition).
|
explicit |
Creates a decompressor by copying from another decompressor.
[in] | imageDecompressor | Decompressor to copy from during initialization. |
Pylon::CImageDecompressor::CImageDecompressor | ( | const void * | pCompressionDescriptor, |
size_t | sizeCompressionDescriptor | ||
) |
Creates a decompressor and initializes it with the compression descriptor provided.
[in] | pCompressionDescriptor | Pointer to the compression descriptor. This parameter must not be NULL. |
[in] | sizeCompressionDescriptor | Size of the data (in bytes) of the compression descriptor. |
|
explicit |
Creates a decompressor and initializes it with a compression descriptor that is retrieved from the camera's node map.
[in] | nodeMap | Node map of the camera to be used for retrieving the compression descriptor. |
Pylon::CImageDecompressor::~CImageDecompressor | ( | ) |
Destroys the decompressor instance.
|
static |
Computes the hash for a given compression descriptor.
[out] | pHash | Pointer to the buffer that will receive the compression descriptor hash or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeHash | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor hash (if pHash is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor hash. This parameter must not be NULL. |
[in] | pCompressionDescriptor | Pointer to the compression descriptor. This parameter must not be NULL. |
[in] | sizeCompressionDescriptor | Size of the data (in bytes) of the compression descriptor. |
CompressionInfo_t Pylon::CImageDecompressor::DecompressImage | ( | void * | pOutputBuffer, |
size_t * | pSizeOutputBuffer, | ||
const void * | pGrabBuffer, | ||
size_t | payloadSize | ||
) | const |
Decompresses the image of the grab buffer provided.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
The grab buffer provided must contain a compressed image that has been received without errors.
[out] | pOutputBuffer | Pointer to the buffer that will receive the decompressed image. This parameter must not be NULL. |
[in,out] | pSizeOutputBuffer | On input, the variable specifies the size of the buffer (in bytes) for the decompressed image (must be larger or equal to the value in the decompressedImageSize field in the CompressionInfo_t struct received via the GetCompressionInfo methods; alternatively, the GetImageSizeForDecompression method can be used to get the image size required for decompression). On output, the variable will receive the actual buffer size required for the decompressed image. This parameter must not be NULL. |
[in] | pGrabBuffer | Pointer to the grab buffer that holds the compressed data. This parameter must not be NULL. |
[in] | payloadSize | Payload size (in bytes) of the data received (must be less or equal to the size of the grab buffer). |
CompressionInfo_t Pylon::CImageDecompressor::DecompressImage | ( | void * | pOutputBuffer, |
size_t * | pSizeOutputBuffer, | ||
const Pylon::GrabResult & | grabResult | ||
) | const |
Decompresses the image of the grab result provided.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
The grab result provided must contain a compressed image that has been received without errors.
[out] | pOutputBuffer | Pointer to the buffer that will receive the decompressed image. This parameter must not be NULL. |
[in,out] | pSizeOutputBuffer | On input, the variable specifies the size of the buffer (in bytes) for the decompressed image (must be larger or equal to the value in the decompressedImageSize field in the CompressionInfo_t struct received via the GetCompressionInfo methods; alternatively, the GetImageSizeForDecompression method can be used to get the image size required for decompression). On output, the variable will receive the actual buffer size required for the decompressed image. This parameter must not be NULL. |
[in] | grabResult | Grab result that holds the compressed data. |
CompressionInfo_t Pylon::CImageDecompressor::DecompressImage | ( | void * | pOutputBuffer, |
size_t * | pSizeOutputBuffer, | ||
const Pylon::CGrabResultPtr | grabResultPtr | ||
) | const |
Decompresses the image of the grab result provided.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
The grab result provided must contain a compressed image that has been received without errors.
[out] | pOutputBuffer | Pointer to the buffer that will receive the decompressed image. This parameter must not be NULL. |
[in,out] | pSizeOutputBuffer | On input, the variable specifies the size of the buffer (in bytes) for the decompressed image (must be larger or equal to the value in the decompressedImageSize field in the CompressionInfo_t struct received via the GetCompressionInfo methods; alternatively, the GetImageSizeForDecompression method can be used to get the image size required for decompression). On output, the variable will receive the actual buffer size required for the decompressed image. This parameter must not be NULL. |
[in] | grabResultPtr | Pointer to grab result that holds the compressed data. |
CompressionInfo_t Pylon::CImageDecompressor::DecompressImage | ( | IReusableImage & | destinationImage, |
const void * | pGrabBuffer, | ||
size_t | payloadSize | ||
) | const |
Decompresses the image of the grab buffer provided.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
The grab buffer provided must contain a compressed image that has been received without errors.
[out] | destinationImage | Image object (e.g., instance of CPylonImage) that will be filled with the decompressed image (will be resized if required). |
[in] | pGrabBuffer | Pointer to the grab buffer that holds the compressed data. This parameter must not be NULL. |
[in] | payloadSize | Payload size (in bytes) of the data received (must be less or equal to the size of the grab buffer). |
CompressionInfo_t Pylon::CImageDecompressor::DecompressImage | ( | IReusableImage & | destinationImage, |
const Pylon::GrabResult & | grabResult | ||
) | const |
Decompresses the image of the grab result provided.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
The grab result provided must contain a compressed image that has been received without errors.
[out] | destinationImage | Image object (e.g., instance of CPylonImage) that will be filled with the decompressed image (will be resized if required). |
[in] | grabResult | Grab result that holds the compressed data. |
CompressionInfo_t Pylon::CImageDecompressor::DecompressImage | ( | IReusableImage & | destinationImage, |
const Pylon::CGrabResultPtr | grabResultPtr | ||
) | const |
Decompresses the image of the grab result provided.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
The grab result provided must contain a compressed image that has been received without errors.
[out] | destinationImage | Image object (e.g., instance of CPylonImage) that will be filled with the decompressed image (will be resized if required). |
[in] | grabResultPtr | Pointer to grab result that holds the compressed data. |
void Pylon::CImageDecompressor::GetCompressionDescriptor | ( | void * | pCompressionDescriptor, |
size_t * | pSizeCompressionDescriptor | ||
) | const |
Gets the currently set compression descriptor.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
[out] | pCompressionDescriptor | Pointer to the buffer that will receive the compression descriptor or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeCompressionDescriptor | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor (if pCompressionDescriptor is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor. This parameter must not be NULL. |
|
static |
Gets the current compression descriptor from the camera's node map.
This method requires image compression to be enabled in the camera. You can determine this via the GetCompressionMode method.
[out] | pCompressionDescriptor | Pointer to the buffer that will receive the compression descriptor or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeCompressionDescriptor | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor (if pCompressionDescriptor is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor. This parameter must not be NULL. |
[in] | nodeMap | Node map of the camera to be used for retrieving the compression descriptor. |
void Pylon::CImageDecompressor::GetCompressionDescriptorHash | ( | void * | pHash, |
size_t * | pSizeHash | ||
) | const |
Gets the hash of the currently set compression descriptor.
This method requires that a compression descriptor has been set previously via the constructor or the SetCompressionDescriptor methods. You can determine this via the HasCompressionDescriptor method.
[out] | pHash | Pointer to the buffer that will receive the compression descriptor hash or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeHash | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor hash (if pHash is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor hash. This parameter must not be NULL. |
|
static |
Gets the hash of the current compression descriptor from the camera's node map.
This method requires image compression to be enabled in the camera. You can determine this via the GetCompressionMode method.
[out] | pHash | Pointer to the buffer that will receive the compression descriptor hash or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeHash | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor hash (if pHash is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor hash. This parameter must not be NULL. |
[in] | nodeMap | Node map of the camera to be used for retrieving the compression descriptor hash. |
|
static |
Gets the hash of the compression descriptor that is required for decompressing the grab buffer provided.
[out] | pHash | Pointer to the buffer that will receive the compression descriptor hash or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeHash | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor hash (if pHash is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor hash. This parameter must not be NULL. |
[in] | pGrabBuffer | Pointer to the grab buffer that holds the compressed data. This parameter must not be NULL. |
[in] | payloadSize | Payload size (in bytes) of the data received (must be less or equal to the size of the grab buffer). |
[in] | endianness | Endianness of the grab buffer's content. If not known, auto detection can be used. |
|
static |
Gets the hash of the compression descriptor that is required for decompressing the grab result provided.
[out] | pHash | Pointer to the buffer that will receive the compression descriptor hash or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeHash | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor hash (if pHash is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor hash. This parameter must not be NULL. |
[in] | grabResult | Grab result that holds the compressed data. |
[in] | endianness | Endianness of the grab result content. If not known, auto detection can be used. |
|
static |
Gets the hash of the compression descriptor that is required for decompressing the grab result provided.
[out] | pHash | Pointer to the buffer that will receive the compression descriptor hash or NULL if you only want to get the size of the buffer for buffer allocation. |
[in,out] | pSizeHash | On input, the variable specifies the size of the buffer (in bytes) for the compression descriptor hash (if pHash is not NULL). On output, the variable will receive the actual buffer size required for the current compression descriptor hash. This parameter must not be NULL. |
[in] | grabResultPtr | Pointer to grab result that holds the compressed data. |
[in] | endianness | Endianness of the grab result content. If not known, auto detection can be used. |
|
static |
Gets compression information about a grab buffer.
[out] | compressionInfo | Reference to the struct that will receive the compression information if the grab buffer contains such information. |
[in] | pGrabBuffer | Pointer to the grab buffer that holds the compressed data. This parameter must not be NULL. |
[in] | payloadSize | Payload size (in bytes) of the data received (must be less or equal to the size of the grab buffer). |
[in] | endianness | Endianness of the grab buffer's content. If not known, auto detection can be used. |
|
static |
Gets compression information about a grab result.
[out] | compressionInfo | Reference to the struct that will receive the compression information if the grab result contains such information. |
[in] | grabResult | Grab result that holds the compressed data. |
[in] | endianness | Endianness of the grab result content. If not known, auto detection can be used. |
|
static |
Gets compression information about a grab result.
[out] | compressionInfo | Reference to the struct that will receive the compression information if the grab result contains such information. |
[in] | grabResultPtr | Pointer to grab result that holds the compressed data. |
[in] | endianness | Endianness of the grab result content. If not known, auto detection can be used. |
|
static |
Retrieves the current compression mode from the camera's node map.
This indicates which kind of compression is active or whether compression is not enabled (or unavailable).
[in] | nodeMap | Node map of the camera to be used for retrieving the compression mode. |
|
static |
Gets size (in bytes) required for allocating buffers for decompressing the images during streaming.
This method requires image compression to be enabled in the camera. You can determine this via the GetCompressionMode method.
[in] | nodeMap | Node map of the camera to be used for retrieving the image size required for decompression. |
bool Pylon::CImageDecompressor::HasCompressionDescriptor | ( | ) | const |
Determines whether the decompressor already has a compression descriptor.
CImageDecompressor& Pylon::CImageDecompressor::operator= | ( | const CImageDecompressor & | imageDecompressor | ) |
Copies the decompressor.
[in] | imageDecompressor | The source decompressor. |
bool Pylon::CImageDecompressor::operator== | ( | const CImageDecompressor & | imageDecompressor | ) |
Compares this instance with another decompressor.
[in] | imageDecompressor | The decompressor on the right-hand side of the comparison. |
void Pylon::CImageDecompressor::ResetCompressionDescriptor | ( | ) |
Resets the compression descriptor in the decompressor.
void Pylon::CImageDecompressor::SetCompressionDescriptor | ( | const void * | pCompressionDescriptor, |
size_t | sizeCompressionDescriptor | ||
) |
Initializes a decompressor with the compression descriptor provided.
[in] | pCompressionDescriptor | Pointer to the compression descriptor. This parameter must not be NULL. |
[in] | sizeCompressionDescriptor | Size of the data (in bytes) of the compression descriptor. |
void Pylon::CImageDecompressor::SetCompressionDescriptor | ( | GenApi::INodeMap & | nodeMap | ) |
Initializes a decompressor with a compression descriptor that is retrieved from the camera's node map.
[in] | nodeMap | Node map of the camera to be used for retrieving the compression descriptor. |