From 0bd4c46750211373119cdd25920783ffcc8233d2 Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Tue, 12 May 2020 10:24:10 -0700 Subject: [PATCH] Fix get stats call order --- scripts/examples/27-Lepton/lepton_get_object_temp.py | 2 +- scripts/examples/27-Lepton/lepton_get_object_temp_lcd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/examples/27-Lepton/lepton_get_object_temp.py b/scripts/examples/27-Lepton/lepton_get_object_temp.py index 0b5e93dde..15c91ebf2 100644 --- a/scripts/examples/27-Lepton/lepton_get_object_temp.py +++ b/scripts/examples/27-Lepton/lepton_get_object_temp.py @@ -51,8 +51,8 @@ while(True): clock.tick() img = sensor.snapshot() for blob in img.find_blobs(threshold_list, pixels_threshold=200, area_threshold=200, merge=True): + stats = img.get_statistics(thresholds=threshold_list, roi=blob.rect()) img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) - stats = img.get_statistics(thresholds=threshold_list, roi=blob.rect()) img.draw_string(blob.x(), blob.y() - 10, "%.2f C" % map_g_to_temp(stats.mean()), mono_space=False) print("FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE))) diff --git a/scripts/examples/27-Lepton/lepton_get_object_temp_lcd.py b/scripts/examples/27-Lepton/lepton_get_object_temp_lcd.py index 6a619f279..6594395b1 100644 --- a/scripts/examples/27-Lepton/lepton_get_object_temp_lcd.py +++ b/scripts/examples/27-Lepton/lepton_get_object_temp_lcd.py @@ -52,9 +52,9 @@ while(True): clock.tick() img = sensor.snapshot() for blob in img.find_blobs(threshold_list, pixels_threshold=200, area_threshold=200, merge=True): + stats = img.get_statistics(thresholds=threshold_list, roi=blob.rect()) img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) - stats = img.get_statistics(thresholds=threshold_list, roi=blob.rect()) img.draw_string(blob.x(), blob.y() - 10, "%.2f C" % map_g_to_temp(stats.mean()), mono_space=False) lcd.display(img) print("FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)))