NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
BiometricEvaluation::Image::BMP Class Reference

A BMP-encoded image. More...

#include <be_image_bmp.h>

Inherits BiometricEvaluation::Image::Image.

Classes

struct  ColorTableEntry
 One element of the colormap table. More...
 

Public Types

using ColorTableEntry = ColorTableEntry
 
using ColorTable = std::vector< ColorTableEntry >
 
- Public Types inherited from BiometricEvaluation::Image::Image
using statusCallback_t = std::function< void(const Framework::Status)>
 

Public Member Functions

 BMP (const uint8_t *data, const uint64_t size, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
 
 BMP (const Memory::uint8Array &data, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
 
 ~BMP ()=default
 
Memory::AutoArray< uint8_t > getRawData () const
 Accessor for the raw image data. More...
 
Memory::AutoArray< uint8_t > getRawGrayscaleData (uint8_t depth) const
 Accessor for decompressed data in grayscale. More...
 
- Public Member Functions inherited from BiometricEvaluation::Image::Image
 Image (const uint8_t *data, const uint64_t size, const Size dimensions, const uint32_t colorDepth, const uint16_t bitDepth, const Resolution resolution, const CompressionAlgorithm compression, const bool hasAlphaChannel, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
 Parent constructor for all Image classes. More...
 
 Image (const uint8_t *data, const uint64_t size, const CompressionAlgorithm compression, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
 Parent constructor for all Image classes. More...
 
CompressionAlgorithm getCompressionAlgorithm () const
 Accessor for the CompressionAlgorithm of the image. More...
 
Resolution getResolution () const
 Accessor for the resolution of the image. More...
 
Memory::uint8Array getData () const
 Accessor for the image data. More...
 
virtual Memory::uint8Array getRawData () const =0
 Accessor for the raw image data. More...
 
virtual Memory::uint8Array getRawData (const bool removeAlphaChannelIfPresent) const
 Accessor for the raw image data. More...
 
virtual Memory::uint8Array getRawGrayscaleData (uint8_t depth) const =0
 Accessor for decompressed data in grayscale. More...
 
Size getDimensions () const
 Accessor for the dimensions of the image in pixels. More...
 
uint32_t getColorDepth () const
 Accessor for the color depth of the image in bits. More...
 
uint16_t getBitDepth () const
 Accessor for the number of bits per color component. More...
 
bool hasAlphaChannel () const
 Accessor for the presence of an alpha channel. More...
 
statusCallback_t getStatusCallback () const
 Get handle to status callback function. More...
 
std::string getIdentifier () const
 Obtain the assigned image identifier. More...
 
virtual ~Image ()
 

Static Public Member Functions

static bool isBMP (const uint8_t *data, uint64_t size)
 Whether or not data is a BMP image. More...
 
- Static Public Member Functions inherited from BiometricEvaluation::Image::Image
static uint64_t valueInColorspace (uint64_t color, uint64_t maxColorValue, uint8_t depth)
 Calculate an equivalent color value for a color in an alternate colorspace. More...
 
static std::shared_ptr< ImageopenImage (const uint8_t *data, const uint64_t size, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
 Determine the image type of a buffer of image data and create an Image object. More...
 
static std::shared_ptr< ImageopenImage (const Memory::uint8Array &data, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
 Determine the image type of a buffer of image data and create an Image object. More...
 
static std::shared_ptr< ImageopenImage (const std::string &path, const statusCallback_t &statusCallback=Image::defaultStatusCallback)
 Determine the image type of an image file and create an Image object. More...
 
static CompressionAlgorithm getCompressionAlgorithm (const uint8_t *data, const uint64_t size)
 Determine the compression algorithm of a buffer of image data. More...
 
static CompressionAlgorithm getCompressionAlgorithm (const Memory::uint8Array &data)
 Determine the compression algorithm of a buffer of image data. More...
 
static CompressionAlgorithm getCompressionAlgorithm (const std::string &path)
 Determine the compression algorithm of a file. More...
 
static BiometricEvaluation::Image::Raw getRawImage (const std::shared_ptr< BiometricEvaluation::Image::Image > &image)
 Obtain Image::Raw version of an Image::Image. More...
 
static void defaultStatusCallback (const Framework::Status &status)
 Default handling of statuses sent from image processing libraries. More...
 

Additional Inherited Members

- Protected Member Functions inherited from BiometricEvaluation::Image::Image
void setResolution (const Resolution resolution)
 Mutator for the resolution of the image . More...
 
void setDimensions (const Size dimensions)
 Mutator for the dimensions of the image in pixels. More...
 
void setColorDepth (const uint32_t colorDepth)
 Mutator for the color depth of the image in bits. More...
 
void setBitDepth (const uint16_t bitDepth)
 Mutator for the number of bits per component for color components in the image, in bits. More...
 
const uint8_t * getDataPointer () const
 
uint64_t getDataSize () const
 
void setHasAlphaChannel (const bool hasAlphaChannel)
 Mutator for the presence of an alpha channel. More...
 

Detailed Description

A BMP-encoded image.

Note
Only supports uncompressed BMPs with the 40-byte BITMAPINFOHEADER header information with no compression or RLE8 compression.

Definition at line 29 of file be_image_bmp.h.

Member Typedef Documentation

◆ ColorTableEntry

Definition at line 44 of file be_image_bmp.h.

◆ ColorTable

Definition at line 45 of file be_image_bmp.h.

Constructor & Destructor Documentation

◆ BMP() [1/2]

BiometricEvaluation::Image::BMP::BMP ( const uint8_t *  data,
const uint64_t  size,
const std::string &  identifier = "",
const statusCallback_t statusCallback = Image::defaultStatusCallback 
)

◆ BMP() [2/2]

BiometricEvaluation::Image::BMP::BMP ( const Memory::uint8Array data,
const std::string &  identifier = "",
const statusCallback_t statusCallback = Image::defaultStatusCallback 
)

◆ ~BMP()

BiometricEvaluation::Image::BMP::~BMP ( )
default

Member Function Documentation

◆ getRawData()

Memory::AutoArray< uint8_t > BiometricEvaluation::Image::BMP::getRawData ( ) const
virtual

Accessor for the raw image data.

The data returned should not be compressed or encoded.

@important Bit depth of data returned from this method is at least 8. If getBitDepth() < 8, data is losslessly converted to use 8 bits to represent a single color channel.

Returns
AutoArray holding raw image data.
Exceptions
Error::DataErrorError decompressing image data.

Implements BiometricEvaluation::Image::Image.

◆ getRawGrayscaleData()

Memory::AutoArray< uint8_t > BiometricEvaluation::Image::BMP::getRawGrayscaleData ( uint8_t  depth) const
virtual

Accessor for decompressed data in grayscale.

Parameters
depthThe desired bit depth of the resulting raw image. This value may either be 16, 8, or 1.
Returns
AutoArray holding raw grayscale image data.
Exceptions
Error::DataErrorError decompressing image data.
Error::NotImplementedUnsupported conversion based on source color depth.
Error::ParameterErrorInvalid value for depth.
Note
This method does not save a cached copy of the decompressed image because the bit depth of the image can be changed between calls.
When depth is 1, this method returns an image that uses 8 bits to represent a single pixel. The depth parameter is used to adjust the number of gray levels. When depth is 1, there are only 2 gray levels (black and white), despite using 8 bits to represent each pixel.
Alpha channels are completely ignored when converting to grayscale.

Implements BiometricEvaluation::Image::Image.

◆ isBMP()

static bool BiometricEvaluation::Image::BMP::isBMP ( const uint8_t *  data,
uint64_t  size 
)
static

Whether or not data is a BMP image.

Parameters
[in]dataThe buffer to check.
[in]sizeThe size of data.
Returns
true if data appears to be a BMP image, false otherwise.

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