Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to run QT Camera Example on Qt 5.9.1
Qt 6.12 LTS is out! See what's new in the release blog

Unable to run QT Camera Example on Qt 5.9.1

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 4 Posters 5.9k 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.
  • H hrithik singh

    I am trying to run the camera example provided by Qt and it keeps throwing an error in debug mode " write access violation" (ref. screen shot).0_1545201691350_image.png

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

    @hrithik-singh You should build it in debug mode, then you should see more than assembly when it crashes...

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

    J.HilkJ 1 Reply Last reply
    0
    • jsulmJ jsulm

      @hrithik-singh You should build it in debug mode, then you should see more than assembly when it crashes...

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #3

      @jsulm I think this is the debugger already, see the play icon on the left side.

      @hrithik-singh click on the level 6 entry I believe thats the camera.cpp class that's called there, should give more info, where the error originates from.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      jsulmJ H 2 Replies Last reply
      0
      • J.HilkJ J.Hilk

        @jsulm I think this is the debugger already, see the play icon on the left side.

        @hrithik-singh click on the level 6 entry I believe thats the camera.cpp class that's called there, should give more info, where the error originates from.

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

        @J.Hilk Yes, but the build is a release build

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

        H 1 Reply Last reply
        1
        • jsulmJ jsulm

          @J.Hilk Yes, but the build is a release build

          H Offline
          H Offline
          hrithik singh
          wrote on last edited by
          #5

          @jsulm yes i changed it to release build still shows me the 0_1545213380417_46f3ae6b-9c08-4bdc-ac38-08e8567caf32-image.png same

          jsulmJ 1 Reply Last reply
          0
          • H hrithik singh

            @jsulm yes i changed it to release build still shows me the 0_1545213380417_46f3ae6b-9c08-4bdc-ac38-08e8567caf32-image.png same

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

            @hrithik-singh Can you show the whole method body above line 182?

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

            H 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @jsulm I think this is the debugger already, see the play icon on the left side.

              @hrithik-singh click on the level 6 entry I believe thats the camera.cpp class that's called there, should give more info, where the error originates from.

              H Offline
              H Offline
              hrithik singh
              wrote on last edited by
              #7

              @J.Hilk when i click on level 6 it takes me to this loadCamerq session part of ca0_1545213661002_e8644048-ca4e-4808-8038-4bbbb66080ca-image.png mera.cpp

              J.HilkJ 1 Reply Last reply
              0
              • H hrithik singh

                @J.Hilk when i click on level 6 it takes me to this loadCamerq session part of ca0_1545213661002_e8644048-ca4e-4808-8038-4bbbb66080ca-image.png mera.cpp

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #8

                @hrithik-singh
                thats a different log file now. Now its level 7 qcamera.cpp, but thats still to deep, thats part of the Qt-lib. You need to go further back, untill the file name fits one of those in the project.


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                H 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @hrithik-singh Can you show the whole method body above line 182?

                  H Offline
                  H Offline
                  hrithik singh
                  wrote on last edited by
                  #9

                  @jsulm this is the method i have just removed all the qinfo lines that I added. then rerun the build; got the same error.
                  void Camera::setCamera(const QCameraInfo &cameraInfo)
                  {
                  delete imageCapture;
                  delete mediaRecorder;
                  delete camera;
                  camera = new QCamera(cameraInfo);
                  connect(camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(updateCameraState(QCamera::State)));
                  connect(camera, SIGNAL(error(QCamera::Error)), this, SLOT(displayCameraError()));
                  mediaRecorder = new QMediaRecorder(camera);
                  connect(mediaRecorder, SIGNAL(stateChanged(QMediaRecorder::State)), this, SLOT(updateRecorderState(QMediaRecorder::State)));
                  imageCapture = new QCameraImageCapture(camera);
                  connect(mediaRecorder, SIGNAL(durationChanged(qint64)), this, SLOT(updateRecordTime()));
                  connect(mediaRecorder, SIGNAL(error(QMediaRecorder::Error)), this, SLOT(displayRecorderError()));
                  mediaRecorder->setMetaData(QMediaMetaData::Title, QVariant(QLatin1String("Test Title")));
                  connect(ui->exposureCompensation, SIGNAL(valueChanged(int)), SLOT(setExposureCompensation(int)));
                  camera->setViewfinder(ui->viewfinder);
                  updateCameraState(camera->state());
                  updateLockStatus(camera->lockStatus(), QCamera::UserRequest);
                  updateRecorderState(mediaRecorder->state());
                  connect(imageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(readyForCapture(bool)));
                  connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(processCapturedImage(int,QImage)));
                  connect(imageCapture, SIGNAL(imageSaved(int,QString)), this, SLOT(imageSaved(int,QString)));
                  connect(imageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this,
                  SLOT(displayCaptureError(int,QCameraImageCapture::Error,QString)));
                  connect(camera, SIGNAL(lockStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)),
                  this, SLOT(updateLockStatus(QCamera::LockStatus,QCamera::LockChangeReason)));
                  ui->captureWidget->setTabEnabled(0, (camera->isCaptureModeSupported(QCamera::CaptureStillImage)));
                  ui->captureWidget->setTabEnabled(1, (camera->isCaptureModeSupported(QCamera::CaptureVideo)));
                  updateCaptureMode();
                  camera->start();
                  }

                  1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @hrithik-singh
                    thats a different log file now. Now its level 7 qcamera.cpp, but thats still to deep, thats part of the Qt-lib. You need to go further back, untill the file name fits one of those in the project.

                    H Offline
                    H Offline
                    hrithik singh
                    wrote on last edited by
                    #10

                    @J-Hilk when i traverse down it goes to camera.cpp and camera-start for I posted the complete method above

                    1 Reply Last reply
                    0
                    • mranger90M Offline
                      mranger90M Offline
                      mranger90
                      wrote on last edited by
                      #11

                      @hrithik-singh said in Unable to run QT Camera Example on Qt 5.9.1:

                      imageCapture

                      Looking at the code above the one thing I'd try is make sure that camerInfo.isNull() is not true. Or you can try to construct the camera with QCameraInfo::defaultCamera().
                      Hard to say because we dont know where cameraInfo comes from.
                      If that camera pointer is not valid, then all bets are off and its certain that a crash will happen further in the code.

                      H 1 Reply Last reply
                      0
                      • mranger90M mranger90

                        @hrithik-singh said in Unable to run QT Camera Example on Qt 5.9.1:

                        imageCapture

                        Looking at the code above the one thing I'd try is make sure that camerInfo.isNull() is not true. Or you can try to construct the camera with QCameraInfo::defaultCamera().
                        Hard to say because we dont know where cameraInfo comes from.
                        If that camera pointer is not valid, then all bets are off and its certain that a crash will happen further in the code.

                        H Offline
                        H Offline
                        hrithik singh
                        wrote on last edited by
                        #12

                        @mranger90
                        we are using this hybrid machine
                        Below is the spec

                        http://www.wortmann.asia/data/album/file/1530168638752052316.pdf

                        camera settings:

                        Hi

                        Video Capture Devices
                        Number of Devices: 2

                               FriendlyName: User Facing Right
                                   Category: Camera
                               SymbolicLink: \\?\display#int3470#4&5dbfe47&0&uid13424#{e5323777-f976-4f5b-9b55-b94699c46e44}\{089f8e59-ffe6-4494-97e5-92273c08f2f1}
                                   Location: Front
                                   Rotation: 0
                               Manufacturer: Intel Corporation
                                 HardwareID: VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02&INT3470,VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&INT3470,VIDEO\VEN_8086&DEV_591E&INT3470,VIDEO\INT3470
                                 DriverDesc: Intel(R) AVStream Camera 2500
                             DriverProvider: Intel
                              DriverVersion: 30.14393.9656.3064
                          DriverDateEnglish: 9/23/2016 00:00:00
                        DriverDateLocalized: 23/09/2016 00:00:00
                                    Service: iacamera64
                                      Class: MEDIA
                              DevNodeStatus: 180200A[DN_DRIVER_LOADED|DN_STARTED|DN_DISABLEABLE|DN_NT_ENUMERATOR|DN_NT_DRIVER]
                                ContainerId: {00000000-0000-0000-FFFF-FFFFFFFFFFFF}
                                ProblemCode: No Problem
                        

                        BusReportedDeviceDesc: ISP Camera Device
                        Parent: PCI\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02\3&11583659&1&10
                        DriverProblemDesc: n/a
                        UpperFilters: n/a
                        LowerFilters: n/a
                        Stack: \Driver\ksthunk,\Driver\iacamera64,\Driver\igfx
                        ContainerCategory: n/a
                        SensorGroupID: n/a
                        MFT0: {5CDB3151-134C-4622-8E44-FAA9158D2F4C}
                        DMFT: n/a
                        DependentStillCapture: n/a
                        EnablePlatformDMFT: n/a
                        DMFTChain: n/a
                        EnableDshowRedirection: n/a
                        FrameServerEnabled: False

                               FriendlyName: World Facing Right
                                   Category: Camera
                               SymbolicLink: \\?\display#int3470#4&5dbfe47&0&uid13424#{e5323777-f976-4f5b-9b55-b94699c46e44}\{ce46c6bb-90df-4932-8ec1-add1804961a1}
                                   Location: Back
                                   Rotation: 0
                               Manufacturer: Intel Corporation
                                 HardwareID: VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02&INT3470,VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&INT3470,VIDEO\VEN_8086&DEV_591E&INT3470,VIDEO\INT3470
                                 DriverDesc: Intel(R) AVStream Camera 2500
                             DriverProvider: Intel
                              DriverVersion: 30.14393.9656.3064
                          DriverDateEnglish: 9/23/2016 00:00:00
                        DriverDateLocalized: 23/09/2016 00:00:00
                                    Service: iacamera64
                                      Class: MEDIA
                              DevNodeStatus: 180200A[DN_DRIVER_LOADED|DN_STARTED|DN_DISABLEABLE|DN_NT_ENUMERATOR|DN_NT_DRIVER]
                                ContainerId: {00000000-0000-0000-FFFF-FFFFFFFFFFFF}
                                ProblemCode: No Problem
                        

                        BusReportedDeviceDesc: ISP Camera Device
                        Parent: PCI\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02\3&11583659&1&10
                        DriverProblemDesc: n/a
                        UpperFilters: n/a
                        LowerFilters: n/a
                        Stack: \Driver\ksthunk,\Driver\iacamera64,\Driver\igfx
                        ContainerCategory: n/a
                        SensorGroupID: n/a
                        MFT0: {5CDB3151-134C-4622-8E44-FAA9158D2F4C}
                        DMFT: n/a
                        DependentStillCapture: n/a
                        EnablePlatformDMFT: n/a
                        DMFTChain: n/a
                        EnableDshowRedirection: n/a
                        FrameServerEnabled: False

                        J.HilkJ 1 Reply Last reply
                        0
                        • H hrithik singh

                          @mranger90
                          we are using this hybrid machine
                          Below is the spec

                          http://www.wortmann.asia/data/album/file/1530168638752052316.pdf

                          camera settings:

                          Hi

                          Video Capture Devices
                          Number of Devices: 2

                                 FriendlyName: User Facing Right
                                     Category: Camera
                                 SymbolicLink: \\?\display#int3470#4&5dbfe47&0&uid13424#{e5323777-f976-4f5b-9b55-b94699c46e44}\{089f8e59-ffe6-4494-97e5-92273c08f2f1}
                                     Location: Front
                                     Rotation: 0
                                 Manufacturer: Intel Corporation
                                   HardwareID: VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02&INT3470,VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&INT3470,VIDEO\VEN_8086&DEV_591E&INT3470,VIDEO\INT3470
                                   DriverDesc: Intel(R) AVStream Camera 2500
                               DriverProvider: Intel
                                DriverVersion: 30.14393.9656.3064
                            DriverDateEnglish: 9/23/2016 00:00:00
                          DriverDateLocalized: 23/09/2016 00:00:00
                                      Service: iacamera64
                                        Class: MEDIA
                                DevNodeStatus: 180200A[DN_DRIVER_LOADED|DN_STARTED|DN_DISABLEABLE|DN_NT_ENUMERATOR|DN_NT_DRIVER]
                                  ContainerId: {00000000-0000-0000-FFFF-FFFFFFFFFFFF}
                                  ProblemCode: No Problem
                          

                          BusReportedDeviceDesc: ISP Camera Device
                          Parent: PCI\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02\3&11583659&1&10
                          DriverProblemDesc: n/a
                          UpperFilters: n/a
                          LowerFilters: n/a
                          Stack: \Driver\ksthunk,\Driver\iacamera64,\Driver\igfx
                          ContainerCategory: n/a
                          SensorGroupID: n/a
                          MFT0: {5CDB3151-134C-4622-8E44-FAA9158D2F4C}
                          DMFT: n/a
                          DependentStillCapture: n/a
                          EnablePlatformDMFT: n/a
                          DMFTChain: n/a
                          EnableDshowRedirection: n/a
                          FrameServerEnabled: False

                                 FriendlyName: World Facing Right
                                     Category: Camera
                                 SymbolicLink: \\?\display#int3470#4&5dbfe47&0&uid13424#{e5323777-f976-4f5b-9b55-b94699c46e44}\{ce46c6bb-90df-4932-8ec1-add1804961a1}
                                     Location: Back
                                     Rotation: 0
                                 Manufacturer: Intel Corporation
                                   HardwareID: VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02&INT3470,VIDEO\VEN_8086&DEV_591E&SUBSYS_224317AA&INT3470,VIDEO\VEN_8086&DEV_591E&INT3470,VIDEO\INT3470
                                   DriverDesc: Intel(R) AVStream Camera 2500
                               DriverProvider: Intel
                                DriverVersion: 30.14393.9656.3064
                            DriverDateEnglish: 9/23/2016 00:00:00
                          DriverDateLocalized: 23/09/2016 00:00:00
                                      Service: iacamera64
                                        Class: MEDIA
                                DevNodeStatus: 180200A[DN_DRIVER_LOADED|DN_STARTED|DN_DISABLEABLE|DN_NT_ENUMERATOR|DN_NT_DRIVER]
                                  ContainerId: {00000000-0000-0000-FFFF-FFFFFFFFFFFF}
                                  ProblemCode: No Problem
                          

                          BusReportedDeviceDesc: ISP Camera Device
                          Parent: PCI\VEN_8086&DEV_591E&SUBSYS_224317AA&REV_02\3&11583659&1&10
                          DriverProblemDesc: n/a
                          UpperFilters: n/a
                          LowerFilters: n/a
                          Stack: \Driver\ksthunk,\Driver\iacamera64,\Driver\igfx
                          ContainerCategory: n/a
                          SensorGroupID: n/a
                          MFT0: {5CDB3151-134C-4622-8E44-FAA9158D2F4C}
                          DMFT: n/a
                          DependentStillCapture: n/a
                          EnablePlatformDMFT: n/a
                          DMFTChain: n/a
                          EnableDshowRedirection: n/a
                          FrameServerEnabled: False

                          J.HilkJ Offline
                          J.HilkJ Offline
                          J.Hilk
                          Moderators
                          wrote on last edited by
                          #13

                          @hrithik-singh
                          mmh, simple question first. Does the normal Qt-Camera example work fine for you ?

                          https://doc.qt.io/qt-5.11/qtmultimedia-multimediawidgets-camera-example.html


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          mranger90M H 2 Replies Last reply
                          0
                          • J.HilkJ J.Hilk

                            @hrithik-singh
                            mmh, simple question first. Does the normal Qt-Camera example work fine for you ?

                            https://doc.qt.io/qt-5.11/qtmultimedia-multimediawidgets-camera-example.html

                            mranger90M Offline
                            mranger90M Offline
                            mranger90
                            wrote on last edited by
                            #14

                            @J.Hilk I thought the OP was working with the multimediawidget camera example.
                            @hrithik singh What I would do next is put a breakpoint (or debug statements) in the
                            Camera::Camera : ui(new Ui::Camera) method.
                            Take a look at the list of available cameras and see what is being found.
                            You can also look at the description of the QCameraInfo::defaultCamera().

                            J.HilkJ H 2 Replies Last reply
                            0
                            • mranger90M mranger90

                              @J.Hilk I thought the OP was working with the multimediawidget camera example.
                              @hrithik singh What I would do next is put a breakpoint (or debug statements) in the
                              Camera::Camera : ui(new Ui::Camera) method.
                              Take a look at the list of available cameras and see what is being found.
                              You can also look at the description of the QCameraInfo::defaultCamera().

                              J.HilkJ Offline
                              J.HilkJ Offline
                              J.Hilk
                              Moderators
                              wrote on last edited by J.Hilk
                              #15

                              @mranger90
                              Well the Code the op posted is defenitely modified

                              Thats why I suggested the default exmaple, to see if at least that works


                              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                              Q: What's that?
                              A: It's blue light.
                              Q: What does it do?
                              A: It turns blue.

                              1 Reply Last reply
                              1
                              • mranger90M mranger90

                                @J.Hilk I thought the OP was working with the multimediawidget camera example.
                                @hrithik singh What I would do next is put a breakpoint (or debug statements) in the
                                Camera::Camera : ui(new Ui::Camera) method.
                                Take a look at the list of available cameras and see what is being found.
                                You can also look at the description of the QCameraInfo::defaultCamera().

                                H Offline
                                H Offline
                                hrithik singh
                                wrote on last edited by
                                #16

                                @mranger90
                                start() method throws access violation, I can get the camera information

                                1 Reply Last reply
                                0
                                • J.HilkJ J.Hilk

                                  @hrithik-singh
                                  mmh, simple question first. Does the normal Qt-Camera example work fine for you ?

                                  https://doc.qt.io/qt-5.11/qtmultimedia-multimediawidgets-camera-example.html

                                  H Offline
                                  H Offline
                                  hrithik singh
                                  wrote on last edited by
                                  #17

                                  @J.Hilk nope doesn't work.

                                  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
                                  • Unsolved