How to get NSubject stored in database

General information about Neurotechnology and its software

How to get NSubject stored in database

Postby aeayala » Jan 25, 2018 12:48

Hello, I am using Neuro SDK 9, and I need to recover the NSubject that I erroll

I have the following code to get the NSubject but I only get your ID and I need the images that you save


Code: Select all
 NSubject result;
using (NBiometricClient biometricClient = new NBiometricClient())
            {
                var connection = new NClusterBiometricConnection { Host = this.Host, AdminPort = this.AdminPort };
                biometricClient.RemoteConnections.Add(connection);

                // create a nbiometric task to identify
                NBiometricTask identifyTask = biometricClient.CreateTask(NBiometricOperations.Identify, subject);

                // preform a task
                biometricClient.PerformTask(identifyTask);

                // Set parameter to return matching details
                biometricClient.MatchingWithDetails = true;

                // get status
                NBiometricStatus status = identifyTask.Status;

                if (status == NBiometricStatus.Ok)
                {
                    result = new NSubject();
                    result.Id = identifyTask.Subjects[0].Id;
                    return result;
                }
                else if (status == NBiometricStatus.MatchNotFound)
                {
                    return null; // not found
                }
               
            }




Thank you very much to anyone who can help me

Adrian
aeayala
 
Posts: 6
Joined: Mar 07, 2016 20:22

Re: How to get NSubject stored in database

Postby MartynasV » Jan 25, 2018 15:44

Hello Adrian,

You are creating empty NSubject() object and setting Id on it, nothying else, so why do you expect it to contain anything else? What you need to do additionally is to retrieve data from database, see following code snippet:
Code: Select all
                if (status == NBiometricStatus.Ok)
                {
                    result = new NSubject();
                    result.Id = identifyTask.Subjects[0].Id;
                    NBiometricTask getTask = biometricClient.CreateTask(NBiometricOperations.Get, subject);
                    biometricClient.PerformTask(getTask); // Retrieves data by subject's id.
                    if(getTask.Status == NBiometricStatus.Ok){
                             return result;
                    } else {throw error}
                }


NOTE: only Templates are saved, images are not saved in database.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 342
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: How to get NSubject stored in database

Postby aeayala » Jan 25, 2018 18:12

Thanks for your answer, and your clarification !!

At the time of enroll the NSubject, I add the following properties:

Code: Select all
// Instance an NSubject
                 persona.NSubject = new NSubject ();
                 persona.NSubject.Properties.Add ("Name", persona.Nombre);
                 persona.NSubject.Properties.Add ("Surname", person.Surname);
                 persona.NSubject.Properties.Add ("DNI", persona.Documento);
                 persona.NSubject.Properties.Add ("Sex", persona.Sexo);
                 persona.NSubject.Id = person.Guid.ToString ();


Code: Select all
//Verifico la identidad
            NBiometricService bioServices = new NBiometricService();
            String respuestaIdentidad = bioServices.Identify(persona.NSubject);
            //Verifica si el usuario no esta registrado
            if (respuestaIdentidad == "0")
            {
                string messageLabel = string.Empty;
                try
                {
                    //Sino existe lo enrolo
                    int respuestaEnrolar = bioServices.Enroll(persona.NSubject);
                    //
                    if (respuestaEnrolar == 1)
                        messageLabel = "Registrado!";
                    else
                        throw new Exception("Ocurrio un problema al errolar a la persona");
                }
                catch (Exception excepcion)
                {
                    messageLabel = "Ocurrio una excepcion: " + excepcion.Message + " inner: " + excepcion.InnerException.Message;
                }
            }


These properties, can you recover the NSubject that is in the base ??
Thanks again
aeayala
 
Posts: 6
Joined: Mar 07, 2016 20:22

Re: How to get NSubject stored in database

Postby MartynasV » Jan 26, 2018 10:51

aeayala wrote:Thanks for your answer, and your clarification !!

At the time of enroll the NSubject, I add the following properties:

Code: Select all
// Instance an NSubject
                 persona.NSubject = new NSubject ();
                 persona.NSubject.Properties.Add ("Name", persona.Nombre);
                 persona.NSubject.Properties.Add ("Surname", person.Surname);
                 persona.NSubject.Properties.Add ("DNI", persona.Documento);
                 persona.NSubject.Properties.Add ("Sex", persona.Sexo);
                 persona.NSubject.Id = person.Guid.ToString ();


