snapshot.py
# هذا العمل مرخص بموجب ترخيص MIT.
# حقوق النشر (c) 2013-2023 OpenMV LLC. جميع الحقوق محفوظة.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# مثال التقاط صورة
#
# ملاحظة: ستحتاج إلى بطاقة SD لتشغيل هذا المثال.
# يمكنك استخدام كاميرا OpenMV لحفظ ملفات الصور.
import csi
import time
import machine
csi0 = csi.CSI()
csi0.reset() # إعادة ضبط المستشعر وتهيئته.
csi0.pixformat(csi.RGB565) # تعيين تنسيق البكسل إلى RGB565 (أو GRAYSCALE)
csi0.framesize(csi.QVGA) # تعيين حجم الإطار إلى QVGA (320x240)
csi0.snapshot(time=2000) # انتظر حتى تدخل الإعدادات حيز التنفيذ.
led = machine.LED("LED_BLUE")
start = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), start) < 3000:
csi0.snapshot()
led.toggle()
led.off()
img = csi0.snapshot()
img.save("example.jpg") # أو "example.bmp" (أو غيرها)
raise (Exception("Please reset the camera to see the new file."))