mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
scripts/examples: Update thermal scripts for new refectored API.
This commit is contained in:
parent
d1cb045de6
commit
cb7df708cf
@ -11,13 +11,11 @@ import image
|
|||||||
import time
|
import time
|
||||||
import tof
|
import tof
|
||||||
|
|
||||||
IMAGE_SCALE = 10 # Higher scaling uses more memory.
|
IMAGE_SCALE = 10 # Scale image to 10x.
|
||||||
drawing_hint = image.BILINEAR # or image.BILINEAR or 0 (nearest neighbor)
|
drawing_hint = image.BILINEAR # or image.BILINEAR or 0 (nearest neighbor)
|
||||||
|
|
||||||
# Initialize the ToF sensor
|
# Initialize the ToF sensor
|
||||||
tof.init() # Auto-detects the connected sensor.
|
tof.init() # Auto-detects the connected sensor.
|
||||||
w = tof.width() * IMAGE_SCALE
|
|
||||||
h = tof.height() * IMAGE_SCALE
|
|
||||||
|
|
||||||
# FPS clock
|
# FPS clock
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
@ -27,8 +25,8 @@ while True:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
img = tof.snapshot(
|
img = tof.snapshot(
|
||||||
x_size=w,
|
x_scale=IMAGE_SCALE,
|
||||||
y_size=h,
|
y_scale=IMAGE_SCALE,
|
||||||
color_palette=tof.PALETTE_IRONBOW,
|
color_palette=tof.PALETTE_IRONBOW,
|
||||||
hint=drawing_hint,
|
hint=drawing_hint,
|
||||||
copy_to_fb=True,
|
copy_to_fb=True,
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import image
|
|||||||
import time
|
import time
|
||||||
import fir
|
import fir
|
||||||
|
|
||||||
|
IMAGE_SCALE = 5 # Scale image to 5x.
|
||||||
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
||||||
|
|
||||||
# Initialize the thermal sensor
|
# Initialize the thermal sensor
|
||||||
@ -18,18 +19,8 @@ fir.init()
|
|||||||
w = fir.width()
|
w = fir.width()
|
||||||
h = fir.height()
|
h = fir.height()
|
||||||
|
|
||||||
if fir.type() == fir.FIR_MLX90621:
|
if fir.type() == fir.FIR_AMG8833:
|
||||||
w = w * 5
|
IMAGE_SCALE = IMAGE_SCALE * 2
|
||||||
h = h * 5
|
|
||||||
elif fir.type() == fir.FIR_MLX90640:
|
|
||||||
w = w * 5
|
|
||||||
h = h * 5
|
|
||||||
elif fir.type() == fir.FIR_MLX90641:
|
|
||||||
w = w * 5
|
|
||||||
h = h * 5
|
|
||||||
elif fir.type() == fir.FIR_AMG8833:
|
|
||||||
w = w * 10
|
|
||||||
h = h * 10
|
|
||||||
|
|
||||||
# FPS clock
|
# FPS clock
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
@ -39,8 +30,8 @@ while True:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
img = fir.snapshot(
|
img = fir.snapshot(
|
||||||
x_size=w,
|
x_scale=IMAGE_SCALE,
|
||||||
y_size=h,
|
y_scale=IMAGE_SCALE,
|
||||||
color_palette=image.PALETTE_IRONBOW,
|
color_palette=image.PALETTE_IRONBOW,
|
||||||
hint=drawing_hint,
|
hint=drawing_hint,
|
||||||
copy_to_fb=True,
|
copy_to_fb=True,
|
||||||
|
|||||||
@ -11,13 +11,11 @@ import image
|
|||||||
import time
|
import time
|
||||||
import fir
|
import fir
|
||||||
|
|
||||||
IMAGE_SCALE = 5 # Higher scaling uses more memory.
|
IMAGE_SCALE = 5 # Scale image to 5x.
|
||||||
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
||||||
|
|
||||||
# Initialize the thermal sensor
|
# Initialize the thermal sensor
|
||||||
fir.init() # Auto-detects the connected sensor.
|
fir.init() # Auto-detects the connected sensor.
|
||||||
w = fir.width() * IMAGE_SCALE
|
|
||||||
h = fir.height() * IMAGE_SCALE
|
|
||||||
|
|
||||||
# FPS clock
|
# FPS clock
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
@ -27,8 +25,8 @@ while True:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
img = fir.snapshot(
|
img = fir.snapshot(
|
||||||
x_size=w,
|
x_scale=IMAGE_SCALE,
|
||||||
y_size=h,
|
y_scale=IMAGE_SCALE,
|
||||||
color_palette=image.PALETTE_IRONBOW,
|
color_palette=image.PALETTE_IRONBOW,
|
||||||
hint=drawing_hint,
|
hint=drawing_hint,
|
||||||
copy_to_fb=True,
|
copy_to_fb=True,
|
||||||
|
|||||||
@ -11,25 +11,14 @@ import image
|
|||||||
import time
|
import time
|
||||||
import fir
|
import fir
|
||||||
|
|
||||||
|
IMAGE_SCALE = 10 # Scale image to 10x.
|
||||||
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
||||||
|
|
||||||
# Initialize the thermal sensor
|
# Initialize the thermal sensor
|
||||||
fir.init()
|
fir.init()
|
||||||
w = fir.width()
|
|
||||||
h = fir.height()
|
|
||||||
|
|
||||||
if fir.type() == fir.FIR_MLX90621:
|
if fir.type() == fir.FIR_AMG8833:
|
||||||
w = w * 10
|
IMAGE_SCALE = IMAGE_SCALE * 2
|
||||||
h = h * 10
|
|
||||||
elif fir.type() == fir.FIR_MLX90640:
|
|
||||||
w = w * 10
|
|
||||||
h = h * 10
|
|
||||||
elif fir.type() == fir.FIR_MLX90641:
|
|
||||||
w = w * 10
|
|
||||||
h = h * 10
|
|
||||||
elif fir.type() == fir.FIR_AMG8833:
|
|
||||||
w = w * 20
|
|
||||||
h = h * 20
|
|
||||||
|
|
||||||
# FPS clock
|
# FPS clock
|
||||||
clock = time.clock()
|
clock = time.clock()
|
||||||
@ -39,8 +28,8 @@ while True:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
img = fir.snapshot(
|
img = fir.snapshot(
|
||||||
x_size=w,
|
x_scale=IMAGE_SCALE,
|
||||||
y_size=h,
|
y_scale=IMAGE_SCALE,
|
||||||
color_palette=image.PALETTE_IRONBOW,
|
color_palette=image.PALETTE_IRONBOW,
|
||||||
hint=drawing_hint,
|
hint=drawing_hint,
|
||||||
copy_to_fb=True,
|
copy_to_fb=True,
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import image
|
|||||||
import time
|
import time
|
||||||
import fir
|
import fir
|
||||||
|
|
||||||
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
# or image.BILINEAR or 0 (nearest neighbor)
|
||||||
|
drawing_hint = image.BICUBIC | image.CENTER | image.SCALE_ASPECT_KEEP
|
||||||
|
|
||||||
ALT_OVERLAY = False # Set to True to allocate a second ir image.
|
ALT_OVERLAY = False # Set to True to allocate a second ir image.
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,8 @@ import time
|
|||||||
import fir
|
import fir
|
||||||
import display
|
import display
|
||||||
|
|
||||||
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
|
# or image.BILINEAR or 0 (nearest neighbor)
|
||||||
|
drawing_hint = image.BICUBIC | image.CENTER | image.SCALE_ASPECT_KEEP
|
||||||
|
|
||||||
ALT_OVERLAY = False # Set to True to allocate a second ir image.
|
ALT_OVERLAY = False # Set to True to allocate a second ir image.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user