-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: -n could apply to detecting "1" and "-" #21
Comments
Interesting idea. I'll have to think about it. I do follow the logic of both "one" and "minus" consisting of a segment, and that they should be of sufficient size that a "scanline" would be accepted. For "one", checking the width suffices; for a "minus", checking the height suffices. This does seem useful. Just extending I'd say I'd like similar functionality for decimal separators, too, but that should probably use a separate value and thus a separate option to specify the minimum dimensions. Yet another approach could be to only accept "digits" during segmentation if they are of some minimum width and height. This would pertain to any type of "digit", including decimal separators. I do not expect to find time to look into this until the next weekend, and cannot promise anything. Thanks! |
Yeah, I was going to suggest a minimum digit segmentation width until I saw the -n. Makes sense that using -n might break old usage, and new options would be great, too. Maybe a separate min W/H from decimal points, though? I'm no 7-segment expert, but it would seem like some decimal points are pretty small compared to digits? Anyway, thanks again for considering! |
I am currently considering adding an option Do you have one (or a few) example image(s) you could provide for testing where you would like to use the requested feature? Ideally with the command line you (would like to) use? |
So it sounds like -N would not apply to overall segmentation (i.e. vertical red and blue lines in the debug images) but rather when scanning for individual segment elements within a potential digit? With this image I get a good scan ("63.7") if I use this command:
If I use a simpler command:
...I understandably get So the appeal of -N for me would just be the convenience to be able to say "ignore any potential digits narrower than X pixels when doing overall segmentation" -- I could skip learning all the noise parameters because it would neatly exclude all the small stuff:
...though I guess that would then apply to decimal points, too. Maybe that's fine. I suppose if it instead worked as a min size on individual segment scanning (as I think you described), but still did overall digit segmentation the way it does now, then it would still output a lot of .'s or _'s for the false-trigger "noise digits" found during segmentation? Or maybe -N could apply to both digit segmentation and segment scanning? Basically saying "this is the scale of real segments in this image, ignore everything smaller". I guess that's basically the point of keep_pixels_filter, but it feels a little touchy to use sometimes. E.g. this outputs nothing because the filter generates white only:
...changing keep_pixels_filter to 8 works perfectly, and changing it to 7 generates a false decimal point based on noise. So it doesn't end up feeling like a safe way to process the noise away. Anyway, not sure if this brainstorming is helpful as I only loosely understand the algorithm. :-) I have many more such images and can post some more if it's helpful, but they're all basically the same: relatively noisy and of the same device. |
The The The following variants work for this image:
I am not sure if applying the I'd expect that adjusting the segmentation step of the algorithm to ignore potential characters / digits below some minimum size or rather minimum dimensions (i.e., not minimum area) would be more helpful with the |
Sounds good, and thanks for the tips! (I had to use -t 98 there because some of the images in that series of images weren't consistent (LCD segments that were caught coming on/off as the shutter was open, so they were half-black, etc.) Some day I'll upgrade my setup to trigger off an Arduino so everything will be sync'ed properly.) |
Just extending the I could add an option to omit empty digits / characters, i.e., digits / characters with no set segments, similar to That still leaves all the spurious decimal points in your example output from one of your comments above. Using If you want to use a high threshold to mitigate timing issues, I would suggest you look into using An alternative approach could be to rely on the exit code of |
I have added Without
With
|
Thanks for the added feature! |
And now for the next step: I have added the option
When the number of digits is know, as with a single example image, this can be specified instead of using
I plan to release |
Awesome! Thanks again! |
This ssocr release adds new features and thus addresses GitHub issue #21: * new option -N, --min-segment=SIZE * new option -M, --min-char-dims=WxH * a range of expected digits can be specified (before, only a single number could be specified, or the number could be left unspecified)
I have released |
Oooh the range of digits enhancement is great, too. Very handy. |
If I understand correctly, -n applies only to detecting segments, and since 1 and - are detected separately, it does not apply to them.
Maybe it would be nice to have -n apply to detecting those digits as well, since they are also made of segments. For 1 it would be a minimum width, and for - a minimum height. This seems like a natural use of it.
It would help me avoid a lot of false detections of 1's. There are the noise-avoidance parameters (-i, remove_isolated, and keep_pixels_filter) but if -n applied it might be a pretty simple way to achieve the same?
Thanks for considering!
The text was updated successfully, but these errors were encountered: