Skip to content

Commit 0bbeeee

Browse files
committed
update comments
1 parent 50e040a commit 0bbeeee

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

SerialPrograms/Source/CommonTools/OCR/OCR_NumberReader.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ int read_number(Logger& logger, const ImageViewRGB32& image, Language language =
2727
// This version attempts to improve reliability by first isolating each number
2828
// via waterfill. Then it OCRs each number by itself and recombines them at the
2929
// end. This requires specifying the color range for the text.
30+
//
31+
// text_inside_range: binary filter is applied to the image so that any pixels within the color range will be turned black, and everything else will be white
32+
// width_max: return -1 if any character's width is greater than width_max (likely means that two characters are touching, and so are treated as one large character)
33+
// check_empty_string: if set to true, return -1 (and stop evaluation) if any character returns an empty string from OCR
3034
int read_number_waterfill(
3135
Logger& logger, const ImageViewRGB32& image,
3236
uint32_t rgb32_min, uint32_t rgb32_max,
@@ -35,10 +39,8 @@ int read_number_waterfill(
3539
bool check_empty_string = false
3640
);
3741

38-
// applies color filters on the text, until each individual waterfilled character/number is less than width_max. then apply OCR.
39-
// this solves the problem where characters are too close to each other and touch, causing more than one character to be OCR'ed
40-
// also, if running OCR on a character results in an empty string, try the next color filter
41-
// the filters should be arranged in order of preference. (probably should be arranged broadest to narrowest)
42+
// Try OCR with all the given color filters.
43+
// Return the best majority candidate
4244
int read_number_waterfill(
4345
Logger& logger, const ImageViewRGB32& image,
4446
std::vector<std::pair<uint32_t, uint32_t>> filters,

0 commit comments

Comments
 (0)