alg: Simplify frame pre check

This commit is contained in:
Fam Zheng 2025-04-24 20:45:42 +01:00
parent 46b7541830
commit 69c701da56

View File

@ -263,15 +263,7 @@ bool check_blur_by_sobel(ProcessState &ps, Mat &gray, string &err)
static
bool check_sharpness(ProcessState &ps, Mat &gray, int method, string &err)
{
if (method == 0) {
return check_blur_by_laplacian(ps, gray, err);
} else if (method == 1) {
return check_blur_by_energy_gradient(gray, err);
} else if (method == 2) {
return check_blur_by_sobel(ps, gray, err);
}
err = "unknown sharpness method: " + to_string(method);
return false;
return check_blur_by_sobel(ps, gray, err);
}
#define COUNT_COMPONENTS 0
@ -458,14 +450,8 @@ bool emblem_dot_angle(ProcessState &ps, InputArray in, float &angle, string &qrc
return false;
}
int a = emblem_detect_angle(ps.dot_area_gray, false, err);
if (a > 0) {
angle = a;
return true;
} else {
err = "cannot detect angle";
return false;
}
angle = 0;
return true;
} catch (const std::exception &exc) {
std::cout << exc.what() << std::endl;
err = "exception";