Skip to content
Snippets Groups Projects
Commit 069fa980 authored by leo's avatar leo
Browse files

changes i dont remember #yolo

parent dfd53745
Branches master
No related tags found
No related merge requests found
Showing
with 284 additions and 0 deletions
0.jpg 0 → 100644
0.jpg

172 KiB

1.jpg 0 → 100644
1.jpg

49.3 KiB

1535461343.png

488 KiB

1535461346.png

167 KiB

[[0, [[0, [[0, [[1, 1, 0, 0, 0, 0, 0, 0, 932, 2530, -1, ""]]]]], [1, [[0, [[2, 1, 1, 0, 0, 0, 270, 270, 412, 407, -1, ""], [3, 1, 1, 1, 0, 0, 270, 270, 412, 407, -1, ""]]], [1, [[4, 1, 1, 1, 1, 0, 270, 270, 412, 407, -1, ""], [5, 1, 1, 1, 1, 1, 270, 270, 412, 407, 95, ""]]]]], [2, [[0, [[2, 1, 2, 0, 0, 0, 90, 708, 691, 186, -1, ""], [3, 1, 2, 1, 0, 0, 90, 708, 691, 186, -1, ""]]], [1, [[4, 1, 2, 1, 1, 0, 226, 708, 398, 32, -1, ""], [5, 1, 2, 1, 1, 1, 226, 708, 398, 32, 47, "WukWanfka&N\u00dfhk"]]], [2, [[4, 1, 2, 1, 2, 0, 303, 746, 247, 31, -1, ""], [5, 1, 2, 1, 2, 1, 303, 746, 208, 31, 67, "Loddenheide"], [5, 1, 2, 1, 2, 2, 534, 747, 16, 28, 74, "5"]]], [3, [[4, 1, 2, 1, 3, 0, 187, 784, 472, 32, -1, ""], [5, 1, 2, 1, 3, 1, 187, 784, 472, 32, 43, "%HlN\u00f6MUH\u00bbUH\u201cIWKMHHQHR"]]], [4, [[4, 1, 2, 1, 4, 0, 251, 822, 373, 31, -1, ""], [5, 1, 2, 1, 4, 1, 251, 822, 62, 29, 55, "lel."], [5, 1, 2, 1, 4, 2, 342, 822, 69, 29, 65, "0261"], [5, 1, 2, 1, 4, 3, 439, 826, 14, 24, 82, "/"], [5, 1, 2, 1, 4, 4, 477, 823, 147, 30, 62, "znaes101"]]], [5, [[4, 1, 2, 1, 5, 0, 90, 859, 691, 35, -1, ""], [5, 1, 2, 1, 5, 1, 90, 859, 67, 28, 74, "Inh."], [5, 1, 2, 1, 5, 2, 186, 859, 130, 29, 75, "NLHKAUF"], [5, 1, 2, 1, 5, 3, 342, 860, 358, 34, 47, "Handelaue$ellgchafl"], [5, 1, 2, 1, 5, 4, 727, 864, 54, 27, 66, "mbH"]]]]], [3, [[0, [[2, 1, 3, 0, 0, 0, 49, 940, 730, 451, -1, ""], [3, 1, 3, 1, 0, 0, 49, 940, 730, 451, -1, ""]]], [1, [[4, 1, 3, 1, 1, 0, 688, 940, 54, 27, -1, ""], [5, 1, 3, 1, 1, 1, 688, 940, 54, 27, 82, "EUR"]]], [2, [[4, 1, 3, 1, 2, 0, 52, 974, 516, 33, -1, ""], [5, 1, 3, 1, 2, 1, 52, 974, 27, 28, 55, "ll"], [5, 1, 3, 1, 2, 2, 113, 985, 10, 16, 42, "@"], [5, 1, 3, 1, 2, 3, 499, 977, 69, 30, 49, "1,59"]]], [3, [[4, 1, 3, 1, 3, 0, 49, 1014, 730, 33, -1, ""], [5, 1, 3, 1, 3, 1, 49, 1014, 140, 27, 49, "VHUUUNII"], [5, 1, 3, 1, 3, 2, 231, 1014, 16, 28, 82, "ll"], [5, 1, 3, 1, 3, 3, 654, 1017, 88, 30, 59, "11,49"], [5, 1, 3, 1, 3, 4, 764, 1018, 15, 27, 74, "B"]]], [4, [[4, 1, 3, 1, 4, 0, 50, 1051, 518, 31, -1, ""], [5, 1, 3, 1, 4, 1, 50, 1051, 34, 29, 62, "24"], [5, 1, 3, 1, 4, 2, 112, 1062, 9, 12, 56, ",:"], [5, 1, 3, 1, 4, 3, 495, 1054, 73, 28, 57, "(H)?!)"]]], [5, [[4, 1, 3, 1, 5, 0, 51, 1089, 690, 35, -1, ""], [5, 1, 3, 1, 5, 1, 51, 1089, 71, 30, 65, "U\ufb02tT"], [5, 1, 3, 1, 5, 2, 147, 1092, 74, 26, 68, "|HIA"], [5, 1, 3, 1, 5, 3, 244, 1092, 48, 27, 67, "UH,"], [5, 1, 3, 1, 5, 4, 321, 1091, 53, 28, 56, "Ml\ufb02"], [5, 1, 3, 1, 5, 5, 650, 1093, 91, 31, 55, "33\u201a/b"]]], [6, [[4, 1, 3, 1, 6, 0, 51, 1127, 517, 35, -1, ""], [5, 1, 3, 1, 6, 1, 51, 1127, 33, 29, 60, "2d"], [5, 1, 3, 1, 6, 2, 110, 1137, 13, 18, 58, "x"], [5, 1, 3, 1, 6, 3, 495, 1131, 73, 31, 59, "U\u201aQh"]]], [7, [[4, 1, 3, 1, 7, 0, 51, 1167, 727, 35, -1, ""], [5, 1, 3, 1, 7, 1, 51, 1167, 31, 28, 47, "I\u2019ller"], [5, 1, 3, 1, 7, 2, 89, 1167, 55, 28, 71, "ANU"], [5, 1, 3, 1, 7, 3, 669, 1175, 15, 22, 48, "\u201e"], [5, 1, 3, 1, 7, 4, 693, 1194, 4, 8, 85, "\u201a"], [5, 1, 3, 1, 7, 5, 707, 1170, 50, 27, 62, "(Min"], [5, 1, 3, 1, 7, 6, 764, 1172, 14, 26, 81, "l.;"]]], [8, [[4, 1, 3, 1, 8, 0, 51, 1207, 517, 33, -1, ""], [5, 1, 3, 1, 8, 1, 51, 1207, 33, 27, 50, ";51"], [5, 1, 3, 1, 8, 2, 109, 1222, 14, 11, 36, "A"], [5, 1, 3, 1, 8, 3, 495, 1210, 73, 30, 61, "tl\u201aUu"]]], [9, [[4, 1, 3, 1, 9, 0, 51, 1244, 717, 35, -1, ""], [5, 1, 3, 1, 9, 1, 51, 1244, 67, 29, 70, "VUI1"], [5, 1, 3, 1, 9, 2, 148, 1246, 72, 26, 55, "tulA"], [5, 1, 3, 1, 9, 3, 244, 1246, 61, 30, 58, "H\u201abl"], [5, 1, 3, 1, 9, 4, 650, 1247, 118, 32, 58, "23\u201a/h["]]], [10, [[4, 1, 3, 1, 10, 0, 51, 1282, 517, 33, -1, ""], [5, 1, 3, 1, 10, 1, 51, 1282, 34, 28, 60, "24"], [5, 1, 3, 1, 10, 2, 110, 1292, 14, 18, 67, "x"], [5, 1, 3, 1, 10, 3, 495, 1284, 73, 31, 58, "U,?5"]]], [11, [[4, 1, 3, 1, 11, 0, 51, 1320, 728, 35, -1, ""], [5, 1, 3, 1, 11, 1, 51, 1320, 93, 30, 71, "PFANH"], [5, 1, 3, 1, 11, 2, 668, 1323, 16, 27, 45, "&"], [5, 1, 3, 1, 11, 3, 707, 1325, 72, 26, 59, "UUAU"]]], [12, [[4, 1, 3, 1, 12, 0, 56, 1359, 512, 32, -1, ""], [5, 1, 3, 1, 12, 1, 56, 1359, 30, 29, 61, "H3"], [5, 1, 3, 1, 12, 2, 110, 1367, 14, 20, 61, "x"], [5, 1, 3, 1, 12, 3, 495, 1367, 16, 20, 74, "ll"], [5, 1, 3, 1, 12, 4, 533, 1363, 35, 26, 44, "b?"]]]]], [4, [[0, [[2, 1, 4, 0, 0, 0, 50, 1398, 729, 67, -1, ""], [3, 1, 4, 1, 0, 0, 50, 1398, 729, 67, -1, ""]]], [1, [[4, 1, 4, 1, 1, 0, 50, 1398, 729, 67, -1, ""], [5, 1, 4, 1, 1, 1, 50, 1398, 131, 67, 49, "FA\"|\\HU1"], [5, 1, 4, 1, 1, 2, 205, 1400, 93, 26, 54, "U|H'I:"], [5, 1, 4, 1, 1, 3, 655, 1401, 86, 30, 24, "]U};;h"], [5, 1, 4, 1, 1, 4, 764, 1401, 15, 29, 53, "[;"]]], [2, [[4, 1, 4, 1, 2, 0, 50, 1436, 707, 29, -1, ""], [5, 1, 4, 1, 2, 1, 50, 1436, 125, 29, 58, "PO&.T_(;|;"], [5, 1, 4, 1, 2, 2, 209, 1436, 50, 29, 62, "_l)\u2019"], [5, 1, 4, 1, 2, 3, 674, 1452, 3, 2, 88, "."], [5, 1, 4, 1, 2, 4, 750, 1452, 7, 2, 89, ".."]]]]], [5, [[0, [[2, 1, 5, 0, 0, 0, 52, 1452, 726, 91, -1, ""], [3, 1, 5, 1, 0, 0, 52, 1452, 726, 91, -1, ""]]], [1, [[4, 1, 5, 1, 1, 0, 52, 1452, 726, 91, -1, ""], [5, 1, 5, 1, 1, 1, 52, 1476, 186, 57, 70, "SUMME"], [5, 1, 5, 1, 1, 2, 303, 1477, 110, 56, 64, "IEI.JR"], [5, 1, 5, 1, 1, 3, 593, 1452, 185, 91, 63, "87,3b"]]]]], [6, [[0, [[2, 1, 6, 0, 0, 0, 50, 1583, 768, 187, -1, ""], [3, 1, 6, 1, 0, 0, 50, 1583, 691, 33, -1, ""], [3, 1, 6, 2, 0, 0, 50, 1660, 768, 110, -1, ""]]], [1, [[4, 1, 6, 1, 1, 0, 50, 1583, 691, 33, -1, ""], [5, 1, 6, 1, 1, 1, 50, 1583, 63, 28, 58, "ht"], [5, 1, 6, 1, 1, 2, 115, 1586, 67, 26, 62, ".a>h"], [5, 1, 6, 1, 1, 3, 457, 1586, 54, 26, 56, "kUR"], [5, 1, 6, 1, 1, 4, 649, 1587, 92, 29, 52, "\u00f6/\u201aub"], [4, 1, 6, 2, 1, 0, 50, 1660, 767, 31, -1, ""], [5, 1, 6, 2, 1, 1, 50, 1660, 69, 27, 51, "Mwat"], [5, 1, 6, 2, 1, 2, 341, 1661, 93, 28, 67, "MIIIU"], [5, 1, 6, 2, 1, 3, 552, 1663, 69, 27, 58, "MwSt"], [5, 1, 6, 2, 1, 4, 706, 1662, 111, 29, 71, "UMSAI?"]]], [2, [[4, 1, 6, 2, 2, 0, 50, 1697, 768, 35, -1, ""], [5, 1, 6, 2, 2, 1, 50, 1698, 15, 27, 73, "B"], [5, 1, 6, 2, 2, 2, 93, 1697, 31, 28, 62, "7%"], [5, 1, 6, 2, 2, 3, 342, 1698, 92, 33, 61, "3h\u201a03"], [5, 1, 6, 2, 2, 4, 558, 1699, 68, 32, 64, "1,82"], [5, 1, 6, 2, 2, 5, 726, 1700, 92, 32, 46, "27,8%"]]], [3, [[4, 1, 6, 2, 3, 0, 50, 1736, 768, 34, -1, ""], [5, 1, 6, 2, 3, 1, 50, 1736, 16, 26, 68, "C"], [5, 1, 6, 2, 3, 2, 91, 1736, 52, 29, 54, "10%"], [5, 1, 6, 2, 3, 3, 341, 1736, 93, 32, 60, "5n\u201au\ufb01"], [5, 1, 6, 2, 3, 4, 553, 1737, 74, 33, 61, "9,50"], [5, 1, 6, 2, 3, 5, 726, 1738, 92, 31, 59, "59,52"]]]]], [7, [[0, [[2, 1, 7, 0, 0, 0, 50, 1813, 653, 150, -1, ""], [3, 1, 7, 1, 0, 0, 51, 1813, 652, 71, -1, ""], [3, 1, 7, 2, 0, 0, 50, 1889, 359, 30, -1, ""], [3, 1, 7, 3, 0, 0, 50, 1928, 628, 35, -1, ""]]], [1, [[4, 1, 7, 1, 1, 0, 51, 1813, 652, 31, -1, ""], [5, 1, 7, 1, 1, 1, 51, 1813, 47, 29, 67, "Mi!"], [5, 1, 7, 1, 1, 2, 128, 1814, 42, 28, 46, "dh!"], [5, 1, 7, 1, 1, 3, 205, 1814, 287, 29, 41, "\u201cHHlbxhldhd\ufb02nld"], [5, 1, 7, 1, 1, 4, 514, 1816, 113, 28, 60, "hmltun"], [5, 1, 7, 1, 1, 5, 650, 1821, 53, 23, 59, "him"], [4, 1, 7, 2, 1, 0, 50, 1889, 359, 30, -1, ""], [5, 1, 7, 2, 1, 1, 50, 1889, 33, 28, 64, "37"], [5, 1, 7, 2, 1, 2, 109, 1890, 112, 29, 60, "Punkln"], [5, 1, 7, 2, 1, 3, 244, 1891, 165, 28, 50, "thalh\ufb02\ufb02"], [4, 1, 7, 3, 1, 0, 50, 1928, 628, 35, -1, ""], [5, 1, 7, 3, 1, 1, 50, 1938, 13, 11, 41, "*"], [5, 1, 7, 3, 1, 2, 88, 1928, 590, 35, 40, "Pu\u201eilhnllnthl|\u00abAMMlhmknlnigl"]]], [2, [[4, 1, 7, 1, 2, 0, 51, 1852, 555, 32, -1, ""], [5, 1, 7, 1, 2, 1, 51, 1852, 50, 28, 60, "auf"], [5, 1, 7, 1, 2, 2, 128, 1852, 54, 29, 58, "den"], [5, 1, 7, 1, 2, 3, 205, 1852, 112, 29, 54, "UWmul2"], [5, 1, 7, 1, 2, 4, 342, 1860, 67, 21, 56, "vun."], [5, 1, 7, 1, 2, 5, 442, 1852, 88, 32, 51, "7H\u201aJh"], [5, 1, 7, 1, 2, 6, 553, 1853, 53, 29, 66, "[UR"]]]]], [8, [[0, [[2, 1, 8, 0, 0, 0, 117, 2006, 705, 30, -1, ""], [3, 1, 8, 1, 0, 0, 117, 2006, 705, 30, -1, ""]]], [1, [[4, 1, 8, 1, 1, 0, 117, 2006, 705, 30, -1, ""], [5, 1, 8, 1, 1, 1, 117, 2007, 16, 25, 75, "U"], [5, 1, 8, 1, 1, 2, 158, 2006, 43, 27, 72, "H1"], [5, 1, 8, 1, 1, 3, 257, 2006, 77, 28, 62, "s(il"], [5, 1, 8, 1, 1, 4, 361, 2007, 70, 27, 63, "llal"], [5, 1, 8, 1, 1, 5, 453, 2006, 263, 30, 75, "211/()1/(lu"], [5, 1, 8, 1, 1, 6, 719, 2008, 103, 27, 68, "\u00a3EJ2'"]]]]], [9, [[0, [[2, 1, 9, 0, 0, 0, 114, 2008, 721, 115, -1, ""], [3, 1, 9, 1, 0, 0, 114, 2008, 721, 115, -1, ""]]], [1, [[4, 1, 9, 1, 1, 0, 114, 2008, 721, 115, -1, ""], [5, 1, 9, 1, 1, 1, 114, 2008, 721, 115, 79, "Illlllllll|IlllllllllllllllllllllllIllllllllllllllllllllll"]]]]], [10, [[0, [[2, 1, 10, 0, 0, 0, 50, 2160, 673, 68, -1, ""], [3, 1, 10, 1, 0, 0, 50, 2160, 673, 68, -1, ""]]], [1, [[4, 1, 10, 1, 1, 0, 50, 2160, 653, 67, -1, ""], [5, 1, 10, 1, 1, 1, 50, 2160, 93, 28, 67, "Unlum"], [5, 1, 10, 1, 1, 2, 166, 2160, 128, 28, 54, "Uhrzmll"], [5, 1, 10, 1, 1, 3, 341, 2160, 131, 28, 61, "lillul\u00fc"], [5, 1, 10, 1, 1, 4, 495, 2162, 54, 65, 43, "I;U\u00dc"], [5, 1, 10, 1, 1, 5, 572, 2161, 55, 28, 69, "Bed"], [5, 1, 10, 1, 1, 6, 650, 2161, 53, 29, 69, "BUH"]]], [2, [[4, 1, 10, 1, 2, 0, 57, 2197, 666, 31, -1, ""], [5, 1, 10, 1, 2, 1, 57, 2197, 143, 29, 16, "1&\u201a12\u20181/"], [5, 1, 10, 1, 2, 2, 226, 2198, 92, 29, 59, "2u\u201au4"], [5, 1, 10, 1, 2, 3, 342, 2199, 206, 28, 61, "uuunun11/"], [5, 1, 10, 1, 2, 4, 575, 2199, 51, 29, 74, "11/"], [5, 1, 10, 1, 2, 5, 650, 2199, 73, 28, 48, "msiJf"]]]]], [11, [[0, [[2, 1, 11, 0, 0, 0, 230, 2039, 5, 81, -1, ""], [3, 1, 11, 1, 0, 0, 230, 2039, 5, 81, -1, ""]]], [1, [[4, 1, 11, 1, 1, 0, 230, 2039, 5, 81, -1, ""], [5, 1, 11, 1, 1, 1, 230, 2039, 5, 81, 95, ""]]]]], [12, [[0, [[2, 1, 12, 0, 0, 0, 189, 2316, 496, 29, -1, ""], [3, 1, 12, 1, 0, 0, 189, 2316, 496, 29, -1, ""]]], [1, [[4, 1, 12, 1, 1, 0, 189, 2316, 496, 29, -1, ""], [5, 1, 12, 1, 1, 1, 189, 2317, 240, 28, 55, "%leuwunummer:"], [5, 1, 12, 1, 1, 2, 463, 2316, 222, 29, 53, "110/%/21f163"]]]]], [13, [[0, [[2, 1, 13, 0, 0, 0, 150, 2393, 568, 105, -1, ""], [3, 1, 13, 1, 0, 0, 150, 2393, 568, 105, -1, ""]]], [1, [[4, 1, 13, 1, 1, 0, 150, 2393, 568, 30, -1, ""], [5, 1, 13, 1, 1, 1, 150, 2393, 113, 28, 57, "Vialen"], [5, 1, 13, 1, 1, 2, 286, 2394, 70, 28, 64, "Dank"], [5, 1, 13, 1, 1, 3, 388, 2393, 35, 29, 67, "fut"], [5, 1, 13, 1, 1, 4, 464, 2394, 87, 28, 63, "|hi\u00fcH"], [5, 1, 13, 1, 1, 5, 573, 2394, 145, 29, 56, "Linkaufl"]]], [2, [[4, 1, 13, 1, 2, 0, 226, 2431, 415, 34, -1, ""], [5, 1, 13, 1, 2, 1, 226, 2431, 114, 29, 47, "Unnurs"], [5, 1, 13, 1, 2, 2, 363, 2431, 278, 34, 53, "0Tfunhguleilen:"]]], [3, [[4, 1, 13, 1, 3, 0, 187, 2469, 478, 29, -1, ""], [5, 1, 13, 1, 3, 1, 187, 2470, 36, 28, 60, "Maja"], [5, 1, 13, 1, 3, 2, 286, 2471, 48, 27, 66, "f'w:\u2018|:"], [5, 1, 13, 1, 3, 3, 363, 2471, 74, 26, 72, "\u00f6:(lfl"], [5, 1, 13, 1, 3, 4, 468, 2483, 2, 2, 70, "'"], [5, 1, 13, 1, 3, 5, 497, 2469, 92, 29, 64, "21:\u00dc\u00dc"], [5, 1, 13, 1, 3, 6, 611, 2470, 54, 28, 70, "Uhl\u2018"]]]]]]], [0, [[0, [[0, [[1, 1, 0, 0, 0, 0, 0, 0, 925, 2535, -1, ""]]]]], [1, [[0, [[2, 1, 1, 0, 0, 0, 373, 2216, 407, 210, -1, ""], [3, 1, 1, 1, 0, 0, 373, 2216, 407, 210, -1, ""]]], [1, [[4, 1, 1, 1, 1, 0, 373, 2216, 407, 112, -1, ""], [5, 1, 1, 1, 1, 1, 373, 2252, 161, 70, 54, "\":>-3\u201d"], [5, 1, 1, 1, 1, 2, 561, 2216, 219, 112, 53, "C\u00d6JWV\\"]]], [2, [[4, 1, 1, 1, 2, 0, 506, 2353, 199, 73, -1, ""], [5, 1, 1, 1, 2, 1, 506, 2353, 199, 73, 62, "C\u00e4\u00ae7"]]]]]]]]
\ No newline at end of file
This diff is collapsed.
W
_____ _.FEMHNN
m täande 3
49549 Ladbergen
515t„ EU Cli'llélb'fllbälfl
r'>'\: . -N“ . L?'\?l '} 1-3".’ €. 5"«
Kää$öLßl
Rechnung -Nr.17945um 06,01.2018
Mitarbeiter Marlene Fröfi1:28:ll
38 K 0,75
KI-Dominos ZB 250g 28,50
13 X 1,99
LA-Zimtsterne 1759 25,87
50 X 1,50
HL-Mozartkugeln 200g 75,00
/" P /_\ // ' / /‚
“.Ä‚ ‘ \/” ZU, („’ (L „(7 .
“ “7
Betrag netto ' 120,91
MWSt 19% 0,00
MWSt 7% 8,46
Rückgeld 0,00
Gegeben 129,37
Vielen Dank für Ihren Einkauf !
Die Ware ist vom Umtausch
ausgeschlossen.
0000000179454
##################
Y@QJ
|
r;b‚‘ ESG
‚JJ. L‘;-
‘?iT'V"
_‚.- “'e_ K.}
EV
13
MI."
??
H.:
n
.d
y‚gounnäJafi26
7 !! N N !! l!1lll| ililllllll!
‚‘ ‚-.nw [güg5fyz-‘f.p
-3_H ; U J."L€“ ?: V."-'-"”'
ue;u° ‘"Ü
‚JÖGIU 50r3 „?
',"_'!'\
+„; Ngnyeue &LgUI£$85?i
-Ml 13355nu! oe OT'S {?
##################
SB.ptt 0 → 100644
This diff is collapsed.
File added
File added
File added
File added
File added
File added
File added
File added
File added
contrast.jpg

228 KiB

[
"Rechnungsdatum",
"Leistungsdatum",
"Rechnungsadresse",
"Kundennummer",
"Bruttobetrag",
"Nettobetrag",
"IBAN",
"Zahlungsart",
"Abrechnungszeitraum",
"Rechnungssteller"
]
from PIL import Image, ImageEnhance
import pytesseract
import json
import datetime
from text_model import Page, Word
from pdf_to_image import get_pdf_as_image
def _read_text_via_ocr(p_image, p_lang="deu"):
return pytesseract.image_to_data(p_image, lang=p_lang).split("\n")[1:]
def _generate_wordlist_from_rawtext(p_raw):
word_list = []
for raw_word in p_raw:
raw_word = raw_word.split("\t")
word = Word(raw_word)
word_list.append(word)
return word_list
def _generate_textmodel_from_wordlist(p_wordlist):
page = Page()
for word in p_wordlist:
page.insert_word(word)
return page
def _binarize_image(p_image):
width, height = p_image.size
binarized = Image.new("RGB", p_image.size)
binarized_data = []
pixeldata = p_image.getdata()
for pixel in pixeldata:
def _preprocess_image(p_image):
p_image = p_image.convert("L")
#contrast = ImageEnhance.Contrast(p_image)
#return contrast.enhance(8)
def generate_text_from_image(p_image, p_lang="deu"):
image = _preprocess_image(p_image)
image.save(str(int(datetime.datetime.now().timestamp())) + ".png")
raw_data = _read_text_via_ocr(image, p_lang)
wordlist = _generate_wordlist_from_rawtext(raw_data)
return _generate_textmodel_from_wordlist(wordlist)
def _page_to_list(p_page):
block_as_string = []
for block in p_page.get_block_list():
line_as_string = []
for line in block.get_line_list():
line_as_string.append(str(line))
block_as_string.append(line_as_string)
return block_as_string
def save_page_list_to_file(p_page_list, p_name):
page_list = []
for page in p_page_list:
block_list = _page_to_list(page)
page_list.append(block_list)
file = open(p_name + ".ptt", "w")
json.dump(page_list, file)
file.close()
def pdf_to_text(p_path_to_pdf):
images = get_pdf_as_image(p_path_to_pdf)
pdf_name = p_path_to_pdf.split("/")[-1]
file = open(pdf_name + ".ms", "w")
for image in images:
text = generate_text_from_image(image)
file.write(str(text))
file.write("\n##################\n")
file.close()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment