BiometricClient Get Failed for ODBC connection

General information about Neurotechnology and its software

BiometricClient Get Failed for ODBC connection

Postby zyunting » Nov 10, 2018 03:40

Hello,

I have been trying to get subject template through setting subject id for a NSubject and use BiometricClient.Get to obtain it.

My connection is ODBC Mysql driver 8.0 ANSI.

When I use ListId, the Id I set is listed. But when I use the get function, it shows Id not found.

One thing to note is that I did an import from SQLite Database (The Tutorial program CPP EnrollToSQLiteDatabase created). The matching looks fine if I do support the template and the id returned looks fine too.

And when I attempt use the same get function on the original SQLite Database, it works and found the requested template.

Another thing is that the orginal database using Type TEXT, the new one using type BIGINT (tried to copy into VARCHAR, but still no luck)

Here is my code

Code: Select all
 NBiometricClient biometricClient;
        biometricClient.SetMatchingThreshold(30);
        biometricClient.SetMatchingMaximalResultCount(10);
        biometricClient.SetMaximalThreadCount(4);
       
        NOdbcBiometricConnection conn = biometricClient.SetDatabaseConnectionToOdbc("DSN=myodbc8w", "templates");
        conn.SetSubjectIdColumn("template_id");
        conn.SetTemplateColumn("template");
 
        NArrayWrapper<NString> ids = biometricClient.ListIds();

        NSubject subject;
     NArrayWrapper<NString> ids = biometricClient.ListIds();

       
        for(NArrayWrapper<NString>::iterator it = ids.begin(); it != ids.end(); it++)
        {
            std::cout << (*it) << std::endl;
            if((*it) == "28293")
            {
                std::cout << "28293 found" << std::endl;
                break;
            }
        }
        subject.SetId("28293");
        std::cout << "Probe Subject ID: " << subject.GetId() << std::endl;
        NBiometricStatus status_s = biometricClient.Get(subject);

        if(status_s == nbsOk){
            cout << "Lookup Subject Succeeded. Status: " << NEnum::ToString(NBiometricTypes::NBiometricStatusNativeTypeOf(), status_s) << endl;
     
        } else
        {
            cout << "Lookup Subject failed. Status: " << NEnum::ToString(NBiometricTypes::NBiometricStatusNativeTypeOf(), status_s) << endl;
        }
       
        NBiometricTask task = biometricClient.CreateTask(nboIdentify, subject);
       
        biometricClient.PerformTask(task);
       
        if (task.GetStatus() != nbsOk)
        {
            cout << "Identification was unsuccessful. Status: " << NEnum::ToString(NBiometricTypes::NBiometricStatusNativeTypeOf(), task.GetStatus()) << endl;
            if (task.GetError() != NULL)
                throw task.GetError();
            return -1;
        }
        for (int i = 0; i < subject.GetMatchingResults().GetCount(); i++)
        {
            NMatchingResult matchingResult = subject.GetMatchingResults().Get(i);
            cout << "Matched with ID: " << matchingResult.GetId() << " with score " << matchingResult.GetScore() << endl;
        }



And here is the database schema I am using.

Code: Select all
Table: templates
Columns:
template   longblob
GalleryId   varchar(45)
template_id   bigint(20) UN PK
SubjectId   varchar(45)


Here is the old database schema

Code: Select all
CREATE TABLE `Subjects` (
   `Id`   INTEGER,
   `Template`   BLOB NOT NULL,
   `SubjectId`   TEXT NOT NULL,
   `GalleryId`   TEXT NOT NULL DEFAULT "",
   PRIMARY KEY(`Id`),
   UNIQUE(`SubjectId`,`GalleryId`)
);


Here is the output
....
61941
18456
51356
46723
21358
1931
72062
51246
22588
78547
28293
28293 found
Current Count: 81552
Current Count: 81552
Probe Subject ID: 28293
Lookup Subject failed. Status: IdNotFound
Identification was unsuccessful. Status: MatchNotFound


And total template in the db is
zyunting
 
Posts: 1
Joined: Sep 29, 2018 01:52

Re: BiometricClient Get Failed for ODBC connection

Postby MartynasV » Nov 30, 2018 13:38

zyunting wrote:Hello,

