mirror of
https://github.com/opendatalab/MinerU.git
synced 2026-09-24 23:10:23 +08:00
fix(table): improve table image processing
- Replace np.array with np.asarray for better performance - Add image color conversion from RGB to BGR using OpenCV
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import cv2
|
||||
from paddleocr.ppstructure.table.predict_table import TableSystem
|
||||
from paddleocr.ppstructure.utility import init_args
|
||||
from magic_pdf.libs.Constants import *
|
||||
@@ -36,7 +37,8 @@ class ppTableModel(object):
|
||||
- HTML (str): A string representing the HTML structure with content of the table.
|
||||
"""
|
||||
if isinstance(image, Image.Image):
|
||||
image = np.array(image)
|
||||
image = np.asarray(image)
|
||||
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
||||
pred_res, _ = self.table_sys(image)
|
||||
pred_html = pred_res["html"]
|
||||
# res = '<td><table border="1">' + pred_html.replace("<html><body><table>", "").replace(
|
||||
|
||||
Reference in New Issue
Block a user