diff options
author | alejandro-colomar <colomar.6.4.3@gmail.com> | 2019-10-03 23:43:28 +0200 |
---|---|---|
committer | alejandro-colomar <colomar.6.4.3@gmail.com> | 2019-10-03 23:43:28 +0200 |
commit | 613da9efa91306840aeefa18ce27464007fa866d (patch) | |
tree | d8393b89d96c83253310d5f692a19758f2a7121d | |
parent | 38c00170a47805319280355d48ee251e6116a76f (diff) |
Update libalx
-rwxr-xr-x | Makefile | 1 | ||||
-rwxr-xr-x | src/label.c | 16 | ||||
-rwxr-xr-x | src/parse.c | 7 |
3 files changed, 12 insertions, 12 deletions
@@ -126,6 +126,7 @@ CFLAGS_W += -Wstrict-prototypes CFLAGS_W += -Werror CFLAGS_PKG = `pkg-config --cflags opencv` +CFLAGS_PKG += `pkg-config --cflags opencv4` CFLAGS_PKG += `pkg-config --cflags libalx-cv` CFLAGS_PKG += `pkg-config --cflags libalx-ocr` CFLAGS_PKG += `pkg-config --cflags libalx-zbar` diff --git a/src/label.c b/src/label.c index a824807..9d2f2ec 100755 --- a/src/label.c +++ b/src/label.c @@ -14,9 +14,9 @@ #include <stdio.h> #include <time.h> -#include <opencv2/imgproc/types_c.h> #include <zbar.h> +#define ALX_NO_PREFIX #include <libalx/base/compiler/size.h> #include <libalx/base/errno/error.h> #include <libalx/base/stdio/printf/sbprintf.h> @@ -222,7 +222,7 @@ int find_label (const img_s *restrict img, alx_cv_invert(img_tmp); if (alx_cv_smooth(img_tmp, ALX_CV_SMOOTH_MEAN, 21)) goto err; - if (alx_cv_threshold(img_tmp, CV_THRESH_BINARY_INV, 2)) + if (alx_cv_threshold(img_tmp, ALX_CV_THRESH_BINARY_INV, 2)) goto err; if (alx_cv_dilate_erode(img_tmp, 100)) goto err; @@ -290,7 +290,7 @@ int find_cerdo (const img_s *restrict img, if (alx_cv_init_rect(rect, lbl_x, lbl_y, lbl_w, lbl_h)) goto err; alx_cv_roi_set(img_tmp, rect); - if (alx_cv_threshold(img_tmp, CV_THRESH_BINARY, ALX_CV_THR_OTSU)) + if (alx_cv_threshold(img_tmp, ALX_CV_THRESH_BINARY, ALX_CV_THR_OTSU)) goto err; if (alx_cv_erode(img_tmp, 1)) goto err; @@ -383,11 +383,11 @@ int read_price (const img_s *restrict img, alx_cv_roi_set(img_tmp, rect); if (alx_cv_smooth(img_tmp, ALX_CV_SMOOTH_MEAN, 3)) goto err; - if (alx_cv_threshold(img_tmp, CV_THRESH_BINARY, ALX_CV_THR_OTSU)) + if (alx_cv_threshold(img_tmp, ALX_CV_THRESH_BINARY, ALX_CV_THR_OTSU)) goto err; if (alx_cv_dilate_erode(img_tmp, 1)) goto err; - if (alx_cv_threshold(img_tmp, CV_THRESH_BINARY, 1)) + if (alx_cv_threshold(img_tmp, ALX_CV_THRESH_BINARY, 1)) goto err; alx_cv_extract_imgdata(img_tmp, &imgdata, NULL, NULL, &imgdata_w, &imgdata_h, @@ -424,13 +424,11 @@ int chk_bcode_price (const char bcode[static restrict BUFSIZ], char bcode_price[BUFSIZ]; if (bcode[8] != '0') { - if (alx_sbprintf(bcode_price, NULL, "%c%c.%c%c", - bcode[8], bcode[9], + if (sbprintf(bcode_price, NULL, "%c%c.%c%c", bcode[8], bcode[9], bcode[10], bcode[11])) return -1; } else { - if (alx_sbprintf(bcode_price, NULL, "%c.%c%c", - bcode[9], + if (sbprintf(bcode_price, NULL, "%c.%c%c", bcode[9], bcode[10], bcode[11])) return -1; } diff --git a/src/parse.c b/src/parse.c index 4f69a06..4ee46c4 100755 --- a/src/parse.c +++ b/src/parse.c @@ -17,6 +17,7 @@ #include <getopt.h> #include <sys/stat.h> +#define ALX_NO_PREFIX #include <libalx/base/errno/error.h> #include <libalx/base/stdio/printf/snprintfs.h> @@ -123,9 +124,9 @@ void parse_file (char fname[static restrict FILENAME_MAX], char *arg) struct stat sb; if (stat(arg, &sb) || !S_ISREG(sb.st_mode)) - alx_error(EXIT_FAILURE, arg); - if (alx_snprintfs(fname, NULL, FILENAME_MAX, "%s", arg)) - alx_error(EXIT_FAILURE, arg); + errorx(EXIT_FAILURE, arg); + if (snprintfs(fname, NULL, FILENAME_MAX, "%s", arg)) + errorx(EXIT_FAILURE, arg); return; } |