Skip to content

Commit

Permalink
Do the preprocessing sharpen after the grayscale
Browse files Browse the repository at this point in the history
rationale:
1. we're treating RGB as BGR -- per channel operations feel very
suspicious.
2. less data to iterate over
3. seems fine on the test datasets
  • Loading branch information
sz3 committed Mar 2, 2021
1 parent 9b90e78 commit 7be3d91
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lib/cimb_translator/CimbReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ namespace {
int blockSize = 3; // default: no preprocessing

cv::Mat symbols;
cv::cvtColor(img, symbols, cv::COLOR_RGB2GRAY);
if (needs_sharpen)
{
sharpenSymbolGrid(img, symbols);
cv::cvtColor(symbols, symbols, cv::COLOR_RGB2GRAY);
sharpenSymbolGrid(symbols, symbols);
blockSize = 7;
}
else
cv::cvtColor(img, symbols, cv::COLOR_RGB2GRAY);

cv::adaptiveThreshold(symbols, symbols, 255, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY, blockSize, 0);

bitbuffer bb(1024*128);
Expand Down

0 comments on commit 7be3d91

Please sign in to comment.