Using a thermal camera in qt

Hi
I want to use the thermal camera in my program, this is the code I wrote for a normal camera that connects via USB, but when I connect the thermal camera to the same USB port, the image looks like this:
test.jpg

and this is my code

void MainWindow::on_btn_thermal_start_clicked()
 {

thermalCap.open(1);

if(!thermalCap.isOpened())  // Check if we succeeded
{
    cout << "camera is not open" << endl;
    errordialog("Thermal_camera is not open" );
}
else
{
    cout << "camera is open" << endl;
    Thermal_CameraTimeout_Func();
}
}
  void MainWindow::Thermal_update_PicInWindow()
  {
      //thermal
      thermalCap >> thermalFrame;
      flip(thermalFrame, thermalFrame, 1);
  
      cvtColor(thermalFrame, thermalFrame,COLOR_BGR2RGB);
  
      thermalImage = QImage((const unsigned char*) (thermalFrame.data),
                           thermalFrame.cols, thermalFrame.rows, QImage::Format_RGB888);
  
      ui->lbl_thermal->setPixmap(QPixmap::fromImage(thermalImage));
  
      ui->lbl_thermal->resize(ui->lbl_thermal->pixmap()->size());
  }
  
  void MainWindow::Thermal_CameraTimeout_Func()
  {
      if (!(timerthermalVideo->isActive()))
      {
          timerthermalVideo->start(50);
          ui->btn_thermal_start->setText("STOP_Camera");
          Thermal_update_PicInWindow();
  
      }
      else if (timerthermalVideo->isActive())
      {
          timerthermalVideo->stop();
          ui->btn_thermal_start->setText("START_Camera");
          thermalCap.release();
  
      }
  
  }

i am using lepton flir 2(thermal camera) and qt5 and windows10
I noticed that my thermal camera image on Google (webcam test) is also gray, but in Firefox (webcam test) it is the natural color, the difference between the two sites is in the image mode and in the video standard.
In Google, which displays an image similar to my program:
Image mode = gray scale
Video standard = ???
And in Firefox this information is equal to
Image mode = rgb
Video standard = QQVGA
Can this information be changed in qt or opencv? How?

The first problem is that the Thermal_CameraTimeout_Func() isn’t a timeout function, it gets called once in on_btn_thermal_start_clicked().
Generally the cameras need some time for calibration, that’s why the first image is gray.
Advice: go step by step. First write a simple program that captures Mat images and displays them using imshow in a loop. If it goes well, then add the Qt interface.

Otherwise, as a general rule it’s the best to use the SDK of the camera to get the images, then cast them to OpenCV Mat, QImage and so on.
The SDK will allow full control over the camera which is particularly useful for exotic equipment like thermal cameras. E.g. you can request either false color images or data representing temperature values.

Thank you ,
I used this program for a normal camera and there was no problem, the timer is updated in the Constructor function, as follows:

timerthermalVideo = new QTimer(this);
connect(timerthermalVideo, SIGNAL(timeout()),this, SLOT(Thermal_update_PicInWindow()));

But I had a problem with the thermal camera image. The image of the thermal camera is displayed in two colors, light gray and bold gray, and the image is difficult to distinguish.
Please give an example to use sdk because I have no idea how to use it.



Camera image: what is (in google like my program)and what should be(in firefox)

image mode: rgb vs grayscale

the second version shows some faint data which is likely linear grayscale temperature values. the rgb one shows false color (it’s called false because the world doesn’t look like that).

Yep, that was my next suggestion.
The thermal camera returns thermal values, not an image. So each value represents a temperature (e.g. 22=22°C or something similar, check the documentation), and as the temperature is mostly constant, you won’t have a lot of variance in the image.
To get the false color image, you need to normalize the image and than apply a colormap.

The SDK for the camera should be here, but the site seems to be down.

Thank you for your help.