Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dlib vs opencv which one to use when

Tags:

I am currently learning OpenCV API with Python and its all good. I am making decent progress. Part of it comes from Python syntax's simplicity as against using it with C++ which I haven't attempted yet. I have come to realize that I have to get dirty with C++ bindings for OpenCV at some point if I intend to do anything production quality.

Just recently I came across dlib which also claims to do all the things OpenCV does and more. Its written in C++ and offers Python API too (surprise). Can anybody vouch for dlib based on their own implementation experience?

like image 768
ultrasounder Avatar asked May 13 '16 16:05

ultrasounder


People also ask

Which is better dlib or OpenCV?

I have used both OpenCV and dlib extensively for face detection and face recognition and dlib is much accurate as compared to OpenCV Haar based face detector. ( Note that OpenCV now has a DNN module where we get Deep Learning based Face Detector and Face Recognizer models. )

Is OpenCV face recognition accurate?

When it comes to a good, all-purpose face detector, I suggest using OpenCV's DNN face detector: It achieves a nice balance of speed and accuracy. As a deep learning-based detector, it's more accurate than its Haar cascade and HOG + Linear SVM counterparts. It's fast enough to run real-time on CPUs.

Is OpenCV still relevant?

OpenCV is not only used by prominent research centres like Stanford, MIT, CMU, Cambridge, and INRIA but also by tech giants like Google, Yahoo, Microsoft, Intel, Sony, Honda, Toyota, among others. Since its alpha release in January 1999, OpenCV has been used in many applications, products, and research efforts.


1 Answers

I have used both OpenCV and dlib extensively for face detection and face recognition and dlib is much accurate as compared to OpenCV Haar based face detector. ( Note that OpenCV now has a DNN module where we get Deep Learning based Face Detector and Face Recognizer models. )

I'm in the middle of comparing the OpenCV-DNN vs Dlib for face detection / recognition. Will post the results once I'm done with it.

There are many useful functions available in dlib, but I prefer OpenCV for any other CV tasks.

EDIT : As promised, I have made a detailed comparison of OpenCV vs Dlib Face Detection methods.

Here is my conclusion :

General Case

In most applications, we won’t know the size of the face in the image before-hand. Thus, it is better to use OpenCV – DNN method as it is pretty fast and very accurate, even for small sized faces. It also detects faces at various angles. We recommend to use OpenCV-DNN in most

For medium to large image sizes

Dlib HoG is the fastest method on CPU. But it does not detect small sized faces ( < 70x70 ). So, if you know that your application will not be dealing with very small sized faces ( for example a selfie app ), then HoG based Face detector is a better option. Also, If you can use a GPU, then MMOD face detector is the best option as it is very fast on GPU and also provides detection at various angles.

For more details, you can have a look at this blog

like image 149
Vikas Gupta Avatar answered Sep 19 '22 12:09

Vikas Gupta