3

I'm actually using OpenCV for face detection, but after watching this video : https://www.youtube.com/watch?v=LsK0hzcEyHI , I've noticed that dlib is much more accurate, and even in my tests, gives a lot of fale positives (but doesn't miss any face), does anyone know how to use dlib within a Java web application (not android) ? I've already found a port to Android, but I don't thinkk it's possible to use it with in a java web application. Thank you

hereForLearing
  • 1,209
  • 1
  • 15
  • 33

2 Answers2

8

I have used dlib myself, and yes it is a very advanced and precise library. There is no port in Java as far as I know. But you can always have it compiled to a shared library (.so in linux or .dll in Windows), and then use that inside your Java code.

More on using a dll or using an so in java

There is also an option to use the C++ library directly within Java, using proxies. You might want to look into that.

Edit : As per @evgeniy's comment, most of dlib is header-only templates. You will not be able to use those if you export dlib directly as a shared library. What you might want to do instead is to expose whatever APIs you need, see here

Edit 2 : As @davis-king's pointed out, you may want to look into using swig and cmake as is done in the mitie/dlib Java api : See here.

Community
  • 1
  • 1
S. Saad
  • 336
  • 2
  • 9
  • 2
    this will not help. most of dlib is header-based and not contained in shared library – Evgeniy Jun 02 '16 at 08:09
  • Correct me if I'm wrong, but I'm pretty sure that is irrelevant, as even then the APIs relevant to the OP can easily be exposed THEN compiled into a shared lib. See http://stackoverflow.com/questions/7349129/compile-header-only-template-library-into-a-shared-library – S. Saad Jun 02 '16 at 10:29
  • 2
    yes, you are right. the only thing I was trying to say, that dlib itself can be compiled as a shared library, but it will be impossible to use libdlib.so(.dll) as-is in java because all face detection functions are template-based and do not exist in libdlib.so. and yes, its possible to build some new library with dlib code inside and then use it in java – Evgeniy Jun 02 '16 at 10:37
2

If you are looking for Android: https://github.com/tzutalin/dlib-android

Otherwise, this https://github.com/bytedeco/javacpp-presets/issues/49 looks like the most promising but still opened at the moment.

Loc Phan
  • 4,304
  • 4
  • 29
  • 35