CanMV
  • CanMV 文档
    • CanMV 上手使用
    • CanMV 例程讲解
      • Basics - 基础示例
      • Drawing - 图像绘制元素
      • Image-Filters - 图像滤波
      • Snapshot - 拍照
      • Feature-Detection - 特征检测
        • Edge detection - 边缘检测
        • Find Circles - 圆形检测
        • Find Lines - 直线检测
        • Find Rects - 矩形检测
        • Histogram of Oriented Gradients (HoG)
        • Object tracking with keypoints - 特征点检测
        • Local Binary Patterns (LBP)
        • Fast Linear Regression - 快速线性回归(巡线)
        • Robust Linear Regression - 鲁棒线性回归
        • Selective Search
        • Template Matching - 模板匹配
      • Color-Tracking - 颜色追踪
      • Lcd - 显示屏
      • Codes - 扫码
      • Frame-Differencing - 图像比对
      • Sensor-Control - 摄像头控制
      • April-Tags
      • Hardware - 硬件
      • Micropython-Basics - Micropython 基础示例
      • Multimedia - 多媒体
      • Board - 板子相关
      • KPU - 深度学习
    • CanMV API 手册
    • CanMV 常见问题汇总(FAQ)
CanMV
  • »
  • CanMV 文档 »
  • CanMV 例程讲解 »
  • Selective Search

Selective Search

# 选择性查找例程

import sensor, image, time
from random import randint

sensor.reset()                      # 复位并初始化摄像头
sensor.set_pixformat(sensor.RGB565) # 设置摄像头输出格式为 RGB565(也可以是GRAYSCALE)
sensor.set_framesize(sensor.QVGA)   # 设置摄像头输出大小为 QVGA (320x240)
sensor.skip_frames(time = 2000)     # 跳过2000帧
sensor.set_auto_gain(False)
# sensor.set_auto_exposure(False, exposure_us=10000)
clock = time.clock()                # 创建一个clock对象,用来计算帧率


while(True):
    clock.tick()                    # 更新计算帧率的clock
    img = sensor.snapshot()         # 拍照,获取一张图像
    rois = img.selective_search(threshold = 200, size = 20, a1=0.5, a2=1.0, a3=1.0)
    for r in rois:
        img.draw_rectangle(r, color=(255, 0, 0))
        #img.draw_rectangle(r, color=(randint(100, 255), randint(100, 255), randint(100, 255)))
    print(clock.fps())

上一页 下一页

© 版权所有 2022 Canaan Inc.

利用 Sphinx 构建,使用了 主题 由 Read the Docs开发.
Versions main
Tags
v1.0
Branches
main
External links
CanMV
CanMV Docs