unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 9a0602672401c2c38ff42d79f543cdb0c6bb4d41 1129 bytes (raw)
name: packages/patches/ccextractor-fix-ocr.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
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 */

debug log:

solving 9a0602672401c2c38ff42d79f543cdb0c6bb4d41 ...
found 9a0602672401c2c38ff42d79f543cdb0c6bb4d41 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).