forked from stawel/ht301_hacklib
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathexample_simple.py
executable file
·61 lines (51 loc) · 1.25 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
import time
import irpythermal
# create camera object and do a initial calibration
cap = irpythermal.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()