Skip to content

Commit

Permalink
fixed tesseract-ocr#390 by introducing new rotate_image flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jm committed Aug 15, 2016
1 parent 4845684 commit 614ec13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion training/text2image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ BOOL_PARAM_FLAG(degrade_image, true,
"Degrade rendered image with speckle noise, dilation/erosion "
"and rotation");

// Rotate the rendered image to have more realistic glyph borders
BOOL_PARAM_FLAG(rotate_image, true, "Rotate the image in a random way.");

// Degradation to apply to the image.
INT_PARAM_FLAG(exposure, 0, "Exposure level in photocopier");

Expand Down Expand Up @@ -598,7 +601,7 @@ int main(int argc, char** argv) {
rotation = -1 * page_rotation[page_num];
}
if (FLAGS_degrade_image) {
pix = DegradeImage(pix, FLAGS_exposure, &randomizer, &rotation);
pix = DegradeImage(pix, FLAGS_exposure, &randomizer, FLAGS_rotate_image ? &rotation : NULL);
}
render.RotatePageBoxes(rotation);

Expand Down

0 comments on commit 614ec13

Please sign in to comment.