Эх сурвалжийг харах

fix: wrong color space conversion

忘忧北萱草 1 жил өмнө
parent
commit
e908a3aac4
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  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,