stawel / ht301_hacklib

ht-301 thermal camera opencv lib
GNU General Public License v3.0
56 stars 31 forks source link

Best project , It's possible add T2S+ ? #10

Open bee1999 opened 1 year ago

bee1999 commented 1 year ago

Cool project , but i have T2S+ , It's possible to add T2S+ for use ?

lamnguyenvu98 commented 1 year ago

Cool project , but i have T2S+ , It's possible to add T2S+ for use ?

Have you tried it for T2S+? Does it work?

stawel commented 1 year ago

Have you tried it for T2S+? Does it work?

Just based on the resolution of T2S+: 256X192 it should not work (at least at this moment)

lamnguyenvu98 commented 1 year ago

Have you tried it for T2S+? Does it work?

Just based on the resolution of T2S+: 256X192 it should not work (at least at this moment)

You mean it should work, right?

stawel commented 1 year ago

You mean it should work, right?

no, it should NOT work,

we currently explicitly check if the resolution is right: https://github.com/stawel/ht301_hacklib/blob/master/ht301_hacklib.py#L286 and https://github.com/stawel/ht301_hacklib/blob/master/ht301_hacklib.py#L243-L246

but even if you change the code above, we additionally assume there are 4 extra lines of meta data, what gives us 4x384x2 Bytes. Since the width resolution of T2S+ is 256, the meta data will definitely look different.

wwagemans commented 1 year ago

You can find the required offsets for other models here: https://gitlab.com/netman69/inficam/-/blob/master/libinficam/src/main/jni/InfiCam/InfiFrame.cpp

I might give it a try to create a pull request, but am not yet sure when I'll have the time to do so.

stawel commented 1 year ago

interesting, I haven't seen this project before, I'll add a link to it

I might give it a try to create a pull request,

this is always appreciated :)

stawel commented 1 year ago

hm... maybe It is also worth checking out: https://github.com/cmair/ht301_hacklib

note: This fork is a hack to support InfiRay T2S+!

GuoPingPan commented 1 year ago

@stawel I think there are some problem with the temperature with TS2+ in line 170: https://github.com/cmair/ht301_hacklib/blob/7bb81ae60ac66edd498447052eb0ee04e056e667/ht301_hacklib.py#L170

    fpatmp_ = 20.0 - (float(Tfpa_raw) - 7800.0) / 36.0;

Should it be correct by following: https://github.com/cmair/ht301_hacklib/blob/7bb81ae60ac66edd498447052eb0ee04e056e667/ht301_hacklib.py#L170 ?

    fpatmp_ = 20.0 - (float(Tfpa_raw) - 8617.0) / 37.682;

or I must got a fever with 40°😂

image

tdamsma commented 1 year ago

hm... maybe It is also worth checking out: https://github.com/cmair/ht301_hacklib

note: This fork is a hack to support InfiRay T2S+!

I can confirm this fork works with a T2S+. However I haven't got the high temperature mode working yet

lamnguyenvu98 commented 1 year ago

I tried to write a class that support different resolutions. Most of my code was based on this repo, this gitlab one and the SDK. This code works for my case (a T2 camera) and I haven't tested on other camera models. I would love to have some feedback though.

https://github.com/lamnguyenvu98/xtherm-python

tdamsma commented 1 year ago

I tried to write a class that support different resolutions. Most of my code was based on this repo, this gitlab one and the SDK. This code works for my case (a T2 camera) and I haven't tested on other camera models. I would love to have some feedback though.

https://github.com/lamnguyenvu98/xtherm-python

Did you find by any chance find the correct temperature scaling parameters for the 450C mode?

I only saw your comment now and in the meantime I also did some work in #11 to get the TS2+ working (including the 450C mode). I'll have a look at what you did to see how it compares

tdamsma commented 1 year ago

@lamnguyenvu98 I think your approach to make a python port of the InfiCam repo is a great idea. Whish I saw it earlier. Getting started, it took me quite some time to figure out there is a whole line of camera's like the HT-301 and Infiray TS2+ that are pretty much the same. Would be great to combine support in a single python library with a nice and discoverable name.

Looking into the InfiCam repo it mentions:

