Verilook Exposure Control

General information about Neurotechnology and its software

Verilook Exposure Control

Postby zerokewl88 » Feb 16, 2019 12:15

Hello,

Using the Verilook and NCamera -> NFaceView Control, I'm taking images and allowing a preview screen to be seen using the SDK. I've noticed that the Async Capture methods of the NCamera however seem to always start from a Low Exposure and works its way forward until a Subject Face is detected. This sometimes leads to a 'purple - tinge image' being captured on the Face of the returned subject. Is there any way to control the Camera behaviour in the way it captures?

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

Re: Verilook Exposure Control

Postby zerokewl88 » Feb 18, 2019 05:53

I wanted to further add to this question, and since it's related to Camera Control thought i can add it on here.

Is there a way to adjust the NFaceView camera feed and capture image rotation ? Sometimes our cameras are mounted either 90, 180, 270 degrees. I think the obvious answer already to this would be capturing the image from the event handler, and then adjusting it to be displayed in a NFaceView - but was wondering if the API has any built in features to create a similar rotation behaviour.

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

Re: Verilook Exposure Control

Postby MartynasV » Feb 18, 2019 14:18

Hello,

I've noticed that the Async Capture methods of the NCamera however seem to always start from a Low Exposure and works its way forward until a Subject Face is detected. This sometimes leads to a 'purple - tinge image' being captured on the Face of the returned subject.

If you use normal method(not async), does the same issue happen?

Is there any way to control the Camera behaviour in the way it captures?

No, the only thing you can do is start capture, get frames, stop capturing.

Is there a way to adjust the NFaceView camera feed and capture image rotation ? Sometimes our cameras are mounted either 90, 180, 270 degrees. I think the obvious answer already to this would be capturing the image from the event handler, and then adjusting it to be displayed in a NFaceView - but was wondering if the API has any built in features to create a similar rotation behaviour.

Unfortunately, no(no inbuilt frames rotation). You'll have to rotate frames yourself.
Also there are couple other alternative ways to achieve it(other than your mentioned):
  1. Use NVirtualCameraSource. Idea would be to capture frame by frame from camera, then rotate frames and pass them to NBiometricClient as frames from virtual device.
    Code: Select all
     
    namespace Neurotec.Devices.Virtual
    {
    public class NVirtualCameraSource : NObject
    {
      public static NType NativeType { get; }
      public NCamera Camera { get; }
     
      public static NVirtualCameraSource Connect(NDeviceManager deviceManger);
      public static int NVirtualCameraSourceTypeOf(out HNObject hType);
      public int PushSample(NImage image, TimeSpan start, TimeSpan duration);
      public int PushSample(string fileName, TimeSpan start, TimeSpan duration);
    }
    }

  2. Use camera’s manufacturers provided SDK and our provided ndm plugin sample (SDK\Samples\Devices\C\NdmSample\), to write a module, so that you would take frame by frame from the camera, manipulate frame however you need(e.g. rotate) and pass it to our API.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 513
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: Verilook Exposure Control

Postby zerokewl88 » Feb 20, 2019 09:25

Thanks again for your response!

Is there a way to convert a NImage back to a MemoryStream or Image, and not a NMemoryStream / NImage - so that i can take the bytearray from the camera stream and output to my WPF Control ? At the moment i found that there is a method NImage.Save (which only saves to disk), and then ToByteArray isn't returning a image byte array.

With this i would like to get the ImageAttributes, perform some calculations and manipulation to adjust the color matrix which is similarily done on a ImagePallete and then recreate the image.

Thank you.

EDIT

Sorry, but I think I have already found my answer and will test this today.

_biometricClient.FaceCaptureDevice.StartCapturing();
var image = _biometricClient.FaceCaptureDevice.GetFrame();
_biometricClient.FaceCaptureDevice.StopCapturing();
var test = image.ToBitmap();
zerokewl88
 
Posts: 17
Joined: Feb 14, 2019 01:26

Re: Verilook Exposure Control

Postby MartynasV » Feb 22, 2019 15:22

zerokewl88 wrote:Thanks again for your response!

Is there a way to convert a NImage back to a MemoryStream or Image, and not a NMemoryStream / NImage - so that i can take the bytearray from the camera stream and output to my WPF Control ? At the moment i found that there is a method NImage.Save (which only saves to disk), and then ToByteArray isn't returning a image byte array.

With this i would like to get the ImageAttributes, perform some calculations and manipulation to adjust the color matrix which is similarily done on a ImagePallete and then recreate the image.

Thank you.

EDIT

Sorry, but I think I have already found my answer and will test this today.

_biometricClient.FaceCaptureDevice.StartCapturing();
var image = _biometricClient.FaceCaptureDevice.GetFrame();
_biometricClient.FaceCaptureDevice.StopCapturing();
var test = image.ToBitmap();

Hello,

Yes, you can get Bitmap that way.
Also you can get BitmapSource by calling "image.ToBitmapSource()"(it comes from our WpfExtensions class). And if you want to get image's byte array, then call "image.Save().ToArray();".
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 513
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: Verilook Exposure Control

Postby zerokewl88 » Sep 17, 2019 02:46

Hi MartynasV,

Can you please help with the definition of this method call, i've got the virtual camera source working, and able to rotate and pass frames - but we are also sometime shaving cached results every 2nd verification / templify.

I am passing frames to a Virtual Camera Source, but i don't understand the 2 TimeSpan fields are used for?

Code: Select all
  public int PushSample(NImage image, TimeSpan start, TimeSpan duration);


When i would like to start capturing a subject / template in order to verify, i pass a NImage to the PushSample like so.

