ht301_hacklib
ht301_hacklib copied to clipboard
V2
Ok, so this might be a bit of an uncalled for update / rewrite. But here is what I did:
- Port the code from https://github.com/lamnguyenvu98/xtherm-python by @lamnguyenvu98 as I found it a lot clearer
- Adjust it so you can connect to any supported thermal camera without changing any code/config
- Keep the same API as the HT301 class had, so the opencv and pyplot scripts still work
- Simplify the emulator class. Unfortunately the
*.npy
save files are now no longer compatible, as the original file lacked the raw data - Because the the high temperature range parameters of the TS2+ are missing, I added support for two (hardcoded) scale factors (mx+b) for the temperatures. I fitted these parameters by comparing the temperature readings of a scene taken in both modes
- made the pyplot.py function windows compatible
I understand if this is somewhat impossible to review. Even more so because I have not been able to test this on anything but my TS2+ camera. I first intended to only copy the parameters from lamnguyenvu98 but then I went a bit overboard
If you somehow accept this PR, I think the readme / supported camera list also needs an update before this is merged
I have T2L and your version worked. Unlike master that was freezing at self.cap.read()
.
I just need to limit resolution search to video_dev = self.find_device(256)
as I guess I had some 640x480 webcam in the system.
To make it work with a HT-301, I had to fix a typo (?) in the supported_widths
set:
diff --git a/ht301_hacklib.py b/ht301_hacklib.py
index 257979c..7f22af0 100755
--- a/ht301_hacklib.py
+++ b/ht301_hacklib.py
@@ -26,7 +26,7 @@ def read_u8(arr_u16, offset, step):
class Camera:
"""Class for reading data from the XTherm/HT301/InfiRay thermal cameras"""
- supported_widths = {240, 256, 392, 640}
+ supported_widths = {240, 256, 384, 640}
ZEROC = 273.15
distance_multiplier = 1.0
offset_temp_shutter = 0.0
At least now it fits the cases in Camera.init_parameters
.