From d2a4413921871da964be9bbdf2a21afc546bc478 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 24 Sep 2023 16:12:53 +0200 Subject: [PATCH] scripts: Update examples. --- .../05-FLIR-Lepton/lepton_get_object_temp_color_lcd.py | 6 +++--- .../01-Camera/05-FLIR-Lepton/lepton_get_object_temp_lcd.py | 6 +++--- .../lepton_hotspot_grayscale_color_tracking_lcd.py | 6 +++--- .../lepton_hotspot_rgb565_color_tracking_lcd.py | 6 +++--- scripts/examples/09-OpenMV-Boards/02-LCD-Shield/lcd.py | 6 +++--- .../04-Thermopile-Shield/thermal_overlay_lcd.py | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_color_lcd.py b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_color_lcd.py index 3c8518711..52c975a37 100644 --- a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_color_lcd.py +++ b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_color_lcd.py @@ -19,7 +19,7 @@ import sensor import time -import lcd +import display # Color Tracking Thresholds (Grayscale Min, Grayscale Max) threshold_list = [(200, 255)] @@ -51,7 +51,7 @@ sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.LCD) sensor.skip_frames(time=5000) clock = time.clock() -lcd.init() +lcd = display.SPIDisplay() # 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 @@ -93,7 +93,7 @@ while True: img.draw_string( blob_stat[0], blob_stat[1] - 10, "%.2f C" % blob_stat[2], mono_space=False ) - lcd.display(img) + lcd.write(img) print( "FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)) diff --git a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_lcd.py b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_lcd.py index 4fca323d4..0ac960d1f 100644 --- a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_lcd.py +++ b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_get_object_temp_lcd.py @@ -19,7 +19,7 @@ import sensor import time -import lcd +import display # Color Tracking Thresholds (Grayscale Min, Grayscale Max) threshold_list = [(200, 255)] @@ -51,7 +51,7 @@ sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.LCD) sensor.skip_frames(time=5000) clock = time.clock() -lcd.init() +lcd = display.SPIDisplay() # 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 @@ -79,7 +79,7 @@ while True: "%.2f C" % map_g_to_temp(stats.mean()), mono_space=False, ) - lcd.display(img) + lcd.write(img) print( "FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)) diff --git a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_grayscale_color_tracking_lcd.py b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_grayscale_color_tracking_lcd.py index 346353449..6471a1a5f 100644 --- a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_grayscale_color_tracking_lcd.py +++ b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_grayscale_color_tracking_lcd.py @@ -9,7 +9,7 @@ import sensor import time -import lcd +import display # Color Tracking Thresholds (Grayscale Min, Grayscale Max) threshold_list = [(220, 255)] @@ -33,7 +33,7 @@ sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.LCD) sensor.skip_frames(time=5000) clock = time.clock() -lcd.init() +lcd = display.SPIDisplay() # 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 @@ -47,5 +47,5 @@ while True: ): img.draw_rectangle(blob.rect(), color=127) img.draw_cross(blob.cx(), blob.cy(), color=127) - lcd.display(img) + lcd.write(img) print(clock.fps()) diff --git a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_rgb565_color_tracking_lcd.py b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_rgb565_color_tracking_lcd.py index 372b82168..156f74c61 100644 --- a/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_rgb565_color_tracking_lcd.py +++ b/scripts/examples/01-Camera/05-FLIR-Lepton/lepton_hotspot_rgb565_color_tracking_lcd.py @@ -9,7 +9,7 @@ import sensor import time -import lcd +import display # Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max) threshold_list = [(70, 100, -30, 40, 20, 100)] @@ -35,7 +35,7 @@ sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.LCD) sensor.skip_frames(time=5000) clock = time.clock() -lcd.init() +lcd = display.SPIDisplay() # 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 @@ -49,5 +49,5 @@ while True: ): img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) - lcd.display(img) + lcd.write(img) print(clock.fps()) diff --git a/scripts/examples/09-OpenMV-Boards/02-LCD-Shield/lcd.py b/scripts/examples/09-OpenMV-Boards/02-LCD-Shield/lcd.py index 8516a6419..ef15da9d7 100644 --- a/scripts/examples/09-OpenMV-Boards/02-LCD-Shield/lcd.py +++ b/scripts/examples/09-OpenMV-Boards/02-LCD-Shield/lcd.py @@ -5,12 +5,12 @@ # The LCD Shield allows you to view your OpenMV Cam's frame buffer on the go. import sensor -import lcd +import display sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE 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: - lcd.display(sensor.snapshot()) # Take a picture and display the image. + lcd.write(sensor.snapshot()) # Take a picture and display the image. diff --git a/scripts/examples/09-OpenMV-Boards/04-Thermopile-Shield/thermal_overlay_lcd.py b/scripts/examples/09-OpenMV-Boards/04-Thermopile-Shield/thermal_overlay_lcd.py index 55d8a94fb..ca0571d39 100644 --- a/scripts/examples/09-OpenMV-Boards/04-Thermopile-Shield/thermal_overlay_lcd.py +++ b/scripts/examples/09-OpenMV-Boards/04-Thermopile-Shield/thermal_overlay_lcd.py @@ -7,7 +7,7 @@ import sensor import image import time import fir -import lcd +import display drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor) @@ -22,7 +22,7 @@ sensor.skip_frames(time=2000) fir.init() # Init the lcd. -lcd.init() +lcd = display.SPIDisplay() # Allocate another frame buffer for smoother video. 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 ) - lcd.display(img) + lcd.write(img) # Force high quality streaming... img.compress(quality=90)