Fix get stats call order

This commit is contained in:
Kwabena W. Agyeman 2020-05-12 10:24:10 -07:00
parent 9383e24b66
commit 0bd4c46750
2 changed files with 2 additions and 2 deletions

View File

@ -51,8 +51,8 @@ while(True):
clock.tick() clock.tick()
img = sensor.snapshot() img = sensor.snapshot()
for blob in img.find_blobs(threshold_list, pixels_threshold=200, area_threshold=200, merge=True): 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_rectangle(blob.rect())
img.draw_cross(blob.cx(), blob.cy()) 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) 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))) print("FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)))

View File

@ -52,9 +52,9 @@ while(True):
clock.tick() clock.tick()
img = sensor.snapshot() img = sensor.snapshot()
for blob in img.find_blobs(threshold_list, pixels_threshold=200, area_threshold=200, merge=True): 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_rectangle(blob.rect())
img.draw_cross(blob.cx(), blob.cy()) 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) img.draw_string(blob.x(), blob.y() - 10, "%.2f C" % map_g_to_temp(stats.mean()), mono_space=False)
lcd.display(img) lcd.display(img)
print("FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE))) print("FPS %f - Lepton Temp: %f C" % (clock.fps(), sensor.ioctl(sensor.IOCTL_LEPTON_GET_FPA_TEMPERATURE)))