Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. The configuration of the development board is low, the face interface display control is stuck, and the same as using OpenGL, is there a solution

The configuration of the development board is low, the face interface display control is stuck, and the same as using OpenGL, is there a solution

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 2 Posters 252 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    baizhou
    wrote on last edited by baizhou
    #1

    Because I tried OpenGL and found that the difference is very small, the OpenGL module has been removed, and it is judged that it should be because the graphics card of the device is too poor.
    Here's the interface display code.

    void ThreadGetCamPic::run()
    {
        bool ret = stVideoCaptrue.open(0);
        Mat matTemp;
        QImage img;
        m_bStop = false;
        while(!m_bStop){
        stVideoCaptrue->matTemp;
    
            if(matTemp.empty()){
                msleep(50);
                continue;
            }
            img = QImage(matTemp.data,matTemp.cols,matTemp.rows,matTemp.step,QImage::Format_RGB888).copy();
            img = convertRGB888toBGR888UsingOpenCV(img);
            emit sigSendCurImg(img);
        }
    }
    
    QImage ThreadGetCamPic::convertRGB888toBGR888UsingOpenCV(const QImage &rgbImage)
    {
        cv::Mat cvImage(rgbImage.height(), rgbImage.width(), CV_8UC3, (void*)rgbImage.bits(), rgbImage.bytesPerLine());
        cv::cvtColor(cvImage, cvImage, cv::COLOR_RGB2BGR);
        QImage bgrImage(cvImage.data, cvImage.cols, cvImage.rows, cvImage.step, QImage::Format_RGB888);
        return bgrImage;
    }
    
    connect(&m_stThreadGetCamPic,&ThreadGetCamPic::sigSendCurImg,this,&Widget::OnFreshCurImg);
    "other code"
    
    void Widget::OnFreshCurImg(const QImage &img) {
        m_imgSrc = img.copy();
        m_img2Show = m_imgSrc.scaled(ui->campic_label->size(),Qt::KeepAspectRatioByExpanding,Qt::SmoothTransformation);
        m_pix2Show = QPixmap::fromImage(m_img2Show);
        ui->campic_label->setPixmap(m_pix2Show);
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What kind of device is that ?
      How did you try to use OpenGL ?
      Did you consider using Qt Multimedia to get images from the camera ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Also, what are the camera specifications ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          baizhou
          wrote on last edited by baizhou
          #4

          I'm very sorry that I've been busy before.,So I didn't come back to reply.,Then I've found the problem.,Now I'm back to answer the question I hope it can help you.,The main reason is that the default frame rate of my device's camera is the lowest, resulting in the number of frames being too low to cause Caton.,So I increased the number of frames to get it solved.

          void ThreadGetCamPic::run()
          {
              bool ret = stVideoCaptrue.open(0);
          
              //The code in the horizontal line is currently known to be only valid for the RK35xx series cameras, if there is a problem with the camera turned on, it should be here, just comment it out, and it is also the reason to solve the freeze of the camera acquisition screen
              /*---------------------------------------------------------------------------------*/
          //    stVideoCaptrue.set(cv::CAP_PROP_FRAME_WIDTH, 800);
          //    stVideoCaptrue.set(cv::CAP_PROP_FRAME_HEIGHT, 600);
          //    stVideoCaptrue.set(cv::CAP_PROP_FPS, 20);
              /*---------------------------------------------------------------------------------*/
          
              Mat matTemp;
          //    QImage img;
              m_bStop = false;
              while(!m_bStop){
                  stVideoCaptrue>>matTemp;
          
                  if(matTemp.empty()){
                      msleep(50);
                      continue;
                  }
                  img = QImage(matTemp.data,matTemp.cols,matTemp.rows,matTemp.step,QImage::Format_RGB888).copy();
                  img = convertRGB888toBGR888UsingOpenCV(img);
                  emit sigSendCurImg(img);
              }
          }
          
          1 Reply Last reply
          0
          • B baizhou has marked this topic as solved on

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved