【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)
相关推荐
十铭忘2 分钟前
SAM2跟踪的理解6——mask decoder
人工智能·计算机视觉
qq_214782614 分钟前
GWalkR,部分替代Tableau!
ide·python·jupyter
Yuner200012 分钟前
Python机器学习:从零基础到深度实战
人工智能·python·机器学习
普密斯科技19 分钟前
从点测量到解决方案:光谱共焦技术如何集成于运动平台,实现3D轮廓扫描与透明物体测厚?
人工智能·算法·计算机视觉·3d·集成测试·测量
r i c k27 分钟前
办公小程序开发----提高工作效率
python·python程序开发
wha the fuck40427 分钟前
(渗透脚本)TCP创建连接脚本----解题----极客大挑战2019HTTP
python·网络协议·tcp/ip·网络安全·脚本书写
qq_3561969528 分钟前
day39模型的可视化和推理@浙大疏锦行
python
深蓝电商API34 分钟前
从 “能爬” 到 “稳爬”:Python 爬虫中级核心技术实战
开发语言·爬虫·python
czlczl200209251 小时前
如何添加“默认给Sql查询语句加上租户条件”的功能
数据库·python·sql
破烂pan1 小时前
Python 长连接实现方式全景解析
python·websocket·sse