keypoints_save.py

# この作品はMITライセンスの下で提供されています。
# Copyright (c) 2013-2023 OpenMV LLC. 全著作権所有。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# キーポイント記述子の例。
# この例では、キーポイント記述子をファイルに保存する方法を示します。カメラにオブジェクトを見せ、
# その後スクリプトを実行してください。スクリプトはキーポイント記述子と画像を抽出して保存します。
# 不要なキーポイントを削除するには 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 は画像ピラミッドから抽出されたマルチスケールのキーポイントを返します。
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 ""