Page 1 of 1

How to get NSubject stored in database

PostPosted: Jan 25, 2018 12:48
by aeayala
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

Re: How to get NSubject stored in database

PostPosted: Jan 25, 2018 15:44
by MartynasV
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.

Re: How to get NSubject stored in database

PostPosted: Jan 25, 2018 18:12
by aeayala
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

Re: How to get NSubject stored in database

PostPosted: Jan 26, 2018 10:51
by MartynasV
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.

Re: How to get NSubject stored in database

PostPosted: Feb 16, 2018 20:25
by aeayala
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.

Re: How to get NSubject stored in database

PostPosted: Feb 19, 2018 10:36
by MartynasV
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"];

Re: How to get NSubject stored in database

PostPosted: Feb 19, 2018 11:49
by aeayala
Thank you very much for your contribution, now I'm going to study it.
We are in contact.

Adrian