调试
This commit is contained in:
@@ -2,6 +2,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
import pdb
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
@@ -55,6 +56,7 @@ def split_image(img_path, max_ratio=2.82, best_ration=1.41, overlap=0.05):
|
|||||||
split_result = []
|
split_result = []
|
||||||
# 打开图片
|
# 打开图片
|
||||||
img = open_image(img_path)
|
img = open_image(img_path)
|
||||||
|
pdb.set_trace()
|
||||||
# 获取图片的宽度和高度
|
# 获取图片的宽度和高度
|
||||||
height, width = img.shape[:2]
|
height, width = img.shape[:2]
|
||||||
# 计算宽高比
|
# 计算宽高比
|
||||||
|
|||||||
15
test.py
15
test.py
@@ -1,15 +0,0 @@
|
|||||||
import urllib.request
|
|
||||||
|
|
||||||
import cv2
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
# 发送HTTP请求并获取图像数据
|
|
||||||
resp = urllib.request.urlopen("http://drg100.cn-sh2.ufileos.com/PH20240529000194_1_075936_1.PNG?UCloudPublicKey=4Z7QYI7qml36QRjcCjKrls7aHl1R6H6uq&Signature=iy2o2yJqJ8jJVoR71qxAIy2wuD4%3D&Expires=1719008836")
|
|
||||||
# 将数据读取为字节流
|
|
||||||
image_data = resp.read()
|
|
||||||
# 将字节流转换为NumPy数组
|
|
||||||
image_np = np.frombuffer(image_data, np.uint8)
|
|
||||||
# 解码NumPy数组为OpenCV图像格式
|
|
||||||
image = cv2.imdecode(image_np, cv2.IMREAD_COLOR)
|
|
||||||
cv2.imwrite("test.png", image)
|
|
||||||
Reference in New Issue
Block a user