erode_and_dilate.py

# هذا العمل مرخص بموجب ترخيص MIT.
# حقوق النشر (c) 2013-2023 OpenMV LLC. جميع الحقوق محفوظة.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# مثال التآكل والتمدد (Erode and Dilate)
#
# يوضح هذا المثال دالتي التآكل والتمدد (erode و dilate) اللتين يمكن تشغيلهما على
# صورة ثنائية لإزالة الضوضاء. كان هذا المثال في الأصل اختبارًا لكنه
# مفيد لتوضيح كيفية عمل هاتين الدالتين.

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 ""