Use Hti-301 ht on Linux (both x86_64, aarch64 and armhf) - Page 1
Forum section: electronics / general

author: ericb
author_rank: Contributor
timestamp: December 12, 2020, 09:40:22 am
content: Hello,I'm the happy owner of a brand new Hti-301 ht, and I'd like to use it on the desktop (only). I'm prof in an french engineers school, and my goal is to study the temperature precision, mainly around the temperature measuring. Got one student working with me, and doing the same with the Seek Compact pro.FYI, we can already do a lot of things with the Seek camera (using the great libseek-thermal) and we started the - difficult- study of temperature value measurement-accuracy and computation. BTW, a big thank you to Fraser for his topic (https://www.eevblog.com/forum/thermal-imaging/seek-thermal-core-measurement-accuracy-whats-the-story/)On the Hti-301, I got it since one day only, and I only found some information. The camera seems to work well (I got no cell phone btw :-) ), but I wasn't ableto see anything yet, but sure I'll progress fastly.For example :Code:~ $ uvcdynctrl -fListing available frame formats for device video0:Pixel format: YUYV (YUYV 4:2:2; MIME type: video/x-raw-yuv)Frame size: 384x292Frame rates: 25v4l2-ctl returns :Code:~ $ v4l2-ctl --list-formats --list-formats-ext -d0ioctl: VIDIOC_ENUM_FMTType: Video Capture: 'YUYV' (YUYV 4:2:2)ioctl: VIDIOC_ENUM_FMTType: Video Capture: 'YUYV' (YUYV 4:2:2)Size: Discrete 384x292Interval: Discrete 0.040s (25.000 fps)Other lsusb command :Code:~ $ lsusb -t/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 10000M/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M|__ Port 2: Dev 2, If 1, Class=CDC Data, Driver=cdc_mbim, 480M|__ Port 2: Dev 2, If 2, Class=Vendor Specific Class, Driver=usbserial_generic, 480M|__ Port 2: Dev 2, If 0, Class=Communications, Driver=cdc_mbim, 480M|__ Port 3: Dev 42, If 0, Class=Video, Driver=uvcvideo, 480M|__ Port 3: Dev 42, If 1, Class=Video, Driver=uvcvideo, 480M|__ Port 10: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M|__ Port 10: Dev 3, If 1, Class=Wireless, Driver=btusb, 12MCode:~ $ v4l2-ctl -d0 -DDriver Info:Driver name : uvcvideoCard type : T3-317-13Bus info : usb-0000:00:14.0-3Driver version : 4.15.23Capabilities : 0x84200001Video CaptureStreamingExtended Pix FormatDevice CapabilitiesDevice Caps : 0x04200001Video CaptureStreamingExtended Pix FormatMedia Driver Info:Driver name : uvcvideoModel : T3-317-13Serial : (hidden)Bus info : 3Media version : 4.15.23Hardware revision: 0x00000200 (512)Driver version : 4.15.23Interface Info:ID : 0x03000002Type : V4L VideoEntity Info:ID : 0x00000001 (1)Name : T3-317-13Function : V4L2 I/OPad 0x01000004 : SinkOther (partial) information returned by lsusb -vCode:Bus 001 Device 042: ID 1514:0001 ActelCouldn't open device, some information will be missingDevice Descriptor:bLength 18bDescriptorType 1bcdUSB 2.00bDeviceClass 239 Miscellaneous DevicebDeviceSubClass 2 ?bDeviceProtocol 1 Interface AssociationbMaxPacketSize0 64idVendor 0x1514 ActelidProduct 0x0001bcdDevice 2.00iManufacturer 1iProduct 2iSerial 3bNumConfigurations 1Configuration Descriptor:bLength 9bDescriptorType 2wTotalLength 162bNumInterfaces 2bConfigurationValue 1iConfiguration 4bmAttributes 0x80(Bus Powered)MaxPower 500mAInterface Association:bLength 8bDescriptorType 11bFirstInterface 0bInterfaceCount 2bFunctionClass 14 VideobFunctionSubClass 3 Video Interface CollectionbFunctionProtocol 0iFunction 0Interface Descriptor:bLength 9bDescriptorType 4bInterfaceNumber 0bAlternateSetting 0bNumEndpoints 0bInterfaceClass 14 VideobInterfaceSubClass 1 Video ControlbInterfaceProtocol 0iInterface 0VideoControl Interface Descriptor:bLength 13bDescriptorType 36bDescriptorSubtype 1 (HEADER)bcdUVC 1.00wTotalLength 40dwClockFrequency 6.000000MHzbInCollection 1baInterfaceNr( 0) 1VideoControl Interface Descriptor:bLength 18bDescriptorType 36bDescriptorSubtype 2 (INPUT_TERMINAL)bTerminalID 1wTerminalType 0x0201 Camera SensorbAssocTerminal 2iTerminal 6wObjectiveFocalLengthMin 0wObjectiveFocalLengthMax 0wOcularFocalLength 0bControlSize 3bmControls 0x00000220Focus (Absolute)Zoom (Absolute)VideoControl Interface Descriptor:bLength 9bDescriptorType 36bDescriptorSubtype 3 (OUTPUT_TERMINAL)bTerminalID 2wTerminalType 0x0101 USB StreamingbAssocTerminal 1bSourceID 1iTerminal 0Interface Descriptor:bLength 9bDescriptorType 4bInterfaceNumber 1bAlternateSetting 0bNumEndpoints 0bInterfaceClass 14 VideobInterfaceSubClass 2 Video StreamingbInterfaceProtocol 0iInterface 9VideoStreaming Interface Descriptor:bLength 14bDescriptorType 36bDescriptorSubtype 1 (INPUT_HEADER)bNumFormats 1wTotalLength 71bEndPointAddress 129bmInfo 0bTerminalLink 2bStillCaptureMethod 0bTriggerSupport 0bTriggerUsage 0bControlSize 1bmaControls( 0) 27VideoStreaming Interface Descriptor:bLength 27bDescriptorType 36bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED)bFormatIndex 1bNumFrameDescriptors 1guidFormat {xxxxxxxxxxxxxxxxxxxxxxxxx privacy ? xxxxxxxxxx}bBitsPerPixel 16bDefaultFrameIndex 1bAspectRatioX 0bAspectRatioY 0bmInterlaceFlags 0x00Interlaced stream or variable: NoFields per frame: 2 fieldsField 1 first: NoField pattern: Field 1 onlybCopyProtect 0VideoStreaming Interface Descriptor:bLength 30bDescriptorType 36bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)bFrameIndex 1bmCapabilities 0x00Still image unsupportedwWidth 384wHeight 292dwMinBitRate 5606400dwMaxBitRate 5606400dwMaxVideoFrameBufferSize 224256dwDefaultFrameInterval 400000bFrameIntervalType 1dwFrameInterval( 0) 400000Interface Descriptor:bLength 9bDescriptorType 4bInterfaceNumber 1bAlternateSetting 1bNumEndpoints 1bInterfaceClass 14 VideobInterfaceSubClass 2 Video StreamingbInterfaceProtocol 0iInterface 0Endpoint Descriptor:bLength 7bDescriptorType 5bEndpointAddress 0x81 EP 1 INbmAttributes 5Transfer Type IsochronousSynch Type AsynchronousUsage Type DatawMaxPacketSize 0x030c 1x 780 bytesbInterval 1As you can see, there is something missing to initialize the camera, and I got some questions :- I got it half-working using OpenCV 3.4.0. Mainly the zoom access is broken in this release. Does someone suggest a better OpenCV version to use, to be sure I can correcly initialize the camera ?I got it working with SeekGui (a software I wrote), but the only frame type I got is a green one, probably because using BGRA by defaut. What is the right pixel format ? YUYV ?Other possible issue: the current Linux kernel version is 4.15.23, maybe obsolete (investigations in progress).Last but not least, any help is welcome (including in private) !!To be continued :-)[EDIT : fixed typos, wording, and some other little glitches]

