diff --git a/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_dark with_tracking.py b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_dark with_tracking.py new file mode 100644 index 000000000..1a1b5c5a2 --- /dev/null +++ b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_dark with_tracking.py @@ -0,0 +1,32 @@ +# This work is licensed under the MIT license. +# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved. +# https://github.com/openmv/openmv/blob/master/LICENSE +# +# This example shows off using the genx320 event camera from Prophesee. + +import sensor +import image +import time + +sensor.reset() +sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale. +sensor.set_framesize(sensor.B320X320) # Must always be 320x320. +sensor.set_color_palette(image.PALETTE_EVT_DARK) + +clock = time.clock() + +while True: + clock.tick() + + img = sensor.snapshot() + # img.median(1) # noise cleanup. + + blobs = img.find_blobs( + [(10, 20, -10, 10, -20, 0)], 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()) diff --git a/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_dark.py b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_dark.py new file mode 100644 index 000000000..74bcbbbf4 --- /dev/null +++ b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_dark.py @@ -0,0 +1,24 @@ +# This work is licensed under the MIT license. +# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved. +# https://github.com/openmv/openmv/blob/master/LICENSE +# +# This example shows off using the genx320 event camera from Prophesee. + +import sensor +import image +import time + +sensor.reset() +sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale. +sensor.set_framesize(sensor.B320X320) # Must always be 320x320. +sensor.set_color_palette(image.PALETTE_EVT_DARK) + +clock = time.clock() + +while True: + clock.tick() + + img = sensor.snapshot() + # img.median(1) # noise cleanup. + + print(clock.fps()) diff --git a/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_light.py b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_light.py new file mode 100644 index 000000000..1718ec134 --- /dev/null +++ b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_light.py @@ -0,0 +1,24 @@ +# This work is licensed under the MIT license. +# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved. +# https://github.com/openmv/openmv/blob/master/LICENSE +# +# This example shows off using the genx320 event camera from Prophesee. + +import sensor +import image +import time + +sensor.reset() +sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale. +sensor.set_framesize(sensor.B320X320) # Must always be 320x320. +sensor.set_color_palette(image.PALETTE_EVT_LIGHT) + +clock = time.clock() + +while True: + clock.tick() + + img = sensor.snapshot() + # img.median(1) # noise cleanup. + + print(clock.fps()) diff --git a/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_light_with_tracking.py b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_light_with_tracking.py new file mode 100644 index 000000000..1e68df25b --- /dev/null +++ b/scripts/examples/01-Camera/03-Event-Cameras/genx320_color_light_with_tracking.py @@ -0,0 +1,32 @@ +# This work is licensed under the MIT license. +# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved. +# https://github.com/openmv/openmv/blob/master/LICENSE +# +# This example shows off using the genx320 event camera from Prophesee. + +import sensor +import image +import time + +sensor.reset() +sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale. +sensor.set_framesize(sensor.B320X320) # Must always be 320x320. +sensor.set_color_palette(image.PALETTE_EVT_LIGHT) + +clock = time.clock() + +while True: + clock.tick() + + img = sensor.snapshot() + # img.median(1) # noise cleanup. + + 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()) diff --git a/scripts/examples/01-Camera/03-Event-Cameras/genx320_grayscale.py b/scripts/examples/01-Camera/03-Event-Cameras/genx320_grayscale.py new file mode 100644 index 000000000..f5e154ffa --- /dev/null +++ b/scripts/examples/01-Camera/03-Event-Cameras/genx320_grayscale.py @@ -0,0 +1,22 @@ +# This work is licensed under the MIT license. +# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved. +# https://github.com/openmv/openmv/blob/master/LICENSE +# +# This example shows off using the genx320 event camera from Prophesee. + +import sensor +import time + +sensor.reset() +sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale. +sensor.set_framesize(sensor.B320X320) # Must always be 320x320. + +clock = time.clock() + +while True: + clock.tick() + + img = sensor.snapshot() + # img.median(1) # noise cleanup. + + print(clock.fps()) diff --git a/scripts/examples/01-Camera/03-Event-Cameras/genx320_grayscale_with_tracking.py b/scripts/examples/01-Camera/03-Event-Cameras/genx320_grayscale_with_tracking.py new file mode 100644 index 000000000..684f9d527 --- /dev/null +++ b/scripts/examples/01-Camera/03-Event-Cameras/genx320_grayscale_with_tracking.py @@ -0,0 +1,30 @@ +# This work is licensed under the MIT license. +# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved. +# https://github.com/openmv/openmv/blob/master/LICENSE +# +# This example shows off using the genx320 event camera from Prophesee. + +import sensor +import time + +sensor.reset() +sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale. +sensor.set_framesize(sensor.B320X320) # Must always be 320x320. + +clock = time.clock() + +while True: + clock.tick() + + img = sensor.snapshot() + # img.median(1) # noise cleanup. + + blobs = img.find_blobs( + [(120, 130)], invert=True, pixels_threshold=10, area_threshold=100, merge=True + ) + + for blob in blobs: + img.draw_rectangle(blob.rect(), color=(255, 255, 255)) + img.draw_cross(blob.cx(), blob.cy(), color=(0, 0, 0)) + + print(clock.fps())