tzutalin / dlib-android

:dragon: Port dlib to Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to speed up detection using gray image ?

e-snail opened this issue · comments

commented

There is a TODO in "jni/jni_detections/detector.h", saying:

// TODO : Convert to gray image to speed up detection
// It's unnecessary to use color image for face/landmark detection

I tried to use gray image with following code:
cv::cvtColor(bgrMat, grayMat, cv::COLOR_BGR2GRAY);
dlib::cv_image<unsigned char> img(image); //image has only 1 channel

It seems does NOT work in speeding up detection.

How to fix it ?

Thanks a lot !

Please, read previous issues instead of creating new ones. It is highly probable that was asked before. Please refer to this issue, you will find the solution: #46

commented

Thanks!
I followed the method u mentioned, another error came out:
E/cv::error(): OpenCV Error: Assertion failed (!fixedType() || ((Mat*)obj)->type() == mtype) in void cv::_OutputArray::create(cv::Size, int, int, bool, int) const, file /Volumes/Linux/builds/master_pack-android/opencv/modules/core/src/matrix.cpp, line 2191

when executing

cv::cvtColor(image, image, CV_BGR2GRAY);

commented

refer to #46