Bläddra i källkod

Merge pull request #94 from Wybxc/rgb2bgr

fix: wrong color space conversion
Byaidu 1 år sedan
förälder
incheckning
f23e7bbc9e
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      pdf2zh/high_level.py

+ 1 - 1
pdf2zh/high_level.py

@@ -164,7 +164,7 @@ def extract_text_to_fp(
         caching=not disable_caching,
     ), total=total_pages, position=0):
         pix = doc_en[page.pageno].get_pixmap()
-        image = np.fromstring(pix.samples, np.uint8).reshape(pix.height, pix.width, 3)
+        image = np.fromstring(pix.samples, np.uint8).reshape(pix.height, pix.width, 3)[:, :, ::-1]
         page_layout=model.predict(
             image,
             imgsz=int(pix.height/32)*32,