summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Dockerfile24
-rw-r--r--Makefile4
-rw-r--r--README.rst37
-rwxr-xr-xbin/laundry-symbol-reader-dk2
-rw-r--r--src/label.c6
-rw-r--r--src/symbols.c4
6 files changed, 42 insertions, 35 deletions
diff --git a/Dockerfile b/Dockerfile
index b873348..17b7964 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,9 +1,19 @@
-FROM debian:testing AS build
+###############################################################################
+# Copyright (C) 2020 Sebastian Francisco Colomar Bauza #
+# Copyright (C) 2020 Alejandro Colomar Andrés #
+# SPDX-License-Identifier: GPL-2.0-only #
+###############################################################################
+
+FROM debian@sha256:e6a6f2625ec46aa6ce5c537208565cde16138e7963c341ff2a3ecbf9a6736060 \
+ AS build
+
RUN apt-get update && \
apt-get upgrade -V --yes && \
apt-get install -V \
gcc \
+ gcc-10 \
g++ \
+ g++-10 \
make \
git \
pkg-config \
@@ -17,13 +27,19 @@ RUN apt-get update && \
apt-get autoclean && \
apt-get clean
WORKDIR /tmp
-RUN git clone https://github.com/alejandro-colomar/libalx.git && \
+RUN git clone \
+ --single-branch \
+ --branch v1.0-b23 \
+ https://github.com/alejandro-colomar/libalx.git && \
make base cv -C libalx -j 8 && \
make install-base install-cv -C libalx -j 8
-RUN git clone https://github.com/SMRLaundryApp/laundry-symbol-reader.git && \
+RUN git clone \
+ --single-branch \
+ --branch v1.1 \
+ https://github.com/SMRLaundryApp/laundry-symbol-reader.git && \
make -C laundry-symbol-reader -j 2
-FROM debian:testing
+FROM debian@sha256:e6a6f2625ec46aa6ce5c537208565cde16138e7963c341ff2a3ecbf9a6736060
RUN apt-get update && \
apt-get upgrade --yes && \
apt-get install -V \
diff --git a/Makefile b/Makefile
index 26a2e35..ab34f9b 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ export SRC_DIR
################################################################################
# Make variables (CC, etc...)
- CC = gcc
+ CC = gcc-10
AS = as
SZ = size
@@ -43,7 +43,7 @@ export SZ
################################################################################
# cflags
-CFLAGS_STD = -std=gnu17
+CFLAGS_STD = -std=gnu2x
CFLAGS_W = -Wall -Wextra -Wno-format -Werror
CFLAGS_O = -O3 -march=x86-64 -flto
CFLAGS_PKG = `pkg-config --cflags libalx-base`
diff --git a/README.rst b/README.rst
index 1688e77..ef95017 100644
--- a/README.rst
+++ b/README.rst
@@ -11,13 +11,10 @@ The program depends on libalx-base and libalx-cv (both from libalx_) being
installed in the system, and those libraries depend on some other packages
being installed in the system. For those reasons, I recommend
`debian 11 (bullseye)`_ as the operating system. That's the OS used in the
-`docker image`_. Other compatible OSes include: Manjaro_,
-`Ubuntu 20.04 (focal)`_.
+`docker image`_.
.. _libalx: https://github.com/alejandro-colomar/libalx
.. _`debian 11 (bullseye)`: https://www.debian.org/devel/debian-installer/
-.. _Manjaro: https://manjaro.org/
-.. _`Ubuntu 20.04 (focal)`: http://cdimage.ubuntu.com/daily-live/current/
.. _`docker image`: https://hub.docker.com/r/laundrysymbolreader/reader
Installing prerequisites on debian 11:
@@ -26,27 +23,13 @@ Installing prerequisites on debian 11:
.. code-block:: sh
## install build tools:
- $ sudo apt-get install gcc g++ make git pkg-config
+ $ sudo apt-get install gcc gcc-10 g++ g++-10 make git pkg-config
## install libraries which libalx depends on:
$ sudo apt-get install libbsd-dev libgsl-dev libopencv-dev
## download libalx
- $ git clone https://github.com/alejandro-colomar/libalx.git
- ## compile libalx
- $ make base cv -C libalx -j8
- ## install libalx
- $ sudo make install-base install-cv -C libalx -j2
-
-Installing prerequisites on manjaro:
---------------------------------------
-
-.. code-block:: sh
-
- ## install build tools:
- $ sudo pacman -S gcc make git pkgconf
- ## install libraries which libalx depends on:
- $ sudo pacman -S libbsd gsl opencv
- ## download libalx
- $ git clone https://github.com/alejandro-colomar/libalx.git
+ $ git clone \
+ --single-branch --branch v1.0-b23 \
+ https://github.com/alejandro-colomar/libalx.git
## compile libalx
$ make base cv -C libalx -j8
## install libalx
@@ -69,7 +52,9 @@ debugging information.
.. code-block:: sh
## download the code:
- $ git clone https://github.com/SMRLaundryApp/laundry-symbol-reader.git
+ $ git clone \
+ --single-branch --branch v1.1 \
+ https://github.com/SMRLaundryApp/laundry-symbol-reader.git
## compile
$ make -C laundry-symbol-reader -j8
## install
@@ -96,9 +81,11 @@ install:
.. code-block:: sh
## download the latest docker image
- $ docker image pull laundrysymbolreader/reader
+ $ docker image pull laundrysymbolreader/reader:v1.1
## clone the repository:
- $ git clone https://github.com/SMRLaundryApp/laundry-symbol-reader.git
+ $ git clone \
+ --single-branch --branch v1.1 \
+ https://github.com/SMRLaundryApp/laundry-symbol-reader.git
## install script
$ sudo make inst-scripts -C laundry-symbol-reader
## remove the repository clone:
diff --git a/bin/laundry-symbol-reader-dk b/bin/laundry-symbol-reader-dk
index 160299d..0ea8f57 100755
--- a/bin/laundry-symbol-reader-dk
+++ b/bin/laundry-symbol-reader-dk
@@ -25,7 +25,7 @@ main()
vol="--volume ${dir}:/tmp/img"
opt="--tty --interactive --rm ${vol}"
- dk_img="laundrysymbolreader/reader"
+ dk_img="laundrysymbolreader/reader:v1.1"
arg="/tmp/img/${fname}"
cmd="laundry-symbol-reader ${arg}"
diff --git a/src/label.c b/src/label.c
index 9befdc7..b2d9c29 100644
--- a/src/label.c
+++ b/src/label.c
@@ -11,6 +11,8 @@
#include <stddef.h>
+#include <sys/param.h>
+
#define ALX_NO_PREFIX
#include <libalx/base/compiler.h>
#include <libalx/base/errno.h>
@@ -129,14 +131,14 @@ int find_symbols_vertically (img_s *img)
alx_cv_extract_imgdata(tmp, NULL, &w, &h, NULL, NULL, NULL);
alx_cv_normalize(tmp); dbg_show(3, tmp);
alx_cv_smooth(tmp, ALX_CV_SMOOTH_MEDIAN, 5); dbg_show(3, tmp);
- h = ALX_MIN(w, h);
+ h = MIN(w, h);
alx_cv_adaptive_thr(tmp, ALX_CV_ADAPTIVE_THRESH_GAUSSIAN,
ALX_CV_THRESH_BINARY_INV, h / 2, 25); dbg_show(3, tmp);
// alx_cv_canny(tmp, 127, 200, 3, true); dbg_show(3, tmp);
alx_cv_dilate_h(tmp, 1); dbg_show(3, tmp);
alx_cv_dilate(tmp, 1); dbg_show(3, tmp);
alx_cv_holes_fill(tmp); dbg_show(3, tmp);
- h = ALX_MIN(w, h);
+ h = MIN(w, h);
alx_cv_erode_dilate(tmp, h / 35); dbg_show(3, tmp);
alx_cv_dilate_h(tmp, w / 6); dbg_show(3, tmp);
alx_cv_contours(tmp, conts);
diff --git a/src/symbols.c b/src/symbols.c
index bf2be17..c79e33c 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -14,6 +14,8 @@
#include <stdint.h>
#include <stdio.h>
+#include <sys/param.h>
+
#define ALX_NO_PREFIX
#include <libalx/base/compiler.h>
#include <libalx/base/errno.h>
@@ -202,7 +204,7 @@ int clean_symbol (img_s *img)
/* Threshold */
alx_cv_normalize(img); dbg_show(3, img);
alx_cv_smooth(img, ALX_CV_SMOOTH_MEDIAN, 3); dbg_show(3, img);
- w = ALX_MIN(w, h);
+ w = MIN(w, h);
alx_cv_adaptive_thr(img, ALX_CV_ADAPTIVE_THRESH_GAUSSIAN,
ALX_CV_THRESH_BINARY_INV, w / 2, 25); dbg_show(1, img);