![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Public Member Functions | |
OpenCVDNNFaceDetector (DetectorNNModel model=DetectorNNModel::DNNDetectorYuNet) | |
std::vector< cv::Rect > | cvDetectFaces (const cv::Mat &inputImage, const cv::Size &paddedSize) |
QList< QRect > | detectFaces (const cv::Mat &inputImage, const cv::Size &paddedSize) |
There is no proof that doing this will help, since face can be detected at various positions (even half, masked faces can be detected), not only frontal. | |
cv::Mat | prepareForDetection (const DImg &inputImage, cv::Size &paddedSize) const |
cv::Mat | prepareForDetection (const QImage &inputImage, cv::Size &paddedSize) const |
cv::Mat | prepareForDetection (const QString &inputImagePath, cv::Size &paddedSize) const |
cv::Mat | prepareForDetectionYuNet (cv::Mat &cvImage, cv::Size &paddedSize) const |
void | setAccuracy (const int accuracy) |
void | setFaceDetectionSize (FaceScanSettings::FaceDetectionSize size) |
Static Public Member Functions | |
static int | recommendedImageSizeForDetection () |
QList< QRect > Digikam::OpenCVDNNFaceDetector::detectFaces | ( | const cv::Mat & | inputImage, |
const cv::Size & | paddedSize | ||
) |
Effort on doing this should be questioned. TODO: Restructure and improve Face Detection module.
void OpenCVDNNFaceDetector::resizeBboxToStandardHumanFace(int& width, int& height) { Human head sizes data. https://en.wikipedia.org/wiki/Human_head#Average_head_sizes
float maxRatioFrontalFace = 15.4 / 15.5; float minRatioNonFrontalFace = 8.6 / 21.6; float r = width*1.0/height, rReference; if ((r >= minRatioNonFrontalFace*0.9) && r <= (maxRatioFrontalFace * 1.1)) { rReference = r; } else if (r <= 0.25) { rReference = r * 1.5; } else if (r >= 4) { rReference = r / 1.5; } else if (r < minRatioNonFrontalFace * 0.9) { rReference = minRatioNonFrontalFace; } else if (r > maxRatioFrontalFace * 1.1) { rReference = maxRatioFrontalFace; } if (width > height) { height = width / rReference; } else { width = height * rReference; }
}
|
static |