Nail to Nail Fingerprint Capture Challenge
API for participant-specific one-to-many template generation and template matching.
be_image_image.h
1/*
2 * This software was developed at the National Institute of Standards and
3 * Technology (NIST) by employees of the Federal Government in the course
4 * of their official duties. Pursuant to title 17 Section 105 of the
5 * United States Code, this software is not subject to copyright protection
6 * and is in the public domain. NIST assumes no responsibility whatsoever for
7 * its use by other parties, and makes no guarantees, expressed or implied,
8 * about its quality, reliability, or any other characteristic.
9 */
10
11#ifndef __BE_IMAGE_IMAGE_H__
12#define __BE_IMAGE_IMAGE_H__
13
14#include <cstdint>
15#include <functional>
16#include <stdexcept>
17#include <memory>
18
19#include <be_framework_status.h>
20#include <be_io.h>
21#include <be_image.h>
22#include <be_memory_autoarray.h>
23
24namespace BiometricEvaluation
25{
30 namespace Image
31 {
32 /* Forward declaration */
33 class Raw;
34
50 class Image {
51 public:
52 using statusCallback_t = std::function<void(
53 const Framework::Status)>;
54
87 const uint8_t *data,
88 const uint64_t size,
89 const Size dimensions,
90 const uint32_t colorDepth,
91 const uint16_t bitDepth,
92 const Resolution resolution,
93 const CompressionAlgorithm compression,
94 const bool hasAlphaChannel,
95 const std::string &identifier = "",
96 const statusCallback_t &statusCallback =
98
121 const uint8_t *data,
122 const uint64_t size,
123 const CompressionAlgorithm compression,
124 const std::string &identifier = "",
125 const statusCallback_t &statusCallback =
127
136 CompressionAlgorithm
138 const;
139
147 Resolution
149 const;
150
161 const;
162
180 virtual Memory::uint8Array
182 const = 0;
183
210 virtual Memory::uint8Array
212 const bool removeAlphaChannelIfPresent)
213 const;
214
249 virtual Memory::uint8Array
251 uint8_t depth)
252 const = 0;
253
262 Size
264 const;
265
273 uint32_t
275 const;
276
284 uint16_t
286 const;
287
295 bool
297 const
298 {
299 return (this->_hasAlphaChannel);
300 }
301
309 statusCallback_t
311 const;
312
320 std::string
322 const;
323
324 virtual ~Image();
325
326 /*
327 * Buffer type conversions.
328 */
329
345 static uint64_t
347 uint64_t color,
348 uint64_t maxColorValue,
349 uint8_t depth);
350
351 /*
352 * Static functions.
353 */
354
378 static std::shared_ptr<Image>
380 const uint8_t *data,
381 const uint64_t size,
382 const std::string &identifier = "",
383 const statusCallback_t &statusCallback =
385
407 static std::shared_ptr<Image>
409 const Memory::uint8Array &data,
410 const std::string &identifier = "",
411 const statusCallback_t &statusCallback =
413
435 static std::shared_ptr<Image>
437 const std::string &path,
438 const statusCallback_t &statusCallback =
440
459 static CompressionAlgorithm
461 const uint8_t *data,
462 const uint64_t size);
463
480 static CompressionAlgorithm
482 const Memory::uint8Array &data);
483
505 static CompressionAlgorithm
507 const std::string &path);
508
525 const std::shared_ptr<BiometricEvaluation::Image::
526 Image> &image);
527
544 static void
546 const Framework::Status &status);
547
548 protected:
556 void
558 const Resolution resolution);
559
567 void
569 const Size dimensions);
570
578 void
580 const uint32_t colorDepth);
581
590 void
592 const uint16_t bitDepth);
593
595 const uint8_t *
597 const;
598
600 uint64_t
602 const;
603
611 void
613 const bool hasAlphaChannel)
614 {
615 this->_hasAlphaChannel = hasAlphaChannel;
616 }
617
618 private:
620 Size _dimensions;
621
623 uint32_t _colorDepth;
624
626 bool _hasAlphaChannel;
627
629 uint16_t _bitDepth;
630
632 Resolution _resolution;
633
636
638 CompressionAlgorithm _compressionAlgorithm;
639
641 const std::string _identifier{};
642
644 statusCallback_t _statusCallback{
646 };
647 }
648}
649
650#endif /* __BE_IMAGE_IMAGE_H__ */
Represent attributes common to all images.
Definition: be_image_image.h:50
virtual Memory::uint8Array getRawData() const =0
Accessor for the raw image data.
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