I have been trying to get subject template through setting subject id for a NSubject and use BiometricClient.Get to obtain it.

My connection is ODBC Mysql driver 8.0 ANSI.

When I use ListId, the Id I set is listed. But when I use the get function, it shows Id not found.

One thing to note is that I did an import from SQLite Database (The Tutorial program CPP EnrollToSQLiteDatabase created). The matching looks fine if I do support the template and the id returned looks fine too.

And when I attempt use the same get function on the original SQLite Database, it works and found the requested template.

Another thing is that the orginal database using Type TEXT, the new one using type BIGINT (tried to copy into VARCHAR, but still no luck)

Here is my code

Code: Select all
 NBiometricClient biometricClient;
        biometricClient.SetMatchingThreshold(30);
        biometricClient.SetMatchingMaximalResultCount(10);
        biometricClient.SetMaximalThreadCount(4);
       
        NOdbcBiometricConnection conn = biometricClient.SetDatabaseConnectionToOdbc("DSN=myodbc8w", "templates");
        conn.SetSubjectIdColumn("template_id");
        conn.SetTemplateColumn("template");
 
        NArrayWrapper<NString> ids = biometricClient.ListIds();

        NSubject subject;
     NArrayWrapper<NString> ids = biometricClient.ListIds();

       
        for(NArrayWrapper<NString>::iterator it = ids.begin(); it != ids.end(); it++)
        {
            std::cout << (*it) << std::endl;
            if((*it) == "28293")
            {
                std::cout << "28293 found" << std::endl;
                break;
            }
        }
        subject.SetId("28293");
        std::cout << "Probe Subject ID: " << subject.GetId() << std::endl;
        NBiometricStatus status_s = biometricClient.Get(subject);

        if(status_s == nbsOk){
            cout << "Lookup Subject Succeeded. Status: " << NEnum::ToString(NBiometricTypes::NBiometricStatusNativeTypeOf(), status_s) << endl;
     
        } else
        {
            cout << "Lookup Subject failed. Status: " << NEnum::ToString(NBiometricTypes::NBiometricStatusNativeTypeOf(), status_s) << endl;
        }
       
        NBiometricTask task = biometricClient.CreateTask(nboIdentify, subject);
       
        biometricClient.PerformTask(task);
       
        if (task.GetStatus() != nbsOk)
        {
            cout << "Identification was unsuccessful. Status: " << NEnum::ToString(NBiometricTypes::NBiometricStatusNativeTypeOf(), task.GetStatus()) << endl;
            if (task.GetError() != NULL)
                throw task.GetError();
            return -1;
        }
        for (int i = 0; i < subject.GetMatchingResults().GetCount(); i++)
        {
            NMatchingResult matchingResult = subject.GetMatchingResults().Get(i);
            cout << "Matched with ID: " << matchingResult.GetId() << " with score " << matchingResult.GetScore() << endl;
        }



And here is the database schema I am using.

Code: Select all
Table: templates
Columns:
template   longblob
GalleryId   varchar(45)
template_id   bigint(20) UN PK
SubjectId   varchar(45)


Here is the old database schema

Code: Select all
CREATE TABLE `Subjects` (
   `Id`   INTEGER,
   `Template`   BLOB NOT NULL,
   `SubjectId`   TEXT NOT NULL,
   `GalleryId`   TEXT NOT NULL DEFAULT "",
   PRIMARY KEY(`Id`),
   UNIQUE(`SubjectId`,`GalleryId`)
);


Here is the output
....
61941
18456
51356
46723
21358
1931
72062
51246
22588
78547
28293
28293 found
Current Count: 81552
Current Count: 81552
Probe Subject ID: 28293
Lookup Subject failed. Status: IdNotFound
Identification was unsuccessful. Status: MatchNotFound


And total template in the db is

Hello,

Try using column names and types specified in our documentation "5.2.2 MySQL".
Code: Select all
USE userdb;
CREATE TABLE Subjects (
  Id           int(11)        NOT NULL AUTO_INCREMENT PRIMARY KEY,
  SubjectId    varchar(16)    UNIQUE NOT NULL,
  Template     longblob       NOT NULL
);
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 409
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania


Return to Public

Who is online

Users browsing this forum: No registered users and 3 guests