alg: Factor in camera_sensitivity in sobel check

This commit is contained in:
Fam Zheng 2025-03-20 23:10:46 -07:00
parent 8cf2a8a4a0
commit 0bd8a93f14
3 changed files with 3 additions and 1 deletions

View File

@ -242,7 +242,7 @@ bool check_blur_by_laplacian(ProcessState &ps, Mat &gray, string &err)
static static
bool check_blur_by_sobel(ProcessState &ps, Mat &gray, string &err) bool check_blur_by_sobel(ProcessState &ps, Mat &gray, string &err)
{ {
const float thres = 15; const float thres = ps.sobel_thres;
Mat sobel_x, sobel_y; Mat sobel_x, sobel_y;
Sobel(gray, sobel_x, CV_64F, 1, 0, 3); Sobel(gray, sobel_x, CV_64F, 1, 0, 3);
Sobel(gray, sobel_y, CV_64F, 0, 1, 3); Sobel(gray, sobel_y, CV_64F, 0, 1, 3);

View File

@ -25,6 +25,7 @@ struct ProcessState {
string qrcode = ""; string qrcode = "";
double clarity; double clarity;
float laplacian_thres = 0.1; float laplacian_thres = 0.1;
float sobel_thres = 15;
int sharpness_method = 2; int sharpness_method = 2;
}; };

View File

@ -29,6 +29,7 @@ const char *qrtool_angle(uint8_t *data,
float camera_sensitivity) { float camera_sensitivity) {
ProcessState ps; ProcessState ps;
ps.laplacian_thres = camera_sensitivity / 10.0; ps.laplacian_thres = camera_sensitivity / 10.0;
ps.sobel_thres = camera_sensitivity * 15;
auto start = std::chrono::system_clock::now(); auto start = std::chrono::system_clock::now();
static char ret[512]; static char ret[512];
printf("qrtool_angle, width: %d height %d\n", width, height); printf("qrtool_angle, width: %d height %d\n", width, height);