例程讲解-04-unsharp_filter消除锐化

本例程为04-image-Filters-unsharp_filter.py

# 此示例显示使用guassian过滤器来消除锐化蒙版过滤器图像。

import sensor, image, time

sensor.reset() # 初始化sensor

sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
#设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种

sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
#设置图像像素大小

sensor.skip_frames(time = 2000) # 让新的设置生效
clock = time.clock() # 跟踪FPS帧率

while(True):

    clock.tick() # 追踪两个snapshots()之间经过的毫秒数.
    img = sensor.snapshot() # 拍一张照片,返回图像

    # Run the kernel on every pixel of the image.
    # 在图像的每个像素上运行核
    img.gaussian(1, unsharp=True)

    print(clock.fps()) # 注意: 当连接电脑后,OpenMV会变成一半的速度。当不连接电脑,帧率会增加。

原图:

运行效果图:

星瞳科技OpenMV官方中文文档函数讲解:

results matching ""

    No results matching ""