summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandroColomar <colomar.6.4.3@gmail.com>2018-11-07 16:31:01 +0100
committerAlejandroColomar <colomar.6.4.3@gmail.com>2018-11-07 16:31:01 +0100
commit7b04c03cf9bb40b35ce3d983b27e59f855b76d81 (patch)
treeea1f21a9e63180181d51f65199927526c49af809
parent7c2c88f6b270944613f9a4bfb0d5c1b34367cd4c (diff)
Reorder functions in img_cv to the order used in openCV; Add bounding_rect; Add ROI_2rect;
-rw-r--r--Makefile2
m---------libalx0
-rw-r--r--modules/image/inc/img_cv.hpp19
-rw-r--r--modules/image/inc/img_iface.h25
-rw-r--r--modules/image/inc/img_iface.hpp67
-rw-r--r--modules/image/src/img_cv.cpp379
-rw-r--r--modules/image/src/img_iface.cpp773
-rw-r--r--modules/user/inc/user_iface.h25
-rw-r--r--modules/user/inc/user_iface.hpp25
-rw-r--r--modules/user/src/user_clui.c183
-rw-r--r--modules/user/src/user_tui.c200
11 files changed, 970 insertions, 728 deletions
diff --git a/Makefile b/Makefile
index 691d537..953e881 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
VERSION = 2
-PATCHLEVEL = ~a3
+PATCHLEVEL = ~a4
SUBLEVEL =
EXTRAVERSION =
NAME =
diff --git a/libalx b/libalx
-Subproject 0a5b686849e34ad7d9d3e72b5b7a9c085978aee
+Subproject cb02fe0372356b3949352a78373ce3647168bdb
diff --git a/modules/image/inc/img_cv.hpp b/modules/image/inc/img_cv.hpp
index f408082..fb6e6f3 100644
--- a/modules/image/inc/img_cv.hpp
+++ b/modules/image/inc/img_cv.hpp
@@ -24,28 +24,29 @@
IMG_CV_ACT_FOO = 0,
IMG_CV_ACT_CV = 0x0100,
+ IMG_CV_ACT_AND_2REF,
IMG_CV_ACT_NOT,
IMG_CV_ACT_OR_2REF,
- IMG_CV_ACT_AND_2REF,
- IMG_CV_ACT_CVT_COLOR,
IMG_CV_ACT_COMPONENT,
+ IMG_CV_ACT_ADAPTIVE_THRESHOLD,
+ IMG_CV_ACT_THRESHOLD,
+ IMG_CV_ACT_CVT_COLOR,
+ IMG_CV_ACT_DISTANCE_TRANSFORM,
IMG_CV_ACT_HISTOGRAM,
IMG_CV_ACT_HISTOGRAM_C3,
- IMG_CV_ACT_SMOOTH,
- IMG_CV_ACT_SOBEL,
- IMG_CV_ACT_THRESHOLD,
- IMG_CV_ACT_ADAPTIVE_THRESHOLD,
IMG_CV_ACT_DILATE,
IMG_CV_ACT_ERODE,
+ IMG_CV_ACT_SMOOTH,
+ IMG_CV_ACT_SOBEL,
IMG_CV_ACT_CONTOURS,
IMG_CV_ACT_CONTOURS_SIZE,
- IMG_CV_ACT_MIN_AREA_RECT,
+ IMG_CV_ACT_BOUNDING_RECT,
IMG_CV_ACT_FIT_ELLIPSE,
+ IMG_CV_ACT_MIN_AREA_RECT,
IMG_CV_ACT_ROTATE_ORTO,
IMG_CV_ACT_ROTATE,
IMG_CV_ACT_SET_ROI,
- IMG_CV_ACT_PIXEL_VALUE,
- IMG_CV_ACT_DISTANCE_TRANSFORM
+ IMG_CV_ACT_PIXEL_VALUE
};
diff --git a/modules/image/inc/img_iface.h b/modules/image/inc/img_iface.h
index 9e926d5..8984871 100644
--- a/modules/image/inc/img_iface.h
+++ b/modules/image/inc/img_iface.h
@@ -32,32 +32,33 @@
IMG_IFACE_ACT_FOO = 0,
IMG_IFACE_ACT_CV = 0x0100,
+ IMG_IFACE_ACT_AND_2REF,
IMG_IFACE_ACT_NOT,
IMG_IFACE_ACT_OR_2REF,
- IMG_IFACE_ACT_AND_2REF,
- IMG_IFACE_ACT_CVT_COLOR,
IMG_IFACE_ACT_COMPONENT,
+ IMG_IFACE_ACT_ADAPTIVE_THRESHOLD,
+ IMG_IFACE_ACT_THRESHOLD,
+ IMG_IFACE_ACT_CVT_COLOR,
+ IMG_IFACE_ACT_DISTANCE_TRANSFORM,
IMG_IFACE_ACT_HISTOGRAM,
IMG_IFACE_ACT_HISTOGRAM_C3,
- IMG_IFACE_ACT_SMOOTH,
- IMG_IFACE_ACT_SOBEL,
- IMG_IFACE_ACT_THRESHOLD,
- IMG_IFACE_ACT_ADAPTIVE_THRESHOLD,
IMG_IFACE_ACT_DILATE,
IMG_IFACE_ACT_ERODE,
+ IMG_IFACE_ACT_DILATE_ERODE,
+ IMG_IFACE_ACT_ERODE_DILATE,
+ IMG_IFACE_ACT_SMOOTH,
+ IMG_IFACE_ACT_SOBEL,
IMG_IFACE_ACT_CONTOURS,
IMG_IFACE_ACT_CONTOURS_SIZE,
- IMG_IFACE_ACT_MIN_AREA_RECT,
+ IMG_IFACE_ACT_BOUNDING_RECT,
IMG_IFACE_ACT_FIT_ELLIPSE,
+ IMG_IFACE_ACT_MIN_AREA_RECT,
IMG_IFACE_ACT_ROTATE_ORTO,
IMG_IFACE_ACT_ROTATE,
+ IMG_IFACE_ACT_ROTATE_2RECT,
IMG_IFACE_ACT_SET_ROI,
+ IMG_IFACE_ACT_SET_ROI_2RECT,
IMG_IFACE_ACT_PIXEL_VALUE,
- IMG_IFACE_ACT_DISTANCE_TRANSFORM,
-
- IMG_IFACE_ACT_DILATE_ERODE,
- IMG_IFACE_ACT_ERODE_DILATE,
- IMG_IFACE_ACT_ROTATE_2RECT,
IMG_IFACE_ACT_ZB = 0x0200,
IMG_IFACE_ACT_DECODE,
diff --git a/modules/image/inc/img_iface.hpp b/modules/image/inc/img_iface.hpp
index 82cfe84..fd70067 100644
--- a/modules/image/inc/img_iface.hpp
+++ b/modules/image/inc/img_iface.hpp
@@ -38,32 +38,33 @@
IMG_IFACE_ACT_FOO = 0,
IMG_IFACE_ACT_CV = 0x0100,
+ IMG_IFACE_ACT_AND_2REF,
IMG_IFACE_ACT_NOT,
IMG_IFACE_ACT_OR_2REF,
- IMG_IFACE_ACT_AND_2REF,
- IMG_IFACE_ACT_CVT_COLOR,
IMG_IFACE_ACT_COMPONENT,
+ IMG_IFACE_ACT_ADAPTIVE_THRESHOLD,
+ IMG_IFACE_ACT_THRESHOLD,
+ IMG_IFACE_ACT_CVT_COLOR,
+ IMG_IFACE_ACT_DISTANCE_TRANSFORM,
IMG_IFACE_ACT_HISTOGRAM,
IMG_IFACE_ACT_HISTOGRAM_C3,
- IMG_IFACE_ACT_SMOOTH,
- IMG_IFACE_ACT_SOBEL,
- IMG_IFACE_ACT_THRESHOLD,
- IMG_IFACE_ACT_ADAPTIVE_THRESHOLD,
IMG_IFACE_ACT_DILATE,
IMG_IFACE_ACT_ERODE,
+ IMG_IFACE_ACT_DILATE_ERODE,
+ IMG_IFACE_ACT_ERODE_DILATE,
+ IMG_IFACE_ACT_SMOOTH,
+ IMG_IFACE_ACT_SOBEL,
IMG_IFACE_ACT_CONTOURS,
IMG_IFACE_ACT_CONTOURS_SIZE,
- IMG_IFACE_ACT_MIN_AREA_RECT,
+ IMG_IFACE_ACT_BOUNDING_RECT,
IMG_IFACE_ACT_FIT_ELLIPSE,
+ IMG_IFACE_ACT_MIN_AREA_RECT,
IMG_IFACE_ACT_ROTATE_ORTO,
IMG_IFACE_ACT_ROTATE,
+ IMG_IFACE_ACT_ROTATE_2RECT,
IMG_IFACE_ACT_SET_ROI,
+ IMG_IFACE_ACT_SET_ROI_2RECT,
IMG_IFACE_ACT_PIXEL_VALUE,
- IMG_IFACE_ACT_DISTANCE_TRANSFORM,
-
- IMG_IFACE_ACT_DILATE_ERODE,
- IMG_IFACE_ACT_ERODE_DILATE,
- IMG_IFACE_ACT_ROTATE_2RECT,
IMG_IFACE_ACT_ZB = 0x0200,
IMG_IFACE_ACT_DECODE,
@@ -121,13 +122,24 @@
******* structs **************************************************************
******************************************************************************/
/* img_cv --------------------------------------------------------------------*/
- struct Img_Iface_Data_Cvt_Color {
+ struct Img_Iface_Data_Component {
+ int cmp;
+ };
+
+ struct Img_Iface_Data_Adaptive_Thr {
int method;
+ int thr_typ;
+ int ksize;
};
- struct Img_Iface_Data_Component {
- int cmp;
+ struct Img_Iface_Data_Threshold {
+ int thr_typ;
+ int thr_val;
};
+ struct Img_Iface_Data_Cvt_Color {
+ int method;
+ };
+
struct Img_Iface_Data_Histogram {
class cv::Mat *hist_c0;
@@ -141,27 +153,16 @@
int ksize;
};
+ struct Img_Iface_Data_Dilate_Erode {
+ int i;
+ };
+
struct Img_Iface_Data_Sobel {
int dx;
int dy;
int ksize;
};
- struct Img_Iface_Data_Threshold {
- int thr_typ;
- int thr_val;
- };
-
- struct Img_Iface_Data_Adaptive_Thr {
- int method;
- int thr_typ;
- int ksize;
- };
-
- struct Img_Iface_Data_Dilate_Erode {
- int i;
- };
-
struct Img_Iface_Data_Contours {
std::vector <std::vector <class cv::Point_ <int>>> *contours;
class cv::Mat *hierarchy;
@@ -173,6 +174,12 @@
double *perimeter;
};
+ struct Img_Iface_Data_Bounding_Rect {
+ std::vector <class cv::Point_ <int>> *contour;
+ class cv::Rect_ <int> *rect;
+ bool show;
+ };
+
struct Img_Iface_Data_MinARect {
std::vector <class cv::Point_ <int>> *contour;
class cv::RotatedRect *rect;
diff --git a/modules/image/src/img_cv.cpp b/modules/image/src/img_cv.cpp
index d70072b..8c5eb83 100644
--- a/modules/image/src/img_cv.cpp
+++ b/modules/image/src/img_cv.cpp
@@ -32,29 +32,39 @@
/******************************************************************************
******* static functions *****************************************************
******************************************************************************/
- /* Filters */
+ /* Operations on Arrays */
+static void img_cv_and_2ref (class cv::Mat *imgptr, void *data);
static void img_cv_not (class cv::Mat *imgptr);
static void img_cv_or_2ref (class cv::Mat *imgptr, void *data);
-static void img_cv_and_2ref (class cv::Mat *imgptr, void *data);
-static void img_cv_cvt_color (class cv::Mat *imgptr, void *data);
static void img_cv_component (class cv::Mat *imgptr, void *data);
+ /* Misc. image transformations: threshold */
+static void img_cv_adaptive_thr (class cv::Mat *imgptr, void *data);
+static void img_cv_threshold (class cv::Mat *imgptr, void *data);
+ /* Misc. image transformations: color */
+static void img_cv_cvt_color (class cv::Mat *imgptr, void *data);
+ /* Misc. image transformations: transforms */
+static void img_cv_distance_transform (class cv::Mat *imgptr);
+ /* Histograms */
static void img_cv_histogram (class cv::Mat *imgptr, void *data);
static void img_cv_histogram_c3 (class cv::Mat *imgptr, void *data);
-static void img_cv_smooth (class cv::Mat *imgptr, void *data);
-static void img_cv_sobel (class cv::Mat *imgptr, void *data);
-static void img_cv_threshold (class cv::Mat *imgptr, void *data);
-static void img_cv_adaptive_thr (class cv::Mat *imgptr, void *data);
+ /* Image filtering */
static void img_cv_dilate (class cv::Mat *imgptr, void *data);
static void img_cv_erode (class cv::Mat *imgptr, void *data);
+static void img_cv_smooth (class cv::Mat *imgptr, void *data);
+static void img_cv_sobel (class cv::Mat *imgptr, void *data);
+ /* Structural analysis and shape descriptors */
static void img_cv_contours (class cv::Mat *imgptr, void *data);
static void img_cv_contours_size (void *data);
-static void img_cv_min_area_rect (class cv::Mat *imgptr, void *data);
+static void img_cv_bounding_rect (class cv::Mat *imgptr, void *data);
static void img_cv_fit_ellipse (class cv::Mat *imgptr, void *data);
+static void img_cv_min_area_rect (class cv::Mat *imgptr, void *data);
+ /* Geometric image transformations */
static void img_cv_rotate_orto (class cv::Mat *imgptr, void *data);
static void img_cv_rotate (class cv::Mat *imgptr, void *data);
+ /* ROI */
static void img_cv_set_ROI (class cv::Mat *imgptr, void *data);
+ /* Pixel */
static void img_cv_pixel_value (class cv::Mat *imgptr, void *data);
-static void img_cv_distance_transform (class cv::Mat *imgptr);
/******************************************************************************
@@ -63,21 +73,32 @@ static void img_cv_distance_transform (class cv::Mat *imgptr);
void img_cv_act (class cv::Mat *imgptr, int action, void *data)
{
switch (action) {
+ case IMG_CV_ACT_AND_2REF:
+ img_cv_and_2ref(imgptr, data);
+ break;
case IMG_CV_ACT_NOT:
img_cv_not(imgptr);
break;
case IMG_CV_ACT_OR_2REF:
img_cv_or_2ref(imgptr, data);
break;
- case IMG_CV_ACT_AND_2REF:
- img_cv_and_2ref(imgptr, data);
+ case IMG_CV_ACT_COMPONENT:
+ img_cv_component(imgptr, data);
+ break;
+
+ case IMG_CV_ACT_ADAPTIVE_THRESHOLD:
+ img_cv_adaptive_thr(imgptr, data);
+ break;
+ case IMG_CV_ACT_THRESHOLD:
+ img_cv_threshold(imgptr, data);
break;
case IMG_CV_ACT_CVT_COLOR:
img_cv_cvt_color(imgptr, data);
break;
- case IMG_CV_ACT_COMPONENT:
- img_cv_component(imgptr, data);
+
+ case IMG_CV_ACT_DISTANCE_TRANSFORM:
+ img_cv_distance_transform(imgptr);
break;
case IMG_CV_ACT_HISTOGRAM:
@@ -86,19 +107,6 @@ void img_cv_act (class cv::Mat *imgptr, int action, void *data)
case IMG_CV_ACT_HISTOGRAM_C3:
img_cv_histogram_c3(imgptr, data);
break;
- case IMG_CV_ACT_SMOOTH:
- img_cv_smooth(imgptr, data);
- break;
- case IMG_CV_ACT_SOBEL:
- img_cv_sobel(imgptr, data);
- break;
-
- case IMG_CV_ACT_THRESHOLD:
- img_cv_threshold(imgptr, data);
- break;
- case IMG_CV_ACT_ADAPTIVE_THRESHOLD:
- img_cv_adaptive_thr(imgptr, data);
- break;
case IMG_CV_ACT_DILATE:
img_cv_dilate(imgptr, data);
@@ -106,6 +114,12 @@ void img_cv_act (class cv::Mat *imgptr, int action, void *data)
case IMG_CV_ACT_ERODE:
img_cv_erode(imgptr, data);
break;
+ case IMG_CV_ACT_SMOOTH:
+ img_cv_smooth(imgptr, data);
+ break;
+ case IMG_CV_ACT_SOBEL:
+ img_cv_sobel(imgptr, data);
+ break;
case IMG_CV_ACT_CONTOURS:
img_cv_contours(imgptr, data);
@@ -113,12 +127,15 @@ void img_cv_act (class cv::Mat *imgptr, int action, void *data)
case IMG_CV_ACT_CONTOURS_SIZE:
img_cv_contours_size(data);
break;
- case IMG_CV_ACT_MIN_AREA_RECT:
- img_cv_min_area_rect(imgptr, data);
+ case IMG_CV_ACT_BOUNDING_RECT:
+ img_cv_bounding_rect(imgptr, data);
break;
case IMG_CV_ACT_FIT_ELLIPSE:
img_cv_fit_ellipse(imgptr, data);
break;
+ case IMG_CV_ACT_MIN_AREA_RECT:
+ img_cv_min_area_rect(imgptr, data);
+ break;
case IMG_CV_ACT_ROTATE_ORTO:
img_cv_rotate_orto(imgptr, data);
@@ -134,10 +151,6 @@ void img_cv_act (class cv::Mat *imgptr, int action, void *data)
case IMG_CV_ACT_PIXEL_VALUE:
img_cv_pixel_value(imgptr, data);
break;
-
- case IMG_CV_ACT_DISTANCE_TRANSFORM:
- img_cv_distance_transform(imgptr);
- break;
}
}
@@ -145,19 +158,6 @@ void img_cv_act (class cv::Mat *imgptr, int action, void *data)
/******************************************************************************
******* static functions *****************************************************
******************************************************************************/
-static void img_cv_not (class cv::Mat *imgptr)
-{
- cv::bitwise_not(*imgptr, *imgptr);
-}
-
-static void img_cv_or_2ref (class cv::Mat *imgptr, void *data)
-{
- class cv::Mat *img_ref;
- img_ref = (class cv::Mat *)data;
-
- cv::bitwise_or(*imgptr, *img_ref, *imgptr);
-}
-
static void img_cv_and_2ref (class cv::Mat *imgptr, void *data)
{
class cv::Mat *img_ref;
@@ -166,17 +166,17 @@ static void img_cv_and_2ref (class cv::Mat *imgptr, void *data)
cv::bitwise_and(*imgptr, *img_ref, *imgptr);
}
-static void img_cv_cvt_color (class cv::Mat *imgptr, void *data)
+static void img_cv_not (class cv::Mat *imgptr)
{
- /* Data */
- struct Img_Iface_Data_Cvt_Color *data_cast;
- data_cast = (struct Img_Iface_Data_Cvt_Color *)data;
+ cv::bitwise_not(*imgptr, *imgptr);
+}
- /* Conversion method */
- int method;
- method = data_cast->method;
+static void img_cv_or_2ref (class cv::Mat *imgptr, void *data)
+{
+ class cv::Mat *img_ref;
+ img_ref = (class cv::Mat *)data;
- cv::cvtColor(*imgptr, *imgptr, method, 0);
+ cv::bitwise_or(*imgptr, *img_ref, *imgptr);
}
static void img_cv_component (class cv::Mat *imgptr, void *data)
@@ -204,6 +204,77 @@ static void img_cv_component (class cv::Mat *imgptr, void *data)
cmp_img[2].release();
}
+static void img_cv_adaptive_thr (class cv::Mat *imgptr, void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Adaptive_Thr *data_cast;
+ data_cast = (struct Img_Iface_Data_Adaptive_Thr *)data;
+
+ /* Threshold method */
+ int method;
+ method = data_cast->method;
+ /* Threshold type */
+ int thr_typ;
+ thr_typ = data_cast->thr_typ;
+ /* Neighbourhood size */
+ int ksize;
+ ksize = data_cast->ksize;
+ if (!(ksize % 2)) {
+ ksize++;
+ }
+
+ /* Apply adaptive threshold */
+ cv::adaptiveThreshold(*imgptr, *imgptr, 255, method, thr_typ, ksize,
+ 0);
+}
+
+static void img_cv_threshold (class cv::Mat *imgptr, void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Threshold *data_cast;
+ data_cast = (struct Img_Iface_Data_Threshold *)data;
+
+ /* Threshold type */
+ int thr_typ;
+ thr_typ = data_cast->thr_typ;
+ /* Threshold value */
+ int thr_val;
+ thr_val = data_cast->thr_val;
+ if (thr_val == -1) {
+ thr_typ |= cv::THRESH_OTSU;
+ }
+
+ /* Threshold */
+ cv::threshold(*imgptr, *imgptr, thr_val, 0xFF, thr_typ);
+}
+
+static void img_cv_cvt_color (class cv::Mat *imgptr, void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Cvt_Color *data_cast;
+ data_cast = (struct Img_Iface_Data_Cvt_Color *)data;
+
+ /* Conversion method */
+ int method;
+ method = data_cast->method;
+
+ cv::cvtColor(*imgptr, *imgptr, method, 0);
+}
+
+static void img_cv_distance_transform (class cv::Mat *imgptr)
+{
+ class cv::Mat imgtmp;
+
+ /* Get transform */
+ cv::distanceTransform(*imgptr, imgtmp, CV_DIST_L2, CV_DIST_MASK_PRECISE);
+
+ /* DistanceTransform gives CV_32F image */
+ imgtmp.convertTo(*imgptr, CV_8U);
+
+ /* Cleanup */
+ imgtmp.release();
+}
+
static void img_cv_histogram (class cv::Mat *imgptr, void *data)
{
/* Data */
@@ -316,6 +387,36 @@ static void img_cv_histogram_c3 (class cv::Mat *imgptr, void *data)
cmp_img[2].release();
}
+static void img_cv_dilate (class cv::Mat *imgptr, void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Dilate_Erode *data_cast;
+ data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
+
+ /* Iterations */
+ int i;
+ i = data_cast->i;
+
+ /* Dilate */
+ cv::dilate(*imgptr, *imgptr, cv::Mat(), cv::Point(-1,-1), i,
+ cv::BORDER_REPLICATE);
+}
+
+static void img_cv_erode (class cv::Mat *imgptr, void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Dilate_Erode *data_cast;
+ data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
+
+ /* Iterations */
+ int i;
+ i = data_cast->i;
+
+ /* Erode */
+ cv::erode(*imgptr, *imgptr, cv::Mat(), cv::Point(-1,-1), i,
+ cv::BORDER_REPLICATE);
+}
+
static void img_cv_smooth (class cv::Mat *imgptr, void *data)
{
/* Data */
@@ -370,80 +471,6 @@ static void img_cv_sobel (class cv::Mat *imgptr, void *data)
cv::BORDER_DEFAULT);
}
-static void img_cv_threshold (class cv::Mat *imgptr, void *data)
-{
- /* Data */
- struct Img_Iface_Data_Threshold *data_cast;
- data_cast = (struct Img_Iface_Data_Threshold *)data;
-
- /* Threshold type */
- int thr_typ;
- thr_typ = data_cast->thr_typ;
- /* Threshold value */
- int thr_val;
- thr_val = data_cast->thr_val;
- if (thr_val == -1) {
- thr_typ |= cv::THRESH_OTSU;
- }
-
- /* Threshold */
- cv::threshold(*imgptr, *imgptr, thr_val, 0xFF, thr_typ);
-}
-
-static void img_cv_adaptive_thr (class cv::Mat *imgptr, void *data)
-{
- /* Data */
- struct Img_Iface_Data_Adaptive_Thr *data_cast;
- data_cast = (struct Img_Iface_Data_Adaptive_Thr *)data;
-
- /* Threshold method */
- int method;
- method = data_cast->method;
- /* Threshold type */
- int thr_typ;
- thr_typ = data_cast->thr_typ;
- /* Neighbourhood size */
- int ksize;
- ksize = data_cast->ksize;
- if (!(ksize % 2)) {
- ksize++;
- }
-
- /* Apply adaptive threshold */
- cv::adaptiveThreshold(*imgptr, *imgptr, 255, method, thr_typ, ksize,
- 0);
-}
-
-static void img_cv_dilate (class cv::Mat *imgptr, void *data)
-{
- /* Data */
- struct Img_Iface_Data_Dilate_Erode *data_cast;
- data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
-
- /* Iterations */
- int i;
- i = data_cast->i;
-
- /* Dilate */
- cv::dilate(*imgptr, *imgptr, cv::Mat(), cv::Point(-1,-1), i,
- cv::BORDER_REPLICATE);
-}
-
-static void img_cv_erode (class cv::Mat *imgptr, void *data)
-{
- /* Data */
- struct Img_Iface_Data_Dilate_Erode *data_cast;
- data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
-
- /* Iterations */
- int i;
- i = data_cast->i;
-
- /* Erode */
- cv::erode(*imgptr, *imgptr, cv::Mat(), cv::Point(-1,-1), i,
- cv::BORDER_REPLICATE);
-}
-
static void img_cv_contours (class cv::Mat *imgptr, void *data)
{
/* Data */
@@ -485,7 +512,52 @@ static void img_cv_contours_size (void *data)
}
}
-static void img_cv_min_area_rect (class cv::Mat *imgptr, void *data)
+static void img_cv_bounding_rect (class cv::Mat *imgptr, void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Bounding_Rect *data_cast;
+ data_cast = (struct Img_Iface_Data_Bounding_Rect *)data;
+
+ /* Contours */
+ std::vector <class cv::Point_ <int>> *contour;
+ contour = data_cast->contour;
+ /* Rotated rectangle */
+ class cv::Rect_ <int> *rect;
+ rect = data_cast->rect;
+ /* Show rectangle ? */
+ bool show;
+ show = data_cast->show;
+
+ /* Get rectangle */
+ *rect = cv::boundingRect(*contour);
+
+ /* Draw rectangle */
+ class cv::Point_<float> vertices[4];
+ if (show) {
+ vertices[0].x = rect->x;
+ vertices[0].y = rect->y;
+ vertices[1].x = rect->x + rect->width;
+ vertices[1].y = rect->y;
+ vertices[2].x = rect->x + rect->width;
+ vertices[2].y = rect->y + rect->height;
+ vertices[3].x = rect->x;
+ vertices[3].y = rect->y + rect->height;
+ cv::line(*imgptr, cv::Point(vertices[0].x, vertices[0].y),
+ cv::Point(vertices[1].x, vertices[1].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ cv::line(*imgptr, cv::Point(vertices[1].x, vertices[1].y),
+ cv::Point(vertices[2].x, vertices[2].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ cv::line(*imgptr, cv::Point(vertices[2].x, vertices[2].y),
+ cv::Point(vertices[3].x, vertices[3].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ cv::line(*imgptr, cv::Point(vertices[3].x, vertices[3].y),
+ cv::Point(vertices[0].x, vertices[0].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ }
+}
+
+static void img_cv_fit_ellipse (class cv::Mat *imgptr, void *data)
{
/* Data */
struct Img_Iface_Data_MinARect *data_cast;
@@ -502,7 +574,7 @@ static void img_cv_min_area_rect (class cv::Mat *imgptr, void *data)
show = data_cast->show;
/* Get rectangle */
- *rect = cv::minAreaRect(*contour);
+ *rect = cv::fitEllipse(*contour);
/* Draw rectangle */
class cv::Point_<float> vertices[4];
@@ -523,7 +595,7 @@ static void img_cv_min_area_rect (class cv::Mat *imgptr, void *data)
}
}
-static void img_cv_fit_ellipse (class cv::Mat *imgptr, void *data)
+static void img_cv_min_area_rect (class cv::Mat *imgptr, void *data)
{
/* Data */
struct Img_Iface_Data_MinARect *data_cast;
@@ -535,25 +607,30 @@ static void img_cv_fit_ellipse (class cv::Mat *imgptr, void *data)
/* Rotated rectangle */
class cv::RotatedRect *rect;
rect = data_cast->rect;
+ /* Show rectangle ? */
+ bool show;
+ show = data_cast->show;
/* Get rectangle */
- *rect = cv::fitEllipse(*contour);
+ *rect = cv::minAreaRect(*contour);
/* Draw rectangle */
class cv::Point_<float> vertices[4];
- rect->points(vertices);
- cv::line(*imgptr, cv::Point(vertices[0].x, vertices[0].y),
- cv::Point(vertices[1].x, vertices[1].y),
- CV_RGB(0, 0, 255), 1, 8, 0);
- cv::line(*imgptr, cv::Point(vertices[1].x, vertices[1].y),
- cv::Point(vertices[2].x, vertices[2].y),
- CV_RGB(0, 0, 255), 1, 8, 0);
- cv::line(*imgptr, cv::Point(vertices[2].x, vertices[2].y),
- cv::Point(vertices[3].x, vertices[3].y),
- CV_RGB(0, 0, 255), 1, 8, 0);
- cv::line(*imgptr, cv::Point(vertices[3].x, vertices[3].y),
- cv::Point(vertices[0].x, vertices[0].y),
- CV_RGB(0, 0, 255), 1, 8, 0);
+ if (show) {
+ rect->points(vertices);
+ cv::line(*imgptr, cv::Point(vertices[0].x, vertices[0].y),
+ cv::Point(vertices[1].x, vertices[1].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ cv::line(*imgptr, cv::Point(vertices[1].x, vertices[1].y),
+ cv::Point(vertices[2].x, vertices[2].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ cv::line(*imgptr, cv::Point(vertices[2].x, vertices[2].y),
+ cv::Point(vertices[3].x, vertices[3].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ cv::line(*imgptr, cv::Point(vertices[3].x, vertices[3].y),
+ cv::Point(vertices[0].x, vertices[0].y),
+ CV_RGB(0, 0, 255), 1, 8, 0);
+ }
}
static void img_cv_rotate_orto (class cv::Mat *imgptr, void *data)
@@ -648,20 +725,6 @@ static void img_cv_pixel_value (class cv::Mat *imgptr, void *data)
*val = imgptr->at<unsigned char>(y, x);
}
-static void img_cv_distance_transform (class cv::Mat *imgptr)
-{
- class cv::Mat imgtmp;
-
- /* Get transform */
- cv::distanceTransform(*imgptr, imgtmp, CV_DIST_L2, CV_DIST_MASK_PRECISE);
-
- /* DistanceTransform gives CV_32F image */
- imgtmp.convertTo(*imgptr, CV_8U);
-
- /* Cleanup */
- imgtmp.release();
-}
-
/******************************************************************************
******* end of file **********************************************************
diff --git a/modules/image/src/img_iface.cpp b/modules/image/src/img_iface.cpp
index cb28790..c275836 100644
--- a/modules/image/src/img_iface.cpp
+++ b/modules/image/src/img_iface.cpp
@@ -68,53 +68,66 @@ static std::vector <std::vector <cv::Point_ <int>>> contours;
static double area [CONTOURS_MAX];
static double perimeter [CONTOURS_MAX];
static class cv::Mat hierarchy;
-static class cv::RotatedRect rectangle;
+static class cv::Rect_ <int> rectangle;
+static class cv::RotatedRect rectangle_rot;
/******************************************************************************
******* static functions *****************************************************
******************************************************************************/
/* img_cv */
-static void img_iface_not (void);
-static void img_iface_or_2ref (void);
-static void img_iface_and_2ref (void);
-static void img_iface_cvt_color (void *data);
-static void img_iface_component (void *data);
-static void img_iface_histogram (void *data);
-static void img_iface_histogram_c3 (void *data);
-static void img_iface_smooth (void *data);
-static void img_iface_sobel (void *data);
-static void img_iface_threshold (void *data);
-static void img_iface_adaptive_thr (void *data);
-static void img_iface_dilate (void *data);
-static void img_iface_erode (void *data);
-static void img_iface_contours (void *data);
-static void img_iface_contours_size (void *data);
-static void img_iface_min_area_rect (void *data);
-static void img_iface_fit_ellipse (void *data);
-static void img_iface_rotate_orto (void *data);
-static void img_iface_rotate (void *data);
-static void img_iface_set_ROI (void *data);
-static void img_iface_pixel_value (void *data);
+ /* Operations on Arrays */
+static void img_iface_and_2ref (void);
+static void img_iface_not (void);
+static void img_iface_or_2ref (void);
+static void img_iface_component (void *data);
+ /* Misc. image transformations: threshold */
+static void img_iface_adaptive_thr (void *data);
+static void img_iface_threshold (void *data);
+ /* Misc. image transformations: color */
+static void img_iface_cvt_color (void *data);
+ /* Misc. image transformations: transforms */
static void img_iface_distance_transform (void);
+ /* Histograms */
+static void img_iface_histogram (void *data);
+static void img_iface_histogram_c3 (void *data);
+ /* Image filtering */
+static void img_iface_dilate (void *data);
+static void img_iface_erode (void *data);
+static void img_iface_dilate_erode (void *data);
+static void img_iface_erode_dilate (void *data);
+static void img_iface_smooth (void *data);
+static void img_iface_sobel (void *data);
+ /* Structural analysis and shape descriptors */
+static void img_iface_contours (void *data);
+static void img_iface_contours_size (void *data);
+static void img_iface_bounding_rect (void *data);
+static void img_iface_fit_ellipse (void *data);
+static void img_iface_min_area_rect (void *data);
+ /* Geometric image transformations */
+static void img_iface_rotate_orto (void *data);
+static void img_iface_rotate (void *data);
+static void img_iface_rotate_2rect (void *data);
+ /* ROI */
+static void img_iface_set_ROI (void *data);
+static void img_iface_set_ROI_2rect (void *data);
+ /* Pixel */
+static void img_iface_pixel_value (void *data);
-static void img_iface_dilate_erode (void *data);
-static void img_iface_erode_dilate (void *data);
-static void img_iface_rotate_2rect (void *data);
/* img_zbar */
-static void img_iface_decode (void *data);
+static void img_iface_decode (void *data);
/* img_ocr */
-static void img_iface_read (void *data);
+static void img_iface_read (void *data);
/* img_orb */
-static void img_iface_align (void);
+static void img_iface_align (void);
/* img_iface */
-static void img_iface_apply (void);
-static void img_iface_discard (void);
-static void img_iface_save_mem (void *data);
-static void img_iface_load_mem (void *data);
-static void img_iface_save_ref (void);
+static void img_iface_apply (void);
+static void img_iface_discard (void);
+static void img_iface_save_mem (void *data);
+static void img_iface_load_mem (void *data);
+static void img_iface_save_ref (void);
/* save */
-static void img_iface_save_file (void);
+static void img_iface_save_file (void);
/******************************************************************************
@@ -192,82 +205,98 @@ void img_iface_act (int action, void *data)
{
switch (action) {
/* img_cv */
+ /* Operations on Arrays */
+ case IMG_IFACE_ACT_AND_2REF:
+ img_iface_and_2ref();
+ break;
case IMG_IFACE_ACT_NOT:
img_iface_not();
break;
case IMG_IFACE_ACT_OR_2REF:
img_iface_or_2ref();
break;
- case IMG_IFACE_ACT_AND_2REF:
- img_iface_and_2ref();
+ case IMG_IFACE_ACT_COMPONENT:
+ img_iface_component(data);
+ break;
+ /* Misc. image transformations: threshold */
+ case IMG_IFACE_ACT_ADAPTIVE_THRESHOLD:
+ img_iface_adaptive_thr(data);
break;
+ case IMG_IFACE_ACT_THRESHOLD:
+ img_iface_threshold(data);
+ break;
+ /* Misc. image transformations: color */
case IMG_IFACE_ACT_CVT_COLOR:
img_iface_cvt_color(data);
break;
- case IMG_IFACE_ACT_COMPONENT:
- img_iface_component(data);
+ /* Misc. image transformations: transforms */
+ case IMG_IFACE_ACT_DISTANCE_TRANSFORM:
+ img_iface_distance_transform();
break;
+ /* Histograms */
case IMG_IFACE_ACT_HISTOGRAM:
img_iface_histogram(data);
break;
case IMG_IFACE_ACT_HISTOGRAM_C3:
img_iface_histogram_c3(data);
break;
- case IMG_IFACE_ACT_SMOOTH:
- img_iface_smooth(data);
- break;
- case IMG_IFACE_ACT_SOBEL:
- img_iface_sobel(data);
- break;
- case IMG_IFACE_ACT_THRESHOLD:
- img_iface_threshold(data);
- break;
- case IMG_IFACE_ACT_ADAPTIVE_THRESHOLD:
- img_iface_adaptive_thr(data);
- break;
+ /* Image filtering */
case IMG_IFACE_ACT_DILATE:
img_iface_dilate(data);
break;
case IMG_IFACE_ACT_ERODE:
img_iface_erode(data);
break;
+ case IMG_IFACE_ACT_DILATE_ERODE:
+ img_iface_dilate_erode(data);
+ break;
+ case IMG_IFACE_ACT_ERODE_DILATE:
+ img_iface_erode_dilate(data);
+ break;
+ case IMG_IFACE_ACT_SMOOTH:
+ img_iface_smooth(data);
+ break;
+ case IMG_IFACE_ACT_SOBEL:
+ img_iface_sobel(data);
+ break;
+ /* Structural analysis and shape descriptors */
case IMG_IFACE_ACT_CONTOURS:
img_iface_contours(data);
break;
case IMG_IFACE_ACT_CONTOURS_SIZE:
img_iface_contours_size(data);
break;
- case IMG_IFACE_ACT_MIN_AREA_RECT:
- img_iface_min_area_rect(data);
+ case IMG_IFACE_ACT_BOUNDING_RECT:
+ img_iface_bounding_rect(data);
break;
case IMG_IFACE_ACT_FIT_ELLIPSE:
img_iface_fit_ellipse(data);
break;
+ case IMG_IFACE_ACT_MIN_AREA_RECT:
+ img_iface_min_area_rect(data);
+ break;
+ /* Geometric image transformations */
case IMG_IFACE_ACT_ROTATE_ORTO:
img_iface_rotate_orto(data);
break;
case IMG_IFACE_ACT_ROTATE:
img_iface_rotate(data);
break;
+ case IMG_IFACE_ACT_ROTATE_2RECT:
+ img_iface_rotate_2rect(data);
+ break;
+ /* ROI */
case IMG_IFACE_ACT_SET_ROI:
img_iface_set_ROI(data);
break;
+ case IMG_IFACE_ACT_SET_ROI_2RECT:
+ img_iface_set_ROI_2rect(data);
+ break;
+ /* Pixel */
case IMG_IFACE_ACT_PIXEL_VALUE:
img_iface_pixel_value(data);
break;
- case IMG_IFACE_ACT_DISTANCE_TRANSFORM:
- img_iface_distance_transform();
- break;
- case IMG_IFACE_ACT_DILATE_ERODE:
- img_iface_dilate_erode(data);
- break;
- case IMG_IFACE_ACT_ERODE_DILATE:
- img_iface_erode_dilate(data);
- break;
- case IMG_IFACE_ACT_ROTATE_2RECT:
- img_iface_rotate_2rect(data);
- break;
/* img_zbar */
case IMG_IFACE_ACT_DECODE:
@@ -335,19 +364,8 @@ void img_iface_show_hist_c3 (void)
******* static functions *****************************************************
******************************************************************************/
/* img_cv --------------------------------------------------------------------*/
-static void img_iface_not (void)
-{
- /* Write into log */
- snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Invert color");
- user_iface_log.lvl[user_iface_log.len] = 1;
- (user_iface_log.len)++;
-
- /* Bitwise NOT */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_NOT, NULL);
-}
-
-static void img_iface_or_2ref (void)
+/* ----- Operations on arrays */
+static void img_iface_and_2ref (void)
{
/* Must have same channels */
if (image_copy_tmp.channels() != image_ref.channels()) {
@@ -362,41 +380,30 @@ static void img_iface_or_2ref (void)
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Bitwise OR");
+ "Bitwise AND");
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Bitwise OR to reference */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_OR_2REF, (void *)&image_ref);
+ /* Bitwise AND to reference */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_AND_2REF, (void *)&image_ref);
}
-static void img_iface_and_2ref (void)
+static void img_iface_not (void)
{
- /* Must have same channels */
- if (image_copy_tmp.channels() != image_ref.channels()) {
- /* Write into log */
- snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "! Invalid input");
- user_iface_log.lvl[user_iface_log.len] = 1;
- (user_iface_log.len)++;
-
- return;
- }
-
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Bitwise AND");
+ "Invert color");
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Bitwise AND to reference */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_AND_2REF, (void *)&image_ref);
+ /* Bitwise NOT */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_NOT, NULL);
}
-static void img_iface_cvt_color (void *data)
+static void img_iface_or_2ref (void)
{
- /* Must have at least 3 channels */
- if (image_copy_tmp.channels() < 3) {
+ /* Must have same channels */
+ if (image_copy_tmp.channels() != image_ref.channels()) {
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
"! Invalid input");
@@ -406,33 +413,17 @@ static void img_iface_cvt_color (void *data)
return;
}
- /* Data */
- struct Img_Iface_Data_Cvt_Color data_tmp;
- if (!data) {
- /* Ask user */
- char title [80];
- snprintf(title, 80, "Method: BGR2GRAY = 6, BGR2HSV = 40");
- data_tmp.method = user_iface_getint(0, 0,
- cv::COLOR_COLORCVT_MAX,
- title, NULL);
-
- data = (void *)&data_tmp;
- }
-
/* Write into log */
- struct Img_Iface_Data_Cvt_Color *data_cast;
- data_cast = (struct Img_Iface_Data_Cvt_Color *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Convert color %i",
- data_cast->method);
+ "Bitwise OR");
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Filter: BGR to gray */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_CVT_COLOR, data);
+ /* Bitwise OR to reference */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_OR_2REF, (void *)&image_ref);
}
-static void img_iface_component (void *data)
+static void img_iface_component (void *data)
{
/* Must have at least 3 channels */
if (image_copy_tmp.channels() < 3) {
@@ -471,7 +462,8 @@ static void img_iface_component (void *data)
img_cv_act(&image_copy_tmp, IMG_CV_ACT_COMPONENT, data);
}
-static void img_iface_histogram (void *data)
+/* ----- Misc. image transformations: threshold */
+static void img_iface_adaptive_thr (void *data)
{
/* Must have 1 channel */
if (image_copy_tmp.channels() != 1) {
@@ -485,28 +477,41 @@ static void img_iface_histogram (void *data)
}
/* Data */
- struct Img_Iface_Data_Histogram data_tmp;
+ struct Img_Iface_Data_Adaptive_Thr data_tmp;
if (!data) {
- data_tmp.hist_c0 = &histogram_c0;
- data_tmp.hist_img = &hist_img_c1;
+ /* Ask user */
+ char title [80];
+ snprintf(title, 80, "Method: MEAN=0, GAUSS=1");
+ data_tmp.method = user_iface_getint(0, 1, 1, title, NULL);
+
+ snprintf(title, 80, "Type: BIN=0, BIN_INV=1");
+ data_tmp.thr_typ = user_iface_getint(0, 0, 1, title, NULL);
+
+ snprintf(title, 80, "Kernel size: 3, 5, 7, ...");
+ data_tmp.ksize = user_iface_getint(3, 3, INFINITY, title, NULL);
data = (void *)&data_tmp;
}
/* Write into log */
+ struct Img_Iface_Data_Adaptive_Thr *data_cast;
+ data_cast = (struct Img_Iface_Data_Adaptive_Thr *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Histogram");
+ "Threshold mth=%i, typ=%i, ks=%i",
+ data_cast->method,
+ data_cast->thr_typ,
+ data_cast->ksize);
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Histogram */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_HISTOGRAM, data);
+ /* Filter: adaptive threshold */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_ADAPTIVE_THRESHOLD, data);
}
-static void img_iface_histogram_c3 (void *data)
+static void img_iface_threshold (void *data)
{
/* Must have 1 channel */
- if (image_copy_tmp.channels() != 3) {
+ if (image_copy_tmp.channels() != 1) {
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
"! Invalid input");
@@ -517,58 +522,75 @@ static void img_iface_histogram_c3 (void *data)
}
/* Data */
- struct Img_Iface_Data_Histogram data_tmp;
+ struct Img_Iface_Data_Threshold data_tmp;
if (!data) {
- data_tmp.hist_c0 = &histogram_c0;
- data_tmp.hist_c1 = &histogram_c1;
- data_tmp.hist_c2 = &histogram_c2;
- data_tmp.hist_img = &hist_img_c3;
+ /* Ask user */
+ char title [80];
+ snprintf(title, 80, "Type: BIN=0, BIN_INV=1, TRUNC=2, TOZ=3, TOZ_INV=4");
+ data_tmp.thr_typ = user_iface_getint(0, 0, 4, title, NULL);
+
+ snprintf(title, 80, "Value: 0 to 255 (or -1 for Otsu's algorithm)");
+ data_tmp.thr_val = user_iface_getint(-1, 0, 255, title, NULL);
data = (void *)&data_tmp;
}
/* Write into log */
+ struct Img_Iface_Data_Threshold *data_cast;
+ data_cast = (struct Img_Iface_Data_Threshold *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Histogram (3 channels)");
+ "Threshold typ=%i, val=%i",
+ data_cast->thr_typ,
+ data_cast->thr_val);
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Histogram */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_HISTOGRAM_C3, data);
+ /* Filter: threshold */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_THRESHOLD, data);
}
-static void img_iface_smooth (void *data)
+/* ----- Misc. image transformations: color */
+static void img_iface_cvt_color (void *data)
{
+ /* Must have at least 3 channels */
+ if (image_copy_tmp.channels() < 3) {
+ /* Write into log */
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "! Invalid input");
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ return;
+ }
+
/* Data */
- struct Img_Iface_Data_Smooth data_tmp;
+ struct Img_Iface_Data_Cvt_Color data_tmp;
if (!data) {
/* Ask user */
char title [80];
- snprintf(title, 80, "Method: MEAN=1, GAUSS=2, MEDIAN=3");
- data_tmp.method = user_iface_getint(1, 3, 3, title, NULL);
-
- snprintf(title, 80, "Kernel size: 3, 5, 7, ...");
- data_tmp.ksize = user_iface_getint(3, 3, INFINITY, title, NULL);
+ snprintf(title, 80, "Method: BGR2GRAY = 6, BGR2HSV = 40");
+ data_tmp.method = user_iface_getint(0, 0,
+ cv::COLOR_COLORCVT_MAX,
+ title, NULL);
data = (void *)&data_tmp;
}
/* Write into log */
- struct Img_Iface_Data_Smooth *data_cast;
- data_cast = (struct Img_Iface_Data_Smooth *)data;
+ struct Img_Iface_Data_Cvt_Color *data_cast;
+ data_cast = (struct Img_Iface_Data_Cvt_Color *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Smooth mth=%i [%ix%i]",
- data_cast->method,
- data_cast->ksize,
- data_cast->ksize);
+ "Convert color %i",
+ data_cast->method);
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Filter: smooth */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_SMOOTH, data);
+ /* Filter: BGR to gray */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_CVT_COLOR, data);
}
-static void img_iface_sobel (void *data)
+/* ----- Misc. image transformations: transforms */
+static void img_iface_distance_transform (void)
{
/* Must have 1 channel */
if (image_copy_tmp.channels() != 1) {
@@ -581,39 +603,18 @@ static void img_iface_sobel (void *data)
return;
}
- /* Data */
- struct Img_Iface_Data_Sobel data_tmp;
- if (!data) {
- /* Ask user */
- char title [80];
- snprintf(title, 80, "Order of the derivative x");
- data_tmp.dx = user_iface_getint(0, 1, 10, title, NULL);
-
- snprintf(title, 80, "Order of the derivative y");
- data_tmp.dy = user_iface_getint(0, 1, 10, title, NULL);
-
- snprintf(title, 80, "Size of the extended Sobel kernel (-1 -> Scharr");
- data_tmp.ksize = user_iface_getint(-1, 3, 7, title, NULL);
-
- data = (void *)&data_tmp;
- }
-
/* Write into log */
- struct Img_Iface_Data_Sobel *data_cast;
- data_cast = (struct Img_Iface_Data_Sobel *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Sobel dx=%i;dy=%i [ks=%i]",
- data_cast->dx,
- data_cast->dy,
- data_cast->ksize);
+ "Distance transform");
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Filter: sobel */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_SOBEL, data);
+ /* Distance transform */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_DISTANCE_TRANSFORM, NULL);
}
-static void img_iface_threshold (void *data)
+/* ----- Histograms */
+static void img_iface_histogram (void *data)
{
/* Must have 1 channel */
if (image_copy_tmp.channels() != 1) {
@@ -627,37 +628,28 @@ static void img_iface_threshold (void *data)
}
/* Data */
- struct Img_Iface_Data_Threshold data_tmp;
+ struct Img_Iface_Data_Histogram data_tmp;
if (!data) {
- /* Ask user */
- char title [80];
- snprintf(title, 80, "Type: BIN=0, BIN_INV=1, TRUNC=2, TOZ=3, TOZ_INV=4");
- data_tmp.thr_typ = user_iface_getint(0, 0, 4, title, NULL);
-
- snprintf(title, 80, "Value: 0 to 255 (or -1 for Otsu's algorithm)");
- data_tmp.thr_val = user_iface_getint(-1, 0, 255, title, NULL);
+ data_tmp.hist_c0 = &histogram_c0;
+ data_tmp.hist_img = &hist_img_c1;
data = (void *)&data_tmp;
}
/* Write into log */
- struct Img_Iface_Data_Threshold *data_cast;
- data_cast = (struct Img_Iface_Data_Threshold *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Threshold typ=%i, val=%i",
- data_cast->thr_typ,
- data_cast->thr_val);
+ "Histogram");
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Filter: threshold */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_THRESHOLD, data);
+ /* Histogram */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_HISTOGRAM, data);
}
-static void img_iface_adaptive_thr (void *data)
+static void img_iface_histogram_c3 (void *data)
{
/* Must have 1 channel */
- if (image_copy_tmp.channels() != 1) {
+ if (image_copy_tmp.channels() != 3) {
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
"! Invalid input");
@@ -668,38 +660,80 @@ static void img_iface_adaptive_thr (void *data)
}
/* Data */
- struct Img_Iface_Data_Adaptive_Thr data_tmp;
+ struct Img_Iface_Data_Histogram data_tmp;
+ if (!data) {
+ data_tmp.hist_c0 = &histogram_c0;
+ data_tmp.hist_c1 = &histogram_c1;
+ data_tmp.hist_c2 = &histogram_c2;
+ data_tmp.hist_img = &hist_img_c3;
+
+ data = (void *)&data_tmp;
+ }
+
+ /* Write into log */
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "Histogram (3 channels)");
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ /* Histogram */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_HISTOGRAM_C3, data);
+}
+
+/* ----- Image filtering */
+static void img_iface_dilate (void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Dilate_Erode data_tmp;
if (!data) {
/* Ask user */
char title [80];
- snprintf(title, 80, "Method: MEAN=0, GAUSS=1");
- data_tmp.method = user_iface_getint(0, 1, 1, title, NULL);
+ snprintf(title, 80, "Iterations:");
+ data_tmp.i = user_iface_getint(1, 1, INFINITY, title, NULL);
- snprintf(title, 80, "Type: BIN=0, BIN_INV=1");
- data_tmp.thr_typ = user_iface_getint(0, 0, 1, title, NULL);
+ data = (void *)&data_tmp;
+ }
- snprintf(title, 80, "Kernel size: 3, 5, 7, ...");
- data_tmp.ksize = user_iface_getint(3, 3, INFINITY, title, NULL);
+ /* Write into log */
+ struct Img_Iface_Data_Dilate_Erode *data_cast;
+ data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "Dilate i=%i",
+ data_cast->i);
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ /* Dilate */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_DILATE, data);
+}
+
+static void img_iface_erode (void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Dilate_Erode data_tmp;
+ if (!data) {
+ /* Ask user */
+ char title [80];
+ snprintf(title, 80, "Iterations:");
+ data_tmp.i = user_iface_getint(1, 1, INFINITY, title, NULL);
data = (void *)&data_tmp;
}
/* Write into log */
- struct Img_Iface_Data_Adaptive_Thr *data_cast;
- data_cast = (struct Img_Iface_Data_Adaptive_Thr *)data;
+ struct Img_Iface_Data_Dilate_Erode *data_cast;
+ data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Threshold mth=%i, typ=%i, ks=%i",
- data_cast->method,
- data_cast->thr_typ,
- data_cast->ksize);
+ "Erode i=%i",
+ data_cast->i);
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Filter: adaptive threshold */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_ADAPTIVE_THRESHOLD, data);
+ /* Erode */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_ERODE, data);
}
-static void img_iface_dilate (void *data)
+static void img_iface_dilate_erode (void *data)
{
/* Data */
struct Img_Iface_Data_Dilate_Erode data_tmp;
@@ -716,16 +750,17 @@ static void img_iface_dilate (void *data)
struct Img_Iface_Data_Dilate_Erode *data_cast;
data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Dilate i=%i",
+ "Dilate-erode i=%i",
data_cast->i);
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
/* Dilate */
img_cv_act(&image_copy_tmp, IMG_CV_ACT_DILATE, data);
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_ERODE, data);
}
-static void img_iface_erode (void *data)
+static void img_iface_erode_dilate (void *data)
{
/* Data */
struct Img_Iface_Data_Dilate_Erode data_tmp;
@@ -742,16 +777,94 @@ static void img_iface_erode (void *data)
struct Img_Iface_Data_Dilate_Erode *data_cast;
data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Erode i=%i",
+ "Erode-dilate i=%i",
data_cast->i);
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
- /* Erode */
+ /* Dilate */
img_cv_act(&image_copy_tmp, IMG_CV_ACT_ERODE, data);
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_DILATE, data);
+}
+
+static void img_iface_smooth (void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Smooth data_tmp;
+ if (!data) {
+ /* Ask user */
+ char title [80];
+ snprintf(title, 80, "Method: MEAN=1, GAUSS=2, MEDIAN=3");
+ data_tmp.method = user_iface_getint(1, 3, 3, title, NULL);
+
+ snprintf(title, 80, "Kernel size: 3, 5, 7, ...");
+ data_tmp.ksize = user_iface_getint(3, 3, INFINITY, title, NULL);
+
+ data = (void *)&data_tmp;
+ }
+
+ /* Write into log */
+ struct Img_Iface_Data_Smooth *data_cast;
+ data_cast = (struct Img_Iface_Data_Smooth *)data;
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "Smooth mth=%i [%ix%i]",
+ data_cast->method,
+ data_cast->ksize,
+ data_cast->ksize);
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ /* Filter: smooth */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_SMOOTH, data);
}
-static void img_iface_contours (void *data)
+static void img_iface_sobel (void *data)
+{
+ /* Must have 1 channel */
+ if (image_copy_tmp.channels() != 1) {
+ /* Write into log */
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "! Invalid input");
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ return;
+ }
+
+ /* Data */
+ struct Img_Iface_Data_Sobel data_tmp;
+ if (!data) {
+ /* Ask user */
+ char title [80];
+ snprintf(title, 80, "Order of the derivative x");
+ data_tmp.dx = user_iface_getint(0, 1, 10, title, NULL);
+
+ snprintf(title, 80, "Order of the derivative y");
+ data_tmp.dy = user_iface_getint(0, 1, 10, title, NULL);
+
+ snprintf(title, 80, "Size of the extended Sobel kernel (-1 -> Scharr");
+ data_tmp.ksize = user_iface_getint(-1, 3, 7, title, NULL);
+
+ data = (void *)&data_tmp;
+ }
+
+ /* Write into log */
+ struct Img_Iface_Data_Sobel *data_cast;
+ data_cast = (struct Img_Iface_Data_Sobel *)data;
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "Sobel dx=%i;dy=%i [ks=%i]",
+ data_cast->dx,
+ data_cast->dy,
+ data_cast->ksize);
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ /* Filter: sobel */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_SOBEL, data);
+}
+
+/* ----- Structural analysis and shape descriptors */
+static void img_iface_contours (void *data)
{
/* Must have 1 channel */
if (image_copy_tmp.channels() != 1) {
@@ -786,7 +899,7 @@ static void img_iface_contours (void *data)
(user_iface_log.len)++;
}
-static void img_iface_contours_size (void *data)
+static void img_iface_contours_size (void *data)
{
/* Data */
struct Img_Iface_Data_Contours_Size data_tmp;
@@ -820,10 +933,10 @@ static void img_iface_contours_size (void *data)
}
}
-static void img_iface_min_area_rect (void *data)
+static void img_iface_bounding_rect (void *data)
{
/* Data */
- struct Img_Iface_Data_MinARect data_tmp;
+ struct Img_Iface_Data_Bounding_Rect data_tmp;
if (!data) {
if(!contours.size()) {
/* Write into log */
@@ -844,15 +957,15 @@ static void img_iface_min_area_rect (void *data)
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Min area rectangle");
+ "Bounding rectangle");
user_iface_log.lvl[user_iface_log.len] = 1;
(user_iface_log.len)++;
/* Enclosing rectangle */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_MIN_AREA_RECT, data);
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_BOUNDING_RECT, data);
}
-static void img_iface_fit_ellipse (void *data)
+static void img_iface_fit_ellipse (void *data)
{
/* Data */
struct Img_Iface_Data_MinARect data_tmp;
@@ -869,7 +982,7 @@ static void img_iface_fit_ellipse (void *data)
}
data_tmp.contour = &(contours[0]);
- data_tmp.rect = &rectangle;
+ data_tmp.rect = &rectangle_rot;
data = (void *)&data_tmp;
}
@@ -884,7 +997,40 @@ static void img_iface_fit_ellipse (void *data)
img_cv_act(&image_copy_tmp, IMG_CV_ACT_FIT_ELLIPSE, data);
}
-static void img_iface_rotate_orto (void *data)
+static void img_iface_min_area_rect (void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_MinARect data_tmp;
+ if (!data) {
+ if(!contours.size()) {
+ /* Write into log */
+ snprintf(user_iface_log.line[user_iface_log.len],
+ LOG_LINE_LEN,
+ "! Invalid input");
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ return;
+ }
+ data_tmp.contour = &(contours[0]);
+ data_tmp.rect = &rectangle_rot;
+ data_tmp.show = true;
+
+ data = (void *)&data_tmp;
+ }
+
+ /* Write into log */
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "Min area rectangle");
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ /* Enclosing rectangle */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_MIN_AREA_RECT, data);
+}
+
+/* ----- Geometric image transformations */
+static void img_iface_rotate_orto (void *data)
{
/* Data */
struct Img_Iface_Data_Rotate_Orto data_tmp;
@@ -910,7 +1056,7 @@ static void img_iface_rotate_orto (void *data)
img_cv_act(&image_copy_tmp, IMG_CV_ACT_ROTATE_ORTO, data);
}
-static void img_iface_rotate (void *data)
+static void img_iface_rotate (void *data)
{
/* Data */
struct Img_Iface_Data_Rotate data_tmp;
@@ -944,7 +1090,32 @@ static void img_iface_rotate (void *data)
img_cv_act(&image_copy_tmp, IMG_CV_ACT_ROTATE, data);
}
-static void img_iface_set_ROI (void *data)
+static void img_iface_rotate_2rect (void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_Rotate data_tmp;
+ if (!data) {
+ data_tmp.center.x = rectangle_rot.center.x;
+ data_tmp.center.y = rectangle_rot.center.y;
+ data_tmp.angle = rectangle_rot.angle;
+
+ data = (void *)&data_tmp;
+ }
+
+ /* Write into log */
+ struct Img_Iface_Data_Rotate *data_cast;
+ data_cast = (struct Img_Iface_Data_Rotate *)data;
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "Rotate to rectangle");
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ /* Rotate ortogonally */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_ROTATE, data);
+}
+
+/* ----- ROI */
+static void img_iface_set_ROI (void *data)
{
/* Data */
struct Img_Iface_Data_SetROI data_tmp;
@@ -990,7 +1161,37 @@ static void img_iface_set_ROI (void *data)
img_cv_act(&image_copy_tmp, IMG_CV_ACT_SET_ROI, data);
}
-static void img_iface_pixel_value (void *data)
+static void img_iface_set_ROI_2rect (void *data)
+{
+ /* Data */
+ struct Img_Iface_Data_SetROI data_tmp;
+ if (!data) {
+ data_tmp.rect.x = rectangle.x;
+ data_tmp.rect.y = rectangle.y;
+ data_tmp.rect.width = rectangle.width;
+ data_tmp.rect.height = rectangle.height;
+
+ data = (void *)&data_tmp;
+ }
+
+ /* Write into log */
+ struct Img_Iface_Data_SetROI *data_cast;
+ data_cast = (struct Img_Iface_Data_SetROI *)data;
+ snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
+ "ROI: (%i,%i) w=%i,h=%i",
+ data_cast->rect.x,
+ data_cast->rect.y,
+ data_cast->rect.width,
+ data_cast->rect.height);
+ user_iface_log.lvl[user_iface_log.len] = 1;
+ (user_iface_log.len)++;
+
+ /* Set ROI */
+ img_cv_act(&image_copy_tmp, IMG_CV_ACT_SET_ROI, data);
+}
+
+/* ----- Pixel */
+static void img_iface_pixel_value (void *data)
{
/* Data */
struct Img_Iface_Data_Pixel_Value data_tmp;
@@ -1028,110 +1229,8 @@ static void img_iface_pixel_value (void *data)
(user_iface_log.len)++;
}
-static void img_iface_distance_transform (void)
-{
- /* Must have 1 channel */
- if (image_copy_tmp.channels() != 1) {
- /* Write into log */
- snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "! Invalid input");
- user_iface_log.lvl[user_iface_log.len] = 1;
- (user_iface_log.len)++;
-
- return;
- }
-
- /* Write into log */
- snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Distance transform");
- user_iface_log.lvl[user_iface_log.len] = 1;
- (user_iface_log.len)++;
-
- /* Distance transform */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_DISTANCE_TRANSFORM, NULL);
-}
-
-/* img_cv: composite --------------------------------------------------------*/
-static void img_iface_dilate_erode (void *data)
-{
- /* Data */
- struct Img_Iface_Data_Dilate_Erode data_tmp;
- if (!data) {
- /* Ask user */
- char title [80];
- snprintf(title, 80, "Iterations:");
- data_tmp.i = user_iface_getint(1, 1, INFINITY, title, NULL);
-
- data = (void *)&data_tmp;
- }
-
- /* Write into log */
- struct Img_Iface_Data_Dilate_Erode *data_cast;
- data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
- snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Dilate-erode i=%i",
- data_cast->i);
- user_iface_log.lvl[user_iface_log.len] = 1;
- (user_iface_log.len)++;
-
- /* Dilate */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_DILATE, data);
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_ERODE, data);
-}
-
-static void img_iface_erode_dilate (void *data)
-{
- /* Data */
- struct Img_Iface_Data_Dilate_Erode data_tmp;
- if (!data) {
- /* Ask user */
- char title [80];
- snprintf(title, 80, "Iterations:");
- data_tmp.i = user_iface_getint(1, 1, INFINITY, title, NULL);
-
- data = (void *)&data_tmp;
- }
-
- /* Write into log */
- struct Img_Iface_Data_Dilate_Erode *data_cast;
- data_cast = (struct Img_Iface_Data_Dilate_Erode *)data;
- snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Erode-dilate i=%i",
- data_cast->i);
- user_iface_log.lvl[user_iface_log.len] = 1;
- (user_iface_log.len)++;
-
- /* Dilate */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_ERODE, data);
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_DILATE, data);
-}
-
-static void img_iface_rotate_2rect (void *data)
-{
- /* Data */
- struct Img_Iface_Data_Rotate data_tmp;
- if (!data) {
- data_tmp.center.x = rectangle.center.x;
- data_tmp.center.y = rectangle.center.y;
- data_tmp.angle = rectangle.angle;
-
- data = (void *)&data_tmp;
- }
-
- /* Write into log */
- struct Img_Iface_Data_Rotate *data_cast;
- data_cast = (struct Img_Iface_Data_Rotate *)data;
- snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
- "Rotate to rectangle");
- user_iface_log.lvl[user_iface_log.len] = 1;
- (user_iface_log.len)++;
-
- /* Rotate ortogonally */
- img_cv_act(&image_copy_tmp, IMG_CV_ACT_ROTATE, data);
-}
-
/* img_zbar ------------------------------------------------------------------*/
-static void img_iface_decode (void *data)
+static void img_iface_decode (void *data)
{
/* Must have 1 channel */
if (image_copy_tmp.channels() != 1) {
@@ -1191,7 +1290,7 @@ static void img_iface_decode (void *data)
}
/* img_ocr -------------------------------------------------------------------*/
-static void img_iface_read (void *data)
+static void img_iface_read (void *data)
{
/* Must have 1 channel */
if (image_copy_tmp.channels() != 1) {
@@ -1249,7 +1348,7 @@ static void img_iface_read (void *data)
}
/* img_orb -------------------------------------------------------------------*/
-static void img_iface_align (void)
+static void img_iface_align (void)
{
/* Must have defined a reference */
if (image_ref.empty()) {
@@ -1273,7 +1372,7 @@ static void img_iface_align (void)
}
/* img_iface -----------------------------------------------------------------*/
-static void img_iface_apply (void)
+static void img_iface_apply (void)
{
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
@@ -1286,7 +1385,7 @@ static void img_iface_apply (void)
image_copy_tmp.copyTo(image_copy_old);
}
-static void img_iface_discard (void)
+static void img_iface_discard (void)
{
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
@@ -1299,7 +1398,7 @@ static void img_iface_discard (void)
image_copy_old.copyTo(image_copy_tmp);
}
-static void img_iface_save_mem (void *data)
+static void img_iface_save_mem (void *data)
{
/* Which memory to use */
int x;
@@ -1323,7 +1422,7 @@ static void img_iface_save_mem (void *data)
image_copy_tmp.copyTo(image_mem[x]);
}
-static void img_iface_load_mem (void *data)
+static void img_iface_load_mem (void *data)
{
/* Which memory to use */
int x;
@@ -1351,7 +1450,7 @@ static void img_iface_load_mem (void *data)
}
}
-static void img_iface_save_ref (void)
+static void img_iface_save_ref (void)
{
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
@@ -1366,7 +1465,7 @@ static void img_iface_save_ref (void)
}
/* save ----------------------------------------------------------------------*/
-static void img_iface_save_file (void)
+static void img_iface_save_file (void)
{
/* Write into log */
snprintf(user_iface_log.line[user_iface_log.len], LOG_LINE_LEN,
diff --git a/modules/user/inc/user_iface.h b/modules/user/inc/user_iface.h
index 2d4a608..4b95844 100644
--- a/modules/user/inc/user_iface.h
+++ b/modules/user/inc/user_iface.h
@@ -38,32 +38,33 @@
USER_IFACE_ACT_FOO = 0,
USER_IFACE_ACT_CV = 0x0100,
+ USER_IFACE_ACT_AND_2REF,
USER_IFACE_ACT_NOT,
USER_IFACE_ACT_OR_2REF,
- USER_IFACE_ACT_AND_2REF,
- USER_IFACE_ACT_CVT_COLOR,
USER_IFACE_ACT_COMPONENT,
+ USER_IFACE_ACT_ADAPTIVE_THRESHOLD,
+ USER_IFACE_ACT_THRESHOLD,
+ USER_IFACE_ACT_CVT_COLOR,
+ USER_IFACE_ACT_DISTANCE_TRANSFORM,
USER_IFACE_ACT_HISTOGRAM,
USER_IFACE_ACT_HISTOGRAM_C3,
- USER_IFACE_ACT_SMOOTH,
- USER_IFACE_ACT_SOBEL,
- USER_IFACE_ACT_THRESHOLD,
- USER_IFACE_ACT_ADAPTIVE_THRESHOLD,
USER_IFACE_ACT_DILATE,
USER_IFACE_ACT_ERODE,
+ USER_IFACE_ACT_DILATE_ERODE,
+ USER_IFACE_ACT_ERODE_DILATE,
+ USER_IFACE_ACT_SMOOTH,
+ USER_IFACE_ACT_SOBEL,
USER_IFACE_ACT_CONTOURS,
USER_IFACE_ACT_CONTOURS_SIZE,
- USER_IFACE_ACT_MIN_AREA_RECT,
+ USER_IFACE_ACT_BOUNDING_RECT,
USER_IFACE_ACT_FIT_ELLIPSE,
+ USER_IFACE_ACT_MIN_AREA_RECT,
USER_IFACE_ACT_ROTATE_ORTO,
USER_IFACE_ACT_ROTATE,
+ USER_IFACE_ACT_ROTATE_2RECT,
USER_IFACE_ACT_SET_ROI,
+ USER_IFACE_ACT_SET_ROI_2RECT,
USER_IFACE_ACT_PIXEL_VALUE,
- USER_IFACE_ACT_DISTANCE_TRANSFORM,
-
- USER_IFACE_ACT_DILATE_ERODE,
- USER_IFACE_ACT_ERODE_DILATE,
- USER_IFACE_ACT_ROTATE_2RECT,
USER_IFACE_ACT_ZB = 0x0200,
USER_IFACE_ACT_DECODE,
diff --git a/modules/user/inc/user_iface.hpp b/modules/user/inc/user_iface.hpp
index 1e3f803..399b8aa 100644
--- a/modules/user/inc/user_iface.hpp
+++ b/modules/user/inc/user_iface.hpp
@@ -38,32 +38,33 @@
USER_IFACE_ACT_FOO = 0,
USER_IFACE_ACT_CV = 0x0100,
+ USER_IFACE_ACT_AND_2REF,
USER_IFACE_ACT_NOT,
USER_IFACE_ACT_OR_2REF,
- USER_IFACE_ACT_AND_2REF,
- USER_IFACE_ACT_CVT_COLOR,
USER_IFACE_ACT_COMPONENT,
+ USER_IFACE_ACT_ADAPTIVE_THRESHOLD,
+ USER_IFACE_ACT_THRESHOLD,
+ USER_IFACE_ACT_CVT_COLOR,
+ USER_IFACE_ACT_DISTANCE_TRANSFORM,
USER_IFACE_ACT_HISTOGRAM,
USER_IFACE_ACT_HISTOGRAM_C3,
- USER_IFACE_ACT_SMOOTH,
- USER_IFACE_ACT_SOBEL,
- USER_IFACE_ACT_THRESHOLD,
- USER_IFACE_ACT_ADAPTIVE_THRESHOLD,
USER_IFACE_ACT_DILATE,
USER_IFACE_ACT_ERODE,
+ USER_IFACE_ACT_DILATE_ERODE,
+ USER_IFACE_ACT_ERODE_DILATE,
+ USER_IFACE_ACT_SMOOTH,
+ USER_IFACE_ACT_SOBEL,
USER_IFACE_ACT_CONTOURS,
USER_IFACE_ACT_CONTOURS_SIZE,
- USER_IFACE_ACT_MIN_AREA_RECT,
+ USER_IFACE_ACT_BOUNDING_RECT,
USER_IFACE_ACT_FIT_ELLIPSE,
+ USER_IFACE_ACT_MIN_AREA_RECT,
USER_IFACE_ACT_ROTATE_ORTO,
USER_IFACE_ACT_ROTATE,
+ USER_IFACE_ACT_ROTATE_2RECT,
USER_IFACE_ACT_SET_ROI,
+ USER_IFACE_ACT_SET_ROI_2RECT,
USER_IFACE_ACT_PIXEL_VALUE,
- USER_IFACE_ACT_DISTANCE_TRANSFORM,
-
- USER_IFACE_ACT_DILATE_ERODE,
- USER_IFACE_ACT_ERODE_DILATE,
- USER_IFACE_ACT_ROTATE_2RECT,
USER_IFACE_ACT_ZB = 0x0200,
USER_IFACE_ACT_DECODE,
diff --git a/modules/user/src/user_clui.c b/modules/user/src/user_clui.c
index 9e83070..c7c6075 100644
--- a/modules/user/src/user_clui.c
+++ b/modules/user/src/user_clui.c
@@ -137,15 +137,22 @@ static int usr_input (void)
switch (ch[1]) {
case '1':
switch (ch[2]) {
- case '1':
+ case '0':
action = USER_IFACE_ACT_PROC_LABEL;
break;
- case '2':
+ default:
action = USER_IFACE_ACT_FOO;
break;
- case '3':
+ }
+ break;
+ case '3':
+ switch (ch[2]) {
+ case '0':
action = USER_IFACE_ACT_PROC_RESISTOR;
break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
}
break;
default:
@@ -161,16 +168,19 @@ static int usr_input (void)
/* img_cv */
switch (ch[2]) {
case '0':
- /* bitwise manipulation */
+ /* Operations on Arrays */
switch (ch[3]) {
case '0':
- action = USER_IFACE_ACT_NOT;
+ action = USER_IFACE_ACT_AND_2REF;
break;
case '1':
- action = USER_IFACE_ACT_OR_2REF;
+ action = USER_IFACE_ACT_NOT;
break;
case '2':
- action = USER_IFACE_ACT_AND_2REF;
+ action = USER_IFACE_ACT_OR_2REF;
+ break;
+ case '3':
+ action = USER_IFACE_ACT_COMPONENT;
break;
default:
action = USER_IFACE_ACT_FOO;
@@ -178,13 +188,43 @@ static int usr_input (void)
}
break;
case '1':
- /* color manipulation */
+ /* Misc. image transformations */
switch (ch[3]) {
case '0':
- action = USER_IFACE_ACT_CVT_COLOR;
+ /* Threshold */
+ switch (ch[4]) {
+ case '0':
+ action = USER_IFACE_ACT_ADAPTIVE_THRESHOLD;
+ break;
+ case '1':
+ action = USER_IFACE_ACT_THRESHOLD;
+ break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
+ }
break;
case '1':
- action = USER_IFACE_ACT_COMPONENT;
+ /* Color */
+ switch (ch[4]) {
+ case '0':
+ action = USER_IFACE_ACT_CVT_COLOR;
+ break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
+ }
+ break;
+ case '2':
+ /* Transforms */
+ switch (ch[4]) {
+ case '0':
+ action = USER_IFACE_ACT_DISTANCE_TRANSFORM;
+ break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
+ }
break;
default:
action = USER_IFACE_ACT_FOO;
@@ -192,7 +232,7 @@ static int usr_input (void)
}
break;
case '2':
- /* grayscale filters */
+ /* Histograms */
switch (ch[3]) {
case '0':
action = USER_IFACE_ACT_HISTOGRAM;
@@ -200,25 +240,13 @@ static int usr_input (void)
case '1':
action = USER_IFACE_ACT_HISTOGRAM_C3;
break;
- case '2':
- action = USER_IFACE_ACT_SMOOTH;
- break;
- case '3':
- action = USER_IFACE_ACT_SOBEL;
- break;
- case '4':
- action = USER_IFACE_ACT_THRESHOLD;
- break;
- case '5':
- action = USER_IFACE_ACT_ADAPTIVE_THRESHOLD;
- break;
default:
action = USER_IFACE_ACT_FOO;
break;
}
break;
case '3':
- /* black & white filters */
+ /* Image filtering */
switch (ch[3]) {
case '0':
action = USER_IFACE_ACT_DILATE;
@@ -232,13 +260,19 @@ static int usr_input (void)
case '3':
action = USER_IFACE_ACT_ERODE_DILATE;
break;
+ case '4':
+ action = USER_IFACE_ACT_SMOOTH;
+ break;
+ case '5':
+ action = USER_IFACE_ACT_SOBEL;
+ break;
default:
action = USER_IFACE_ACT_FOO;
break;
}
break;
case '4':
- /* contour */
+ /* Structural analysis and shape descriptors */
switch (ch[3]) {
case '0':
action = USER_IFACE_ACT_CONTOURS;
@@ -247,18 +281,21 @@ static int usr_input (void)
action = USER_IFACE_ACT_CONTOURS_SIZE;
break;
case '2':
- action = USER_IFACE_ACT_MIN_AREA_RECT;
+ action = USER_IFACE_ACT_BOUNDING_RECT;
break;
case '3':
action = USER_IFACE_ACT_FIT_ELLIPSE;
break;
+ case '4':
+ action = USER_IFACE_ACT_MIN_AREA_RECT;
+ break;
default:
action = USER_IFACE_ACT_FOO;
break;
}
break;
case '5':
- /* contour */
+ /* Geometric image transformations */
switch (ch[3]) {
case '0':
action = USER_IFACE_ACT_ROTATE_ORTO;
@@ -280,6 +317,9 @@ static int usr_input (void)
case '0':
action = USER_IFACE_ACT_SET_ROI;
break;
+ case '1':
+ action = USER_IFACE_ACT_SET_ROI_2RECT;
+ break;
default:
action = USER_IFACE_ACT_FOO;
break;
@@ -296,17 +336,6 @@ static int usr_input (void)
break;
}
break;
- case '8':
- /* Transforms */
- switch (ch[3]) {
- case '0':
- action = USER_IFACE_ACT_DISTANCE_TRANSFORM;
- break;
- default:
- action = USER_IFACE_ACT_FOO;
- break;
- }
- break;
default:
action = USER_IFACE_ACT_FOO;
break;
@@ -335,7 +364,7 @@ static int usr_input (void)
}
break;
case '4':
- /* img_ocr */
+ /* img_orb */
switch (ch[2]) {
case '0':
action = USER_IFACE_ACT_ALIGN;
@@ -410,46 +439,48 @@ static int usr_input (void)
static void show_help (void)
{
// FIXME
- printf("Apply: %s\n", "Space");
- printf("Discard: %s\n", "Backspace");
- printf("Save to mem: %c\n", 'm');
- printf("Load from mem: %c\n", 'l');
- printf("Save to ref: %c\n", 'r');
- printf("Save to file: %c\n", 's');
+ printf("Apply: %s\n", "Space");
+ printf("Discard: %s\n", "Backspace");
+ printf("Save to mem: %c\n", 'm');
+ printf("Load from mem: %c\n", 'l');
+ printf("Save to ref: %c\n", 'r');
+ printf("Save to file: %c\n", 's');
printf("Functions:\n");
- printf(" - Bitwise NOT: %s\n", "f100");
- printf(" - BW. OR 2ref: %s\n", "f101");
- printf(" - BW. AND 2ref:%s\n", "f102");
- printf(" - Cvt color: %s\n", "f110");
- printf(" - Component: %s\n", "f111");
- printf(" - Histogram: %s\n", "f120");
- printf(" - Histogram c3:%s\n", "f121");
- printf(" - Smooth: %s\n", "f122");
- printf(" - Sobel: %s\n", "f123");
- printf(" - Threshold: %s\n", "f124");
- printf(" - Adaptive Thr:%s\n", "f125");
- printf(" - Dilate: %s\n", "f130");
- printf(" - Erode: %s\n", "f131");
- printf(" - D-E: %s\n", "f132");
- printf(" - E-D: %s\n", "f133");
- printf(" - Contours: %s\n", "f140");
- printf(" - Contours siz:%s\n", "f141");
- printf(" - Min. A rect.:%s\n", "f142");
- printf(" - Fit ellipse: %s\n", "f143");
- printf(" - Rotate orto.:%s\n", "f150");
- printf(" - Rotate: %s\n", "f151");
- printf(" - Rotate 2rect:%s\n", "f152");
- printf(" - Set ROI: %s\n", "f160");
- printf(" - Pixel value: %s\n", "f170");
- printf(" - Distance tr.:%s\n", "f180");
- printf(" - Scan codes: %s\n", "f20");
- printf(" - Scan text: %s\n", "f30");
- printf(" - Align: %s\n", "f40");
+ printf(" - Bitwise AND 2ref: %s\n", "f100");
+ printf(" - Bitwise NOT: %s\n", "f101");
+ printf(" - Bitwise OR 2ref: %s\n", "f102");
+ printf(" - Component: %s\n", "f103");
+ printf(" - Adaptive threshold: %s\n", "f1100");
+ printf(" - Threshold: %s\n", "f1101");
+ printf(" - Cvt color: %s\n", "f1110");
+ printf(" - Distance transform: %s\n", "f1120");
+ printf(" - Histogram: %s\n", "f120");
+ printf(" - Histogram (3 chan): %s\n", "f121");
+ printf(" - Dilate: %s\n", "f130");
+ printf(" - Erode: %s\n", "f131");
+ printf(" - D-E: %s\n", "f132");
+ printf(" - E-D: %s\n", "f133");
+ printf(" - Smooth: %s\n", "f134");
+ printf(" - Sobel: %s\n", "f135");
+ printf(" - Contours: %s\n", "f140");
+ printf(" - Contours size: %s\n", "f141");
+ printf(" - Bounding rectangle: %s\n", "f142");
+ printf(" - Fit ellipse: %s\n", "f143");
+ printf(" - Min. area rectangle: %s\n", "f144");
+ printf(" - Rotate ortogonally: %s\n", "f150");
+ printf(" - Rotate: %s\n", "f151");
+ printf(" - Rotate 2rect_rot: %s\n", "f152");
+ printf(" - Set ROI: %s\n", "f160");
+ printf(" - Set ROI 2rect: %s\n", "f161");
+ printf(" - Pixel value: %s\n", "f170");
+ printf(" - Scan codes (ZBAR): %s\n", "f20");
+ printf(" - Scan text (OCR): %s\n", "f30");
+ printf(" - Align 2ref (ORB): %s\n", "f40");
printf("Exercises:\n");
- printf(" - Label: %s\n", "e11");
- printf(" - Resistor: %s\n", "e13");
+ printf(" - Label: %s\n", "e10");
+ printf(" - Resistor: %s\n", "e30");
printf("Other:\n");
- printf(" - Show OCR: %s\n", "u1");
+ printf(" - Show OCR text: %s\n", "u1");
printf("Quit: %c\n", 'q');
}
diff --git a/modules/user/src/user_tui.c b/modules/user/src/user_tui.c
index 4fba4b5..f12e9dc 100644
--- a/modules/user/src/user_tui.c
+++ b/modules/user/src/user_tui.c
@@ -54,14 +54,14 @@ void user_tui_init (void)
/* Dimensions: log */
const int h1 = 54;
- const int w1 = 50;
+ const int w1 = 40;
const int r1 = 0;
const int c1 = 30;
win_log = newwin(h1, w1, r1, c1);
/* Dimensions: help */
const int h2 = 54;
- const int w2 = 30;
+ const int w2 = 40;
const int r2 = 0;
const int c2 = 0;
win_help = newwin(h2, w2, r2, c2);
@@ -218,19 +218,29 @@ static int usr_input (void)
switch (ch) {
case '1':
- /* img_cv */
+ /* Label */
ch = wgetch(win_log);
switch (ch) {
- case '1':
+ case '0':
action = USER_IFACE_ACT_PROC_LABEL;
break;
- case '2':
+ default:
action = USER_IFACE_ACT_FOO;
break;
- case '3':
+ }
+ break;
+ case '3':
+ /* Resistor */
+ ch = wgetch(win_log);
+
+ switch (ch) {
+ case '0':
action = USER_IFACE_ACT_PROC_RESISTOR;
break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
}
break;
default:
@@ -250,18 +260,21 @@ static int usr_input (void)
switch (ch) {
case '0':
- /* bitwise manipulation */
+ /* Operations on Arrays */
ch = wgetch(win_log);
switch (ch) {
case '0':
- action = USER_IFACE_ACT_NOT;
+ action = USER_IFACE_ACT_AND_2REF;
break;
case '1':
- action = USER_IFACE_ACT_OR_2REF;
+ action = USER_IFACE_ACT_NOT;
break;
case '2':
- action = USER_IFACE_ACT_AND_2REF;
+ action = USER_IFACE_ACT_OR_2REF;
+ break;
+ case '3':
+ action = USER_IFACE_ACT_COMPONENT;
break;
default:
action = USER_IFACE_ACT_FOO;
@@ -269,15 +282,51 @@ static int usr_input (void)
}
break;
case '1':
- /* color manipulation */
+ /* Misc. image transformations */
ch = wgetch(win_log);
switch (ch) {
case '0':
- action = USER_IFACE_ACT_CVT_COLOR;
+ /* Threshold */
+ ch = wgetch(win_log);
+
+ switch (ch) {
+ case '0':
+ action = USER_IFACE_ACT_ADAPTIVE_THRESHOLD;
+ break;
+ case '1':
+ action = USER_IFACE_ACT_THRESHOLD;
+ break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
+ }
break;
case '1':
- action = USER_IFACE_ACT_COMPONENT;
+ /* Color */
+ ch = wgetch(win_log);
+
+ switch (ch) {
+ case '0':
+ action = USER_IFACE_ACT_CVT_COLOR;
+ break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
+ }
+ break;
+ case '2':
+ /* Transforms */
+ ch = wgetch(win_log);
+
+ switch (ch) {
+ case '0':
+ action = USER_IFACE_ACT_DISTANCE_TRANSFORM;
+ break;
+ default:
+ action = USER_IFACE_ACT_FOO;
+ break;
+ }
break;
default:
action = USER_IFACE_ACT_FOO;
@@ -285,7 +334,7 @@ static int usr_input (void)
}
break;
case '2':
- /* grayscale filters */
+ /* Histograms */
ch = wgetch(win_log);
switch (ch) {
@@ -295,25 +344,13 @@ static int usr_input (void)
case '1':
action = USER_IFACE_ACT_HISTOGRAM_C3;
break;
- case '2':
- action = USER_IFACE_ACT_SMOOTH;
- break;
- case '3':
- action = USER_IFACE_ACT_SOBEL;
- break;
- case '4':
- action = USER_IFACE_ACT_THRESHOLD;
- break;
- case '5':
- action = USER_IFACE_ACT_ADAPTIVE_THRESHOLD;
- break;
default:
action = USER_IFACE_ACT_FOO;
break;
}
break;
case '3':
- /* black & white filters */
+ /* Image filtering */
ch = wgetch(win_log);
switch (ch) {
@@ -329,13 +366,19 @@ static int usr_input (void)
case '3':
action = USER_IFACE_ACT_ERODE_DILATE;
break;
+ case '4':
+ action = USER_IFACE_ACT_SMOOTH;
+ break;
+ case '5':
+ action = USER_IFACE_ACT_SOBEL;
+ break;
default:
action = USER_IFACE_ACT_FOO;
break;
}
break;
case '4':
- /* contour */
+ /* Structural analysis and shape descriptors */
ch = wgetch(win_log);
switch (ch) {
@@ -346,18 +389,21 @@ static int usr_input (void)
action = USER_IFACE_ACT_CONTOURS_SIZE;
break;
case '2':
- action = USER_IFACE_ACT_MIN_AREA_RECT;
+ action = USER_IFACE_ACT_BOUNDING_RECT;
break;
case '3':
action = USER_IFACE_ACT_FIT_ELLIPSE;
break;
+ case '4':
+ action = USER_IFACE_ACT_MIN_AREA_RECT;
+ break;
default:
action = USER_IFACE_ACT_FOO;
break;
}
break;
case '5':
- /* rotation */
+ /* Geometric image transformations */
ch = wgetch(win_log);
switch (ch) {
@@ -383,6 +429,9 @@ static int usr_input (void)
case '0':
action = USER_IFACE_ACT_SET_ROI;
break;
+ case '1':
+ action = USER_IFACE_ACT_SET_ROI_2RECT;
+ break;
default:
action = USER_IFACE_ACT_FOO;
break;
@@ -401,19 +450,6 @@ static int usr_input (void)
break;
}
break;
- case '8':
- /* Transforms */
- ch = wgetch(win_log);
-
- switch (ch) {
- case '0':
- action = USER_IFACE_ACT_DISTANCE_TRANSFORM;
- break;
- default:
- action = USER_IFACE_ACT_FOO;
- break;
- }
- break;
default:
action = USER_IFACE_ACT_FOO;
break;
@@ -538,47 +574,49 @@ static void show_help (void)
r = 0;
c = 0;
- mvwprintw(win_help, r++, c, "Apply: %s", "Space");
- mvwprintw(win_help, r++, c, "Discard: %s", "Backspace");
- mvwprintw(win_help, r++, c, "Save to mem: %c", 'm');
- mvwprintw(win_help, r++, c, "Load from mem: %c", 'l');
- mvwprintw(win_help, r++, c, "Save to ref: %c", 'r');
- mvwprintw(win_help, r++, c, "Save to file: %c", 's');
+ mvwprintw(win_help, r++, c, "Apply: %s", "Space");
+ mvwprintw(win_help, r++, c, "Discard: %s", "BS");
+ mvwprintw(win_help, r++, c, "Save to mem: %c", 'm');
+ mvwprintw(win_help, r++, c, "Load from mem: %c", 'l');
+ mvwprintw(win_help, r++, c, "Save to ref: %c", 'r');
+ mvwprintw(win_help, r++, c, "Save to file: %c", 's');
mvwprintw(win_help, r++, c, "Functions:");
- mvwprintw(win_help, r++, c, " - Bitwise NOT: %s", "f100");
- mvwprintw(win_help, r++, c, " - BW. OR 2ref: %s", "f101");
- mvwprintw(win_help, r++, c, " - BW. AND 2ref:%s", "f102");
- mvwprintw(win_help, r++, c, " - Cvt color: %s", "f110");
- mvwprintw(win_help, r++, c, " - Component: %s", "f111");
- mvwprintw(win_help, r++, c, " - Histogram: %s", "f120");
- mvwprintw(win_help, r++, c, " - Histogram_c3:%s", "f121");
- mvwprintw(win_help, r++, c, " - Smooth: %s", "f122");
- mvwprintw(win_help, r++, c, " - Sobel: %s", "f123");
- mvwprintw(win_help, r++, c, " - Threshold: %s", "f124");
- mvwprintw(win_help, r++, c, " - Adaptive Thr:%s", "f125");
- mvwprintw(win_help, r++, c, " - Dilate: %s", "f130");
- mvwprintw(win_help, r++, c, " - Erode: %s", "f131");
- mvwprintw(win_help, r++, c, " - D-E: %s", "f132");
- mvwprintw(win_help, r++, c, " - E-D: %s", "f133");
- mvwprintw(win_help, r++, c, " - Contours: %s", "f140");
- mvwprintw(win_help, r++, c, " - Contours siz:%s", "f141");
- mvwprintw(win_help, r++, c, " - Min. A rect.:%s", "f142");
- mvwprintw(win_help, r++, c, " - Fit ellipse: %s", "f143");
- mvwprintw(win_help, r++, c, " - Rotate orto.:%s", "f150");
- mvwprintw(win_help, r++, c, " - Rotate: %s", "f151");
- mvwprintw(win_help, r++, c, " - Rotate 2rect:%s", "f152");
- mvwprintw(win_help, r++, c, " - Set ROI: %s", "f160");
- mvwprintw(win_help, r++, c, " - Pixel value: %s", "f170");
- mvwprintw(win_help, r++, c, " - Distance tr.:%s", "f180");
- mvwprintw(win_help, r++, c, " - Scan codes: %s", "f20");
- mvwprintw(win_help, r++, c, " - Scan text: %s", "f30");
- mvwprintw(win_help, r++, c, " - Align: %s", "f40");
+ mvwprintw(win_help, r++, c, " - Bitwise AND 2ref: %s", "f100");
+ mvwprintw(win_help, r++, c, " - Bitwise NOT: %s", "f101");
+ mvwprintw(win_help, r++, c, " - Bitwise OR 2ref: %s", "f102");
+ mvwprintw(win_help, r++, c, " - Component: %s", "f103");
+ mvwprintw(win_help, r++, c, " - Adaptive threshold: %s", "f1100");
+ mvwprintw(win_help, r++, c, " - Threshold: %s", "f1101");
+ mvwprintw(win_help, r++, c, " - Cvt color: %s", "f1110");
+ mvwprintw(win_help, r++, c, " - Distance transform: %s", "f1120");
+ mvwprintw(win_help, r++, c, " - Histogram: %s", "f120");
+ mvwprintw(win_help, r++, c, " - Histogram (3 chan): %s", "f121");
+ mvwprintw(win_help, r++, c, " - Dilate: %s", "f130");
+ mvwprintw(win_help, r++, c, " - Erode: %s", "f131");
+ mvwprintw(win_help, r++, c, " - D-E: %s", "f132");
+ mvwprintw(win_help, r++, c, " - E-D: %s", "f133");
+ mvwprintw(win_help, r++, c, " - Smooth: %s", "f134");
+ mvwprintw(win_help, r++, c, " - Sobel: %s", "f135");
+ mvwprintw(win_help, r++, c, " - Contours: %s", "f140");
+ mvwprintw(win_help, r++, c, " - Contours size: %s", "f141");
+ mvwprintw(win_help, r++, c, " - Bounding rectangle: %s", "f142");
+ mvwprintw(win_help, r++, c, " - Fit ellipse: %s", "f143");
+ mvwprintw(win_help, r++, c, " - Min. area rectangle: %s", "f144");
+ mvwprintw(win_help, r++, c, " - Rotate ortogonally: %s", "f150");
+ mvwprintw(win_help, r++, c, " - Rotate: %s", "f151");
+ mvwprintw(win_help, r++, c, " - Rotate 2rect_rot: %s", "f152");
+ mvwprintw(win_help, r++, c, " - Set ROI: %s", "f160");
+ mvwprintw(win_help, r++, c, " - Set ROI 2rect: %s", "f161");
+ mvwprintw(win_help, r++, c, " - Pixel value: %s", "f170");
+ mvwprintw(win_help, r++, c, " - Scan codes (ZBAR): %s", "f20");
+ mvwprintw(win_help, r++, c, " - Scan text (OCR): %s", "f30");
+ mvwprintw(win_help, r++, c, " - Align 2ref (ORB): %s", "f40");
mvwprintw(win_help, r++, c, "Exercises:");
- mvwprintw(win_help, r++, c, " - Label: %s", "e11");
- mvwprintw(win_help, r++, c, " - Resistor: %s", "e13");
+ mvwprintw(win_help, r++, c, " - Label: %s", "e10");
+ mvwprintw(win_help, r++, c, " - Resistor: %s", "e30");
mvwprintw(win_help, r++, c, "Other:");
- mvwprintw(win_help, r++, c, " - Show OCR: %s", "u1");
- mvwprintw(win_help, r++, c, "Quit: %c", 'q');
+ mvwprintw(win_help, r++, c, " - Show OCR: %s", "u1");
+ mvwprintw(win_help, r++, c, "Quit: %c", 'q');
/* Refresh */
wrefresh(win_help);