【Python】Qwen-VL-7B box

VLLM-Qwen2-VL-7B-Instruct

bash 复制代码
import cv2

# 读取图像
image_path = 'haibaoA.png'  # 替换为图像的路径
image = cv2.imread(image_path)

# 定义框的坐标 (x1, y1) 是左上角,(x2, y2) 是右下角
x1, y1 = 200, 550  # 左上角坐标
x2, y2 = 799, 750 # 右下角坐标
h, w = image.shape[0], image.shape[1]
x1, y1, x2, y2 = (int(x1 / 1000 * w), int(y1 / 1000 * h), int(x2 / 1000 * w), int(y2 / 1000 * h))
# 定义框的颜色 (B, G, R) 和线条宽度
color = (0, 255, 0)  # 绿色
thickness = 2  # 线条宽度

# 在图像上绘制矩形框
cv2.rectangle(image, (x1, y1), (x2, y2), color, thickness)

# 显示图像
cv2.imshow('Image with Rectangle', image)
cv2.waitKey(0)
cv2.destroyAllWindows()

# 保存绘制框后的图像
output_path = 'image_with_rectangle.jpg'
cv2.imwrite(output_path, image)
相关推荐
szxinmai主板定制专家几秒前
基于 RK3576 的智能割草机器人解决方案,从样机到量产
人工智能·嵌入式硬件·计算机视觉·fpga开发·机器人·rk3588+fpga·割草机器人
2601_962099081 分钟前
python flask sqlalchemy连接数据库流程介绍
数据库·python·flask·教程·sqlalchemy
2601_962293243 分钟前
python接口自动化(二十八)--html测试 报告——下(详解)
python·接口自动化·编码问题·htmltestrunner·报告优化
烂蜻蜓7 分钟前
Flask入门教程(附录):模板渲染API——Jinja2集成全解析
后端·python·flask
2601_9623878211 分钟前
Python CUDA 编程 - 2 - Numba 简介
python·numpy·cuda·jit编译器·numba
AI云海23 分钟前
计算机视觉之-YOLO目标检测
yolo·目标检测·计算机视觉
YOLO数据集集合32 分钟前
红外热成像人员检测数据集 |红外检测 白热模式 人员检测 夜间监控 目标检测 YOLO格式 深度学习数据集 计算机视觉9067期
数据库·深度学习·yolo·目标检测·计算机视觉·红外人员·红外数据
智能体与具身智能9 小时前
TVA具身智能的概念、架构与应用(19)
人工智能·python·具身智能
2601_962294619 小时前
python中range函数怎么用
python·for循环·可迭代对象·range函数·整数列表
青 春 记 忆11 小时前
零基础入门python70:Docker Compose 编排完整后端
python·后端开发