Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Display the QML screen on Ui :: MainWindow
Forum Updated to NodeBB v4.3 + New Features

Display the QML screen on Ui :: MainWindow

Scheduled Pinned Locked Moved Unsolved General and Desktop
20 Posts 3 Posters 1.5k Views 2 Watching
  • 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.
  • SGaistS SGaist

    As I already wrote: use OpenCV directly to get the data from the camera.

    DQUY05D Offline
    DQUY05D Offline
    DQUY05
    wrote on last edited by
    #11

    @SGaist said in Display the QML screen on Ui :: MainWindow:

    As I already wrote: use OpenCV directly to get the data from the camera.

    As I tried the Qt Android does not support OpenCv open directly from the camera, for example the following function always returns false

    capture.open(0);                      // mở camera 0
    
        if(!capture.isOpened())
        {
            qDebug() << "Could not open camera" << 0;
            return;
        }
    

    There are many places on the forum that also talk about this
    https://forum.qt.io/topic/41961/accessing-the-android-camera-in-qt/16
    and
    https://github.com/opencv/opencv/issues/11952

    Thanks!

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

      Which version of OpenCV are you using ?

      This merge request implemented the Androïd support.

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

      DQUY05D 2 Replies Last reply
      0
      • SGaistS SGaist

        Which version of OpenCV are you using ?

        This merge request implemented the Androïd support.

        DQUY05D Offline
        DQUY05D Offline
        DQUY05
        wrote on last edited by
        #13

        @SGaist said in Display the QML screen on Ui :: MainWindow:

        Which version of OpenCV are you using ?
        This merge request implemented the Androïd support.

        I use Qt5.15, OpenCV4.5.2, I hope you can show me how to use it
        with this Opencv + Qt, I am still using its features normally, except for taking video directly from the camera

        Regards!

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

          Did you check that you are using the API level 24 as indicated in the patch ?

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

          DQUY05D 1 Reply Last reply
          0
          • SGaistS SGaist

            Did you check that you are using the API level 24 as indicated in the patch ?

            DQUY05D Offline
            DQUY05D Offline
            DQUY05
            wrote on last edited by
            #15

            @SGaist said in Display the QML screen on Ui :: MainWindow:

            Did you check that you are using the API level 24 as indicated in the patch ?

            Hi !
            I am using API30, but the integration of this suite is relatively complicated, because my English is limited, so I have not done this yet, I hope that next time there will be an easier approach. Thank you very much!

            1 Reply Last reply
            0
            • SGaistS SGaist

              Which version of OpenCV are you using ?

              This merge request implemented the Androïd support.

              DQUY05D Offline
              DQUY05D Offline
              DQUY05
              wrote on last edited by
              #16

              @SGaist
              Hi Sir !

              Is there any tutorial with Qt C ++?

              Thanks!

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

                Tutorial of what ?

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

                DQUY05D 1 Reply Last reply
                0
                • SGaistS SGaist

                  Tutorial of what ?

                  DQUY05D Offline
                  DQUY05D Offline
                  DQUY05
                  wrote on last edited by
                  #18

                  @SGaist
                  Is there any tutorial with Qt C ++? I want detailed tutorial on reading realtime camera using opencv on android, as you said, there is this merge request implemented the Android support,
                  I also tried using QVideoProbe, but the camera video format is still wrong, I'm stuck

                  void MainWindow::handleFrame(QVideoFrame frame)
                  {
                      tien++;
                      qDebug() << tien;
                  
                      auto input_w = frame.width();
                      auto input_h = frame.height();
                  
                      auto cam_data = frame.bits();
                  
                      Mat yuyv(input_h+input_h/2, input_w,CV_8UC1, &cam_data);
                      Mat rgb (input_h, input_w,CV_8UC4);
                  
                      cvtColor(yuyv, rgb, cv::COLOR_YUV2BGRA_NV21);
                  
                      QImage img= QImage((const unsigned char*)(yuyv.data),
                                                           yuyv.cols,yuyv.rows,
                                                           QImage::Format_BGR888);
                  }
                  

                  Thanks!

                  @SGaist said in Display the QML screen on Ui :: MainWindow:

                  Which version of OpenCV are you using ?

                  This merge request implemented the Androïd support.

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

                    You did not check the type of video frame you get. From memory, on Androïd it's an OpenGL texture.

                    No, I do not have a tutorial at hand however there are already many applications running OpenCV in conjunction with Qt. Use the search feature of this forum. There are already been several question related to that subject.

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

                    DQUY05D 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      You did not check the type of video frame you get. From memory, on Androïd it's an OpenGL texture.

                      No, I do not have a tutorial at hand however there are already many applications running OpenCV in conjunction with Qt. Use the search feature of this forum. There are already been several question related to that subject.

                      DQUY05D Offline
                      DQUY05D Offline
                      DQUY05
                      wrote on last edited by
                      #20

                      @SGaist said in Display the QML screen on Ui :: MainWindow:

                      You did not check the type of video frame you get. From memory, on Androïd it's an OpenGL texture.

                      No, I do not have a tutorial at hand however there are already many applications running OpenCV in conjunction with Qt. Use the search feature of this forum. There are already been several question related to that subject.

                      Hello!

                      I am also using openecv with Qt android, everything is very good, except getting realtime data of the camera, i have also spent a lot of time searching the forum, but haven't found anyone who can do it real time from camera, thank you!

                      1 Reply Last reply
                      0

                      • Login

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