scripts: Update examples.

This commit is contained in:
iabdalkader 2023-09-24 16:12:53 +02:00
parent 7ed72f2240
commit d2a4413921
6 changed files with 18 additions and 18 deletions

View File

@ -19,7 +19,7 @@
import sensor import sensor
import time import time
import lcd import display
# Color Tracking Thresholds (Grayscale Min, Grayscale Max) # Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(200, 255)] threshold_list = [(200, 255)]
@ -51,7 +51,7 @@ sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.LCD) sensor.set_framesize(sensor.LCD)
sensor.skip_frames(time=5000) sensor.skip_frames(time=5000)
clock = time.clock() clock = time.clock()
lcd.init() lcd = display.SPIDisplay()
# Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
# returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
@ -93,7 +93,7 @@ while True:
img.draw_string( img.draw_string(
blob_stat[0], blob_stat[1] - 10, "%.2f C" % blob_stat[2], mono_space=False blob_stat[0], blob_stat[1] - 10, "%.2f C" % blob_stat[2], mono_space=False
) )
lcd.display(img) lcd.write(img)
print( print(
"FPS %f - Lepton Temp: %f C" "FPS %f - Lepton Temp: %f C"
% (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)) % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE))

View File

@ -19,7 +19,7 @@
import sensor import sensor
import time import time
import lcd import display
# Color Tracking Thresholds (Grayscale Min, Grayscale Max) # Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(200, 255)] threshold_list = [(200, 255)]
@ -51,7 +51,7 @@ sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.LCD) sensor.set_framesize(sensor.LCD)
sensor.skip_frames(time=5000) sensor.skip_frames(time=5000)
clock = time.clock() clock = time.clock()
lcd.init() lcd = display.SPIDisplay()
# Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
# returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
@ -79,7 +79,7 @@ while True:
"%.2f C" % map_g_to_temp(stats.mean()), "%.2f C" % map_g_to_temp(stats.mean()),
mono_space=False, mono_space=False,
) )
lcd.display(img) lcd.write(img)
print( print(
"FPS %f - Lepton Temp: %f C" "FPS %f - Lepton Temp: %f C"
% (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)) % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE))

View File

@ -9,7 +9,7 @@
import sensor import sensor
import time import time
import lcd import display
# Color Tracking Thresholds (Grayscale Min, Grayscale Max) # Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(220, 255)] threshold_list = [(220, 255)]
@ -33,7 +33,7 @@ sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.LCD) sensor.set_framesize(sensor.LCD)
sensor.skip_frames(time=5000) sensor.skip_frames(time=5000)
clock = time.clock() clock = time.clock()
lcd.init() lcd = display.SPIDisplay()
# Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
# returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
@ -47,5 +47,5 @@ while True:
): ):
img.draw_rectangle(blob.rect(), color=127) img.draw_rectangle(blob.rect(), color=127)
img.draw_cross(blob.cx(), blob.cy(), color=127) img.draw_cross(blob.cx(), blob.cy(), color=127)
lcd.display(img) lcd.write(img)
print(clock.fps()) print(clock.fps())

View File

@ -9,7 +9,7 @@
import sensor import sensor
import time import time
import lcd import display
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max) # Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
threshold_list = [(70, 100, -30, 40, 20, 100)] threshold_list = [(70, 100, -30, 40, 20, 100)]
@ -35,7 +35,7 @@ sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.LCD) sensor.set_framesize(sensor.LCD)
sensor.skip_frames(time=5000) sensor.skip_frames(time=5000)
clock = time.clock() clock = time.clock()
lcd.init() lcd = display.SPIDisplay()
# Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
# returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
@ -49,5 +49,5 @@ while True:
): ):
img.draw_rectangle(blob.rect()) img.draw_rectangle(blob.rect())
img.draw_cross(blob.cx(), blob.cy()) img.draw_cross(blob.cx(), blob.cy())
lcd.display(img) lcd.write(img)
print(clock.fps()) print(clock.fps())

View File

@ -5,12 +5,12 @@
# The LCD Shield allows you to view your OpenMV Cam's frame buffer on the go. # The LCD Shield allows you to view your OpenMV Cam's frame buffer on the go.
import sensor import sensor
import lcd import display
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA2) # Special 128x160 framesize for LCD Shield. sensor.set_framesize(sensor.QQVGA2) # Special 128x160 framesize for LCD Shield.
lcd.init() # Initialize the lcd screen. lcd = display.SPIDisplay() # Initialize the lcd screen.
while True: while True:
lcd.display(sensor.snapshot()) # Take a picture and display the image. lcd.write(sensor.snapshot()) # Take a picture and display the image.

View File

@ -7,7 +7,7 @@ import sensor
import image import image
import time import time
import fir import fir
import lcd import display
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor) drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
@ -22,7 +22,7 @@ sensor.skip_frames(time=2000)
fir.init() fir.init()
# Init the lcd. # Init the lcd.
lcd.init() lcd = display.SPIDisplay()
# Allocate another frame buffer for smoother video. # Allocate another frame buffer for smoother video.
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)
@ -64,7 +64,7 @@ while True:
8, 16, "To max: %0.2f C" % to_max, color=(255, 0, 0), mono_space=False 8, 16, "To max: %0.2f C" % to_max, color=(255, 0, 0), mono_space=False
) )
lcd.display(img) lcd.write(img)
# Force high quality streaming... # Force high quality streaming...
img.compress(quality=90) img.compress(quality=90)