例程讲解-04-mode_filter众数滤波

# 众数滤波例程
#
# 这个例子显示众数过滤。 众数滤波是一种高度非线性的操作,它用每个像素周围像素的NxN邻# 域的众数取代每个像素。 避免在RGB565图像上使用众数过滤器。 它会在图像边缘造成伪影.

import sensor, image, time

sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS.

while(True):
    clock.tick() # Track elapsed milliseconds between snapshots().
    img = sensor.snapshot() # Take a picture and return the image.

    # Size是内核的大小。取1 (3x3 内核)、2 (5x5 内核)。
    img.mode(1)

    print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
    # connected to your computer. The FPS should increase once disconnected.

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

results matching ""

    No results matching ""