Closed chconnor closed 1 year ago
Oh, I see, -W and -H do the opposite of what I expected. I thought they set a minimum size of a decimal point, they in fact set the maximum size.
Suggestion, change these man page lines:
-H, --dec-h-ratio RATIO
Set the max_digit_height/height ratio used for recognition of a decimal separator. This value is used in combination with the max_digit_width/width ratio.
-W, --dec-w-ratio RATIO
Set the max_digit_width/width ratio used for recognition of a decimal separator. This value is used in combination with the max_digit_height/height ratio.
To this:
-H, --dec-h-ratio RATIO
Set the max_digit_height/height ratio used for recognition of a decimal separator. This value is used in combination with the max_digit_width/width ratio, and sets an upper bound to how tall a decimal point can be; both ratios must be exceeded to detect a decimal point.
-W, --dec-w-ratio RATIO
Set the max_digit_width/width ratio used for recognition of a decimal separator. This value is used in combination with the max_digit_height/height ratio, and sets an upper bound to how wide a decimal point can be; both ratios must be exceeded to detect a decimal point.
Thanks for letting me know!
I intend to update the documentation, and create a bug fix release of ssocr
to address this. I intend to add a comment here when I have done this to let you know.
I have not yet closely examined your image, but if the problem really pertains to a single pixel, you might be able to remove it using the remove_isolated
command. If there are larger groups of noise pixels, you might be able to remove them using the keep_pixels_filter NUMBER_OF_NEIGHBORS
command.
Since the image is quite large, you may be able to adjust the minimum number of pixels required during image segmentation via the --ignore-pixels NUMBER
option to require more than the ignored number of pixels to detect a foreground feature.
OK, I've just tried it out, remove_isolated
works:
$ ssocr rotate 359 crop 2394 960 612 327 shear 30 -H 6 -W 2.5 -d -1 -T remove_isolated ssocr_demo.jpg
82.8
Of course, I still intend to improve the documentation!
I have just released ssocr
version 2.22.2 with just documentation improvements (--help
output, --debug-output
output, man page, and web page).
Thanks! Yeah, I used -i and it worked as well. Great to hear the doc was updated, thanks for the software!
Another suggestion: the documentation for -r and -m could possibly be updated: -r sets the ratio "threshold" for the 1 digit, and I again assumed that was an upper bound on the ratio, but it's actually a lower bound, if I'm reading the code correctly.
Perhaps -n could/should be applied to detecting 1's and -'s as well? In general it would be nice to be able to specify minimum digit widths ("ignore any digit detected that is narrower than X") and it seems like -n would be a natural way to achieve the same thing.
Edit: I'll make an FR...
Another suggestion: the documentation for -r and -m could possibly be updated: -r sets the ratio "threshold" for the 1 digit, and I again assumed that was an upper bound on the ratio, but it's actually a lower bound, if I'm reading the code correctly.
I did that already, when I updated the documentation regarding -H
and -W
, please see the man page.
Hello!
With this image, using this command:
ssocr rotate 359 crop 2394 960 612 327 shear 30 -H 6 -W 2.5 -P -Dssocr_out.png -d -1 -T ssocr_demo.jpg
I get ".82.8" instead of 82.8, with the following stdout... it seems to be finding a single-pixel decimal point, despite my specification of minimum size via ratios specified with -H -W.
Debug image here.
Anything I can be doing better? Or is it a bug? Thanks!