27 Commits

Author SHA1 Message Date
Erik Auerswald 94ce321060 lazily adapt threshold to image
Instead of adapting the threshold to the image before executing
commands, adapt the threshold just before it is needed.

This allows to avoid theshold adaptation when -p, --process-only
is used with only the "grayscale" and/or "mirror" commands.

This also prepares the code to allow introduction of a new option
to avoid adapting the threshold to the original image before the
"crop" command is applied.
2025-03-23 18:54:13 +01:00
Erik Auerswald fa30f473e7 simplify adapt_threshold() and iterative_threshold()
Both functions are always called with the same arguments.
Only the get_threshold() function is also called with
different x, y, w, h arguments (when used during dynamic
thresholding).
2025-03-18 21:31:19 +01:00
Erik Auerswald 67abe0fba8 combine get_minval() and get_maxval()
This simplifies the code a bit, and slightly speeds up using
option "-P, --debug-output".
2025-03-18 20:42:38 +01:00
Erik Auerswald 74aeb44f94 rename draw_pixel() to draw_fg_bg_pixel() 2025-02-02 20:42:52 +01:00
Erik Auerswald f012c14d93 refactoring and type consistency fixes
* The draw_pixel() function was called with an "image" parameter
  of type "Imlib_Image" instead of "Imlib_Image *".  This type
  error did not result in a compilation error, and thus stayed
  undetected in the code.

* Introduce a new function draw_color_pixel() similar to draw_pixel(),
  and use it instead of repeatedly open-coding this operation.
2025-02-02 20:32:48 +01:00
Erik Auerswald b44a4ad72a update copyright years 2025-02-01 19:33:29 +01:00
Erik Auerswald 6569ca9f6b update copyright years 2024-02-23 19:03:58 +01:00
Erik Auerswald ea8f724846 update copyright years 2023-04-23 12:53:48 +02:00
Erik Auerswald b83610d7d2 update copyright year 2022-01-25 18:38:52 +01:00
Erik Auerswald dc463a5529 options to control decimal separator recognition
Additionally, bump copyright dates and version number.
2021-04-19 19:27:52 +02:00
Erik Auerswald 2031c2c08e refactor scanning for set segments
This introduces a function to scan part of the image for foreground
pixels.

This scanline() function may be of use for distuingishing between
the digit '1' and the symbol ":".

It may also help in segment detection reliability if the "len" parameter
is used to skip scanning image areas between segment positions.
2019-03-10 17:58:04 +01:00
Erik Auerswald 9569289c63 bump copyright year to 2019 2019-02-02 13:08:13 +01:00
Erik Auerswald 583b96263c bump copyright year to 2018 2018-07-24 15:18:05 +02:00
Erik Auerswald f87b4a80bd enable executing dilation & erosion N times...
...with optional parameter N instead of repeating the command
2017-11-19 15:33:29 +01:00
Erik Auerswald 60614d467e maint: change flags from int to unsigned int 2017-10-22 17:03:03 +02:00
Erik Auerswald 482969cd12 bump copyright year to 2017 2017-02-26 21:38:51 +01:00
Erik Auerswald 2fc3a07190 bump copyright year to 2016 to reflect recent changes 2016-08-08 21:11:22 +02:00
Erik Auerswald 55a982e253 use a float for one_ratio comparison, and bump copyright year 2015-02-23 15:52:56 +00:00
Erik Auerswald 842cae99e2 bumped version number and copyright year 2014-10-27 09:45:23 +00:00
Erik Auerswald 9865a9ea41 Added new command 'mirror' and bumped version to 2.16.0.
This command enables recognition of Critiano Fontana's images.
2013-12-29 05:29:51 +00:00
Erik Auerswald 03434efeae Check for errors when loading or saving an image with Imlib2.
This relies on the definition of enum _imlib_load_error in Imlib2.h
and might break on different versions of Imlib2, but should be better
than the total lack of error reporting before.

Developed with Imlib2 version 1.4.5 from Debian/Sid:

$ dpkg -l libimlib2-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  libimlib2-dev  1.4.5-1      i386         Imlib2 development files
2013-01-11 05:30:21 +00:00
Erik Auerswald 16bcc37f78 Bumped copyright years to 2004-2013. 2013-01-08 16:56:37 +00:00
Erik Auerswald 1d8e788e93 Removed function rgb_threshold() from imgproc.[ch].
All calls to this function have been replaced by calls to make_mono()
with the appropriate luminance type (minimum, red, green, or blue).
This way --foreground / --background work with the commands
{r,g,b,rgb}_threshold as expected.

Problem was "shear" setting background pixels using the specified
--background color, but rgb_threshold() always using the default colors
(foreground black, background white), ognoring the options.

Added a formerly failing test case to the regression tests:
  Lauro-LEDs-digits-fore_back
2012-07-13 17:03:43 +00:00
Erik Auerswald a45d5cd5d8 Bump copyright to 2004-2010,2012. 2012-02-16 08:58:31 +00:00
Erik Auerswald 5bd1f54b5d Updated copyright statement. 2010-06-08 11:59:09 +00:00
Erik Auerswald 5738646605 Use "gray" and "color" consistently (A.E.). 2009-08-05 05:14:45 +00:00
Erik Auerswald a1a060b416 - refactor image processing and online help in seperate files
- no functional changes
- this is another step towards refactoring the recognition algorithm
- this is another step towards factoring out the image access routines to
  ultimately replace Imlib2 by something else (e.g. gd)
2009-01-06 11:22:10 +00:00