feat(afis): integrate new C# matcher & hybrid minutiae pairing pipeline#153
feat(afis): integrate new C# matcher & hybrid minutiae pairing pipeline#153bruno12303 wants to merge 10 commits into
Conversation
TheMultii
left a comment
There was a problem hiding this comment.
Build artifacts and binaries are committed to git - they shouldn't be committed at all. Please add src-tauri/sourceafis_cli_src/bin/ and obj/ to .gitignore and remove them from this pull request.
Committed binaries that can't be reviewed are also a supply-chain risk.
| alert( | ||
| `Dopasowanie udane! Zablokowano ${manualPairs.length} punktów bazowych. Automat dobrał ${automatedPairs.length} kolejnych cech. Score: ${data.matchScore}` | ||
| ); | ||
| } catch (error) {} |
There was a problem hiding this comment.
don't swallow the error here
| ? "Zaznacz CORE na obu zdjęciach" | ||
| : currentManualPairsCount < 4 | ||
| ? `Zaznacz jeszcze ${4 - currentManualPairsCount} punkty bazowe` | ||
| : "Wyodrębnij i dopasuj"} |
There was a problem hiding this comment.
use i18 translations. everywhere
|
|
||
| const leftClone = Object.create( | ||
| Object.getPrototypeOf(leftCore) | ||
| ) as Record<string, unknown>; |
There was a problem hiding this comment.
createTransformedMarkings clones the core marking with Object.create(Object.getPrototypeOf(leftCore)) and copies enumerable keys, skipping _-prefixed ones. The codebase has real classes (RayMarking, etc.) with constructors and a labelGenerator for labels. Clones built this way may miss private fields the class methods rely on and can break rendering or serialization.
| function detectCoordinatePath(obj: AppMarking) { | ||
| if (obj.origin && typeof obj.origin.x === "number") { | ||
| return { x: obj.origin.x, y: obj.origin.y, path: "origin" }; | ||
| } | ||
| if (obj.position && typeof obj.position.x === "number") { | ||
| return { x: obj.position.x, y: obj.position.y, path: "position" }; | ||
| } | ||
| if (typeof obj.x === "number" && typeof obj.y === "number") { | ||
| return { x: obj.x, y: obj.y, path: "plain" }; | ||
| } | ||
| return { x: 0, y: 0, path: "unknown" }; | ||
| } |
There was a problem hiding this comment.
detectCoordinatePath duck-types origin/position/x,y at runtime (and matchWithSourceafis does the same with m.x ?? m.X), but the marking shape is known and typed in this codebase - MarkingBase always carries origin. The extra branches are dead code and the ?? 0 fallbacks would mask a real shape mismatch instead of surfacing it. Please use the typed marking interfaces directly.
| return finalHybridResult; | ||
|
|
||
| } catch (error) { | ||
| console.error("❌ Błąd podczas hybrydowego dopasowywania SourceAFIS:", error); |
| leftCoreCoords: { path: string }, | ||
| rightCoreCoords: { path: string }, | ||
| maxCurrentLabel: number, | ||
| rozwidlenieTypeId: string, |
There was a problem hiding this comment.
don't use polish in prop names
| name.includes("rozwidlenie") || | ||
| display.includes("rozwidlenie") || | ||
| name.includes("bifurcation") || | ||
| display.includes("bifurcation") |
There was a problem hiding this comment.
With custom user presets, minutiae get silently assigned to arbitrary marking types here. The existing code already has resolveSourceafisTypeId(minutia.type) - extend that instead.
| console.log( | ||
| "SŁOWNIK TYPÓW ADNOTACJI W APLIKACJI", | ||
| allMarkingTypes.map(t => ({ | ||
| id: t.id, | ||
| name: t.name, | ||
| displayName: t.displayName, | ||
| })) | ||
| ); | ||
| console.log( | ||
| "Przypisane ID robocze -> Rozwidlenie:", | ||
| rozwidlenieTypeId, | ||
| "Zakończenie:", | ||
| zakonczenieTypeId | ||
| ); |
|
|
||
| console.log("4. [Hybryda] Uruchamiam nowy Matcher C# dla obliczenia Score..."); | ||
| const matcherTool = await createSourceAfisMatcherTool(); | ||
| const matchResult = await matcherTool.run({ |
There was a problem hiding this comment.
Redundant work in the hybrid pipeline: by this point both images have already been processed by cliTool.run, and matcherTool.run makes the C# side compute both FingerprintTemplates again from scratch - 4 extractions where 2 would do. The matcher's --out-template/--out-json outputs (matchTemplatePath/matchJsonPath) are also written and then ignored except for matchScore. Consider having the matcher accept the already-serialized templates (the old CLI already writes them via --out-template) instead of re-extracting from images.
| } | ||
| }, | ||
| }, | ||
| */ |
There was a problem hiding this comment.
If the Auto-mark feature is being retired, please delete this block instead of commenting it out
| MarkingsStore( | ||
| CANVAS_ID.LEFT | ||
| ).actions.markings.reset(); |
There was a problem hiding this comment.
This wipes all of the user's manual markings and re-adds them merged with the automated ones - if addMany throws midway (and the catch below is empty), the examiner's work is silently lost. It also bypasses GlobalHistoryManager, so undo history is destroyed. Please add only the new markings via AddOrUpdateMarkingCommand (see autoMarkWithSourceafis.ts for the existing pattern) instead of reset + re-add.
…move redundant try-catch
…olution in toolbar
Description of Changes
This Pull Request introduces a custom geometric registration and minutiae-pairing algorithm developed entirely on the application's frontend, creating a hybrid solution integrated with the SourceAFIS biometric engine.
Key Features & Refactoring:
vertical-toolbar.tsxcomponent was entirely refactored to reduce cognitive complexity (extracting heavy mathematical logic into clean helper functions) and satisfy strict TypeScript compiler flags (noUncheckedIndexedAccess,noPropertyAccessFromIndexSignature).