Show 『Picture Add + Crosee Line ROI
Show 结果先
import os
import tkinter as tk
from PIL import Image, ImageDraw, ImageTk
# 定义图片文件夹路径和文件扩展名
path = r'C:\Users\Administrator\Desktop\Case'
extensions = ['.jpg', '.jpeg', '.png', '.bmp', '.gif']
# 加载图片函数
def load_images(path):
images = []
for ext in extensions:
for file in os.listdir(path):
if file.lower().endswith(ext):
img = Image.open(os.path.join(path, file))
img.thumbnail((360, 360)) # image.resize((300, 300))
images.append(img)
return images
# 处理图片,添加十字线和正方形
def process_image(img, show_cross, show_square):
draw = ImageDraw.Draw(img)
width, height = img.size
if show_cross:
# 绘制黄色十字中心线
draw.