fangjiasheng 2 rokov pred
rodič
commit
46f4a389c4
1 zmenil súbory, kde vykonal 5 pridanie a 2 odobranie
  1. 5 2
      format_convert/convert_image.py

+ 5 - 2
format_convert/convert_image.py

@@ -251,7 +251,9 @@ def image_process(image_np, image_path, is_from_pdf=False, is_from_docx=False, u
                 # 长图分割
                 image_np_list = image_slice_new(image_np)
         if len(image_np_list) < 1:
-            return [-10]
+            log("image_slice failed!")
+            image_np_list = [image_np]
+            # return [-10]
 
         all_obj_list = []
         _add_y = 0
@@ -486,6 +488,7 @@ def image_slice_new(image_np):
 
         # 分割点距离不能太远
         cut_h = zero_h_after.tolist()[0]
+        print("cut_h", cut_h)
         if abs(h - cut_h) <= max_distance:
             image_list.append(image_origin[last_h:cut_h, :, :])
             last_h = cut_h
@@ -873,4 +876,4 @@ def image_process_old(image_np, image_path, is_from_pdf=False, is_from_docx=Fals
 
 
 if __name__ == "__main__":
-    image_slice_new(cv2.imread("C:/Users/Administrator/Desktop/test_image/1653566873838.png"))
+    image_slice_new(cv2.imread("C:/Users/Administrator/Desktop/test_image/error28.jpg"))