keypoints_save.py

# هذا العمل مرخص بموجب ترخيص MIT.
# حقوق النشر (c) 2013-2023 OpenMV LLC. جميع الحقوق محفوظة.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# مثال على واصف النقاط المميزة (keypoints descriptor).
# يوضح هذا المثال كيفية حفظ واصف النقاط المميزة في ملف. اعرض جسمًا أمام الكاميرا
# ثم شغّل السكربت. سيقوم السكربت باستخراج وحفظ واصف النقاط المميزة والصورة.
# يمكنك استخدام أداة keypoints_editor.py لإزالة النقاط المميزة غير المرغوب فيها.
import csi
import time
import image

csi0 = csi.CSI()
csi0.reset()
csi0.contrast(3)
csi0.gainceiling(16)
csi0.framesize(csi.VGA)
csi0.window((320, 240))
csi0.pixformat(csi.GRAYSCALE)
csi0.snapshot(time=2000)
csi0.auto_gain(False, gain_db=100)

FILE_NAME = "desc"
img = csi0.snapshot()

# ملاحظة: راجع الوثائق لمعرفة الوسائط الأخرى
# ملاحظة: بشكل افتراضي، تُرجع find_keypoints نقاطًا مميزة متعددة المقاييس مستخرجة من هرم الصورة (image pyramid).
kpts = img.find_keypoints(max_keypoints=150, threshold=10, scale_factor=1.2)

if kpts is None:
    raise (Exception("Couldn't find any keypoints!"))

image.save_descriptor(kpts, "%s.orb" % (FILE_NAME))
img.save("%s.pgm" % (FILE_NAME))

img.draw_keypoints(kpts)
csi0.snapshot()
time.sleep_ms(1000)

raise (Exception("Please reset the camera to see the new file."))

results matching ""

    No results matching ""