xxxdemo is supplied as an exe file and as a c file in the SDK and shows how XXX Signatur
is integrated. It checks signature pairs. The supplied ras files
contain signature pairs, xxxdemo1i.ras
with unknown signatures and
xxxdemo1.ras
with known signatures. xxxdemo.exe uses the first
signature as gold and the second signature as the signature to be checked.
The xxxdemo.exe programme is started in the operating system prompt.
The following information must be entered:
Rec file:
E:\xxx_check\xxx_platinum.rec
.Img file:
E:\xxx_check\xxxdemo1.ras
.
The file format can be the ras format of re Recognition GmbH or a TIFF file.
After the start, there is a screen output for each pair.1 expert results: single gold/probe !6/32 !6/43 group gold/probe W /16 W /14 pair_ingroup_value = 1 pair_allgroup_value = 3 similarity_percentage 100
1 expert results:
1
stands for the first gold signature.single gold/probe
single gold/probe !6/32 !6/43
recognises the gold signature as recognised in this case
with the identifier !6
and the confidence value of 32
,
as well as the signature to be verified, as signature with the identifier !6
and the confidence value of 43
.
group gold/probe
group gold/probe W /16 W /14
recognises in this case the gold signature as belonging to the
group W
with a confidence value of 16
and the signature to be verified
as belonging to the group W
with a confidence value of 14
.
pair_ingroup_value
rec_value
is returned.
pair_allgroup_value
similarity_percentage
/**************************************************************************** * * xxxdemo.c * * Sample for xxx.lib applications * * $Date: 17-Dec-2019 09:47 $ * * Copyright 1993-2019 re Recognition GmbH * Höhenstrasse 5a, 8280 Kreuzlingen, Schweiz * +41 (0)71 6725100 * info@reRecognition.com * www.reRecognition.com * ****************************************************************************/ #if defined(_WIN32) || defined(_WIN64) #pragma warning(disable:4996) #define _CRTDBG_MAP_ALLOC #include <windows.h> #include <io.h> #elif defined _UNIX #include <ncurses.h> // Ncurses library has to be installed #endif #include <string.h> #include <stdio.h> #include <stdlib.h> #include <wchar.h> #if defined(_WIN32) || defined(_WIN64) #include <crtdbg.h> #include <conio.h> #endif #include "xxx.h" #ifndef _MAX_PATH #define _MAX_PATH 256 #endif #if defined(_DEBUG) #if !defined(_UNIX) #define ERR_EXIT(s) {printf("\nError: %s\n",s); printf("\nAny key to continue ..."); getch(); return EXIT_FAILURE;} #else #define ERR_EXIT(s) {printf("\nError: %s\n",s); printf("\nAny key to continue ..."); getchar(); return EXIT_FAILURE;} #endif #else #define ERR_EXIT(s) {printf("\nError: %s\n",s); return EXIT_FAILURE;} #endif int main(int argc, char *argv[ ]) { char ImageFileName[_MAX_PATH+1]={0}; /* file names */ char RecFileName[_MAX_PATH+1]={0}; XXX_Data xxx; /* main XXX_Data structure */ ReFileHandle file_handle; ReImageHandle image_handle_gold, image_handle_probe; int image_number; /* ------ input ---------------------------------------------------------- */ /* take input file names from command line ... */ if (argc>1) strcpy(RecFileName,argv[1]); if (argc>2) strcpy(ImageFileName,argv[2]); /* ... or get them from the console */ #if defined(_WIN32) || defined(_WIN64) || defined(_CONSOLE) if (argc<=2) { if (GetPrivateFileName(RecFileName, "", OF_EXIST | OF_PROMPT, "Rec file", "xxxdemo.sts", "files", "recfile")!=RE_SUCCESS) return EXIT_FAILURE; printf("\n"); if (GetPrivateFileName(ImageFileName, "", OF_EXIST | OF_PROMPT, "Img file", "xxxdemo.sts", "files", "imgfile")!=RE_SUCCESS) return EXIT_FAILURE; printf("\n"); } #else { char format[16]; FILE *fstream; int ret; // avoid GCC warnings sprintf(format," %%%ds",_MAX_PATH-1); while (!*RecFileName || !(fstream=fopen(RecFileName,"r"))) { printf("Rec file: "); fflush(stdout); ret = scanf(format,RecFileName); } fclose(fstream); while (!*ImageFileName || !(fstream=fopen(ImageFileName,"r"))) { printf("Img file: "); fflush(stdout); ret = scanf(format,ImageFileName); } ret = ret; // avoid GCC warnings fclose(fstream); } #endif /* ------ initialization ------------------------------------------------- */ /* suppress XXX error messages */ /* re_SetErrorConfig(re_GetErrorConfig() & ~RE_ERRORDISPLAY); */ /* or show XXX error messages */ re_SetErrorConfig(re_GetErrorConfig() | RE_ERRORDISPLAY); /* initialize recognizer */ memset(&xxx, 0, sizeof(xxx)); strcpy(xxx.init.version, INC_XXX); /* Activate version check */ if (xxx_init(&xxx, RecFileName)!=RE_SUCCESS) ERR_EXIT("xxx_init() failed"); #if defined(_WIN32) || defined(_WIN64) // xxx_config(&xxx); // under development #endif /* open image file */ file_handle = re_openimagefile(ImageFileName, "r"); if (!file_handle) ERR_EXIT("Can't open image file") image_number = 0; /* read the gold signature */ image_handle_gold = re_readimagefile(file_handle, image_number, &xxx.gold_image); if (!image_handle_gold) { if (re_GetErrorText(NULL)!=RE_SUCCESS) { ERR_EXIT("Cant't load image"); } else { ERR_EXIT("Empty image file"); } } /* read the probe signature */ image_number++; image_handle_probe = re_readimagefile(file_handle, image_number, &xxx.probe_image); if (!image_handle_probe) { if (re_GetErrorText(NULL) != RE_SUCCESS) { ERR_EXIT("Cant't load image"); } else { ERR_EXIT("Empty image file"); } } /* ------ kernel --------------------------------------------------------- */ while (image_handle_probe) { int i; /* compare signatures */ if (xxx_do(&xxx)!=RE_SUCCESS) ERR_EXIT("xxx_do() failed"); /* check and display result */ printf("\n %6d platinum results: ", image_number); for (i=0; i<PLATINUM_ALT; i++) { if (!xxx.platinum_wchar[i][0] || xxx.platinum_wchar[i][0]==' ' || !xxx.platinum_value[i]) break; wprintf(L"%2.2s/%-3d ", xxx.platinum_wchar[i], xxx.platinum_value[i]); } if (i==0) { if (!xxx.platinum_value[0]) printf("no corresponding platinum signature"); } printf("\n comparison value (distance) %d", xxx.comparison_value); fflush(stdout); re_freeimage(image_handle_probe); re_freeimage(image_handle_gold); image_handle_gold = re_readimagefile(file_handle, ++image_number, &xxx.gold_image); image_handle_probe = re_readimagefile(file_handle, ++image_number, &xxx.probe_image); } /* ------ end ------------------------------------------------------------ */ re_closeimagefile(file_handle); xxx_end(&xxx); printf("\n"); #if defined(_DEBUG) && defined(_CONSOLE) printf("\nAny key to continue ..."); #if !defined(_UNIX) _getch(); #else getchar(); #endif #endif #if defined(_WIN32) || defined(_WIN64) _CrtDumpMemoryLeaks(); #endif return EXIT_SUCCESS; }