Access original imagedata captured by Android QML camera



  • Hey,

    I am using a QML Camera object for capturing a image and a C++ class for processing the captured image. Until now the code looks like this:

    QML Camera object :

    Camera {
        id: camera
        captureMode: Camera.CaptureStillImage
        imageCapture {
            onImageCaptured: {
                imagecaptured.source = preview;
                imgProcessor.processImage(preview);
            }
        }
    }
    

    process Image in C++:

    void ImgProcessor::processImage(const QString& path)
    {
    QUrl imageURL(path);
    QQmlEngine* engine = QQmlEngine::contextForObject(this)->engine();
    QQmlImageProviderBase* imageProviderBase = engine->imageProvider(imageURL.host());
    QQuickImageProvider* imageProvider = static_cast<QQuickImageProvider*>   (imageProviderBase);
    QSize imageSize;
    QString imageId = imageURL.path().remove(0,1);
    QImage image = imageProvider->requestImage(imageId, &imageSize, imageSize); }
    

    What I get from QML camera is a preview which has a very small image size. (in my case 704 x 528)
    Is there a possibility to get the original image size ( 4608 x 3456 ) or to access the raw image data?

    dev environment:
    OS: windows 7
    dev for android version 4.4.2
    qt creator 3.5
    qt quick 2.5
    qt 5.5



  • onImageSaved gives you the path to the actual image.



  • @xargs1
    thanks for your response.
    is it also possible to access the image data before the saving process?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.