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. Finally I have camera problem...
Forum Updated to NodeBB v4.3 + New Features

Finally I have camera problem...

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 3 Posters 1.1k 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.
  • G Offline
    G Offline
    Gourmet
    wrote on last edited by Gourmet
    #1

    I need camera based on widgets for Android. All I did like in provided camera example. I even added permissions requests to manifest and Java code.
    The camera code sequence is like that (excluding connections for error and capture result):

        camera = new QCamera( QCameraInfo::defaultCamera() );
        imageCapture = new QCameraImageCapture( camera ); 
        QImageEncoderSettings codec;
        codec.setCodec("image/png");
        codec.setResolution(ui->viewFinder->size());
        imageCapture->setEncodingSettings(codec);
        qWarning()<<"camera setting viewfinder";
        camera->setViewfinder( ui->viewFinder );
        qWarning()<<"camera setting capture mode";
        camera->setCaptureMode(QCamera::CaptureStillImage);
        qWarning()<<"camera starting";
        camera->start();
    

    Error handler is simple:

    void CameraDlg::cameraError(QCamera::Error)
    {
        qWarning()<<"camera error:"<<camera->errorString();
    }
    

    And...

    : camera setting viewfinder
    : camera setting capture mode
    : camera starting
    : camera error: "The camera service is missing"

    8-()

    Qt 5.12.5 - I read similar problems were with Qt 5.4. And I read they must be solved.

    G 1 Reply Last reply
    0
    • G Gourmet

      I need camera based on widgets for Android. All I did like in provided camera example. I even added permissions requests to manifest and Java code.
      The camera code sequence is like that (excluding connections for error and capture result):

          camera = new QCamera( QCameraInfo::defaultCamera() );
          imageCapture = new QCameraImageCapture( camera ); 
          QImageEncoderSettings codec;
          codec.setCodec("image/png");
          codec.setResolution(ui->viewFinder->size());
          imageCapture->setEncodingSettings(codec);
          qWarning()<<"camera setting viewfinder";
          camera->setViewfinder( ui->viewFinder );
          qWarning()<<"camera setting capture mode";
          camera->setCaptureMode(QCamera::CaptureStillImage);
          qWarning()<<"camera starting";
          camera->start();
      

      Error handler is simple:

      void CameraDlg::cameraError(QCamera::Error)
      {
          qWarning()<<"camera error:"<<camera->errorString();
      }
      

      And...

      : camera setting viewfinder
      : camera setting capture mode
      : camera starting
      : camera error: "The camera service is missing"

      8-()

      Qt 5.12.5 - I read similar problems were with Qt 5.4. And I read they must be solved.

      G Offline
      G Offline
      Gourmet
      wrote on last edited by
      #2

      No cameras at all...

          QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
          foreach (const QCameraInfo &cameraInfo, cameras)
              qWarning() << cameraInfo.deviceName();
      

      Gives nothing. :-(

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gourmet
        wrote on last edited by Gourmet
        #3

        Damn. This requires permissions for camera on mainfest and code. With them it founds "front" and "back" cameras on my device. But viewfinder is empty. And I finally found this in Qt docs:

        The Qt Multimedia Widgets module is not supported on Android, which means video display is only available using the VideoOutput and the Video QML Type.

        But what was against implement QCameraViewfinder using VideoOutput for Android? No answer...
        I will not mark this thread as solved - the solution assumes working QCameraViewfinder. But it does not.

        jsulmJ 1 Reply Last reply
        0
        • G Gourmet

          Damn. This requires permissions for camera on mainfest and code. With them it founds "front" and "back" cameras on my device. But viewfinder is empty. And I finally found this in Qt docs:

          The Qt Multimedia Widgets module is not supported on Android, which means video display is only available using the VideoOutput and the Video QML Type.

          But what was against implement QCameraViewfinder using VideoOutput for Android? No answer...
          I will not mark this thread as solved - the solution assumes working QCameraViewfinder. But it does not.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Gourmet said in Finally I have camera problem...:

          But what was against implement QCameraViewfinder using VideoOutput for Android?

          What do you mean? One is a C++ widget the other QML component - completely different technologies. Qt Widgets are not that well suited for mobile applications, that's probably why QCameraViewfinder is not supported on Android. You should really consider to use QML for mobile applications.

          Also leaving this thread open because you want QCameraViewfinder to support Android will not help - this forum is for Qt users not Qt developers. You should file a change request in Qt bug tracker instead.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M G 2 Replies Last reply
          0
          • jsulmJ jsulm

            @Gourmet said in Finally I have camera problem...:

            But what was against implement QCameraViewfinder using VideoOutput for Android?

            What do you mean? One is a C++ widget the other QML component - completely different technologies. Qt Widgets are not that well suited for mobile applications, that's probably why QCameraViewfinder is not supported on Android. You should really consider to use QML for mobile applications.

            Also leaving this thread open because you want QCameraViewfinder to support Android will not help - this forum is for Qt users not Qt developers. You should file a change request in Qt bug tracker instead.

            M Offline
            M Offline
            mvuori
            wrote on last edited by
            #5

            Bad advice. Camera and viewfinder can be made to work very well in Android and this site has many discussions about how it's done.

            1 Reply Last reply
            0
            • jsulmJ jsulm

              @Gourmet said in Finally I have camera problem...:

              But what was against implement QCameraViewfinder using VideoOutput for Android?

              What do you mean? One is a C++ widget the other QML component - completely different technologies. Qt Widgets are not that well suited for mobile applications, that's probably why QCameraViewfinder is not supported on Android. You should really consider to use QML for mobile applications.

              Also leaving this thread open because you want QCameraViewfinder to support Android will not help - this forum is for Qt users not Qt developers. You should file a change request in Qt bug tracker instead.

              G Offline
              G Offline
              Gourmet
              wrote on last edited by Gourmet
              #6

              @jsulm said in Finally I have camera problem...:

              What do you mean?

              That was small mistake. I meant QOpenGLWidget but wrote about QML component.

              You should file a change request in Qt bug tracker instead.

              I have created QTBUG-80341 - immediately it have got level P2: Important. This gives hope for solution. And for same mark here. Now it's absence shows to Qt users - the problem persists yet.

              1 Reply Last reply
              1

              • Login

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