-
Notifications
You must be signed in to change notification settings - Fork 39
/
example_simple.py
executable file
·39 lines (29 loc) · 1.17 KB
/
example_simple.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python3
import time
import numpy as np
import ht301_hacklib
# create camera object and do a initial calibration
cap = ht301_hacklib.HT301()
# read frame (raw ADC data)
ret, frame = cap.read()
# read additional data associated with the last frame
info, temperature_lookup_table = cap.info()
point = (10, 20)
print('temperature at point:', point, 'is:', temperature_lookup_table[frame[point]], '°C', '[raw ADC value:', frame[point], ']')
#print('additional info:', info)
time.sleep(5) # not needed
print('click, click')
cap.calibrate()
time.sleep(5) # not needed
# read next frame
ret, frame = cap.read()
info, temperature_lookup_table = cap.info()
print('temperature at point:', point, 'is:', temperature_lookup_table[frame[point]], '°C', '[raw ADC value:', frame[point], ']')
#print('additional info:', info)
print('temperature at any point:', temperature_lookup_table[frame])
print('frame shape:', frame.shape, 'data type:', frame.dtype)
#result: frame shape: (288, 384) data type: uint16
print('T lut shape:', temperature_lookup_table.shape, 'data type:', temperature_lookup_table.dtype)
#result: T lut shape: (16384,) data type: float64
# release camera object
cap.release()