If you have everything installed and wired up correctly, you should see a nice thermal camera image. Cool tones (blue
and purple) are cooler temperatures, and warmer tones (yellow, red) are warmer temperatures.
If your image seems to be flipped on the screen, try changing the orientation of the AMG8833 breakout on the
breadboard.
If you're interested int he details, and want to know more about how we made 64 pixels look like many more, it's
called bicubic interpolation (https://adafru.it/xgA) (hat tip to OSHpark for the idea (https://adafru.it/xgB)!)
displayPixelHeight = height / 30
lcd = pygame.display.set_mode((width, height))
lcd.fill((255, 0, 0))
pygame.display.update()
pygame.mouse.set_visible(False)
lcd.fill((0, 0, 0))
pygame.display.update()
#some utility functions
def constrain(val, min_val, max_val):
return min(max_val, max(min_val, val))
def map_value(x, in_min, in_max, out_min, out_max):
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
#let the sensor initialize
time.sleep(.1)
while True:
#read the pixels
pixels = []
for row in sensor.pixels:
pixels = pixels + row
pixels = [map_value(p, MINTEMP, MAXTEMP, 0, COLORDEPTH - 1) for p in pixels]
#perform interpolation
bicubic = griddata(points, pixels, (grid_x, grid_y), method='cubic')
#draw everything
for ix, row in enumerate(bicubic):
for jx, pixel in enumerate(row):
pygame.draw.rect(lcd, colors[constrain(int(pixel), 0, COLORDEPTH- 1)],
(displayPixelHeight * ix, displayPixelWidth * jx,
displayPixelHeight, displayPixelWidth))
pygame.display.update()