NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_image_jpeg2000.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_JPEG2000__
12#define __BE_IMAGE_JPEG2000__
13
14#include <be_image_image.h>
15
16namespace BiometricEvaluation
17{
18 namespace Image
19 {
24 class JPEG2000 : public Image
25 {
26 public:
47 const uint8_t *data,
48 const uint64_t size,
49 const std::string &identifier = "",
50 const statusCallback_t &statusCallback =
52 const int8_t codecFormat = 2);
53
55 const Memory::uint8Array &data,
56 const std::string &identifier = "",
57 const statusCallback_t &statusCallback =
59
60 ~JPEG2000() = default;
61
64 const;
65
68 uint8_t depth) const;
69
82 static bool
84 const uint8_t *data,
85 uint64_t size);
86
87 private:
89 const int8_t _codecFormat;
90
102 bool
103 checkForAlphaInCDEF();
104
115 static void
116 openjpeg_error(
117 const char *msg,
118 void *client_data);
119
130 static void
131 openjpeg_warning(
132 const char *msg,
133 void *client_data);
134
145 static void
146 openjpeg_info(
147 const char *msg,
148 void *client_data);
149
169 uint64_t
170 static find_marker_offset(
171 const uint8_t *marker,
172 uint64_t marker_size,
173 const uint8_t *buffer,
174 uint64_t buffer_size);
175
200 static find_marker(
201 const uint8_t *marker,
202 uint64_t marker_size,
203 const uint8_t *buffer,
204 uint64_t buffer_size,
205 uint64_t value_size);
206
226 parse_res(
227 const Memory::AutoArray<uint8_t> &res);
228
229 /*
230 * libopenjp2 stream callbacks.
231 *
232 * Note that libopenjp2 types have been converted to
233 * void* below so that openjpeg.h does not need to
234 * be in the include path of applications that use this
235 * file.
236 */
237
239 void*
240 getDecompressionStream()
241 const;
242
244 void*
245 getDecompressionCodec()
246 const;
247
248 /*
249 * libopenjp2 callbacks.
250 *
251 * Note that libopenjp2 types have been converted
252 * to standard types below so that openjpeg.h
253 * does not need to be in the include path of
254 * applications that use this file.
255 */
256
264 static void
265 libopenjp2Free(
266 void *p_user_data);
267
282 static size_t
283 libopenjp2Read(
284 void *p_buffer,
285 size_t p_nb_bytes,
286 void *p_user_data);
287
300 static int64_t
301 libopenjp2Skip(
302 int64_t p_nb_bytes,
303 void *p_user_data);
304
317 static int
318 libopenjp2Seek(
319 int64_t p_nb_bytes,
320 void *p_user_data);
321 };
322 }
323}
324
325#endif /* __BE_IMAGE_JPEG2000__ */
326
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
static bool isJPEG2000(const uint8_t *data, uint64_t size)
Whether or not data is a JPEG-2000 image.
Memory::uint8Array getRawGrayscaleData(uint8_t depth) const
Accessor for decompressed data in grayscale.
JPEG2000(const uint8_t *data, const uint64_t size, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback, const int8_t codecFormat=2)
Create a new JPEG2000 object.
Memory::uint8Array getRawData() const
Accessor for the raw image data.
JPEG2000(const Memory::uint8Array &data, const std::string &identifier="", const statusCallback_t &statusCallback=Image::defaultStatusCallback)
This software was developed at the National Institute of Standards and Technology (NIST) by employees...
A structure to represent the resolution of an image.
Definition: be_image.h:206