scripts/examples: Rename and update histogram mode genx320 scripts.

This commit is contained in:
Kwabena W. Agyeman 2025-07-10 22:11:49 -07:00
parent c231f66555
commit 061a0b2b6b
8 changed files with 66 additions and 55 deletions

View File

@ -151,6 +151,11 @@ static int set_framesize(omv_csi_t *csi, omv_csi_framesize_t framesize) {
genx_state_t *genx = csi->priv;
if (genx->mode == OMV_CSI_GENX320_MODE_HISTO) {
if (framesize == OMV_CSI_FRAMESIZE_CUSTOM &&
resolution[framesize][0] == ACTIVE_SENSOR_WIDTH &&
resolution[framesize][1] == ACTIVE_SENSOR_HEIGHT) {
return 0;
}
return (framesize == OMV_CSI_FRAMESIZE_320X320) ? 0 : -1;
} else {
return (framesize == OMV_CSI_FRAMESIZE_CUSTOM) ? 0 : -1;

View File

@ -4,26 +4,27 @@
#
# This example shows off using the genx320 event camera from Prophesee.
import sensor
import csi
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_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.
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # Leave at 128 generally (this is the default).
csi0.contrast(16) # Increase to make the image pop.
csi0.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)
csi0.framerate(50)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
img = csi0.snapshot()
# img.median(1) # noise cleanup.
print(clock.fps())

View File

@ -4,26 +4,27 @@
#
# This example shows off using the genx320 event camera from Prophesee.
import sensor
import csi
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_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.
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # Leave at 128 generally (this is the default).
csi0.contrast(16) # Increase to make the image pop.
csi0.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)
csi0.framerate(50)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
img = csi0.snapshot()
# img.median(1) # noise cleanup.
blobs = img.find_blobs(

View File

@ -4,24 +4,25 @@
#
# This example shows off using the genx320 event camera from Prophesee.
import sensor
import csi
import time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
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.
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # Leave at 128 generally (this is the default).
csi0.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)
csi0.framerate(50)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
img = csi0.snapshot()
# img.median(1) # noise cleanup.
print(clock.fps())

View File

@ -6,26 +6,27 @@
# AntiFlicKer (AFK) filter bloc in the GenX320 digital pipeline.
# AFK allows to detect periodic changes of given frequencies in the scene and filter them out.
import sensor
import csi
import time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
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)
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # Leave at 128 generally (this is the default).
csi0.contrast(16) # Increase to make the image pop.
csi0.framerate(100)
# Enables AFK filter to remove periodic data in the frequency range from 130Hz to 160Hz
sensor.ioctl(sensor.IOCTL_GENX320_SET_AFK, 1, 130, 160)
csi0.ioctl(csi.IOCTL_GENX320_SET_AFK, 1, 130, 160)
# Disables AFK filter
# sensor.ioctl(sensor.IOCTL_GENX320_SET_AFK, 0)
# csi0.ioctl(csi.IOCTL_GENX320_SET_AFK, 0)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
img = csi0.snapshot()
print(clock.fps())

View File

@ -4,24 +4,25 @@
#
# This example shows off using the genx320 event camera from Prophesee.
import sensor
import csi
import time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
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.
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # Leave at 128 generally (this is the default).
csi0.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)
csi0.framerate(50)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
img = csi0.snapshot()
# img.median(1) # noise cleanup.
blobs = img.find_blobs(

View File

@ -10,8 +10,8 @@ import time
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE) # Must always be grayscale.
csi0.framesize(csi.B320X320) # Must always be 320x320.
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # Leave at 128 generally (this is the default).
csi0.contrast(16) # Increase to make the image pop.

View File

@ -9,24 +9,25 @@
# Prophesee active marker board with LEDs and the corresponding event-based data are shown in
# https://youtu.be/j-LpkDpCxUU?si=jA3B4xZg9RHlyoW3.
import sensor
import csi
import time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # Must always be grayscale.
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)
csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128) # Leave at 128 generally (this is the default).
csi0.contrast(16) # Increase to make the image pop.
csi0.framerate(200)
# Applies sensor biases tuned for tracking of an active marker with LEDs
sensor.ioctl(sensor.IOCTL_GENX320_SET_BIASES, sensor.GENX320_BIASES_ACTIVE_MARKER)
csi0.ioctl(csi.IOCTL_GENX320_SET_BIASES, csi.GENX320_BIASES_ACTIVE_MARKER)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
img = csi0.snapshot()
blobs = img.find_blobs(
[(120, 140)], invert=True, pixels_threshold=2, area_threshold=4, merge=True