Code: Select all
//Verifico la identidad
            NBiometricService bioServices = new NBiometricService();
            String respuestaIdentidad = bioServices.Identify(persona.NSubject);
            //Verifica si el usuario no esta registrado
            if (respuestaIdentidad == "0")
            {
                string messageLabel = string.Empty;
                try
                {
                    //Sino existe lo enrolo
                    int respuestaEnrolar = bioServices.Enroll(persona.NSubject);
                    //
                    if (respuestaEnrolar == 1)
                        messageLabel = "Registrado!";
                    else
                        throw new Exception("Ocurrio un problema al errolar a la persona");
                }
                catch (Exception excepcion)
                {
                    messageLabel = "Ocurrio una excepcion: " + excepcion.Message + " inner: " + excepcion.InnerException.Message;
                }
            }


These properties, can you recover the NSubject that is in the base ??
Thanks again

Hello,

Yes, those properties should be retrieved from database and you should be able to access them via NSubject object.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 342
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: How to get NSubject stored in database

Postby aeayala » Feb 16, 2018 20:25

Hello Martynas, How can I get the properties I store in the database?

At the time of enrollment, load them in this way:
Code: Select all
NSubject = new NSubject ();
NSubject.Properties.Add ("Name", persona.Nombre);
NSubject.Properties.Add ("Surname", person.Surname);
NSubject.Properties.Add ("DNI", persona.Documento);
NSubject.Properties.Add ("Sex", persona.Sexo);
NSubject.Id = person.Guid.ToString ();


I am very new to Neuro, sorry for the questions I ask.

Thank sou much!!

MartynasV wrote:
aeayala wrote:Thanks for your answer, and your clarification !!

At the time of enroll the NSubject, I add the following properties:

Code: Select all
// Instance an NSubject
                 persona.NSubject = new NSubject ();
                 persona.NSubject.Properties.Add ("Name", persona.Nombre);
                 persona.NSubject.Properties.Add ("Surname", person.Surname);
                 persona.NSubject.Properties.Add ("DNI", persona.Documento);
                 persona.NSubject.Properties.Add ("Sex", persona.Sexo);
                 persona.NSubject.Id = person.Guid.ToString ();


Code: Select all
//Verifico la identidad
            NBiometricService bioServices = new NBiometricService();
            String respuestaIdentidad = bioServices.Identify(persona.NSubject);
            //Verifica si el usuario no esta registrado
            if (respuestaIdentidad == "0")
            {
                string messageLabel = string.Empty;
                try
                {
                    //Sino existe lo enrolo
                    int respuestaEnrolar = bioServices.Enroll(persona.NSubject);
                    //
                    if (respuestaEnrolar == 1)
                        messageLabel = "Registrado!";
                    else
                        throw new Exception("Ocurrio un problema al errolar a la persona");
                }
                catch (Exception excepcion)
                {
                    messageLabel = "Ocurrio una excepcion: " + excepcion.Message + " inner: " + excepcion.InnerException.Message;
                }
            }


These properties, can you recover the NSubject that is in the base ??
Thanks again

Hello,

Yes, those properties should be retrieved from database and you should be able to access them via NSubject object.
aeayala
 
Posts: 6
Joined: Mar 07, 2016 20:22

Re: How to get NSubject stored in database

Postby MartynasV » Feb 19, 2018 10:36

aeayala wrote:Hello Martynas, How can I get the properties I store in the database?

At the time of enrollment, load them in this way:
Code: Select all
NSubject = new NSubject ();
NSubject.Properties.Add ("Name", persona.Nombre);
NSubject.Properties.Add ("Surname", person.Surname);
NSubject.Properties.Add ("DNI", persona.Documento);
NSubject.Properties.Add ("Sex", persona.Sexo);
NSubject.Id = person.Guid.ToString ();


I am very new to Neuro, sorry for the questions I ask.

Thank sou much!!


Hello aeayala,

You can set property like this:
Code: Select all
subject.Properties["Age"] = 15;


After you "get" nsubject, you can retrieve property like this:
Code: Select all
var age = subject.Properties["Age"];
Attachments
BiographicQueryTest.cs
Biographic/Custom data example code.
(3.85 KiB) Downloaded 82 times
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 342
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: How to get NSubject stored in database

Postby aeayala » Feb 19, 2018 11:49

Thank you very much for your contribution, now I'm going to study it.
We are in contact.

Adrian
aeayala
 
Posts: 6
Joined: Mar 07, 2016 20:22


Return to Public

Who is online

Users browsing this forum: No registered users and 5 guests

cron