mirror of
https://github.com/simon987/sist2.git
synced 2025-04-19 10:16:42 +00:00
Tweak MIN_OCR_SIZE behavior, update gitignore
This commit is contained in:
parent
fe1aa6dd4c
commit
255bc2d689
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,3 +24,5 @@ Testing/
|
|||||||
test_i
|
test_i
|
||||||
test_i_inc
|
test_i_inc
|
||||||
node_modules/
|
node_modules/
|
||||||
|
.cmake/
|
||||||
|
i_inc/
|
2
third-party/libscan/libscan/ebook/ebook.c
vendored
2
third-party/libscan/libscan/ebook/ebook.c
vendored
@ -233,7 +233,7 @@ void fill_image(fz_context *fzctx, UNUSED(fz_device *dev),
|
|||||||
|
|
||||||
int l2factor = 0;
|
int l2factor = 0;
|
||||||
|
|
||||||
if (img->w > MIN_OCR_SIZE && img->h > MIN_OCR_SIZE && OCR_IS_VALID_BPP(img->n)) {
|
if (img->w >= MIN_OCR_SIZE && img->h >= MIN_OCR_SIZE && OCR_IS_VALID_BPP(img->n)) {
|
||||||
fz_pixmap *pix = img->get_pixmap(fzctx, img, NULL, img->w, img->h, &l2factor);
|
fz_pixmap *pix = img->get_pixmap(fzctx, img, NULL, img->w, img->h, &l2factor);
|
||||||
ocr_extract_text(thread_ctx.tesseract_path, thread_ctx.tesseract_lang, pix->samples, pix->w, pix->h, pix->n, pix->stride, pix->xres, fill_image_ocr_cb);
|
ocr_extract_text(thread_ctx.tesseract_path, thread_ctx.tesseract_lang, pix->samples, pix->w, pix->h, pix->n, pix->stride, pix->xres, fill_image_ocr_cb);
|
||||||
fz_drop_pixmap(fzctx, pix);
|
fz_drop_pixmap(fzctx, pix);
|
||||||
|
2
third-party/libscan/libscan/ocr/ocr.h
vendored
2
third-party/libscan/libscan/ocr/ocr.h
vendored
@ -19,7 +19,7 @@ ocr_extract_text(const char *tesseract_path, const char *tesseract_lang,
|
|||||||
const int img_bpp, const int img_stride, const int img_xres,
|
const int img_bpp, const int img_stride, const int img_xres,
|
||||||
const ocr_extract_callback_t cb) {
|
const ocr_extract_callback_t cb) {
|
||||||
|
|
||||||
if (img_w <= MIN_OCR_SIZE || img_h <= MIN_OCR_SIZE || img_xres <= 0 ||
|
if (img_w < MIN_OCR_SIZE || img_h < MIN_OCR_SIZE || img_xres <= 0 ||
|
||||||
!OCR_IS_VALID_BPP(img_bpp)) {
|
!OCR_IS_VALID_BPP(img_bpp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user