mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #2754 from kwagyeman/kwabena/improve_genx320_examples
scripts/examples: Add framerate control to genx320 examples.
This commit is contained in:
commit
a45e458935
@ -11,7 +11,12 @@ import time
|
|||||||
sensor.reset()
|
sensor.reset()
|
||||||
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
||||||
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
||||||
sensor.set_color_palette(image.PALETTE_EVT_DARK)
|
sensor.set_brightness(128) # Leave at 128 generally (this is the default).
|
||||||
|
sensor.set_contrast(16) # Increase to make the image pop.
|
||||||
|
sensor.set_color_palette(image.PALETTE_EVT_LIGHT) # image.PALETTE_EVT_DARK for dark mode.
|
||||||
|
|
||||||
|
# The default frame rate is 50 FPS. You can change it between ~20 FPS and ~350 FPS.
|
||||||
|
sensor.set_framerate(50)
|
||||||
|
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
|
|
||||||
@ -21,12 +26,4 @@ while True:
|
|||||||
img = sensor.snapshot()
|
img = sensor.snapshot()
|
||||||
# img.median(1) # noise cleanup.
|
# 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())
|
print(clock.fps())
|
||||||
@ -1,24 +0,0 @@
|
|||||||
# 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())
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
# 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())
|
|
||||||
@ -11,7 +11,12 @@ import time
|
|||||||
sensor.reset()
|
sensor.reset()
|
||||||
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
||||||
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
||||||
sensor.set_color_palette(image.PALETTE_EVT_LIGHT)
|
sensor.set_brightness(128) # Leave at 128 generally (this is the default).
|
||||||
|
sensor.set_contrast(16) # Increase to make the image pop.
|
||||||
|
sensor.set_color_palette(image.PALETTE_EVT_LIGHT) # image.PALETTE_EVT_DARK for dark mode.
|
||||||
|
|
||||||
|
# The default frame rate is 50 FPS. You can change it between ~20 FPS and ~350 FPS.
|
||||||
|
sensor.set_framerate(50)
|
||||||
|
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
|
|
||||||
@ -10,6 +10,11 @@ import time
|
|||||||
sensor.reset()
|
sensor.reset()
|
||||||
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
||||||
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
||||||
|
sensor.set_brightness(128) # Leave at 128 generally (this is the default).
|
||||||
|
sensor.set_contrast(16) # Increase to make the image pop.
|
||||||
|
|
||||||
|
# The default frame rate is 50 FPS. You can change it between ~20 FPS and ~350 FPS.
|
||||||
|
sensor.set_framerate(50)
|
||||||
|
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import time
|
|||||||
sensor.reset()
|
sensor.reset()
|
||||||
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
||||||
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
||||||
|
sensor.set_brightness(128) # Leave at 128 generally (this is the default).
|
||||||
|
sensor.set_contrast(16) # Increase to make the image pop.
|
||||||
sensor.set_framerate(200)
|
sensor.set_framerate(200)
|
||||||
# Applies sensor biases tuned for tracking of an active marker with LEDs
|
# Applies sensor biases tuned for tracking of an active marker with LEDs
|
||||||
sensor.ioctl(sensor.IOCTL_GENX320_SET_BIASES, sensor.GENX320_BIASES_ACTIVE_MARKER)
|
sensor.ioctl(sensor.IOCTL_GENX320_SET_BIASES, sensor.GENX320_BIASES_ACTIVE_MARKER)
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import time
|
|||||||
sensor.reset()
|
sensor.reset()
|
||||||
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
||||||
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
||||||
|
sensor.set_brightness(128) # Leave at 128 generally (this is the default).
|
||||||
|
sensor.set_contrast(16) # Increase to make the image pop.
|
||||||
sensor.set_framerate(100)
|
sensor.set_framerate(100)
|
||||||
|
|
||||||
# Enables AFK filter to remove periodic data in the frequency range from 130Hz to 160Hz
|
# Enables AFK filter to remove periodic data in the frequency range from 130Hz to 160Hz
|
||||||
|
|||||||
@ -10,6 +10,11 @@ import time
|
|||||||
sensor.reset()
|
sensor.reset()
|
||||||
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
|
||||||
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
sensor.set_framesize(sensor.B320X320) # Must always be 320x320.
|
||||||
|
sensor.set_brightness(128) # Leave at 128 generally (this is the default).
|
||||||
|
sensor.set_contrast(16) # Increase to make the image pop.
|
||||||
|
|
||||||
|
# The default frame rate is 50 FPS. You can change it between ~20 FPS and ~350 FPS.
|
||||||
|
sensor.set_framerate(50)
|
||||||
|
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user