Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Unable to run QT Camera Example on Qt 5.9.1



  • 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


  • Lifetime Qt Champion

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


  • Moderators

    @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.


  • Lifetime Qt Champion

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



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


  • Lifetime Qt Champion

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



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


  • Moderators

    @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.



  • @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();
    }



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



  • @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.



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


  • Moderators

    @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



  • @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().


  • Moderators

    @mranger90
    Well the Code the op posted is defenitely modified

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



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



  • @J.Hilk nope doesn't work.


Log in to reply