Use "gray" and "color" consistently (A.E.).

This commit is contained in:
Erik Auerswald
2009-08-05 05:14:45 +00:00
parent 807ff6ac40
commit 5738646605
6 changed files with 35 additions and 35 deletions
+1 -1
View File
@@ -86,7 +86,7 @@
#define ADJUST_GREY (1<<6)
#define DEBUG_OUTPUT (1<<7)
/* colours used by ssocr */
/* colors used by ssocr */
#define SSOCR_BLACK 0
#define SSOCR_WHITE 255
+3 -3
View File
@@ -98,7 +98,7 @@ void usage(char *name, FILE *f)
fprintf(f, " -f, --foreground=COLOR set foreground color (black or white)\n");
fprintf(f, " -b, --background=COLOR set foreground color (black or white)\n");
fprintf(f, " -I, --print-info print image dimensions and used lum values\n");
fprintf(f, " -g, --adjust-grey use T1 and T2 as percentages of used values\n");
fprintf(f, " -g, --adjust-gray use T1 and T2 as percentages of used values\n");
fprintf(f, " -l, --luminance=KEYWORD compute luminance using formula KEYWORD\n");
fprintf(f, " use -l help for list of KEYWORDS\n");
fprintf(f, "\nCommands: dilation dilation algorithm (with mask of 1 pixel)\n");
@@ -109,9 +109,9 @@ void usage(char *name, FILE *f)
fprintf(f, " ([N times] erosion then [N times] dilation)\n");
fprintf(f, " remove_isolated remove isolated pixels\n");
fprintf(f, " make_mono make image monochrome\n");
fprintf(f, " greyscale transform image to greyscale\n");
fprintf(f, " grayscale transform image to grayscale\n");
fprintf(f, " invert make inverted monochrome image\n");
fprintf(f, " grey_stretch T1 T2 stretch luminance values\n");
fprintf(f, " gray_stretch T1 T2 stretch luminance values\n");
fprintf(f, " from [T1,T2] to [0,255]\n");
fprintf(f, " dynamic_threshold W H make image monochrome w. dynamic thresholding\n");
fprintf(f, " with a window of width W and height H\n");
+10 -10
View File
@@ -307,9 +307,9 @@ Imlib_Image remove_isolated(Imlib_Image *source_image, double thresh,
return keep_pixels_filter(source_image, thresh, lt, 1);
}
/* grey stretching, i.e. lum<t1 => lum=0, lum>t2 => lum=100,
/* gray stretching, i.e. lum<t1 => lum=0, lum>t2 => lum=100,
* else lum=((lum-t1)*MAXRGB)/(t2-t1) */
Imlib_Image grey_stretch(Imlib_Image *source_image, double t1, double t2,
Imlib_Image gray_stretch(Imlib_Image *source_image, double t1, double t2,
luminance_t lt)
{
Imlib_Image new_image; /* construct filtered image here */
@@ -321,17 +321,17 @@ Imlib_Image grey_stretch(Imlib_Image *source_image, double t1, double t2,
/* do nothing if t1>=t2 */
if(t1 >= t2) {
fprintf(stderr, "error: grey_stretch(): t1=%.2f >= t2=%.2f\n", t1, t2);
fprintf(stderr, "error: gray_stretch(): t1=%.2f >= t2=%.2f\n", t1, t2);
exit(99);
}
/* check if 0 < t1,t2 < MAXRGB */
if(t1 <= 0.0) {
fprintf(stderr, "error: grey_stretch(): t1=%.2f <= 0.0\n", t1);
fprintf(stderr, "error: gray_stretch(): t1=%.2f <= 0.0\n", t1);
exit(99);
}
if(t2 >= MAXRGB) {
fprintf(stderr, "error: grey_stretch(): t2=%.2f >= %d.0\n", t2, MAXRGB);
fprintf(stderr, "error: gray_stretch(): t2=%.2f >= %d.0\n", t2, MAXRGB);
exit(99);
}
@@ -344,7 +344,7 @@ Imlib_Image grey_stretch(Imlib_Image *source_image, double t1, double t2,
width = imlib_image_get_width();
new_image = imlib_clone_image();
/* grey stretch image */
/* gray stretch image */
for(x=0; x<width; x++) {
for(y=0; y<height; y++) {
imlib_image_query_pixel(x, y, &color);
@@ -877,10 +877,10 @@ Imlib_Image rotate(Imlib_Image *source_image, double theta)
return new_image;
}
/* turn image to greyscale */
Imlib_Image greyscale(Imlib_Image *source_image, luminance_t lt)
/* turn image to grayscale */
Imlib_Image grayscale(Imlib_Image *source_image, luminance_t lt)
{
Imlib_Image new_image; /* construct greyscale image here */
Imlib_Image new_image; /* construct grayscale image here */
Imlib_Image current_image; /* save image pointer */
int height, width; /* image dimensions */
int x,y; /* iteration variables */
@@ -896,7 +896,7 @@ Imlib_Image greyscale(Imlib_Image *source_image, luminance_t lt)
width = imlib_image_get_width();
new_image = imlib_clone_image();
/* transform image to greyscale */
/* transform image to grayscale */
for(x=0; x<width; x++) {
for(y=0; y<height; y++) {
imlib_context_set_image(*source_image);
+6 -6
View File
@@ -73,9 +73,9 @@ Imlib_Image keep_pixels_filter(Imlib_Image *source_image, double thresh,
Imlib_Image remove_isolated(Imlib_Image *source_image, double thresh,
luminance_t lt);
/* grey stretching, i.e. lum<t1 => lum=0, lum>t2 => lum=100,
/* gray stretching, i.e. lum<t1 => lum=0, lum>t2 => lum=100,
* else lum=((lum-t1)*MAXRGB)/(t2-t1) */
Imlib_Image grey_stretch(Imlib_Image *source_image, double t1, double t2,
Imlib_Image gray_stretch(Imlib_Image *source_image, double t1, double t2,
luminance_t lt);
/* use dynamic (aka adaptive) local thresholding to create monochrome image */
@@ -114,8 +114,8 @@ Imlib_Image shear(Imlib_Image *source_image, int offset);
/* rotate the image */
Imlib_Image rotate(Imlib_Image *source_image, double theta);
/* turn image to greyscale */
Imlib_Image greyscale(Imlib_Image *source_image, luminance_t lt);
/* turn image to grayscale */
Imlib_Image grayscale(Imlib_Image *source_image, luminance_t lt);
/* crop image */
Imlib_Image crop(Imlib_Image *source_image, int x, int y, int w, int h);
@@ -133,11 +133,11 @@ double get_threshold(Imlib_Image *source_image, double fraction, luminance_t lt,
double iterative_threshold(Imlib_Image *source_image, double thresh,
luminance_t lt, int x, int y, int w, int h);
/* get minimum grey value */
/* get minimum gray value */
double get_minval(Imlib_Image *source_image, int x, int y, int w, int h,
luminance_t lt);
/* get maximum grey value */
/* get maximum gray value */
double get_maxval(Imlib_Image *source_image, int x, int y, int w, int h,
luminance_t lt);
+5 -5
View File
@@ -108,13 +108,13 @@ Default is
.IR white .
.SS -I, --print-info
Prints image dimensions and range of used luminance values to standard error.
.SS -g, --adjust-grey
.SS -g, --adjust-gray
Interpret the values
.B T1
and
.B T2
given to the command
.B grey_stretch
.B gray_stretch
as percentages instead of absolut luminance values.
.SS -l, --luminance KEYWORD
Choose the type of luminace computation.
@@ -167,13 +167,13 @@ The threshold can be specified with option
and is adjusted to the used luminance interval of the image unless option
.B --absolute-threshold
is used.
.SS greyscale
Transform image to grey values using luminance.
.SS grayscale
Transform image to gray values using luminance.
The formula to compute luminance can be specified using option
.BR --luminance .
.SS invert
Set every foreground pixel to background color and vice versa.
.SS grey_stretch T1 T2
.SS gray_stretch T1 T2
Transform image so that the luminance interval [
.BR T1 , T2
] is projected to [
+10 -10
View File
@@ -95,7 +95,7 @@ int main(int argc, char **argv)
{"foreground", 1, 0, 'f'}, /* set foreground color */
{"background", 1, 0, 'b'}, /* set background color */
{"print-info", 0, 0, 'I'}, /* print image info */
{"adjust-grey", 0, 0, 'g'}, /* use T1 and T2 as perecntages of used vals*/
{"adjust-gray", 0, 0, 'g'}, /* use T1 and T2 as perecntages of used vals*/
{"luminance", 1, 0, 'l'}, /* luminance formula */
{0, 0, 0, 0} /* terminate long options */
};
@@ -552,13 +552,13 @@ int main(int argc, char **argv)
imlib_context_set_image(image);
imlib_free_image();
image = new_image;
} else if(strcasecmp("grey_stretch",argv[i]) == 0) {
} else if(strcasecmp("gray_stretch",argv[i]) == 0) {
if(i+2<argc-1) {
double t1, t2;
t1 = atof(argv[i+1]);
t2 = atof(argv[i+2]);
if(flags & VERBOSE) {
fprintf(stderr, " processing grey_stretch %.2f %.2f", t1, t2);
fprintf(stderr, " processing gray_stretch %.2f %.2f", t1, t2);
if(flags & DEBUG_OUTPUT) {
fprintf(stderr," (from strings %s and %s)",argv[i+1],argv[i+2]);
}
@@ -578,19 +578,19 @@ int main(int argc, char **argv)
fprintf(stderr, " adjusted to T1=%.2f and T2=%.2f\n", t1, t2);
}
}
i+=2; /* skip the arguments to grey_stretch */
new_image = grey_stretch(&image, t1, t2, lt);
i+=2; /* skip the arguments to gray_stretch */
new_image = gray_stretch(&image, t1, t2, lt);
imlib_context_set_image(image);
imlib_free_image();
image = new_image;
} else {
fprintf(stderr,
"error: grey_stretch command needs two arguments\n");
"error: gray_stretch command needs two arguments\n");
exit(99);
}
} else if(strcasecmp("greyscale",argv[i]) == 0) {
if(flags & VERBOSE) fputs(" processing greyscale\n", stderr);
new_image = greyscale(&image, lt);
} else if(strcasecmp("grayscale",argv[i]) == 0) {
if(flags & VERBOSE) fputs(" processing grayscale\n", stderr);
new_image = grayscale(&image, lt);
imlib_context_set_image(image);
imlib_free_image();
image = new_image;
@@ -868,7 +868,7 @@ int main(int argc, char **argv)
if(flags & USE_DEBUG_IMAGE) {
/* draw rectangles around digits */
imlib_context_set_image(debug_image);
imlib_context_set_color(128,128,128,255); /* grey line */
imlib_context_set_color(128,128,128,255); /* gray line */
for(d=0; d<number_of_digits; d++) {
imlib_image_draw_rectangle(digits[d].x1, digits[d].y1,
digits[d].x2-digits[d].x1, digits[d].y2-digits[d].y1);