diff --git a/defines.h b/defines.h index 6fc5475..2350a4a 100644 --- a/defines.h +++ b/defines.h @@ -21,7 +21,7 @@ #define SSOCR2_DEFINES_H /* version number */ -#define VERSION "2.17.0" +#define VERSION "2.18.0" /* states */ #define FIND_DARK 0 diff --git a/help.c b/help.c index 6b584b6..58385a3 100644 --- a/help.c +++ b/help.c @@ -105,8 +105,12 @@ void usage(char *name, FILE *f) fprintf(f, " use -l help for list of KEYWORDS\n"); fprintf(f, " -S, --ascii-art-segments print recognized segments a ASCII art\n"); fprintf(f, " -X, --print-as-hex change output format to hexadecimal\n"); - fprintf(f, "\nCommands: dilation dilation algorithm (with mask of 1 pixel)\n"); - fprintf(f, " erosion erosion algorithm (with mask of 9 pixels)\n"); + fprintf(f, "\nCommands: dilation [N] [N times] dilation algorithm" + "\n (set_pixels_filter with mask" + " of 1 pixel)\n"); + fprintf(f, " erosion [N] [N times] erosion algorithm\n" + " (set_pixels_filter with mask" + " of 9 pixels)\n"); fprintf(f, " closing [N] closing algorithm\n"); fprintf(f, " ([N times] dilation then [N times] erosion)\n"); fprintf(f, " opening [N] opening algorithm\n"); diff --git a/imgproc.c b/imgproc.c index 74ca35e..69f3887 100644 --- a/imgproc.c +++ b/imgproc.c @@ -179,32 +179,15 @@ Imlib_Image set_pixels_filter(Imlib_Image *source_image, double thresh, return new_image; } -Imlib_Image dilation(Imlib_Image *source_image, double thresh, luminance_t lt) -{ - return set_pixels_filter(source_image, thresh, lt, 1); -} - -Imlib_Image erosion(Imlib_Image *source_image, double thresh, luminance_t lt) -{ - return set_pixels_filter(source_image, thresh, lt, 9); -} - -Imlib_Image closing(Imlib_Image *source_image,double thresh,luminance_t lt,int n) +Imlib_Image set_pixels_filter_iter(Imlib_Image *source_image, double thresh, + luminance_t lt, int mask, int iter) { int i; Imlib_Image temp_image1, temp_image2; - /* dilation n times */ imlib_context_set_image(*source_image); temp_image1 = temp_image2 = imlib_clone_image(); - for(i=0; i +.I 1 +is specified, the dilation algorithm is executed +.B N +times. +.SS erosion [N] Filter image using erosion algorithm. Any pixel with every neighbour pixel set in the source image will be set in the filtered image. +If a number +.B N +> +.I 1 +is specified, the erosion algorithm is executed +.B N +times. .SS closing [N] Filter image using closing algorithm, i.e. erosion and then dilation. If a number diff --git a/ssocr.c b/ssocr.c index 0d12e69..5f79cc0 100644 --- a/ssocr.c +++ b/ssocr.c @@ -463,14 +463,40 @@ int main(int argc, char **argv) if(optind < argc-1) /* then process commands */ { for(i=optind; i0) && (i+10) && (i+1