int CheckImageType(const unsigned char *image_data,
const rr_image_type image_type,
const int image_width,
const int image_height)
{
int cv_type = (int)rr_image_type::RR_IMAGE_MAX;
int main()
{
int flag = 1;
string model_dir; // Ä£ÐÍÎļþ¼Ð
model_dir = "../../models";
int iFrame=0;
int ret = 0;
cv::VideoCapture capture;
cv::Mat frame;
ret = capture.read(frame);
iFrame++;
rr_face_t* faces_array = NULL;
int faces_count = 0;
// you could test image_data, image_type and show image, when you met image_type problem.
//if (CheckImageType(img.data, rr_image_type::RR_IMAGE_BGR8UC3, img.cols, img.rows) != RR_OK) printf("img data or type ERROR!\n");
ret = firefly_fd_detect_image(hDetector, frame.data, rr_image_type::RR_IMAGE_BGR8UC3, frame.cols, frame.rows, &faces_array, &faces_count);
if (ret != RR_OK)
{
printf("firefly_fd_detect_image() failed: %d\n", ret);
printf("press ENTER to continue");
getchar();
continue;
}
// draw faces rect and id
for (int i = 0; i<faces_count; i++)
{
float x = faces_array[i].rect.left;
float y = faces_array[i].rect.top;
float h = faces_array[i].rect.bottom - faces_array[i].rect.top + 1;
float w = faces_array[i].rect.right - faces_array[i].rect.left + 1;