47 lines
843 B
C++
47 lines
843 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
struct Point {
|
|
float x = 0.0f;
|
|
float y = 0.0f;
|
|
};
|
|
|
|
struct Face {
|
|
float score = 0.0f;
|
|
|
|
float x1 = 0.0f;
|
|
float y1 = 0.0f;
|
|
float x2 = 0.0f;
|
|
float y2 = 0.0f;
|
|
|
|
Point kps[5]{};
|
|
|
|
// SFace: embedding L2-normalizzato da 128 float32.
|
|
std::vector<float> embedding;
|
|
};
|
|
|
|
class FaceEngine {
|
|
public:
|
|
FaceEngine();
|
|
~FaceEngine();
|
|
|
|
FaceEngine(const FaceEngine&) = delete;
|
|
FaceEngine& operator=(const FaceEngine&) = delete;
|
|
|
|
bool init(
|
|
const std::string& scrfd_model,
|
|
const std::string& sface_model);
|
|
|
|
bool process_image(
|
|
const std::string& image_path,
|
|
std::vector<Face>& faces,
|
|
int& image_width,
|
|
int& image_height,
|
|
int rotation_degrees = 0);
|
|
|
|
private:
|
|
struct Impl;
|
|
Impl* impl_;
|
|
};
|