PureThermal 1 Y16 with c++ and libuvc

1,030 views
Skip to first unread message

Guillaume Navel

unread,
Aug 23, 2017, 11:03:21 AM8/23/17
to Flir Lepton
Hi,

I'm trying to get working the PureThermal 1 with a custom C++ software using libuvc on Ubuntu.
I want to do a console only software.

I tested the example from this page : https://int80k.com/libuvc/doc/index.html 
It compile well, but I receive no frame.
I attach the code I use and the output.

Do I need another configuration to get it working ?

Please, can you help me ?

Guillaume
main.cpp
output.log

Kurt Kiefer

unread,
Aug 23, 2017, 11:33:25 AM8/23/17
to Flir Lepton
Guillaume,

We had to fork libuvc to get it to support the frame formats for PT1: https://github.com/groupgets/libuvc

We're using the library for GetThermal (C++/QT): https://github.com/groupgets/getthermal

Kurt

Guillaume Navel

unread,
Aug 23, 2017, 12:01:06 PM8/23/17
to Flir Lepton
Hi Kurt,

Thank you for your response.

I already installed the libuvc from groupgets.

I can't use QT because my software run on a computer with no gui.
The purpose is to save thermal pictures.

I try to understand the getthermal library, but I don't know what I need to use to get it working.

Guillaume

Kurt Kiefer

unread,
Aug 23, 2017, 1:02:09 PM8/23/17
to Flir Lepton
Ok, you didn't say you were using this version.

Could you try removing the call to "uvc_set_ae_mode" and see if that makes a difference?

Here are a couple more examples that might be helpful:


pt1-v4l2-grab uses v4l2 so it only works on Linux, and does exactly what you're trying to do (you just need to change the frame format): https://github.com/groupgets/purethermal1-uvc-capture#c--v4l2-linux

Guillaume Navel

unread,
Aug 23, 2017, 1:10:03 PM8/23/17
to Flir Lepton
I tested my software with a webcam and it works.
I changed just the  uvc_get_stream_ctrl_format_size() parameters to get it working with the webcam.
So, I think that my parameters for the PureThermal 1 are wrong. I use :

res = uvc_get_stream_ctrl_format_size(devh, &ctrl, UVC_FRAME_FORMAT_Y16, 80, 60, 9);

Did someone can validate my parameters or send me the correct one ?

I thank you in advance for your help.

Guillaume

Kurt Kiefer

unread,
Aug 23, 2017, 1:24:58 PM8/23/17
to Flir Lepton
In GetThermal, it works like this:

    switch(format.pixelFormat())
    {
    case QVideoFrame::Format_YUV420P:
        uvcFormat = UVC_FRAME_FORMAT_I420;
        break;
    case QVideoFrame::Format_RGB24:
        uvcFormat = UVC_FRAME_FORMAT_RGB;
        break;
    case QVideoFrame::Format_Y16:
        uvcFormat = UVC_FRAME_FORMAT_Y16;
        break;
    default:
        uvcFormat = UVC_FRAME_FORMAT_UNKNOWN;
        break;
    }

    res = uvc_get_stream_ctrl_format_size(
                devh, &ctrl, /* result stored in ctrl */
                uvcFormat,
                format.frameWidth(), format.frameHeight(), 0);

So the only difference there is that we're not explicitly calling out a frame rate. Setting it to 9 should be OK though. 

Guillaume Navel

unread,
Aug 23, 2017, 1:35:44 PM8/23/17
to Flir Lepton
I solved my problem. The flir sensor wasn't connected well on the PureThermal board !
I pushed it and it works :)

Thank you very much for your help and sorry to disturb you with this so simple problem !
Message has been deleted

sam vadidar

unread,
Mar 20, 2019, 10:20:55 AM3/20/19
to Flir Lepton
Hi,

Recently I got a pure thermal mini and I am trying to access the raw data. I can get an stream using opencv c++ with a pre-defined color map but I am not sure how can I access the raw data. Since you already done it, I thought maybe you can give me some hints to figure it out.

Thank you :)

Julhio

unread,
Mar 21, 2019, 12:15:21 AM3/21/19
to Flir Lepton
Hi Sam !

I converted the uvc-radiometry code from Python to C++.
You can use the code from my github:

I am using EclipseCDT, gcc 7.3.0, C++11 and OpenCV 3.4.1 on Ubuntu 18.04.

All the parameters are configured on .project and .cproject.

Best regards,
Julhio.
Reply all
Reply to author
Forward
0 new messages