guix/gnu/packages/patches/ccextractor-fix-ocr.patch
Maxim Cournoyer 2dc2722dc0
gnu: ccextractor: Update to 0.94 and fix build.
* gnu/packages/gstreamer.scm (ccextractor): Update to 0.94.
[source]: Apply patches.  Add FIXME comment.
[build-system]: Switch to gnu-build-system.
[arguments]: Delete #tests? argument.  Delete trailing #t and use gexps.
Adjust configure flags accordingly, removing WITH_SHARING (doesn't exist for
Autoconf) and adding '--without-rust'.  Override check phase.
[native-inputs]: Remove labels.  Remove python-wrapper and perl.
[propagated-inputs]: Remove labels.  Remove nanomsg and zlib.  Replace
leptonica with leptonica-1.80.  replace tesseract-ocr with tesseract-ocr-4.
* gnu/packages/patches/ccextractor-add-missing-header.patch: New file.
* gnu/packages/patches/ccextractor-autoconf-tesseract.patch: Likewise.
* gnu/packages/patches/ccextractor-fix-ocr.patch: Likewise.
* gnu/local.mk (dist_patch_DATA): Register them.
2023-03-17 10:40:02 -04:00

30 lines
1.1 KiB
Diff

Extracted from upstream commit 0264e7da2be67182deb031228eb07e6ed4943c81.
diff --git a/src/lib_ccx/ocr.c b/src/lib_ccx/ocr.c
index 31cc1c5c..73bd4818 100644
--- a/src/lib_ccx/ocr.c
+++ b/src/lib_ccx/ocr.c
@@ -331,6 +331,11 @@ char *ocr_bitmap(void *arg, png_color *palette, png_byte *alpha, unsigned char *
}
BOX *crop_points = ignore_alpha_at_edge(copy->alpha, copy->data, w, h, color_pix, &color_pix_out);
+
+ l_int32 x, y, _w, _h;
+
+ boxGetGeometry(crop_points, &x, &y, &_w, &_h);
+
// Converting image to grayscale for OCR to avoid issues with transparency
cpix_gs = pixConvertRGBToGray(cpix, 0.0, 0.0, 0.0);
@@ -426,8 +431,8 @@ char *ocr_bitmap(void *arg, png_color *palette, png_byte *alpha, unsigned char *
{
for (int j = x1; j <= x2; j++)
{
- if (copy->data[(crop_points->y + i) * w + (crop_points->x + j)] != firstpixel)
- histogram[copy->data[(crop_points->y + i) * w + (crop_points->x + j)]]++;
+ if (copy->data[(y + i) * w + (x + j)] != firstpixel)
+ histogram[copy->data[(y + i) * w + (x + j)]]++;
}
}
/* sorted in increasing order of intensity */