Results 1 to 3 of 3

Thread: why is QCameraImageCapture always not ready windows 7?

  1. #1
    Join Date
    Sep 2011
    Posts
    30
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question why is QCameraImageCapture always not ready windows 7?

    When I use QCamera and QCameraImageCapture to take image, I can get the picture in Camera's viewfinder, but can't take image due to QCameraImageCapture's isReadyForCapture always return false. Please see my code pice:
    ......
    QList<QByteArray> cameraDevice = QCamera::availableDevices();
    camera = new QCamera(cameraDevice[1]);
    camera->setCaptureMode(QCamera::CaptureStillImage);
    camera->setViewfinder(imageCap);
    camera->start();

    imageCapture = new QCameraImageCapture(camera);
    imageCapture->setCaptureDestination(QCameraImageCapture::Captur eToBuffer);
    ......
    if (!imageCapture->isAvailable())
    {
    qDebug() << "QCameraImageCapture isn't available!";
    return;
    }

    camera->searchAndLock();
    if (camera->state() == QCamera::ActiveState)
    {
    if (imageCapture->isReadyForCapture())
    {
    imageCapture->capture();
    testLog->append(tr("image captured!"));
    }
    else
    {
    s = tr("QCameraImageCapture is ") + imageCapture->errorString();
    testLog->append(s);
    }
    }
    else testLog->append(tr("Camera isn't at ActiveState!"));

    camera->unlock();
    ........

    The code worked well in OSX, but can't work in window7.
    Any one can help? thanks

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: why is QCameraImageCapture always not ready windows 7?

    camera = new QCamera(cameraDevice[1]);
    Do you want the first camera? That will be this one:

    Qt Code:
    1. camera = new QCamera(cameraDevice[0]);
    To copy to clipboard, switch view to plain text mode 

    Do you have more than one camera on your PC? The QCamera instance you are creating using cameraDevice[1] is probably invalid, which is why it is never ready for capture.

  3. #3
    Join Date
    Sep 2011
    Posts
    30
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: why is QCameraImageCapture always not ready windows 7?

    I tried your suggestion but it is worse than cameraDevice[1] due to viewfinder became black. When use cameraDevice[1], viewfinder can output monitor video.

Similar Threads

  1. QQmlComponent: Component is not ready
    By nuliknol in forum Newbie
    Replies: 1
    Last Post: 10th April 2014, 10:23
  2. Qt Creator - Librarries - Ready for ANSI C ?!
    By kosasker in forum Newbie
    Replies: 5
    Last Post: 20th August 2011, 23:43
  3. Ready to use QML elements
    By .:saeed:. in forum Qt Quick
    Replies: 0
    Last Post: 22nd February 2011, 16:25
  4. Replies: 5
    Last Post: 16th November 2010, 21:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.