Skip to content

Latest commit

 

History

History
84 lines (60 loc) · 4.57 KB

File metadata and controls

84 lines (60 loc) · 4.57 KB

API Reference

Namespace root: Dp\.

Dp\Fmd — high-level facade

Method Description
__construct(string $dpfjLib = 'libdpfj.so', string $dpfpddLib = 'libdpfpdd.so', int $far = 100_000) Loads both native libraries, runs dpfpdd_init() then dpfj_select_engine(). Throws SDKException if either fails.
native(): NativeMethods Escape hatch to the underlying low-level bindings.
fmdFromRaw(string $raw, int $width, int $height, int $dpi = 500, FmdFormat $format = FmdFormat::VERIFICATION, int $fingerPosition = 0, int $cbeffId = 0): string One raw 8bpp grayscale sample -> FMD bytes.
fmdFromImage(string $imageBase64, int $dpi = 500, FmdFormat $format = FmdFormat::VERIFICATION): string PNG/JPEG (base64) -> FMD bytes. Requires ext-gd.
enrollMany(array $raws, int $width, int $height, int $dpi = 500): string Fuse any number of same-finger raw samples into one REGISTRATION FMD.
enrollFour(array $raws, int $width, int $height, int $dpi = 500): string Same as enrollMany(), requires exactly 4 samples.
enrollFourToBase64(array $raws, int $width, int $height, int $dpi = 500): string enrollFour() + base64_encode().
enrollFourImagesToBase64(array $imagesBase64, int $dpi = 500): string Same, from 4 PNG/JPEG images. Requires ext-gd.
verify(string $rawProbe, int $width, int $height, string $enrollmentFmd, int $dpi = 500): array{match,score,threshold} 1:1 match a fresh sample against a stored enrollment FMD.
compare(string $fmd1, string $fmd2, FmdFormat $format1 = FmdFormat::REGISTRATION, FmdFormat $format2 = FmdFormat::VERIFICATION): array{match,score,threshold} Compare two raw FMD byte strings directly.

Dp\NativeMethods — low-level FFI bindings

@internal-ish; use via Fmd::native() or construct directly for the lower-level workflow in docs/usage.md. One instance per process is sufficient — the underlying dpfj_* enrollment functions are inherently process-global state in the native library, not per-instance.

Dp\FeatureExtraction

createFmdFromRaw(NativeMethods $native, string $raw, int $width, int $height, int $dpi = 500, FmdFormat $formatOut = FmdFormat::VERIFICATION, int $fingerPosition = 0, int $cbeffId = 0): string

Dp\Enrollment

createEnrollmentFmd(NativeMethods $native, string[] $raws, int $width, int $height, int $dpi = 500, int $fingerPosition = 0, int $cbeffId = 0): string

Runs the full dpfj_start_enrollment -> (dpfj_create_fmd_from_raw + dpfj_add_to_enrollment, looped per sample, tolerating MORE_DATA) -> dpfj_create_enrollment_fmd -> dpfj_finish_enrollment sequence. Each sample's PRE_REGISTRATION FMD is extracted inside the active enrollment session, not pre-built beforehand — see the note on Enrollment in docs/troubleshooting.md.

Dp\Comparison

compare(NativeMethods $native, string $fmd1, FmdFormat $format1, string $fmd2, FmdFormat $format2, int $far = 100_000): array{match,score,threshold}

Comparison::PROBABILITY_ONE (0x7FFFFFFF) is the score's theoretical upper bound.

Dp\RawSample

Method Description
fromWebSdkJson(string $json): array{raw,width,height,dpi} Decodes a DigitalPersona WebSDK "Raw" sample (base64URL Data + Format header).
fromImageBase64(string $imageBase64): array{raw,width,height} Decodes any GD-supported image to raw 8bpp grayscale. Requires ext-gd.

Dp\ResultCode (enum, backed by int)

Mirrors DPUruNet.dll's Constants.ResultCode values exactly: SUCCESS, NOT_IMPLEMENTED, FAILURE, NO_DATA, MORE_DATA, INVALID_PARAMETER, INVALID_DEVICE, DEVICE_BUSY, DEVICE_FAILURE, INVALID_FID, TOO_SMALL_AREA, INVALID_FMD, ENROLLMENT_IN_PROGRESS, ENROLLMENT_NOT_STARTED, ENROLLMENT_NOT_READY, ENROLLMENT_INVALID_SET, VERSION_INCOMPATIBILITY.

  • ->isSuccess(): bool
  • ->describe(): string — human-readable explanation, including troubleshooting hints for the trickier codes.
  • ResultCode::fromRaw(int $code): self — throws \ValueError on an unrecognized code.

Dp\FmdFormat (enum, backed by int)

PRE_REGISTRATION (0), REGISTRATION (1), VERIFICATION (2), ANSI (1769473), ISO (16842753).

Dp\EngineType (enum, backed by int)

DPFJ (0, the default), INNOVATRICS_ANSIISO (1), DPFJ7 (2).

Dp\SDKException extends \RuntimeException

Thrown for every native failure. getCode() returns the raw numeric result code; $exception->resultCode gives you the typed ResultCode enum. getMessage() includes the calling function name (when provided), a human-readable description, and the code in both decimal and hex.