【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)
相关推荐
FL16238631296 分钟前
基于yolo11实现的车辆实时交通流量进出统计与速度测量系统python源码+演示视频
开发语言·python·音视频
华如锦16 分钟前
四:从零搭建一个RAG
java·开发语言·人工智能·python·机器学习·spring cloud·计算机视觉
向阳蒲公英28 分钟前
Pycharm2025版本配置Anaconda步骤
python
Darkershadow34 分钟前
蓝牙学习之uuid与mac
python·学习·ble
AI生成未来35 分钟前
北交&字节最新开源ThinkGen:首次显式利用多模态CoT处理生成任务,多项任务性能SOTA
计算机视觉·aigc·多模态·思维链·视觉生成
北海有初拥38 分钟前
Python基础语法万字详解
java·开发语言·python
Mqh1807621 小时前
day61 经典时序模型3
python
我想吃烤肉肉1 小时前
logger比print优秀之处
python
Cosmoshhhyyy1 小时前
《Effective Java》解读第32条:谨慎并用泛型和可变参数
java·python
Cherry的跨界思维1 小时前
【AI测试全栈:Vue核心】19、Vue3+ECharts实战:构建AI测试可视化仪表盘全攻略
前端·人工智能·python·echarts·vue3·ai全栈·ai测试全栈