optimize
git-svn-id: http://192.168.1.226/svn/proxy@572 454eff88-639b-444f-9e54-f578c98de674
| | |
| | | |
| | | cv_face_algorithm_info(); |
| | | |
| | | cv_result_t cv_result = cv_face_create_detector(&cacheContext.handle_detect, nullptr, CV_DETECT_ENABLE_ALIGN_21); |
| | | cv_result_t cv_result = cv_face_create_detector(&cacheContext.handle_detect, nullptr, CV_DETECT_ENABLE_ALIGN_106);//CV_DETECT_ENABLE_ALIGN_21 |
| | | if (cv_result != CV_OK) |
| | | { |
| | | LOGP(ERROR, "create detect handle failed, error code %d", cv_result); |
| | |
| | | cv_feature_t *p_feature = nullptr; |
| | | cv_face_t *p_face = nullptr; |
| | | int face_count = 0; |
| | | cv_result_t st_result = CV_OK; |
| | | st_result = cv_face_detect(handles.handle_detect, bgr_image.data, CV_PIX_FMT_BGR888, |
| | | cv_result_t result = CV_OK; |
| | | result = cv_face_detect(handles.handle_detect, bgr_image.data, CV_PIX_FMT_BGR888, |
| | | bgr_image.cols, bgr_image.rows, bgr_image.step, |
| | | CV_FACE_UP, &p_face, &face_count); |
| | | if (face_count >= 1) { |
| | | st_result = cv_verify_get_feature(handles.handle_verify, |
| | | result = cv_verify_get_feature(handles.handle_verify, |
| | | (unsigned char *)bgr_image.data, CV_PIX_FMT_BGR888, |
| | | bgr_image.cols, bgr_image.rows, bgr_image.step, |
| | | p_face, &p_feature, nullptr); |
| | | if (st_result != CV_OK) { |
| | | LOGP(DEBUG, "cv_verify_get_feature failed, error code %d", st_result); |
| | | if (result != CV_OK) { |
| | | LOGP(DEBUG, "cv_verify_get_feature failed, error code %d", result); |
| | | } |
| | | } else { |
| | | LOGP(DEBUG, "can't find face in %s", image_path); |
| | |
| | | stimgfmt = CV_PIX_FMT_GRAY8; |
| | | matType = CV_8UC1; |
| | | } |
| | | else if (image.mb_type == MB_Frame::MBFT_ARGB8888) |
| | | else if (image.mb_type == MB_Frame::MBFT_ABGR8888) |
| | | { |
| | | //int ret = libyuv::ARGBToBGRA( |
| | | // image.buff, image.width * 4, |
| | |
| | | //stimgfmt = CV_PIX_FMT_BGRA8888; |
| | | //matType = CV_8UC4; |
| | | |
| | | int ret = libyuv::ARGBToI400( |
| | | int ret = libyuv::ABGRToI400( |
| | | image.buff, image.width * 4, |
| | | imgbuf, image.width, |
| | | image.width, image.height |
| | |
| | | imgbufSize = image.height * image.width; |
| | | stimgfmt = CV_PIX_FMT_GRAY8; |
| | | matType = CV_8UC1; |
| | | |
| | | //{ |
| | | // static int f = 0; |
| | | // ++f; |
| | | // |
| | | // char fname[50]; |
| | | // sprintf(fname, "st-%d-w%d-h%d.y8", f, image.width, image.height); |
| | | // FILE *pFile = fopen(fname, "wb"); |
| | | // fwrite(imgbuf, 1, imgbufSize, pFile); |
| | | // fclose(pFile); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | |
| | | cv_feature_t *p_feature = nullptr; |
| | | cv_face_t *p_face = nullptr; |
| | | int face_count = 0; |
| | | cv_result_t st_result = CV_OK; |
| | | st_result = cv_face_detect(handles.handle_detect, matImg.data, stimgfmt, matImg.cols, matImg.rows, matImg.step, CV_FACE_UP, &p_face, &face_count); |
| | | cv_result_t result = CV_OK; |
| | | result = cv_face_detect(handles.handle_detect, matImg.data, stimgfmt, matImg.cols, matImg.rows, matImg.step, CV_FACE_UP, &p_face, &face_count); |
| | | if (face_count >= 1) |
| | | { |
| | | st_result = cv_verify_get_feature(handles.handle_verify, (unsigned char *)matImg.data, stimgfmt, matImg.cols, matImg.rows, matImg.step, p_face, &p_feature, nullptr); |
| | | if (st_result != CV_OK) |
| | | result = cv_verify_get_feature(handles.handle_verify, (unsigned char *)matImg.data, stimgfmt, matImg.cols, matImg.rows, matImg.step, p_face, &p_feature, nullptr); |
| | | if (result != CV_OK) |
| | | { |
| | | LOGP(DEBUG, "cv_verify_get_feature failed, error code %d", st_result); |
| | | LOGP(DEBUG, "cv_verify_get_feature failed, error code %d", result); |
| | | } |
| | | } |
| | | else |