java - How to pass the image as a structure parameter to C function of libfprint using JNI -


i working biometric finger print scanning device, , have developed java application finger print image data. want process image , fingerprint matching. have found 1 open source library, libfprint.

this library provides functions process image , functions matching images. application written in java image passed java code through jni c code. example function image binarization in library shown below

struct fp_img *fp_img_binarize(struct fp_img *img) 

what should pass java code such functions in c code takes structure data parameter? or how pass values java code c functions if take structure parameter? or how write jni layer in case?

you have write jni function take image java , converts fp_img structure libfprint (you can't call c-library function java).

the structure in libfprint looks this

struct fp_img {     int width;     int height;     size_t length;     uint16_t flags;     struct fp_minutiae *minutiae;     unsigned char *binarized;     unsigned char data[0]; }; 

libfprint not meant used external images. fingerprint images should acquired using libfprint in first place.

but can create new image calling function

struct fp_img *fpi_img_new(size_t length) 

with length=width*height. problem is, function might not declared in libfprint headers have declare or reimplement it. doing this:

struct fp_img *img = malloc(sizeof(struct fp_img) + length); img->length = length; 

you should set

img->width = width; img->height = height; 

you can access raw image data (8-bit greyscale) function (i assume rows-column order, i.e. data[x + y*img->width] (x,y) pixel).

unsigned char *fp_img_get_data(struct fp_img *img) 

you can treat array being of size=length. can write pixels of java image array within jni function. when have image can pass fp_img_binarize function.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -