summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@ASUS>2018-10-18 13:28:57 +0200
committeralex <alex@ASUS>2018-10-18 13:28:57 +0200
commit8d4fa231c1d13a281b61018f3d34f755bcf0129c (patch)
tree0032dfbfacc3eb4f5418a4b016671ef299a17c40
parent18095a0eb93429361645f944f8d2d7dff3bb8fdd (diff)
Add share/price (config file for OCR); change /home/alex/.vision-artificial -> /home/alex/vision-artificial
-rw-r--r--modules/image/src/img_ocr.c6
-rw-r--r--modules/image/tmp/Makefile49
-rw-r--r--modules/proc/src/proc.c46
-rw-r--r--modules/save/inc/save.h4
-rw-r--r--modules/save/inc/save.hpp4
-rw-r--r--share/price1
6 files changed, 63 insertions, 47 deletions
diff --git a/modules/image/src/img_ocr.c b/modules/image/src/img_ocr.c
index 29b4d27..61dae92 100644
--- a/modules/image/src/img_ocr.c
+++ b/modules/image/src/img_ocr.c
@@ -21,8 +21,8 @@
/* Project -------------------------------------------------------------------*/
/* user_iface_log */
#include "user_iface.h"
- /* user_prog_path */
- #include "save.h"
+ /* share_path */
+ #include "about.h"
/* Module --------------------------------------------------------------------*/
/* data & img_ocr_text & OCR_TEXT_MAX */
@@ -82,7 +82,7 @@ static void img_ocr_read (struct _IplImage *imgptr, void *data)
conf = ((struct Img_Iface_Data_Read *)data)->conf;
switch (conf) {
case 1:
- sprintf(conf_str, "%s/%s", user_prog_path, "price");
+ sprintf(conf_str, "%s/%s", share_path, "price");
break;
}
diff --git a/modules/image/tmp/Makefile b/modules/image/tmp/Makefile
index ee33e31..d9abdc0 100644
--- a/modules/image/tmp/Makefile
+++ b/modules/image/tmp/Makefile
@@ -6,6 +6,7 @@
LIBALX_INC_DIR = $(LIBALX_DIR)/inc/
+ABOUT_INC_DIR = $(ABOUT_DIR)/inc/
SAVE_INC_DIR = $(SAVE_DIR)/inc/
USR_INC_DIR = $(USR_DIR)/inc/
@@ -17,53 +18,53 @@ SRC_DIR = $(IMG_DIR)/src/
_ALL = img_cv.o img_zbar.o img_ocr.o img_orb.o img_iface.o
ALL = $(_ALL) img_mod.o
-IMGCV_INC_USR = user_iface.h
-IMGCV_INC = img_cv.h img_iface.h
-IMGCV_DEPS = $(SRC_DIR)/img_cv.c \
+IMGCV_INC_USR = user_iface.h
+IMGCV_INC = img_cv.h img_iface.h
+IMGCV_DEPS = $(SRC_DIR)/img_cv.c \
$(patsubst %,$(INC_DIR)/%,$(IMGCV_INC)) \
$(patsubst %,$(USR_INC_DIR)/%,$(IMGCV_INC_USR))
-IMGCV_INC_DIRS = -I $(INC_DIR) \
+IMGCV_INC_DIRS = -I $(INC_DIR) \
-I $(USR_INC_DIR) \
-I $(LIBALX_INC_DIR)
-IMGZB_INC_USR = user_iface.h
-IMGZB_INC = img_zbar.h img_iface.h
-IMGZB_DEPS = $(SRC_DIR)/img_zbar.c \
+IMGZB_INC_USR = user_iface.h
+IMGZB_INC = img_zbar.h img_iface.h
+IMGZB_DEPS = $(SRC_DIR)/img_zbar.c \
$(patsubst %,$(INC_DIR)/%,$(IMGZB_INC)) \
$(patsubst %,$(USR_INC_DIR)/%,$(IMGZB_INC_USR))
-IMGZB_INC_DIRS = -I $(INC_DIR) \
+IMGZB_INC_DIRS = -I $(INC_DIR) \
-I $(USR_INC_DIR) \
-I $(LIBALX_INC_DIR)
-IMGOCR_INC_USR = user_iface.h
-IMGOCR_INC_SAVE = save.h
-IMGOCR_INC = img_ocr.h img_iface.h
-IMGOCR_DEPS = $(SRC_DIR)/img_ocr.c \
+IMGOCR_INC_USR = user_iface.h
+IMGOCR_INC_ABOUT = about.h
+IMGOCR_INC = img_ocr.h img_iface.h
+IMGOCR_DEPS = $(SRC_DIR)/img_ocr.c \
$(patsubst %,$(INC_DIR)/%,$(IMGOCR_INC)) \
$(patsubst %,$(USR_INC_DIR)/%,$(IMGOCR_INC_USR)) \
- $(patsubst %,$(SAVE_INC_DIR)/%,$(IMGOCR_INC_SAVE))
-IMGOCR_INC_DIRS = -I $(INC_DIR) \
+ $(patsubst %,$(ABOUT_INC_DIR)/%,$(IMGOCR_INC_ABOUT))
+IMGOCR_INC_DIRS = -I $(INC_DIR) \
-I $(USR_INC_DIR) \
- -I $(SAVE_INC_DIR) \
+ -I $(ABOUT_INC_DIR) \
-I $(LIBALX_INC_DIR)
-IMGORB_INC_USR = user_iface.hpp
-IMGORB_INC = img_orb.hpp img_iface.h
-IMGORB_DEPS = $(SRC_DIR)/img_orb.cpp \
+IMGORB_INC_USR = user_iface.hpp
+IMGORB_INC = img_orb.hpp img_iface.h
+IMGORB_DEPS = $(SRC_DIR)/img_orb.cpp \
$(patsubst %,$(INC_DIR)/%,$(IMGORB_INC)) \
$(patsubst %,$(USR_INC_DIR)/%,$(IMGORB_INC_USR))
-IMGORB_INC_DIRS = -I $(INC_DIR) \
+IMGORB_INC_DIRS = -I $(INC_DIR) \
-I $(USR_INC_DIR) \
-I $(LIBALX_INC_DIR)
-IMGI_INC_SAVE = save.h
-IMGI_INC_USR = user_iface.h
-IMGI_INC = img_iface.h img_cv.h img_zbar.h img_ocr.h img_orb.h
-IMGI_DEPS = $(SRC_DIR)/img_iface.c \
+IMGI_INC_SAVE = save.h
+IMGI_INC_USR = user_iface.h
+IMGI_INC = img_iface.h img_cv.h img_zbar.h img_ocr.h img_orb.h
+IMGI_DEPS = $(SRC_DIR)/img_iface.c \
$(patsubst %,$(INC_DIR)/%,$(IMGI_INC)) \
$(patsubst %,$(SAVE_INC_DIR)/%,$(IMGI_INC_SAVE)) \
$(patsubst %,$(USR_INC_DIR)/%,$(IMGI_INC_USR))
-IMGI_INC_DIRS = -I $(INC_DIR) \
+IMGI_INC_DIRS = -I $(INC_DIR) \
-I $(SAVE_INC_DIR) \
-I $(USR_INC_DIR)
diff --git a/modules/proc/src/proc.c b/modules/proc/src/proc.c
index 0858aa3..ea065b6 100644
--- a/modules/proc/src/proc.c
+++ b/modules/proc/src/proc.c
@@ -6,6 +6,15 @@
/******************************************************************************
******* headers **************************************************************
******************************************************************************/
+/* Standard C ----------------------------------------------------------------*/
+ /* snprintf() & fflush() */
+ #include <stdio.h>
+ /* bool */
+ #include <stdbool.h>
+ /* strcmp() */
+ #include <string.h>
+ /* clock_t & clock() & CLOCKS_PER_SEC */
+ #include <time.h>
/* Packages ------------------------------------------------------------------*/
/* opencv */
@@ -13,28 +22,14 @@
#include <highgui.h>
/* ZBAR_EAN13 */
#include <zbar.h>
-/* * * * * * * * * *
- * * * Standard * * * * * *
- * * * * * * * * * */
- /* opencv */
- #include <cv.h>
- /* opencv gui */
- #include <highgui.h>
- /* snprintf() & fflush() */
- #include <stdio.h>
- /* bool */
- #include <stdbool.h>
- /* strcmp() */
- #include <string.h>
-/* * * * * * * * * *
- * * * Other * * * * * * *
- * * * * * * * * * */
+/* Project -------------------------------------------------------------------*/
/* img_iface_act() */
#include "img_iface.h"
/* WIN_NAME */
#include "user_iface.h"
+/* Module --------------------------------------------------------------------*/
#include "proc.h"
@@ -91,13 +86,32 @@ static void proc_show_img (void);
int proc_iface (int proc_mode)
{
int error;
+ clock_t time_0;
+ clock_t time_1;
+ double time_tot;
+ /* Init timer */
+ time_0 = clock();
+
+ /* Process */
switch (proc_mode) {
case PROC_MODE_ETIQUETA:
error = proc_etiqueta();
break;
}
+ /* End timer */
+ time_1 = clock();
+
+ /* Calculate time in seconds */
+ time_tot = ((double) time_1 - time_0) / CLOCKS_PER_SEC;
+
+ /* Write time into log */
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "Time: %.3lf", time_tot);
+ user_iface_log.lvl[user_iface_log.len] = 2;
+ (user_iface_log.len)++;
+
return error;
}
diff --git a/modules/save/inc/save.h b/modules/save/inc/save.h
index 1a8373b..125e774 100644
--- a/modules/save/inc/save.h
+++ b/modules/save/inc/save.h
@@ -24,8 +24,8 @@
******************************************************************************/
# define ENV_HOME "HOME"
- # define USER_PROG_DIR ".vision-artificial/"
- # define USER_SAVED_DIR ".vision-artificial/saved/"
+ # define USER_PROG_DIR "vision-artificial/"
+ # define USER_SAVED_DIR "vision-artificial/saved/"
# define SAVED_NAME_DEFAULT "saved"
diff --git a/modules/save/inc/save.hpp b/modules/save/inc/save.hpp
index 23084b0..47c9cc8 100644
--- a/modules/save/inc/save.hpp
+++ b/modules/save/inc/save.hpp
@@ -33,8 +33,8 @@ extern "C" {
******************************************************************************/
# define ENV_HOME "HOME"
- # define USER_PROG_DIR ".vision-artificial/"
- # define USER_SAVED_DIR ".vision-artificial/saved/"
+ # define USER_PROG_DIR "vision-artificial/"
+ # define USER_SAVED_DIR "vision-artificial/saved/"
# define SAVED_NAME_DEFAULT "saved"
diff --git a/share/price b/share/price
new file mode 100644
index 0000000..c2b89cc
--- /dev/null
+++ b/share/price
@@ -0,0 +1 @@
+tessedit_char_whitelist 0123456789.€