Slap Fingerprint Segmentation Evaluation III
API for participating in NIST's evaluation of slap fingerprint segmentation algorithms.
slapsegiii.h
1
33#ifndef SLAPSEGIII_H_
34#define SLAPSEGIII_H_
35
36#include <cstddef>
37#include <filesystem>
38#include <memory>
39#include <set>
40#include <string>
41#include <vector>
42
44namespace SlapSegIII
45{
48 {
50 Unknown = 0,
52 RightThumb = 1,
54 RightIndex = 2,
56 RightMiddle = 3,
58 RightRing = 4,
60 RightLittle = 5,
62 LeftThumb = 6,
64 LeftIndex = 7,
66 LeftMiddle = 8,
68 LeftRing = 9,
70 LeftLittle = 10
71 };
72
75 {
85 const int32_t x = 0,
86 const int32_t y = 0)
87 noexcept;
88
90 int32_t x{};
92 int32_t y{};
93 };
94
96 struct SlapImage
97 {
99 enum class Kind
100 {
102 TwoInch = 2,
104 ThreeInch = 3,
106 UpperPalm = 5,
108 FullPalm = 8
109 };
110
113 {
115 Unknown = 0,
117 ScannedInkOnPaper = 2,
119 OpticalTIRBright = 3
120 };
121
123 enum class Orientation
124 {
126 Right = 0,
128 Left = 1,
130 Thumbs = 2
131 };
132
134 enum class Deficiency
135 {
140 Artifacts = 0,
142 ImageQuality,
148 HandGeometry,
153 Incomplete
154 };
155
157 SlapImage();
158
182 SlapImage(
183 const uint16_t width,
184 const uint16_t height,
185 const uint16_t ppi,
186 const Kind kind,
189 const std::vector<std::byte> &pixels);
190
192 uint16_t width{};
194 uint16_t height{};
196 uint16_t ppi{};
214 std::vector<std::byte> pixels{};
215 };
216
219 {
221 struct Result
222 {
224 enum class Code
225 {
227 Success = 0,
229 FingerNotFound,
231 FailedToSegment,
233 VendorDefined
234 };
235
244 Result(
245 const Code code = Code::Success,
246 const std::string &message = "");
247
251 std::string message{};
252 };
253
256
280 const Coordinate &tl,
281 const Coordinate &tr,
282 const Coordinate &bl,
283 const Coordinate &br,
284 const Result result = {});
285
310 };
311
314 {
316 enum class Code
317 {
319 Success = 0,
321 InvalidImageData,
328 RequestRecapture,
335 RequestRecaptureWithAttempt,
337 UnsupportedResolution,
339 UnsupportedSlapType,
341 NotImplemented,
343 VendorDefined
344 };
345
364 const Code code = Code::Success,
365 const std::set<SlapImage::Deficiency>
366 &imageDeficiencies = {},
367 const std::string &message = "");
368
375 std::set<SlapImage::Deficiency> imageDeficiencies{};
377 std::string message{};
378 };
379
382 {
385
398 const std::string &libraryIdentifier,
399 const uint16_t version,
400 const std::string &marketingIdentifier = "");
401
411 uint16_t version{};
423 std::string libraryIdentifier{};
431 std::string marketingIdentifier{};
432
433 };
434
443 {
444 public:
457 virtual
460 const = 0;
461
485 virtual
486 std::tuple<std::set<SlapImage::Kind>, bool>
488 const = 0;
489
527 virtual
528 std::tuple<ReturnStatus, std::vector<SegmentationPosition>>
530 const SlapImage &image) = 0;
531
559 virtual
560 std::tuple<ReturnStatus, SlapImage::Orientation>
562 const SlapImage &image) = 0;
563
565 virtual ~Interface();
566
591 static
592 std::shared_ptr<Interface>
594 const std::filesystem::path &configurationDirectory);
595 };
596
597 /*
598 * API versioning.
599 *
600 * NIST code will extern the version number symbols. Participant code
601 * shall compile them into their core library.
602 */
603 #ifdef NIST_EXTERN_API_VERSION
605 extern uint16_t API_MAJOR_VERSION;
607 extern uint16_t API_MINOR_VERSION;
609 extern uint16_t API_PATCH_VERSION;
610 #else /* NIST_EXTERN_API_VERSION */
612 uint16_t API_MAJOR_VERSION{1};
614 uint16_t API_MINOR_VERSION{2};
616 uint16_t API_PATCH_VERSION{0};
617 #endif /* NIST_EXTERN_API_VERSION */
618
619 /*
620 * Ensure that std::byte is exactly 8 bits, such that reinterpret_casts
621 * may be safely used.
622 */
623 static_assert(std::is_same_v<std::underlying_type_t<std::byte>,
624 uint8_t>, "std::byte not represented as unsigned 8 bit type");
625}
626
627#endif /* SLAPSEGIII_H_ */
Slap Fingerprint Segmentation III interface.
Definition: slapsegiii.h:443
static std::shared_ptr< Interface > getImplementation(const std::filesystem::path &configurationDirectory)
Obtain a managed pointer to an object implementing SlapSegIII::Interface.
virtual ~Interface()
Destructor.
virtual std::tuple< std::set< SlapImage::Kind >, bool > getSupported() const =0
Obtain features supported by this implementation.
virtual std::tuple< ReturnStatus, std::vector< SegmentationPosition > > segment(const SlapImage &image)=0
Discover fingerprint segmentation positions within a slap image.
virtual std::tuple< ReturnStatus, SlapImage::Orientation > determineOrientation(const SlapImage &image)=0
Determine the hand orientation of a slap image.
virtual SubmissionIdentification getIdentification() const =0
Obtain identification and version information for this submission.
Slap Fingerprint Segmentation Evaluation III namespace.
Definition: slapsegiii.h:45
uint16_t API_PATCH_VERSION
API patch version number.
Definition: slapsegiii.h:616
uint16_t API_MINOR_VERSION
API minor version number.
Definition: slapsegiii.h:614
FrictionRidgeGeneralizedPosition
Friction ridge generalized position.
Definition: slapsegiii.h:48
uint16_t API_MAJOR_VERSION
API major version number.
Definition: slapsegiii.h:612
A 2D coordinate, assuming an origin at the top left.
Definition: slapsegiii.h:75
Coordinate(const int32_t x=0, const int32_t y=0) noexcept
Coordinate constructor.
int32_t y
Y coordinate.
Definition: slapsegiii.h:92
int32_t x
X coordinate.
Definition: slapsegiii.h:90
Information about the execution of an API method.
Definition: slapsegiii.h:314
std::set< SlapImage::Deficiency > imageDeficiencies
Deficiencies with a SlapImage (required only when code is RequestRecapture or RequestRecaptureWithAtt...
Definition: slapsegiii.h:375
ReturnStatus(const Code code=Code::Success, const std::set< SlapImage::Deficiency > &imageDeficiencies={}, const std::string &message="")
ReturnStatus constructor.
Code
Possible exit status of a SlapSegIII API method.
Definition: slapsegiii.h:317
Code code
Returned status code.
Definition: slapsegiii.h:370
std::string message
Explanatory message (optional).
Definition: slapsegiii.h:377
An individual segmentation position discovery.
Definition: slapsegiii.h:222
Result(const Code code=Code::Success, const std::string &message="")
Result constructor.
Code
Possible results of segmenting a single finger.
Definition: slapsegiii.h:225
std::string message
Message providing insight into code's value.
Definition: slapsegiii.h:251
Code code
Status from segmenting an individual finger.
Definition: slapsegiii.h:249
Representation of a segmentation position.
Definition: slapsegiii.h:219
Coordinate bl
Bottom-left coordinate, where bottom refers to distal interphalangeal joint of the fingerprint.
Definition: slapsegiii.h:302
SegmentationPosition()
Default SegmentationPosition constructor.
Coordinate tr
Top-right coordinate, where top refers to the top of the fingerprint.
Definition: slapsegiii.h:297
Coordinate tl
Top-left coordinate, where top refers to the top of the fingerprint.
Definition: slapsegiii.h:292
FrictionRidgeGeneralizedPosition frgp
Friction ridge generalized position.
Definition: slapsegiii.h:287
Result result
Result of segmentation position discovery.
Definition: slapsegiii.h:309
Coordinate br
Bottom-right coordinate, where bottom refers to distal interphalangeal joint of the fingerprint.
Definition: slapsegiii.h:307
Data and metadata of an image containing multiple fingerprints.
Definition: slapsegiii.h:97
uint16_t ppi
Resolution of the image in pixels per inch.
Definition: slapsegiii.h:196
SlapImage()
Default SlapImage constructor.
Deficiency
Reasons that a SlapImage cannot be reliably segmented.
Definition: slapsegiii.h:135
uint16_t width
Width of the image.
Definition: slapsegiii.h:192
Orientation
Hand orientation being segmented.
Definition: slapsegiii.h:124
Kind kind
The kind of capture employed to create the image.
Definition: slapsegiii.h:198
CaptureTechnology
Friction ridge capture technology.
Definition: slapsegiii.h:113
CaptureTechnology captureTechnology
The capture technology used to create the image.
Definition: slapsegiii.h:200
uint16_t height
Height of the image.
Definition: slapsegiii.h:194
std::vector< std::byte > pixels
width * height bytes of image data, with pixels.front() representing the top-left pixel and pixels....
Definition: slapsegiii.h:214
Kind
Kind of slap image.
Definition: slapsegiii.h:100
Orientation orientation
The orientation of fingers in the image.
Definition: slapsegiii.h:202
Information identifying this submission.
Definition: slapsegiii.h:382
uint16_t version
Version number for this submission.
Definition: slapsegiii.h:411
SubmissionIdentification()
Default constructor.
std::string libraryIdentifier
Identifier for this submission.
Definition: slapsegiii.h:423
std::string marketingIdentifier
Marketing name for this submission.
Definition: slapsegiii.h:431