Page 1 of 1

Creating NImage from QImage/OpenCV mat

PostPosted: Nov 06, 2017 22:22
by justynnuff
Hello,

I"m evaluating the VeriFinger SDK for use with a project I"m currently working on.

In this project, we"d like to provide the hardware capture device as well as the user interface, and do some additional, non-traditional, image processing using OpenCV. In my current application, I capture images as QImages (a Qt image format), but can easily convert them between QImages and OpenCV mat formats. I"m wondering how to convert either of those formats to an NImage so I can create templates from finger prints. Currently it looks like the SDK provides extensive examples of reading images from files, or reading images directly from devices. I don"t want to do either, as I"ve already captured images and have them available from within the application itself. I DO NOT want to save a file, then immediately read that file in via NImage.fromFile, as this is round about and hacky.

From the documentation, I see that there are 10 .fromData methods for the NImage class. However, all of the methods need an NBuffer. So I"m trying to get an image into an NBuffer by using one of its constructors, however, the documentation in the "Neurotechnology Biometrics" SDK is incomplete. For example, a lot of the descriptions are missing for the NBuffer constructors on page 1914 through 1917: the descriptions read "_nt_".

I am going to explore how to do this more on my own, but it would be nice to get some expert help on the matter so I don"t have to waste too much time.

Re: Creating NImage from QImage/OpenCV mat

PostPosted: Nov 08, 2017 11:41
by MartynasV
justynnuff wrote:Hello,

I"m evaluating the VeriFinger SDK for use with a project I"m currently working on.

In this project, we"d like to provide the hardware capture device as well as the user interface, and do some additional, non-traditional, image processing using OpenCV. In my current application, I capture images as QImages (a Qt image format), but can easily convert them between QImages and OpenCV mat formats. I"m wondering how to convert either of those formats to an NImage so I can create templates from finger prints. Currently it looks like the SDK provides extensive examples of reading images from files, or reading images directly from devices. I don"t want to do either, as I"ve already captured images and have them available from within the application itself. I DO NOT want to save a file, then immediately read that file in via NImage.fromFile, as this is round about and hacky.

From the documentation, I see that there are 10 .fromData methods for the NImage class. However, all of the methods need an NBuffer. So I"m trying to get an image into an NBuffer by using one of its constructors, however, the documentation in the "Neurotechnology Biometrics" SDK is incomplete. For example, a lot of the descriptions are missing for the NBuffer constructors on page 1914 through 1917: the descriptions read "_nt_".

I am going to explore how to do this more on my own, but it would be nice to get some expert help on the matter so I don"t have to waste too much time.

Hello justynnuff,

How to convert OpenCV mat image to NImage thread was already created, you can view it here:
viewtopic.php?f=3&t=95726&p=106922&hilit=opencv&sid=963d3b7afdc49872d8919c848d5c0208#p106922

About Qt Image format, as I understood by reading here: http://doc.qt.io/qt-5/qtimageformats-index.html, that it is not a format, but library for standard image formats like PNG, JPEG, etc. In that case you could use following to open them as NImage:
Code: Select all
// CSharp snippet, bytes is byte[]
NImage.FromMemory(bytes); // If image format is supported it will successfully create NImage from those bytes


Supported image formats by our SDK:
CanRead: TIFF, JPEG, PNG, WSQ, JPEG 2000, BMP, NIST IHead
CanWrite: JPEG, PNG, WSQ, JPEG 2000, BMP, NIST IHead