当前位置: 首页 > news >正文

opencv-yolov8-目标检测

import cv2
from ultralytics import YOLO# 模型加载权重model = YOLO('yolov8n.pt')# 视频路径cap = cv2.VideoCapture(0)# 对视频中检测到目标画框标出来
while cap.isOpened():# Read a frame from the videosuccess, frame = cap.read()if success:# Run YOLOv8 inference on the frameresults = model(frame)# Visualize the results on the frameannotated_frame = results[0].plot()# Display the annotated framecv2.imshow("YOLOv8 Inference", annotated_frame)# Break the loop if 'q' is pressedif cv2.waitKey(5) & 0xFF == ord("q"):breakelse:# Break the loop if the end of the video is reachedbreak# Release the video capture object and close the display window
cap.release()
cv2.destroyAllWindows()

 

http://www.lryc.cn/news/129534.html

相关文章:

  • CRYPTO 密码学-笔记
  • 基于YOLOv8模型的五类动物目标检测系统(PyTorch+Pyside6+YOLOv8模型)
  • Java课题笔记~ SpringBoot基础配置
  • vue实现文件上传,前后端
  • OJ练习第151题——克隆图
  • keepalived+lvs实现高可用
  • 【Let‘s make it big】英语合集61~70
  • python实现图像的二分类
  • 8.深浅拷贝和异常处理
  • Element Plus el-table 数据为空时自定义内容【默认为 No Data】
  • 使用nginx和frp实现高效内网穿透:简单配置,畅通无阻
  • Python土力学与基础工程计算.PDF-螺旋板载荷试验
  • 低代码开发ERP:精打细算,聚焦核心投入
  • 顺序表(数据结构)
  • stable_diffusion_webui docker环境配置
  • 【Java】常见面试题:HTTP/HTTPS、Servlet、Cookie、Linux和JVM
  • 批量爬虫采集完成任务
  • intelij idea 2023 创建java web项目
  • 【论文笔记】基于指令回译的语言模型自对齐-MetaAI
  • MySQL和MariaDB的版本对应关系
  • Python数据的输入与输出
  • 生成国密密钥对
  • ASR(自动语音识别)任务中的LLM(大语言模型)
  • 简单介绍一下centos上有什么工具可以优雅的管理开机启动项
  • 万宾燃气管网监测解决方案,守护城市生命线安全
  • Django框架 靓号管理(增删改查)
  • 责任链模式简单实现
  • Excel自动化办公——Openpyxl的基本使用
  • 解决Fastjson2 oom(Out Of Memory),支持大对象(LargeObject 1G)json操作
  • SpringBoot + redis处理购物车逻辑