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. QT Camera example
QtWS25 Last Chance

QT Camera example

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 2 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.
  • T Offline
    T Offline
    tech.hi
    wrote on last edited by tech.hi
    #1

    Hi,
    I am trying to use the qtcamera example application. It worked perfectly while i was using my USB camera. But i have another h/w connected camera which i want to use.
    When i looked at the devices only usb camera was detected and hw camera was not.

    What changes do you think i should make to make the h/w camera work?

    As of now i am using gstreamer commands,
    sudo gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! glimagesink
    Any help will be appreciated :)
    Thanks in advance

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

      Hi,

      What type of camera is that ?

      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

        I just remembered that if you use a more recent version of Qt, you can use custom gstreamer pipelines. See the corresponding Qt documentation.

        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
        • T Offline
          T Offline
          tech.hi
          wrote on last edited by
          #4

          @SGaist Hey thanks for answering.
          But i think I might need little more help here.

          So when i was going through the code i found the part which is searching for the camera device,
          ui->setupUi(this);

          //Camera devices:
          QByteArray cameraDevice;
          
          QActionGroup *videoDevicesGroup = new QActionGroup(this);
          videoDevicesGroup->setExclusive(true);
          foreach(const QByteArray &deviceName, QCamera::availableDevices()) {
              QString description = camera->deviceDescription(deviceName);
              QAction *videoDeviceAction = new QAction(description, videoDevicesGroup);
              videoDeviceAction->setCheckable(true);
              videoDeviceAction->setData(QVariant(deviceName));
              if (cameraDevice.isEmpty()) {
                  cameraDevice = deviceName;
                  videoDeviceAction->setChecked(true);
              }
              ui->menuDevices->addAction(videoDeviceAction);
          }
          
          connect(videoDevicesGroup, SIGNAL(triggered(QAction*)), SLOT(updateCameraDevice(QAction*)));
          connect(ui->captureWidget, SIGNAL(currentChanged(int)), SLOT(updateCaptureMode()));
          

          #ifdef HAVE_CAMERA_BUTTONS
          ui->lockButton->hide();
          #endif

          setCamera(cameraDevice);
          

          }

          So you are saying i should replace the above code with this command " sudo gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! glimagesink " ??
          Can you help me out to do this?

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

            No, see QMediaPlayer::setMedia.

            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
            1
            • T Offline
              T Offline
              tech.hi
              wrote on last edited by tech.hi
              #6

              @SGaist :
              So URL should be something like ,
              QUrl("gst-pipeline:v4l2src device=/dev/video1 ! 'video/x-raw,format=UYVY,width=1920,height=1080' ! glimagesink "); ?

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

                As shown in the documentation I linked, you need a video sink named qtvideosink.

                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

                • Login

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