author: therwp
author_rank: Contributor
timestamp: December 17, 2020, 04:16:27 am
content: Quote from: ericb on December 12, 2020, 09:40:22 amVery cool! I don't have the knowledge to be of assistance, but I appreciate your moving everyone forward.-Regarding "I got it working with...," that is referring to the Seek camera only, right?-Interesting that the HT-301 reports a resolution of 384x292. As you know, it's sold as a 384 x 288. Where do the extra four pixels come from?

author: tonykids
author_rank: Regular Contributor
timestamp: December 17, 2020, 01:18:45 pm
content: Quote from: therwp on December 17, 2020, 04:16:27 amThey are some addtion info of this frame,like max&min temp and their x,y position,centre temp,some user defined positions' temp etc.

author: ericb
author_rank: Contributor
timestamp: December 17, 2020, 10:20:58 pm
content: Hello,@therwp : I'm using libseek-thermal (you can find on github) adapted to Seek Compact pro. It works very well, and is really reliable.Back to the Hti 301 : to answer you about the 384 x 288 pixels, I think there is some extra lnformation, like done with e.g. TV line / TV frame for TV signals, but I'm currently discovering all of that, and I take care to experiment without brake anything.Current status : on Linux x86_64 + OpenCV 3.4.11 I got frames 388x292@25fps, and I only found that some values for zoom and focus cause something like new something, maybe shutter reset or something. The big issue is that I got NO image yet, and I'm very disappointedIf it doesn'twork, I'll return it soon (sort of big 800 euros deception in this case :-/ )@tonykidsThanks for the information, I'll investigate this path

