NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_image.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_H__
12#define __BE_IMAGE_H__
13
14#include <cstdint>
15#include <iostream>
16#include <vector>
17
19#include <be_memory_autoarray.h>
20
21namespace BiometricEvaluation
22{
31 namespace Image
32 {
35 {
36 None = 0,
37 Facsimile = 1,
38 WSQ20 = 2,
39 JPEGB = 3,
40 JPEGL = 4,
41 JP2 = 5,
42 JP2L = 6,
43 PNG = 7,
44 NetPBM = 8,
45 BMP = 9,
46 TIFF = 10
47 };
48
50 enum class PixelFormat
51 {
53 MonoWhite = 0,
55 MonoBlack = 1,
57 Gray8 = 2,
59 RGB24 = 3
60 };
61
67 struct Coordinate {
82 const uint32_t x = 0,
83 const uint32_t y = 0,
84 const float xDistance = 0,
85 const float yDistance = 0);
86
88 uint32_t x;
90 uint32_t y;
92 float xDistance;
94 float yDistance;
95 };
96 using Coordinate = struct Coordinate;
97
108 std::string
110 const Coordinate &c);
111 std::ostream& operator<< (std::ostream&, const Coordinate&);
112 using CoordinateSet = std::vector<Image::Coordinate>;
113 bool
115 const Coordinate &lhs,
116 const Coordinate &rhs);
117 bool
119 const Coordinate &lhs,
120 const Coordinate &rhs);
121
132 std::string
134 const CoordinateSet &coordinates);
149 std::ostream&
151 std::ostream &stream,
152 const CoordinateSet &coordinates);
153
159 struct Size {
170 const uint32_t xSize = 0,
171 const uint32_t ySize = 0);
172
174 uint32_t xSize;
176 uint32_t ySize;
177 };
178 using Size = struct Size;
189 std::string
191 const Size &s);
192 std::ostream& operator<< (std::ostream&, const Size&);
193 bool
195 const Size &lhs,
196 const Size &rhs);
197 bool
199 const Size &lhs,
200 const Size &rhs);
201
206 struct Resolution {
212 enum class Units {
214 NA = 0,
216 PPI = 1,
218 PPMM = 2,
220 PPCM = 3
221 };
222
235 const double xRes = 0.0,
236 const double yRes = 0.0,
237 const Units units = Units::PPI);
238
240 double xRes;
242 double yRes;
245
262 const Units &units)
263 const;
264 };
265 using Resolution = struct Resolution;
266
268 const double CentimetersPerInch = 2.54;
271
282 std::string
284 const Resolution &r);
285 std::ostream& operator<< (std::ostream&, const Resolution&);
286 bool
288 const Resolution &lhs,
289 const Resolution &rhs);
290 bool
292 const Resolution &lhs,
293 const Resolution &rhs);
294
307 float
309 const Coordinate &p1,
310 const Coordinate &p2);
311
340 const uint8_t bitDepth,
341 const std::vector<bool> &components);
342
348 struct ROI {
353
366 const Size size,
367 const uint32_t horzOffset,
368 const uint32_t vertOffset,
369 const CoordinateSet &path);
370
372 uint32_t horzOffset;
373 uint32_t vertOffset;
375 };
376 using ROI = struct ROI;
377
388 std::string
390 const ROI &r);
391 std::ostream& operator<< (std::ostream&, const ROI&);
392 bool
394 const ROI &lhs,
395 const ROI &rhs);
396 bool
398 const ROI &lhs,
399 const ROI &rhs);
400 }
401}
402
405 BE_Image_CompressionAlgorithm_EnumToStringMap);
406
409 BE_Image_PixelFormat_EnumToStringMap);
410
413 BE_Image_Resolution_Units_EnumToStringMap);
414
415#endif /* __BE_IMAGE_H__ */
BE_FRAMEWORK_ENUMERATION_DECLARATIONS(BiometricEvaluation::Image::CompressionAlgorithm, BE_Image_CompressionAlgorithm_EnumToStringMap)
A BMP-encoded image.
Definition: be_image_bmp.h:30
Represent attributes common to all images.
A Lossless JPEG-encoded image.
A PNG-encoded image.
Definition: be_image_png.h:25
std::vector< Image::Coordinate > CoordinateSet
Definition: be_image.h:112
BiometricEvaluation::Memory::uint8Array removeComponents(const BiometricEvaluation::Memory::uint8Array &rawData, const uint8_t bitDepth, const std::vector< bool > &components)
Remove components from a decompressed image's raw byte representation.
bool operator==(const Coordinate &lhs, const Coordinate &rhs)
PixelFormat
Image pixel formats.
Definition: be_image.h:51
@ MonoWhite
1 bit/pixel, 0 is white, 1 = black
@ MonoBlack
1 bit/pixel, 0 is black, 1 = white
bool operator!=(const Coordinate &lhs, const Coordinate &rhs)
CompressionAlgorithm
Image compression algorithms.
Definition: be_image.h:35
const double CentimetersPerInch
Number of centimeters in one inch.
Definition: be_image.h:268
float distance(const Coordinate &p1, const Coordinate &p2)
Calculate the distance between two points.
std::ostream & operator<<(std::ostream &, const Coordinate &)
std::string to_string(const Coordinate &c)
Convert Coordinate to std::string.
const double MillimetersPerInch
Number of millimeters in one inch.
Definition: be_image.h:270
This software was developed at the National Institute of Standards and Technology (NIST) by employees...
A structure to contain a two-dimensional coordinate without a specified origin.
Definition: be_image.h:67
float yDistance
Y-coordinate distance from origin.
Definition: be_image.h:94
Coordinate(const uint32_t x=0, const uint32_t y=0, const float xDistance=0, const float yDistance=0)
Create a Coordinate struct.
float xDistance
X-coordinate distance from origin.
Definition: be_image.h:92
A structure to represent a region of interest (ROI), which is a bounding box and a set of coordinates...
Definition: be_image.h:348
ROI()
Create an empty ROI object.
ROI(const Size size, const uint32_t horzOffset, const uint32_t vertOffset, const CoordinateSet &path)
Create a ROI object with the given parameters.
A structure to represent the resolution of an image.
Definition: be_image.h:206
Units
Possible representations of the units in a Resolution struct.
Definition: be_image.h:212
Units units
Units in which xRes and yRes are represented.
Definition: be_image.h:244
Resolution(const double xRes=0.0, const double yRes=0.0, const Units units=Units::PPI)
Create a Resolution struct.
double yRes
Resolution along the Y-axis.
Definition: be_image.h:242
double xRes
Resolution along the X-axis.
Definition: be_image.h:240
Resolution toUnits(const Units &units) const
Obtain alternate representations of this resolution.
A structure to represent the size of an image, in pixels.
Definition: be_image.h:159
Size(const uint32_t xSize=0, const uint32_t ySize=0)
Create a Size struct.
uint32_t xSize
Number of pixels on the X-axis.
Definition: be_image.h:174
uint32_t ySize
Number of pixels on the Y-axis.
Definition: be_image.h:176