improved jellyfin support
This commit is contained in:
@@ -24,6 +24,28 @@ inline cv::Mat align_face(const cv::Mat& img,
|
||||
return crop;
|
||||
}
|
||||
|
||||
// ── enhance_for_retry ────────────────────────────────────────────────────────
|
||||
// Used when initial face detection finds nothing. Pads the image by 50%
|
||||
// (border-replicated, so the detector doesn't see a hard edge) and applies
|
||||
// CLAHE to boost local contrast, giving the detector a second try.
|
||||
inline cv::Mat enhance_for_retry(const cv::Mat& img) {
|
||||
cv::Mat padded;
|
||||
const int pad_x = img.cols / 4;
|
||||
const int pad_y = img.rows / 4;
|
||||
cv::copyMakeBorder(img, padded, pad_y, pad_y, pad_x, pad_x, cv::BORDER_REPLICATE);
|
||||
|
||||
cv::Mat lab;
|
||||
cv::cvtColor(padded, lab, cv::COLOR_BGR2Lab);
|
||||
std::vector<cv::Mat> channels;
|
||||
cv::split(lab, channels);
|
||||
cv::createCLAHE(2.0, cv::Size(8, 8))->apply(channels[0], channels[0]);
|
||||
cv::merge(channels, lab);
|
||||
|
||||
cv::Mat out;
|
||||
cv::cvtColor(lab, out, cv::COLOR_Lab2BGR);
|
||||
return out;
|
||||
}
|
||||
|
||||
// ── l2_normalise ──────────────────────────────────────────────────────────────
|
||||
inline Embedding l2_normalise(const float* row) {
|
||||
float norm = 0.f;
|
||||
|
||||
Reference in New Issue
Block a user