SimpleFaceSampleCS - to WPF using MVVM

General information about Neurotechnology and its software

SimpleFaceSampleCS - to WPF using MVVM

Postby zerokewl88 » Feb 14, 2019 11:15

Hi,

I have been attempting to use the example of SimpleFacesSampleCS in the SDK 11.0 download and migrate this into our existing application which utilizes WPF MVVM.

Initializing and getting the sdk to template, and capture a image via code was simple enough, and I am seeing templates being saved and images taken when i go through a enroll process - however, I am trying to obtain the video feed of the camera and display this.

Our application has already been tested and is able to render image bytearray"s sent to it to create a similar type of "video stream", but I have found that in the NeuroTech Verilook SDK - there is no such Event Handler using the FaceCameraDevice that provides a constant image byte array to be able to send and update.

Am i correct to believe that the control for the NFaceView receives a NFace via the NCamera and then somehow maps and connects its stream image / video output to the NFaceview ?

In the sample code, when this line is commented out, I can see no preview is displayed so assume the connection is happening here with the NFace object. facesView.Face = face **

Code: Select all
// Set face capture from stream
var face = new NFace { CaptureOptions = NBiometricCaptureOptions.Stream };
if (!chbCaptureAutomatically.Checked) face.CaptureOptions |= NBiometricCaptureOptions.Manual;
_subject = new NSubject();
_subject.Faces.Add(face);
facesView.Face = face;


While the async operation continues, we are presented with the image / video feed from the camera.

Code: Select all
var status = await _biometricClient.CaptureAsync(_subject);
await OnCapturingCompletedAsync(status);


How can i either get a byte array of image stream from the camera while the capture is enrolling / verifying, or find another way to get the NCamera image displayed in my WPF Control.

Using WPF, i have implemented a Windows Forms Host control, and have mapped and created events that trigger and update the "NFace" object to the NFaceView and update - but i do not see any preview starting.

Thank you.
zerokewl88
 
Posts: 9
Joined: Feb 14, 2019 01:26

Re: SimpleFaceSampleCS - to WPF using MVVM

Postby MartynasV » Feb 15, 2019 15:23

Hello,

If you don't use our NFaceView form(https://docs.microsoft.com/en-us/dotnet ... rol-in-wpf), then you have couple ways to get images from camera:

Getting directly from camera(you can process those frames as shown in "SDK\Tutorials\Biometrics\CS\EnrollFaceFromImageStreamCS" example):
Code: Select all
               NCamera camera = (NCamera)deviceManager.Devices[0];
                    camera.StartCapturing();
               while ()
               {
                        image = camera.GetFrame(); // You can display this image
               }         
               camera.StopCapturing();


Subscribe to NFace event:
Code: Select all
        face.PropertyChanged += face_PropertyChanged; // Subscribe to event


        static void face_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if ("Image".Equals(e.PropertyName))
            {
                //image changed, redraw it
            }       
        }
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 446
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: SimpleFaceSampleCS - to WPF using MVVM

Postby zerokewl88 » Feb 16, 2019 12:03

Thanks, very helpful!
zerokewl88
 
Posts: 9
Joined: Feb 14, 2019 01:26


Return to Public

Who is online

Users browsing this forum: No registered users and 4 guests