NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_image_bmp.h
Go to the documentation of this file.
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_BMP__
12#define __BE_IMAGE_BMP__
13
14#include <be_image_image.h>
15
16namespace BiometricEvaluation
17{
18 namespace Image
19 {
29 class BMP : public Image
30 {
31 public:
34 {
36 uint8_t red;
38 uint8_t green;
40 uint8_t blue;
42 uint8_t reserved;
43 };
45 using ColorTable = std::vector<ColorTableEntry>;
46
48 const uint8_t *data,
49 const uint64_t size,
50 const std::string &identifier = "",
51 const statusCallback_t &statusCallback =
53
55 const Memory::uint8Array &data,
56 const std::string &identifier = "",
57 const statusCallback_t &statusCallback =
59
60 ~BMP() = default;
61
64 const;
65
68 uint8_t depth)
69 const;
70
83 static bool
85 const uint8_t *data,
86 uint64_t size);
87 protected:
88
89 private:
91 typedef struct
92 {
94 uint16_t magic;
96 uint32_t size;
98 uint16_t reserved1;
100 uint16_t reserved2;
102 uint32_t startingAddress;
103 } BMPHeader;
104
106 typedef struct
107 {
109 uint32_t headerSize;
111 int32_t width;
113 int32_t height;
115 uint16_t colorPanes;
117 uint16_t bitsPerPixel;
119 uint32_t compressionMethod;
121 uint32_t bitmapSize;
123 uint32_t xResolution;
125 uint32_t yResolution;
127 uint32_t numberOfColors;
129 uint32_t numberOfImportantColors;
130 } BITMAPINFOHEADER;
131
147 static void
148 getBMPHeader(
149 const uint8_t * const buf,
150 uint64_t bufsz,
151 BMPHeader *header);
152
172 static void
173 getDIBHeader(
174 const uint8_t * const buf,
175 uint64_t bufsz,
176 BITMAPINFOHEADER *header);
177
193 void
194 getColorTable(
195 const uint8_t *buf,
196 uint64_t bufsz,
197 int count,
198 ColorTable &colorTable);
199
219 void
220 rle8Decoder(
221 const uint8_t *input,
222 uint64_t inputSize,
223 Memory::uint8Array &output,
224 BMPHeader *bmpHeader,
225 BITMAPINFOHEADER *dibHeader) const;
226
227 ColorTable _colorTable{};
228 };
229
230 #ifndef BI_RGB
232 static const uint8_t BI_RGB = 0;
233 #endif /* BI_RGB */
234 #ifndef BI_RLE8
236 static const uint8_t BI_RLE8 = 1;
237 #endif /* BI_RLE8 */
238
239 }
240}
241#endif
242
A BMP-encoded image.
Definition: be_image_bmp.h:30
Memory::AutoArray< uint8_t > getRawData() const
Accessor for the raw image data.
BMP(const Memory::uint8Array &data, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
std::vector< ColorTableEntry > ColorTable
Definition: be_image_bmp.h:45
BMP(const uint8_t *data, const uint64_t size, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
static bool isBMP(const uint8_t *data, uint64_t size)
Whether or not data is a BMP image.
Memory::AutoArray< uint8_t > getRawGrayscaleData(uint8_t depth) const
Accessor for decompressed data in grayscale.
Represent attributes common to all images.
static void defaultStatusCallback(const Framework::Status &status)
Default handling of statuses sent from image processing libraries.
std::function< void(const Framework::Status)> statusCallback_t
This software was developed at the National Institute of Standards and Technology (NIST) by employees...
One element of the colormap table.
Definition: be_image_bmp.h:34
uint8_t red
Red value.
Definition: be_image_bmp.h:36
uint8_t reserved
Reserved value.
Definition: be_image_bmp.h:42
uint8_t green
Green value.
Definition: be_image_bmp.h:38
uint8_t blue
Blue value.
Definition: be_image_bmp.h:40