author: Cat
author_rank: Regular Contributor
timestamp: December 17, 2020, 10:35:09 pm
content: Quote from: ericb on December 17, 2020, 10:20:58 pmNo image with OpenCV or no image at all?According to your snippets the Hti-301 is an UVC (USB Video Class) device which can be accessed with an mediaplayer like VLC and the thermal image should be seen.

author: ericb
author_rank: Contributor
timestamp: December 17, 2020, 10:48:55 pm
content: @Cat:q4l2 /dev/video0 => start the capture gives grey vertical lines ~ 3 s then uniform grey ?$ v4l2-ctl -Lfocus_absolute 0x009a090a (int) : min=0 max=65535 step=0 default=0 value=0zoom_absolute 0x009a090d (int) : min=0 max=65535 step=0 default=0 value=0Playing with focus_absolute and zoom absolute, gives a green fixed frame, and nothing else.Playing with any player , no image at all : means when moving the camera, I see no change.I forgot : I hear no shutter (like with the Seek Compact pro)I can hear it again :-)Can the camera be broken ?probably not, but sure it is not correctly initialized. : removed useless information, update : it works !Ok, it starts to work. See attached screenshot, taken with miniDart. As expected, it works directly with my software ! UFF ! Last, SeekGui will be adapted to both Seek Compact pro (I'll integrate libseek-thermal) and Hti-301 + I'll cross compile everything to work on Windows too.

author: ericb
author_rank: Contributor
timestamp: December 25, 2020, 03:19:11 pm
content: Hello,Got all colour pallettes workings. See the attached screenshot (add the selector using ImGui was easy)+ works on x86_64 (obviously), plus RPi 4 (8GB but should work on 4GB, aarch64, GPU @650 MHz / MPU @2 GHz)) and works somewhat with armhf on RPi 3b+ 2GB (32 bits)Important: the code has not been commited, for good reasons.Next steps :- provide a simple way to init/calibrate.- resize to image only (remove the 4 extra lines)- provide a Windows port (cross compiled binary + installer)- add cross + temperature information (works already for Seek Compact pro on my machine, but needs some love)Note: select an area + zoom and draw over the image are already includedTo be continued

author: riccardo.pittini
author_rank: Regular Contributor
timestamp: December 26, 2020, 10:27:19 am
content: Amazing job!!!Do you think that changing the resolution will make it work also for the HTI-201?

author: ericb
author_rank: Contributor
timestamp: December 26, 2020, 11:03:53 am
content: @riccardo.pittiniHello,To be honest, I don't know the Hti 201 camera well, but it should, since this camera is very probably seen as (USB 2.x) USB device providing any of RGBA or YUYV or YUV420 or even RGB24 pixel format for frames. e.g. if you are using Linux, qv4l2 should work out of the box, including controls.+ IMHO this should work with ffmpeg too (all OS ! )For the radiometric data, and any control operation, I don't know (but v4l2 will provide you tracks to explore).@Fraser or some expert : can you please confirm the 201 is seen as an USB 2 device ?About resolution, just take care to dissociate the sensor resolution (pixels width by pixels height) with image resolution obtained using cv::resize(). For the hti 301, got 388 x 292 resized into 720p (aka 1280 x 720 @25 FPS) or any of the 640 x480, 800 x 600 ... 2k ...etc. Or whatever other image size I propose.If you want to test on Windows, I'd suggest you to give it a try with miniDart (I provide Windows versions here :https://framagit.org/ericb/miniDart/-/tree/master/testing_version(please be gentle, this is the Handball version and I'll adapt to thermogaphy with SeekGui in a while).BE CAREFULL:if you want to test miniDart, or SeekGui later, install OpenGL drivers on your Windows machine IS MANDATORY. Else miniDart won't even launch!On Linux, you'll have to build it, but this is very complicated. The problem is I customized Freetype inside OpenCV (there in a minimal canvas included in miniDart, and you can draw over the images - WIP-). I'll have more time in next summer to simplify. Sorry, this is the only moment in the year I have less work :-/HTH

