c8e2a8b8 by 周伟奇

Merge branch 'feature/ebank' into feature/0918

2 parents a351ec6f eb19605f
import os
import cv2
import shutil
import fitz
import math
......@@ -309,7 +310,7 @@ class PDFHandler:
if isinstance(max_img_count, int) and pdf.pageCount >= max_img_count:
self.img_count = pdf.pageCount
return
self.check_ebank(pdf)
# self.check_ebank(pdf)
for pno in range(pdf.pageCount):
il = pdf.getPageImageList(pno) # 获取页面图片对象
# (xref, smask, width, height, bpc, colorspace, alt.colorspace, name, filter, invoker)
......@@ -344,3 +345,14 @@ class PDFHandler:
page = pdf.loadPage(pno)
self.page_to_png(page)
self.img_count = len(self.img_path_list)
def ebank_draw(self):
for img_idx, img_path in enumerate(self.img_path_list):
img = cv2.imread(img_path)
pre, suf = os.path.splitext(img_path)
output_path = '{0}_res{1}'.format(pre, suf)
for (x0, y0, x1, y0, x1, y1, x0, y1), text in self.page_text_list[img_idx].pop('rebuild_text'):
# print((x0, y0, x1, y0, x1, y1, x0, y1))
# print(text)
cv2.rectangle(img, (int(x0), int(y0)), (int(x1), int(y1)), (0, 255, 0), 2)
cv2.imwrite(output_path, img)
\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!