Hi I'm trying to implement dlib facial landmark detection in android. I know, but I need as many fps I can get. There are 2 issues that I face,
- Conversion Chain
- Resizing
Currently, I am getting the data from a preview callback set to a camera. It outputs a byte[] of a NV21 Image. Since dlib dont know image and only know array2d<dlib::rgb_pixel>, I need to conform the data to it. The implementation that I get uses bitmap, and when I try to use there code, I have a chain of conversion byte[]->bmp->array2d, I want to implement a byte[]->array2d conversion.
Now, I need to leverage the performance of dlib by manipulating the size of the image fed in to it. My use-case though doesn't involve small faces so I can down-scale the input image to boost performance, but lets say I am successful on making the byte[]->array2d conversion, how can I resize the image? Resizing in bitmap though have many fast implementations but I need to cut the bitmap involvement to extract more fps. I have an option on resizing the byte[] or the converted one array2d, but again... how? Im guessing its good to do the resizing after the conversion because it will now be operating on native and not on java.
Edit
The down-scaling should take the byte[](not the dlib::arrray2d) form as input since I need to do something on the down-scaled byte[].
So my final problem is to implement this on jni
byte[] resize(ByteArray img, Size targetSize);
and
dlib::array2d<rgb_pixel> convert(ByteArray img);