Example: 05-Feature-Detection/keypoints_save.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()
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."))