11#ifndef __BE_IMAGE_IMAGE_H__
12#define __BE_IMAGE_IMAGE_H__
19#include <be_framework_status.h>
22#include <be_memory_autoarray.h>
24namespace BiometricEvaluation
52 using statusCallback_t = std::function<void(
53 const Framework::Status)>;
89 const Size dimensions,
90 const uint32_t colorDepth,
91 const uint16_t bitDepth,
92 const Resolution resolution,
93 const CompressionAlgorithm compression,
95 const std::string &identifier =
"",
96 const statusCallback_t &statusCallback =
123 const CompressionAlgorithm compression,
124 const std::string &identifier =
"",
125 const statusCallback_t &statusCallback =
212 const bool removeAlphaChannelIfPresent)
299 return (this->_hasAlphaChannel);
348 uint64_t maxColorValue,
378 static std::shared_ptr<Image>
382 const std::string &identifier =
"",
383 const statusCallback_t &statusCallback =
407 static std::shared_ptr<Image>
410 const std::string &identifier =
"",
411 const statusCallback_t &statusCallback =
435 static std::shared_ptr<Image>
437 const std::string &path,
438 const statusCallback_t &statusCallback =
459 static CompressionAlgorithm
462 const uint64_t size);
480 static CompressionAlgorithm
505 static CompressionAlgorithm
507 const std::string &path);
546 const Framework::Status &status);
558 const Resolution resolution);
569 const Size dimensions);
580 const uint32_t colorDepth);
592 const uint16_t bitDepth);
623 uint32_t _colorDepth;
626 bool _hasAlphaChannel;
632 Resolution _resolution;
638 CompressionAlgorithm _compressionAlgorithm;
641 const std::string _identifier{};
644 statusCallback_t _statusCallback{
Represent attributes common to all images.
Definition: be_image_image.h:50
virtual Memory::uint8Array getRawData() const =0
Accessor for the raw image data.
uint64_t getDataSize() const
static std::shared_ptr< Image > openImage(const std::string &path, const statusCallback_t &statusCallback=Image::defaultStatusCallback)
Determine the image type of an image file and create an Image object.
static void defaultStatusCallback(const Framework::Status &status)
Default handling of statuses sent from image processing libraries.
void setResolution(const Resolution resolution)
Mutator for the resolution of the image .
uint32_t getColorDepth() const
Accessor for the color depth of the image in bits.
static CompressionAlgorithm getCompressionAlgorithm(const Memory::uint8Array &data)
Determine the compression algorithm of a buffer of image data.
bool hasAlphaChannel() const
Accessor for the presence of an alpha channel.
Definition: be_image_image.h:296
Memory::uint8Array getData() const
Accessor for the image data.
static std::shared_ptr< Image > openImage(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.
std::string getIdentifier() const
Obtain the assigned image identifier.
Size getDimensions() const
Accessor for the dimensions of the image in pixels.
static BiometricEvaluation::Image::Raw getRawImage(const std::shared_ptr< BiometricEvaluation::Image::Image > &image)
Obtain Image::Raw version of an Image::Image.
virtual Memory::uint8Array getRawGrayscaleData(uint8_t depth) const =0
Accessor for decompressed data in grayscale.
statusCallback_t getStatusCallback() const
Get handle to status callback function.
const uint8_t * getDataPointer() const
uint16_t getBitDepth() const
Accessor for the number of bits per color component.
void setDimensions(const Size dimensions)
Mutator for the dimensions of the image in pixels.
void setBitDepth(const uint16_t bitDepth)
Mutator for the number of bits per component for color components in the image, in bits.
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.
virtual Memory::uint8Array getRawData(const bool removeAlphaChannelIfPresent) const
Accessor for the raw image data.
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.
Resolution getResolution() const
Accessor for the resolution of the 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.
CompressionAlgorithm getCompressionAlgorithm() const
Accessor for the CompressionAlgorithm of the image.
void setColorDepth(const uint32_t colorDepth)
Mutator for the color depth of the image in bits.
void setHasAlphaChannel(const bool hasAlphaChannel)
Mutator for the presence of an alpha channel.
Definition: be_image_image.h:612
static CompressionAlgorithm getCompressionAlgorithm(const std::string &path)
Determine the compression algorithm of a file.
static std::shared_ptr< Image > openImage(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.
static CompressionAlgorithm getCompressionAlgorithm(const uint8_t *data, const uint64_t size)
Determine the compression algorithm of a buffer of image data.
An image with no encoding or compression.
Definition: be_image_raw.h:25
A C-style array wrapped in the facade of a C++ STL container.
Definition: be_memory_autoarray.h:45
Classes and methods for manipulating images.
Definition: be_image_raw.h:20