Skip to content

pylon/ImageDecompressor.h#

Declaration of the CImageDecompressor class.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
struct Pylon::CompressionInfo_t
The struct containing information about a grab buffer/result.
class Pylon::CImageDecompressor
Provides convenient access to cameras that support image compression and helps with decompressing these images.

Defines#

Name
INCLUDED_IMAGEDECOMPRESSOR_H_C5305647

Macros Documentation#

define INCLUDED_IMAGEDECOMPRESSOR_H_C5305647#

#define INCLUDED_IMAGEDECOMPRESSOR_H_C5305647 

Source code#

//-----------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2019-2022 Basler AG
//  http://www.baslerweb.com
//  Author:  MP
//-----------------------------------------------------------------------------
#pragma once

#ifndef INCLUDED_IMAGEDECOMPRESSOR_H_C5305647
#define INCLUDED_IMAGEDECOMPRESSOR_H_C5305647

#include <pylon/Platform.h>

#include <GenApi/INodeMap.h>
#include <pylon/PylonUtility.h>
#include <pylon/ReusableImage.h>
#include <pylon/Result.h>
#include <pylon/PixelType.h>
#include <pylon/GrabResultPtr.h>

namespace Pylon
{

#ifdef _MSC_VER
#   pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */

    enum ECompressionStatus
    {
        CompressionStatus_Ok,                           
        CompressionStatus_BufferOverflow,               
        CompressionStatus_Error                         
    };

    enum EEndianness
    {
        Endianness_Little,                              
        Endianness_Big,                                 
        Endianness_Auto                                 
    };

    struct PYLONUTILITY_API CompressionInfo_t
    {
        bool                hasCompressedImage;         
        ECompressionStatus  compressionStatus;          
        bool                lossy;                      
        EPixelType          pixelType;                  
        size_t              width;                      
        size_t              height;                     
        size_t              offsetX;                    
        size_t              offsetY;                    
        size_t              paddingX;                   
        size_t              paddingY;                   
        size_t              decompressedImageSize;      
        size_t              decompressedPayloadSize;    

        CompressionInfo_t();
    };

    enum ECompressionMode
    {
        CompressionMode_Off,                        
        CompressionMode_BaslerLossless,             
        CompressionMode_BaslerFixRatio              
    };

    class PYLONUTILITY_API CImageDecompressor
    {
    public:
        CImageDecompressor();

        explicit CImageDecompressor( const CImageDecompressor& imageDecompressor );

        CImageDecompressor( const void* pCompressionDescriptor, size_t sizeCompressionDescriptor );

        explicit CImageDecompressor( GenApi::INodeMap& nodeMap );

        ~CImageDecompressor();

        bool HasCompressionDescriptor() const;

        void ResetCompressionDescriptor();

        void SetCompressionDescriptor( const void* pCompressionDescriptor, size_t sizeCompressionDescriptor );

        void SetCompressionDescriptor( GenApi::INodeMap& nodeMap );

        static ECompressionMode GetCompressionMode( GenApi::INodeMap& nodeMap );

        void GetCompressionDescriptor( void* pCompressionDescriptor, size_t* pSizeCompressionDescriptor ) const;

        static void GetCompressionDescriptor( void* pCompressionDescriptor, size_t* pSizeCompressionDescriptor, GenApi::INodeMap& nodeMap );

        static bool GetCompressionInfo( CompressionInfo_t& compressionInfo, const void* pGrabBuffer, size_t payloadSize, EEndianness endianness = Endianness_Auto );

        static bool GetCompressionInfo( CompressionInfo_t& compressionInfo, const Pylon::GrabResult& grabResult, EEndianness endianness = Endianness_Auto );

        static bool GetCompressionInfo( CompressionInfo_t& compressionInfo, const Pylon::CGrabResultPtr grabResultPtr, EEndianness endianness = Endianness_Auto );

        static void ComputeCompressionDescriptorHash( void* pHash, size_t* pSizeHash, const void* pCompressionDescriptor, size_t sizeCompressionDescriptor );

        void GetCompressionDescriptorHash( void* pHash, size_t* pSizeHash ) const;

        static void GetCompressionDescriptorHash( void* pHash, size_t* pSizeHash, GenApi::INodeMap& nodeMap );

        static void GetCompressionDescriptorHash( void* pHash, size_t* pSizeHash, const void* pGrabBuffer, size_t payloadSize, EEndianness endianness = Endianness_Auto );

        static void GetCompressionDescriptorHash( void* pHash, size_t* pSizeHash, const Pylon::GrabResult& grabResult, EEndianness endianness = Endianness_Auto );

        static void GetCompressionDescriptorHash( void* pHash, size_t* pSizeHash, const Pylon::CGrabResultPtr grabResultPtr, EEndianness endianness = Endianness_Auto );

        static size_t GetImageSizeForDecompression( GenApi::INodeMap& nodeMap );

        CompressionInfo_t DecompressImage( void* pOutputBuffer, size_t* pSizeOutputBuffer, const void* pGrabBuffer, size_t payloadSize ) const;

        CompressionInfo_t DecompressImage( void* pOutputBuffer, size_t* pSizeOutputBuffer, const Pylon::GrabResult& grabResult ) const;

        CompressionInfo_t DecompressImage( void* pOutputBuffer, size_t* pSizeOutputBuffer, const Pylon::CGrabResultPtr grabResultPtr ) const;

        CompressionInfo_t DecompressImage( IReusableImage& destinationImage, const void* pGrabBuffer, size_t payloadSize ) const;

        CompressionInfo_t DecompressImage( IReusableImage& destinationImage, const Pylon::GrabResult& grabResult ) const;

        CompressionInfo_t DecompressImage( IReusableImage& destinationImage, const Pylon::CGrabResultPtr grabResultPtr ) const;

        CImageDecompressor& operator = ( const CImageDecompressor& imageDecompressor );

        bool operator == ( const CImageDecompressor& imageDecompressor );

    private:
        struct Impl_t;

        Impl_t* m_pImpl;
    };

#ifdef _MSC_VER
#   pragma pack(pop)
#endif /* _MSC_VER */

} //namespace Pylon

#endif // INCLUDED_IMAGEDECOMPRESSOR_H_C5305647

Updated on 5 July 2022 at 15:30:01