| | |
| | | // fclose(pFile); |
| | | //} |
| | | } |
| | | else if (image.mb_type == MB_Frame::MBFT_JPEG) |
| | | { |
| | | Mat matTmp = imdecode(_InputArray(image.buff, image.size), CV_LOAD_IMAGE_COLOR); |
| | | |
| | | //imwrite("aaa.jpg", matTmp); |
| | | |
| | | imgbufSize = matTmp.total() * matTmp.elemSize(); |
| | | memcpy(imgbuf, matTmp.ptr(), imgbufSize); |
| | | |
| | | stimgfmt = CV_PIX_FMT_BGR888; |
| | | } |
| | | else |
| | | { |
| | | LOG_WARN << "mb frame type not support" << LOG_ENDL; |
| | |
| | | return p_feature; |
| | | } |
| | | |
| | | float stface_compare(stface_handles& handles, const STFaceImage& image1, const STFaceImage& image2) |
| | | { |
| | | cv_feature_t* f1 = stface_extract_feature(handles, image1); |
| | | if (f1 == nullptr) |
| | | { |
| | | LOGP(INFO, "can't find face in image1"); |
| | | return -1.0; |
| | | } |
| | | |
| | | cv_feature_t* f2 = stface_extract_feature(handles, image2); |
| | | if (f2 == nullptr) |
| | | { |
| | | cv_verify_release_feature(f1); |
| | | LOGP(INFO, "can't find face in image1"); |
| | | return -1.0; |
| | | } |
| | | |
| | | float score = -1.0; |
| | | cv_result_t cv_result = cv_verify_compare_feature(handles.handle_verify, f1, f2, &score); |
| | | if (cv_result != CV_OK) { |
| | | LOGP(DEBUG, "cv_verify_compare_feature failed, error code %d", cv_result); |
| | | score = -1.0; |
| | | } |
| | | |
| | | cv_verify_release_feature(f1); |
| | | cv_verify_release_feature(f2); |
| | | return score; |
| | | } |
| | | |
| | | int stface_db_add(stface_handles& handles, const char *image_path) { |
| | | cv_feature_t *p_feature = stface_extract_feature(handles, image_path); |
| | | if (!p_feature) { |