/* NOTE Decompiled libthermometry.so from the android lib handles 400C range for 640px wide
 *   cameras differently, having different offsets for calibration values in that mode.
 * I couldn't wrap my head around how that worked so it's not implemented here.
 */

So it only has the correct values for the normal temperature mode. But perhaps I can do some data fitting to get these out.

tdamsma commented 1 year ago

See #13 for a proposed rewrite of this lib based on https://github.com/lamnguyenvu98/xtherm-python

diminDDL commented 3 months ago

Hello everyone, first of all thank you for adding support for the T2S+ and it does indeed appear to connect and work initially, but my specific unit appears to behave a bit weirdly compared to the things I saw posted in this thread. For example, this is what the software shows when the camera is just pointed straight up with nothing hotter than room temperature in the frame: image Here is what my hand looks like: image And finally a soldering iron: image It is very obvious that something is wrong here. Running the calibration causes the shutter to click, but it doesn't change anything, same thing for all the other settings. Next I tried to set it into the lower temperature range: image No matter what I did with switching ranges it completely breaks the display... Here is the snapshot of the raw data: https://we.tl/t-DvYokFLywK

From what I understand this is the newer version of the T2S+ that requires some processing to be done on the host end, and I would love to help adding such support to the project.

diminDDL commented 3 months ago

I did some digging and found that the primary issue is that we need to do uniformity correction manually. (Also it couldn't read out some registers like the shutter and body temp, but I hard coded those to 25C for now). I implemented a very simple routine to take an image with the shutter closed and then subtract the offsets from that from the subsequent frames and it worked out quite well. image I still need to deal with the dead pixel and the slightly off temperature, but I think this shouldn't be too hard.

tdamsma commented 3 months ago

I noticed that sometimes the camera is really off (the pixel intensity to temp curve has an inversion/parabolic shape instead of monotonically increasing) when it is just on, and after a few minutes it starts behaving. Haven't had the time to look into it

On Fri, May 24, 2024, 14:46 Dima @.***> wrote:

I did some digging and found that the primary issue is that we need to do uniformity correction manually. I implemented a very simple routine to take an image with the shutter closed and then subtract the offsets from that from the subsequent frames and it worked out quite well. image.png (view on web) https://github.com/stawel/ht301_hacklib/assets/25513498/6f14c1ee-e181-4e34-9545-241d77714154 I still need to deal with the dead pixel and the slightly off temperature, but I think this shouldn't be too hard.

— Reply to this email directly, view it on GitHub https://github.com/stawel/ht301_hacklib/issues/10#issuecomment-2129451882, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4BSUZ3G7QHPXX27YX2UZTZD4ZDPAVCNFSM6AAAAAAUE7QDT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRZGQ2TCOBYGI . You are receiving this because you commented.Message ID: @.***>

diminDDL commented 3 months ago

I noticed that sometimes the camera is really off (the pixel intensity to temp curve has an inversion/parabolic shape instead of monotonically increasing) when it is just on, and after a few minutes it starts behaving. Haven't had the time to look into it On Fri, May 24, 2024, 14:46 Dima @.> wrote: I did some digging and found that the primary issue is that we need to do uniformity correction manually. I implemented a very simple routine to take an image with the shutter closed and then subtract the offsets from that from the subsequent frames and it worked out quite well. image.png (view on web) https://github.com/stawel/ht301_hacklib/assets/25513498/6f14c1ee-e181-4e34-9545-241d77714154 I still need to deal with the dead pixel and the slightly off temperature, but I think this shouldn't be too hard. — Reply to this email directly, view it on GitHub <#10 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4BSUZ3G7QHPXX27YX2UZTZD4ZDPAVCNFSM6AAAAAAUE7QDT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRZGQ2TCOBYGI . You are receiving this because you commented.Message ID: @.>

Which camera are you talking about, because for my T2S+ v2 it takes just a few seconds to become stable.

What does take a bit longer is the board/core? temperature register on it. It very quickly increases and gets quite hot which suggests it is placed somewhere close to a hot spot of some sort. Maybe even on die of the ASIC. When I tried to use these values in the thermometry calculations I also got crazy drift and completely wrong results. So in my PR #16 I just hard coded a room temperature value until I figure out how to use that weird register properly.