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)))