erode_and_dilate.py

# Dieses Werk ist unter der MIT-Lizenz lizenziert.
# Copyright (c) 2013-2023 OpenMV LLC. Alle Rechte vorbehalten.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Beispiel für Erosion und Dilatation
#
# Dieses Beispiel demonstriert die Erosions- und Dilatationsfunktionen, die Sie auf
# ein Binärbild anwenden können, um Rauschen zu entfernen. Dieses Beispiel war ursprünglich ein Test, ist aber
# nützlich, um zu zeigen, wie diese Funktionen funktionieren.

import csi

csi0 = csi.CSI()
csi0.reset()
csi0.framesize(csi.QVGA)

grayscale_thres = (170, 255)
rgb565_thres = (70, 100, -128, 127, -128, 127)

while True:
    csi0.pixformat(csi.GRAYSCALE)
    for i in range(20):
        img = csi0.snapshot()
        img.binary([grayscale_thres])
        img.erode(2)
    for i in range(20):
        img = csi0.snapshot()
        img.binary([grayscale_thres])
        img.dilate(2)

    csi0.pixformat(csi.RGB565)
    for i in range(20):
        img = csi0.snapshot()
        img.binary([rgb565_thres])
        img.erode(2)
    for i in range(20):
        img = csi0.snapshot()
        img.binary([rgb565_thres])
        img.dilate(2)

results matching ""

    No results matching ""