Code: Select all
myVirtualCameraSource.PushSample(NImage.FromBitmap(bitmapImage), TimeSpan.MinValue, TimeSpan.MinValue);


I then, call the async method and wait until a face is captured.

Code: Select all
var face = new NFace { CaptureOptions = NBiometricCaptureOptions.Stream };
_newSubject = new NSubject();
_newSubject.Faces.Add(face);
_newSubjectCaptureTemplateResult = await _biometricClient.CaptureAsync(_newSubject);


This works, but on the 2nd call, i'm always receiving a cached result from every 2nd CaptureAsync call - even without a subject in the camera feed (sometimes...)
Could you please let me know if i'm missing something here, or have to call a clear cache / create a new subject another way to prevent this.

Also a few more questions regarding this:
1. When using the method Pushsample, what does the returned Int value represent,
2. and what do the Start / Duration Timespan values mean?
3. When we are not attempting to Create a Subject, or Verify / Templify from the custom Video Source, should we still be pushing samples, or only at the time we want to use the engine? At the moment i'm restructuring between constant Pushing Samples, and then pushing Samples only when i want to start verification / templates.

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

Re: Verilook Exposure Control

Postby MartynasV » Sep 18, 2019 13:22

Hello,

1. When using the method Pushsample, what does the returned Int value represent,

Frames count.

2. and what do the Start / Duration Timespan values mean?

Start parameter is timestamp of the frame and duration is time between frames.

3. When we are not attempting to Create a Subject, or Verify / Templify from the custom Video Source, should we still be pushing samples, or only at the time we want to use the engine? At the moment i'm restructuring between constant Pushing Samples, and then pushing Samples only when i want to start verification / templates.

You should NOT push frames all the time. You should start pushing frames when you start capturing and stop, when you stop capturing.
If you are pushing frames non-stop and capturing(via NBiometricClient) sometimes, then frames will be cached and it would explain your described behavior. You should implement as mentioned above.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 513
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: Verilook Exposure Control

Postby zerokewl88 » Sep 19, 2019 08:48

Thanks Martynas,

Is it safe to use the method as such. I am trying to determine what difference the values entered in the Start / Duration Timespan fields implies and how it affects captures.

Code: Select all
if (capturingActiveBoolean)
{
  myVirtualCameraSource.PushSample(NImage.FromBitmap(bitmapImage), DateTime.Now.TimeOfDay, TimeSpan.FromTicks(1));
}


Does the Timespan of the Frame, and it's duration matter if we just want to be pushing frames while capturing and not mention the time ? Or should we be knowing the last pushed frame, have a DateTime value stored, and calculate the time between last frame, and then the duration would be the incoming frame rate ?

Code: Select all
var lastCapturedFrame = new DateTime.MinValue;
if (capturingActiveBoolean)
{
  if (lastCapturedFrame == DateTime.MinValue)
  {
    lastCapturedFrame = DateTime.now;
  }
  var frameTimeSpan = DateTime.Now.TimeOfDay;
  var durationTimeSpan = DateTime.now - lastCapturedFrame;
  myVirtualCameraSource.PushSample(NImage.FromBitmap(bitmapImage), frameTimeSpan  durationTimeSpan );
}


Thank you.


EDIT: Doing some testing and i think the timers work as follows if im correct.
1. PushSamples, with a Start Time, and duration -> translates to, gives frames, that expire after x (duration timeout) ?
When the engine is capturing and trying to Capture a subject, it will return TooFewSamples when the duration and capture frames is not long enough. Changing this to a longer duration of perhaps 1 second at a time, perhaps does give the engine enough time to Cache and capture a subject ?
Last edited by zerokewl88 on Sep 19, 2019 10:36, edited 1 time in total.
zerokewl88
 
Posts: 17
Joined: Feb 14, 2019 01:26

Re: Verilook Exposure Control

Postby MartynasV » Sep 19, 2019 10:33

zerokewl88 wrote:Thanks Martynas,

Is it safe to use the method as such. I am trying to determine what difference the values entered in the Start / Duration Timespan fields implies and how it affects captures.

Code: Select all
if (capturingActiveBoolean)
{
  myVirtualCameraSource.PushSample(NImage.FromBitmap(bitmapImage), DateTime.Now.TimeOfDay, TimeSpan.FromTicks(1));
}


Does the Timespan of the Frame, and it's duration matter if we just want to be pushing frames while capturing and not mention the time ? Or should we be knowing the last pushed frame, have a DateTime value stored, and calculate the time between last frame, and then the duration would be the incoming frame rate ?

Code: Select all
var lastCapturedFrame = new DateTime.MinValue;
if (capturingActiveBoolean)
{
  if (lastCapturedFrame == DateTime.MinValue)
  {
    lastCapturedFrame = DateTime.now;
  }
  var frameTimeSpan = DateTime.Now.TimeOfDay;
  var durationTimeSpan = DateTime.now - lastCapturedFrame;
  myVirtualCameraSource.PushSample(NImage.FromBitmap(bitmapImage), frameTimeSpan  durationTimeSpan );
}


Thank you.


EDIT: Doing some testing and i think the timers work as follows if im correct.
1. PushSamples, with a Start Time, and duration -> translates to, gives frames, that expire after x (duration timeout) ?
When the engine is capturing and trying to Capture a subject, it will return TooFewSamples when the duration and capture frames is not long enough. Changing this to a longer duration of perhaps 1 second at a time, perhaps does give the engine enough time to Cache and capture a subject ?

Hello,

Actually, NBiometricClient doesn't use start and duration values.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 513
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania


Return to Public

Who is online

Users browsing this forum: No registered users and 2 guests

cron