pylon/PixelData.h#
Namespaces#
Name |
---|
Pylon Contains definitions of pylon types. |
Classes#
Name | |
---|---|
class | Pylon::SPixelData Describes the data of one pixel. |
Source code#
//------------------------------------------------------------------------------
// Basler pylon SDK
// Copyright (c) 2012-2022 Basler AG
// http://www.baslerweb.com
// Author: Andreas Gau
//------------------------------------------------------------------------------
#ifndef INCLUDED_PIXELDATA_H_9714014
#define INCLUDED_PIXELDATA_H_9714014
#include <pylon/Platform.h>
#ifdef _MSC_VER
# pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */
#include <pylon/PylonBase.h>
namespace Pylon
{
struct SPixelData
{
SPixelData()
: PixelDataType( PixelDataType_Unknown )
, BitDepth( 0 )
{
Data.RGBA.R =
Data.RGBA.G =
Data.RGBA.B =
Data.RGBA.A = 0;
}
~SPixelData()
{
}
enum EPixelDataType
{
PixelDataType_Unknown,
PixelDataType_Mono,
PixelDataType_YUV,
PixelDataType_RGB,
PixelDataType_RGBA,
PixelDataType_BayerR,
PixelDataType_BayerG,
PixelDataType_BayerB
};
EPixelDataType PixelDataType;
uint32_t BitDepth;
union
{
int Mono;
int BayerR;
int BayerG;
int BayerB;
struct
{
int Y;
int U;
int V;
}
YUV;
struct
{
int R;
int G;
int B;
}
RGB;
struct
{
int R;
int G;
int B;
int A;
}
RGBA;
}
Data;
bool operator==( const SPixelData& rhs )
{
if (PixelDataType != rhs.PixelDataType) return false;
if (BitDepth != rhs.BitDepth) return false;
switch (PixelDataType)
{
case PixelDataType_Unknown:
return true;
case PixelDataType_Mono:
return Data.Mono == rhs.Data.Mono;
case PixelDataType_YUV:
return Data.YUV.Y == rhs.Data.YUV.Y && Data.YUV.U == rhs.Data.YUV.U && Data.YUV.V == rhs.Data.YUV.V;
case PixelDataType_RGB:
return Data.RGB.R == rhs.Data.RGB.R && Data.RGB.G == rhs.Data.RGB.G && Data.RGB.B == rhs.Data.RGB.B;
case PixelDataType_RGBA:
return Data.RGB.R == rhs.Data.RGBA.R && Data.RGBA.G == rhs.Data.RGBA.G && Data.RGBA.B == rhs.Data.RGBA.B && Data.RGBA.A == rhs.Data.RGBA.A;
case PixelDataType_BayerR:
return Data.BayerR == rhs.Data.BayerR;
case PixelDataType_BayerG:
return Data.BayerG == rhs.Data.BayerG;
case PixelDataType_BayerB:
return Data.BayerB == rhs.Data.BayerB;
default:
PYLON_ASSERT2( false, "Cannot compare SPixelDataStructure. It contains unexpected data." );
}
return false;
}
bool operator!=( const SPixelData& rhs )
{
return !((*this) == rhs);
}
};
}
#ifdef _MSC_VER
# pragma pack(pop)
#endif /* _MSC_VER */
#endif /* INCLUDED_PIXELDATA_H_9714014 */
Updated on 5 July 2022 at 15:30:01