Example: 01-Camera/03-Event-Cameras/02-Genx320/genx320_color_light_with_tracking.py
import sensor
import image
import time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.B320X320)
sensor.set_color_palette(image.PALETTE_EVT_LIGHT)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
blobs = img.find_blobs(
[(85, 95, -10, 10, -10, 10)], invert=True, pixels_threshold=10, area_threshold=100, merge=True
)
for blob in blobs:
img.draw_rectangle(blob.rect(), color=(255, 0, 0))
img.draw_cross(blob.cx(), blob.cy(), color=(0, 255, 0))
print(clock.fps())