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

A camera problem.

Scheduled Pinned Locked Moved Unsolved General and Desktop
91 Posts 7 Posters 18.9k 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.
  • J jenya7

    @jsulm said in A camera problem.:

    @jenya7 I think you will also need to install GStreamer plug-ins. On Linux Qt uses GStreamer for multimedia.

    when I run
    dpkg -l | grep gstreamer
    I see gstreamer installed.

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

    @jenya7 said in A camera problem.:

    I see gstreamer installed

    What exactly is installed? There are many GStreamer plug-ins which may be needed.

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

    J 1 Reply Last reply
    0
    • jsulmJ jsulm

      @jenya7 said in A camera problem.:

      I see gstreamer installed

      What exactly is installed? There are many GStreamer plug-ins which may be needed.

      J Offline
      J Offline
      jenya7
      wrote on last edited by
      #10

      @jsulm said in A camera problem.:

      @jenya7 said in A camera problem.:

      I see gstreamer installed

      What exactly is installed? There are many GStreamer plug-ins which may be needed.

      this is the list

      ii  gstreamer1.0-alsa:armhf               1.14.4-2+deb10u1                        armhf        GStreamer plugin for ALSA
      ii  gstreamer1.0-gtk3:armhf               1.14.4-1+rpt1+deb10u1                   armhf        GStreamer plugin for GTK+3
      ii  gstreamer1.0-libav:armhf              1.15.0.1+git20180723+db823502-2+deb10u1 armhf        libav plugin for GStreamer
      ii  gstreamer1.0-omx                      1.14.4-1+rpt1                           armhf        GStreamer OpenMAX plugins
      ii  gstreamer1.0-omx-rpi                  1.14.4-1+rpt1                           armhf        OpenMax plugins for GStreamer
      ii  gstreamer1.0-omx-rpi-config           1.14.4-1+rpt1                           armhf        OpenMax plugins for GStreamer
      ii  gstreamer1.0-plugins-bad:armhf        1.14.4-1+rvt+deb10u2                    armhf        GStreamer plugins from the "bad" set
      ii  gstreamer1.0-plugins-base:armhf       1.14.4-2+deb10u1                        armhf        GStreamer plugins from the "base" set
      ii  gstreamer1.0-plugins-good:armhf       1.14.4-1+rpt1+deb10u1                   armhf        GStreamer plugins from the "good" set
      ii  gstreamer1.0-x:armhf                  1.14.4-2+deb10u1                        armhf        GStreamer plugins for X11 and Pango
      ii  libgstreamer-gl1.0-0:armhf            1.14.4-2+deb10u1                        armhf        GStreamer GL libraries
      ii  libgstreamer-plugins-bad1.0-0:armhf   1.14.4-1+rvt+deb10u2                    armhf        GStreamer libraries from the "bad" set
      ii  libgstreamer-plugins-base1.0-0:armhf  1.14.4-2+deb10u1                        armhf        GStreamer libraries from the "base" set
      ii  libgstreamer1.0-0:armhf               1.14.4-1                                armhf        Core GStreamer libraries and elements
      ii  libreoffice-avmedia-backend-gstreamer 1:6.1.5-3+rpi1+deb10u7+rpt1             armhf        GStreamer backend for LibreOffice
      
      

      I really don't know if it's a complete list or a right version.

      jsulmJ 1 Reply Last reply
      0
      • J jenya7

        @jsulm said in A camera problem.:

        @jenya7 said in A camera problem.:

        I see gstreamer installed

        What exactly is installed? There are many GStreamer plug-ins which may be needed.

        this is the list

        ii  gstreamer1.0-alsa:armhf               1.14.4-2+deb10u1                        armhf        GStreamer plugin for ALSA
        ii  gstreamer1.0-gtk3:armhf               1.14.4-1+rpt1+deb10u1                   armhf        GStreamer plugin for GTK+3
        ii  gstreamer1.0-libav:armhf              1.15.0.1+git20180723+db823502-2+deb10u1 armhf        libav plugin for GStreamer
        ii  gstreamer1.0-omx                      1.14.4-1+rpt1                           armhf        GStreamer OpenMAX plugins
        ii  gstreamer1.0-omx-rpi                  1.14.4-1+rpt1                           armhf        OpenMax plugins for GStreamer
        ii  gstreamer1.0-omx-rpi-config           1.14.4-1+rpt1                           armhf        OpenMax plugins for GStreamer
        ii  gstreamer1.0-plugins-bad:armhf        1.14.4-1+rvt+deb10u2                    armhf        GStreamer plugins from the "bad" set
        ii  gstreamer1.0-plugins-base:armhf       1.14.4-2+deb10u1                        armhf        GStreamer plugins from the "base" set
        ii  gstreamer1.0-plugins-good:armhf       1.14.4-1+rpt1+deb10u1                   armhf        GStreamer plugins from the "good" set
        ii  gstreamer1.0-x:armhf                  1.14.4-2+deb10u1                        armhf        GStreamer plugins for X11 and Pango
        ii  libgstreamer-gl1.0-0:armhf            1.14.4-2+deb10u1                        armhf        GStreamer GL libraries
        ii  libgstreamer-plugins-bad1.0-0:armhf   1.14.4-1+rvt+deb10u2                    armhf        GStreamer libraries from the "bad" set
        ii  libgstreamer-plugins-base1.0-0:armhf  1.14.4-2+deb10u1                        armhf        GStreamer libraries from the "base" set
        ii  libgstreamer1.0-0:armhf               1.14.4-1                                armhf        Core GStreamer libraries and elements
        ii  libreoffice-avmedia-backend-gstreamer 1:6.1.5-3+rpi1+deb10u7+rpt1             armhf        GStreamer backend for LibreOffice
        
        

        I really don't know if it's a complete list or a right version.

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

        @jenya7 said in A camera problem.:

        or a right version

        That depends on the Qt version you're using.
        Try to also install gstreamer1.0-plugins-ugly, but I don't know whether this will help.

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

        J 1 Reply Last reply
        1
        • jsulmJ jsulm

          @jenya7 said in A camera problem.:

          or a right version

          That depends on the Qt version you're using.
          Try to also install gstreamer1.0-plugins-ugly, but I don't know whether this will help.

          J Offline
          J Offline
          jenya7
          wrote on last edited by jenya7
          #12

          @jsulm said in A camera problem.:

          @jenya7 said in A camera problem.:

          or a right version

          That depends on the Qt version you're using.
          Try to also install gstreamer1.0-plugins-ugly, but I don't know whether this will help.

          I found it out! It's not enough to install library
          sudo apt-get install qtmultimedia5-dev
          One should add plugins also
          sudo apt-get install libqt5multimedia5-plugins

          Now it founds the camera. But how do I refer to it later on? There are no fields like name or id or something
          at least on debug level

          availableCameras	<1 items>	QList<QCameraInfo>
              [0]	@0x1027c8	QCameraInfo
                  d	@0x1027c8	QSharedPointer<QCameraInfoPrivate>
          			data	@0x10cd88	QCameraInfoPrivate
          			weakref	2	int
          			strongref	2	int
          	availableCameras@1	<optimized out>	
          	cameraInfo	@0x1027c8	QCameraInfo &
          		d	@0x1027c8	QSharedPointer<QCameraInfoPrivate>
          			data	@0x10cd88	QCameraInfoPrivate
          			weakref	2	int
          			strongref	2	int
          	cameraInfo@1	@0x1027c8	QCameraInfo &
          		d	@0x1027c8	QSharedPointer<QCameraInfoPrivate>
          			data	@0x10cd88	QCameraInfoPrivate
          			weakref	2	int
          			strongref	2	int
          
          QCameraInfo::defaultCamera()		QCameraInfo
          		d		QSharedPointer<QCameraInfoPrivate>
          			data	@0x111438	QCameraInfoPrivate
          			weakref	1	int
          			strongref	1	int
          
          jsulmJ 1 Reply Last reply
          0
          • J jenya7

            @jsulm said in A camera problem.:

            @jenya7 said in A camera problem.:

            or a right version

            That depends on the Qt version you're using.
            Try to also install gstreamer1.0-plugins-ugly, but I don't know whether this will help.

            I found it out! It's not enough to install library
            sudo apt-get install qtmultimedia5-dev
            One should add plugins also
            sudo apt-get install libqt5multimedia5-plugins

            Now it founds the camera. But how do I refer to it later on? There are no fields like name or id or something
            at least on debug level

            availableCameras	<1 items>	QList<QCameraInfo>
                [0]	@0x1027c8	QCameraInfo
                    d	@0x1027c8	QSharedPointer<QCameraInfoPrivate>
            			data	@0x10cd88	QCameraInfoPrivate
            			weakref	2	int
            			strongref	2	int
            	availableCameras@1	<optimized out>	
            	cameraInfo	@0x1027c8	QCameraInfo &
            		d	@0x1027c8	QSharedPointer<QCameraInfoPrivate>
            			data	@0x10cd88	QCameraInfoPrivate
            			weakref	2	int
            			strongref	2	int
            	cameraInfo@1	@0x1027c8	QCameraInfo &
            		d	@0x1027c8	QSharedPointer<QCameraInfoPrivate>
            			data	@0x10cd88	QCameraInfoPrivate
            			weakref	2	int
            			strongref	2	int
            
            QCameraInfo::defaultCamera()		QCameraInfo
            		d		QSharedPointer<QCameraInfoPrivate>
            			data	@0x111438	QCameraInfoPrivate
            			weakref	1	int
            			strongref	1	int
            
            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #13

            @jenya7 said in A camera problem.:

            There are no fields like name or id or something

            There is: https://doc.qt.io/qt-5/qcamerainfo.html#deviceName

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

            J 1 Reply Last reply
            0
            • jsulmJ jsulm

              @jenya7 said in A camera problem.:

              There are no fields like name or id or something

              There is: https://doc.qt.io/qt-5/qcamerainfo.html#deviceName

              J Offline
              J Offline
              jenya7
              wrote on last edited by
              #14

              @jsulm said in A camera problem.:

              @jenya7 said in A camera problem.:

              There are no fields like name or id or something

              There is: https://doc.qt.io/qt-5/qcamerainfo.html#deviceName

              I see. Thank you. I'll try to get it going.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jenya7
                wrote on last edited by
                #15

                something eluding me
                To take a shot

                void Camera::takeImage()
                

                Then on

                connect(m_imageCapture.data(), &QCameraImageCapture::imageCaptured, this, &Camera::processCapturedImage);
                
                void Camera::processCapturedImage(int requestId, const QImage& img)
                {
                    Q_UNUSED(requestId);
                    QImage scaledImage = 100, 100,
                                                    Qt::KeepAspectRatio,
                                                    Qt::SmoothTransformation);
                
                    ui->lastImagePreviewLabel->setPixmap(QPixmap::fromImage(scaledImage));
                
                    // Display captured image for 4 seconds.
                    displayCapturedImage();
                    QTimer::singleShot(4000, this, &Camera::displayViewfinder);
                }
                

                But where the image actually stored?

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

                  Hi,

                  Unless you configure the capture to capture to file, its just going to be in the buffer. You can still save it yourself though.

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

                  J 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Hi,

                    Unless you configure the capture to capture to file, its just going to be in the buffer. You can still save it yourself though.

                    J Offline
                    J Offline
                    jenya7
                    wrote on last edited by jenya7
                    #17

                    @SGaist said in A camera problem.:

                    Hi,

                    Unless you configure the capture to capture to file, its just going to be in the buffer. You can still save it yourself though.

                    How do I do that? I see m_imageCapture but no property or method to set a path to a file.
                    And where the buffer located?

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

                      The buffer just means it's in memory. You'll get a frame to process and then it's up to you to save it.

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

                      J 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        The buffer just means it's in memory. You'll get a frame to process and then it's up to you to save it.

                        J Offline
                        J Offline
                        jenya7
                        wrote on last edited by
                        #19

                        @SGaist said in A camera problem.:

                        The buffer just means it's in memory. You'll get a frame to process and then it's up to you to save it.

                        After

                        g_camera.SetCaptureMode(QCamera::CaptureMode::CaptureStillImage);
                        g_camera.takeImage();
                        

                        Nothing happens. I didn't get to

                        void Camera::processCapturedImage(int requestId, const QImage& img)
                        

                        or

                        void Camera::imageSaved(int id, const QString &fileName)
                        

                        How do I know where is the image (if it was taken at all)?

                        jsulmJ 1 Reply Last reply
                        0
                        • J jenya7

                          @SGaist said in A camera problem.:

                          The buffer just means it's in memory. You'll get a frame to process and then it's up to you to save it.

                          After

                          g_camera.SetCaptureMode(QCamera::CaptureMode::CaptureStillImage);
                          g_camera.takeImage();
                          

                          Nothing happens. I didn't get to

                          void Camera::processCapturedImage(int requestId, const QImage& img)
                          

                          or

                          void Camera::imageSaved(int id, const QString &fileName)
                          

                          How do I know where is the image (if it was taken at all)?

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

                          @jenya7 Did you connect a slot to https://doc.qt.io/qt-5/qcamera.html#errorOccurred to see whether you get any errors? Same for https://doc.qt.io/qt-5/qcameraimagecapture.html#error-1
                          You can get the cptured image using this signal: https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable

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

                          J 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @jenya7 Did you connect a slot to https://doc.qt.io/qt-5/qcamera.html#errorOccurred to see whether you get any errors? Same for https://doc.qt.io/qt-5/qcameraimagecapture.html#error-1
                            You can get the cptured image using this signal: https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable

                            J Offline
                            J Offline
                            jenya7
                            wrote on last edited by jenya7
                            #21

                            @jsulm said in A camera problem.:

                            @jenya7 Did you connect a slot to https://doc.qt.io/qt-5/qcamera.html#errorOccurred to see whether you get any errors? Same for https://doc.qt.io/qt-5/qcameraimagecapture.html#error-1
                            You can get the cptured image using this signal: https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable

                            this is what I have

                            connect(m_imageCapture.data(), &QCameraImageCapture::readyForCaptureChanged, this, &Camera::readyForCapture);
                            connect(m_imageCapture.data(), &QCameraImageCapture::imageCaptured, this, &Camera::processCapturedImage);
                            connect(m_imageCapture.data(), &QCameraImageCapture::imageSaved, this, &Camera::imageSaved);
                            connect(m_imageCapture.data(), QOverload<int, QCameraImageCapture::Error, const QString &>::of(&QCameraImageCapture::error),
                                        this, &Camera::displayCaptureError);
                            
                            jsulmJ 1 Reply Last reply
                            0
                            • J jenya7

                              @jsulm said in A camera problem.:

                              @jenya7 Did you connect a slot to https://doc.qt.io/qt-5/qcamera.html#errorOccurred to see whether you get any errors? Same for https://doc.qt.io/qt-5/qcameraimagecapture.html#error-1
                              You can get the cptured image using this signal: https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable

                              this is what I have

                              connect(m_imageCapture.data(), &QCameraImageCapture::readyForCaptureChanged, this, &Camera::readyForCapture);
                              connect(m_imageCapture.data(), &QCameraImageCapture::imageCaptured, this, &Camera::processCapturedImage);
                              connect(m_imageCapture.data(), &QCameraImageCapture::imageSaved, this, &Camera::imageSaved);
                              connect(m_imageCapture.data(), QOverload<int, QCameraImageCapture::Error, const QString &>::of(&QCameraImageCapture::error),
                                          this, &Camera::displayCaptureError);
                              
                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #22

                              @jenya7 So, what about trying https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable ?

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

                              J 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @jenya7 So, what about trying https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable ?

                                J Offline
                                J Offline
                                jenya7
                                wrote on last edited by jenya7
                                #23

                                @jsulm said in A camera problem.:

                                @jenya7 So, what about trying https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable ?

                                I did in Camera::setCamera

                                connect(m_imageCapture.data(), &QCameraImageCapture::imageAvailable, this, &Camera::ImageAvailable);
                                

                                and then

                                void Camera::ImageAvailable(int id, const QVideoFrame &frame)
                                {
                                     qDebug() <<  id;
                                     //qDebug() << frame->???;
                                }
                                

                                I also added

                                void Camera::displayCameraError()
                                {
                                    //QMessageBox::warning(this, tr("Camera Error"), m_camera->errorString());
                                    qDebug() << "Camera Error: " + m_camera->errorString() + "\n";
                                }
                                
                                void Camera::displayCaptureError(int id, const QCameraImageCapture::Error error, const QString &errorString)
                                {
                                    Q_UNUSED(id);
                                    Q_UNUSED(error);
                                    qDebug() << "Image Capture Error: " + errorString;
                                    m_isCapturingImage = false;
                                }
                                

                                and when I do

                                g_camera.SetCaptureMode(QCamera::CaptureMode::CaptureStillImage);
                                g_camera.takeImage();
                                

                                I get

                                "Image Capture Error: Camera not ready"
                                

                                How can I know a reason why the camera isn't ready?

                                jsulmJ 1 Reply Last reply
                                0
                                • J jenya7

                                  @jsulm said in A camera problem.:

                                  @jenya7 So, what about trying https://doc.qt.io/qt-5/qcameraimagecapture.html#imageAvailable ?

                                  I did in Camera::setCamera

                                  connect(m_imageCapture.data(), &QCameraImageCapture::imageAvailable, this, &Camera::ImageAvailable);
                                  

                                  and then

                                  void Camera::ImageAvailable(int id, const QVideoFrame &frame)
                                  {
                                       qDebug() <<  id;
                                       //qDebug() << frame->???;
                                  }
                                  

                                  I also added

                                  void Camera::displayCameraError()
                                  {
                                      //QMessageBox::warning(this, tr("Camera Error"), m_camera->errorString());
                                      qDebug() << "Camera Error: " + m_camera->errorString() + "\n";
                                  }
                                  
                                  void Camera::displayCaptureError(int id, const QCameraImageCapture::Error error, const QString &errorString)
                                  {
                                      Q_UNUSED(id);
                                      Q_UNUSED(error);
                                      qDebug() << "Image Capture Error: " + errorString;
                                      m_isCapturingImage = false;
                                  }
                                  

                                  and when I do

                                  g_camera.SetCaptureMode(QCamera::CaptureMode::CaptureStillImage);
                                  g_camera.takeImage();
                                  

                                  I get

                                  "Image Capture Error: Camera not ready"
                                  

                                  How can I know a reason why the camera isn't ready?

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

                                  @jenya7 Did you call

                                  camera->setCaptureMode(QCamera::CaptureStillImage);
                                  camera->start();
                                  //on half pressed shutter button
                                  camera->searchAndLock();
                                  
                                  //on shutter button pressed
                                  imageCapture->capture();
                                  

                                  like shown in https://doc.qt.io/qt-5/qcameraimagecapture.html ?

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

                                  J 1 Reply Last reply
                                  0
                                  • jsulmJ jsulm

                                    @jenya7 Did you call

                                    camera->setCaptureMode(QCamera::CaptureStillImage);
                                    camera->start();
                                    //on half pressed shutter button
                                    camera->searchAndLock();
                                    
                                    //on shutter button pressed
                                    imageCapture->capture();
                                    

                                    like shown in https://doc.qt.io/qt-5/qcameraimagecapture.html ?

                                    J Offline
                                    J Offline
                                    jenya7
                                    wrote on last edited by jenya7
                                    #25

                                    @jsulm said in A camera problem.:

                                    @jenya7 Did you call

                                    camera->setCaptureMode(QCamera::CaptureStillImage);
                                    camera->start();
                                    //on half pressed shutter button
                                    camera->searchAndLock();
                                    
                                    //on shutter button pressed
                                    imageCapture->capture();
                                    

                                    like shown in https://doc.qt.io/qt-5/qcameraimagecapture.html ?

                                    I thought

                                    void Camera::takeImage()
                                    {
                                        m_isCapturingImage = true;
                                        m_imageCapture->capture();
                                    }
                                    

                                    handles all this, kinda higher layer that wraps all together.
                                    and what is
                                    //on half pressed shutter button
                                    //on shutter button pressed
                                    I don't have any buttons. my app is not widget controlled. all commands issued from a command line.
                                    I took a widget camera example (from Examples) and removed all UI related staff.

                                    jsulmJ 1 Reply Last reply
                                    0
                                    • J jenya7

                                      @jsulm said in A camera problem.:

                                      @jenya7 Did you call

                                      camera->setCaptureMode(QCamera::CaptureStillImage);
                                      camera->start();
                                      //on half pressed shutter button
                                      camera->searchAndLock();
                                      
                                      //on shutter button pressed
                                      imageCapture->capture();
                                      

                                      like shown in https://doc.qt.io/qt-5/qcameraimagecapture.html ?

                                      I thought

                                      void Camera::takeImage()
                                      {
                                          m_isCapturingImage = true;
                                          m_imageCapture->capture();
                                      }
                                      

                                      handles all this, kinda higher layer that wraps all together.
                                      and what is
                                      //on half pressed shutter button
                                      //on shutter button pressed
                                      I don't have any buttons. my app is not widget controlled. all commands issued from a command line.
                                      I took a widget camera example (from Examples) and removed all UI related staff.

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

                                      @jenya7 said in A camera problem.:

                                      I don't have any buttons.

                                      These comments simply tell you that these methods simulate these buttons.
                                      So, yes you have to set the capture mode, start the camera, call searchAndLock and then capture.

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

                                      J 1 Reply Last reply
                                      0
                                      • jsulmJ jsulm

                                        @jenya7 said in A camera problem.:

                                        I don't have any buttons.

                                        These comments simply tell you that these methods simulate these buttons.
                                        So, yes you have to set the capture mode, start the camera, call searchAndLock and then capture.

                                        J Offline
                                        J Offline
                                        jenya7
                                        wrote on last edited by
                                        #27

                                        @jsulm said in A camera problem.:

                                        @jenya7 said in A camera problem.:

                                        I don't have any buttons.

                                        These comments simply tell you that these methods simulate these buttons.
                                        So, yes you have to set the capture mode, start the camera, call searchAndLock and then capture.

                                        I changed to

                                        void Camera::takeImage()
                                        {
                                            m_camera->start();
                                            m_camera->searchAndLock();
                                        
                                            m_isCapturingImage = true;
                                            m_imageCapture->capture();
                                        }
                                        

                                        I still have
                                        "Image Capture Error: Camera not ready"
                                        Do I need to set a Viewfinder?
                                        I commented out those lines

                                        //QCameraViewfinder *v_finder = new QCameraViewfinder();
                                        //v_finder->setFixedSize(240, 320);
                                        //v_finder->show();
                                        //v_finder->setAttribute(Qt::WA_NoSystemBackground);
                                        //m_camera->setViewfinder(v_finder);
                                        

                                        cause I get an exception on
                                        QCameraViewfinder *v_finder = new QCameraViewfinder();

                                        jsulmJ 1 Reply Last reply
                                        0
                                        • J jenya7

                                          @jsulm said in A camera problem.:

                                          @jenya7 said in A camera problem.:

                                          I don't have any buttons.

                                          These comments simply tell you that these methods simulate these buttons.
                                          So, yes you have to set the capture mode, start the camera, call searchAndLock and then capture.

                                          I changed to

                                          void Camera::takeImage()
                                          {
                                              m_camera->start();
                                              m_camera->searchAndLock();
                                          
                                              m_isCapturingImage = true;
                                              m_imageCapture->capture();
                                          }
                                          

                                          I still have
                                          "Image Capture Error: Camera not ready"
                                          Do I need to set a Viewfinder?
                                          I commented out those lines

                                          //QCameraViewfinder *v_finder = new QCameraViewfinder();
                                          //v_finder->setFixedSize(240, 320);
                                          //v_finder->show();
                                          //v_finder->setAttribute(Qt::WA_NoSystemBackground);
                                          //m_camera->setViewfinder(v_finder);
                                          

                                          cause I get an exception on
                                          QCameraViewfinder *v_finder = new QCameraViewfinder();

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

                                          @jenya7 For capturing images view finder should not be needed.
                                          But you could try to enable it to see whether your camera works at all in Qt.
                                          What exception do you get?

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

                                          J 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