author: Odiug
author_rank: Newbie
timestamp: January 30, 2021, 09:54:27 pm
content: @ericbHiHow did you get the palettes to work. Is it also a setting inside UVC or are they applied afterwards in the application?BTW, my HT-301 worked out of the box as a UVC device under Linux with the app "Cheese", but also even under Win10 with Camera and Teams. It seems to come up with reasonable default settings as a working UVC device.RegardsGuido

author: ericb
author_rank: Contributor
timestamp: January 30, 2021, 10:45:05 pm
content: @OdiugOf course it will work for you on Linux (even VLC should work).Though, everything is not yet perfect yet : for example, I can record video (thermal view + min max + radiometric data) using miniDart + Seek Compact pro, using v4l2loopback + the viewver, but the hti-301 ht recording is broken. Maybe my fault. If I'm not wrong, I still have to add the right change to v4l2loopback with the hti-301 ht too. The current track is, currently, the software refresh rate is not enough to record the video, or it could be the framesize (720p). Investigating ...Indeed paletts will miss you, since I'm using a not documented way to select one of them. Tell me if you want to try, I'lll start to build a windows version soon (should work directly, since it does compile straight away since a while).As short anwser, I found the trick randomly (confirmed by someone who reversed some parts of the sdk). If you can read "between the lines" in my previous answers, you'll understand what happens.To tell you more, I can change the pallet in runtime, and it rocks really, and more, but this is undocumented. I'm still waiting the official SDK from the reseller .... got no news since a while.pm me if you want to know more.

author: jonnys
author_rank: Newbie
timestamp: December 11, 2021, 02:05:41 pm
content: Hi i see that no news from a few month ago so i refresh this topic,and ask are is any new information about this case ?kind regards

author: ericb
author_rank: Contributor
timestamp: December 16, 2021, 08:04:10 pm
content: Hello,Well, I don't have much of feedback (nor help in any way) ... no idea why : it works well and is promising.I'm sorry I was crazy busy with my -new- job, and didn't find the time to improve, but I'll have more time very soon (bettwen Christmas and New Year day).Other important point : I worked a lot to improve miniDart (record and SYNC correctly video and audio)Please stay tuned, big changes are scheduled during 2022 Q1 (or maybe Q2)My plans are:- change a lot of code (and rebase with loudly improved miniDart), including video recording- add min max + some radiometic data- improve palettes (currently not working well)- provide a Windows version : fixed typos

author: ericb
author_rank: Contributor
timestamp: December 26, 2021, 03:28:39 pm
content: The code is noW adapted to OpenCV 3.4.17, and I have added the color palettes to miniDart too. Tests and WIP with OpenCV 4.5.5For further details, see :https://framagit.org/ericb/ir_thermography(Linux only Windows asap)(orhttps://framagit.org/ericb/miniDart/-/commit/deadd5a95f9fdc097fd6cb23658789ff939f96b2)I think I'll have a look at radiometric values during the coming days. Feel free to help me if you are interested.

author: ericb
author_rank: Contributor
timestamp: December 30, 2021, 03:45:24 pm
content: In fact, I found 10 color palettes + other features (including internal chessboard for calibration, maybe other things hidden)Works perfectly using both OpenCV 3.4.17 AND OpenCV 4.5.5.Tested on Linux only (x86_64 and aarch 64). Since the code is very portable, it should work on Windows. For the new palettes, just have a look at the headers in seekGui code (I'll update miniDart source code soon, because the images can be recorded in a video -.mp4, .mkv or .avi @25 fps- very easely).I'll have to stop for some days. To be continued.