Camera element on N8



  • Hello, I have created a simple QML app for exercising the Camera example taken from http://doc.qt.nokia.com/qtmobility/qml-multimedia.html

    I have added all the relevant header files and Symbian capabilities but it seems the camera doesn't show any content when the application starts on the N8. I can see only a white background. Here is the main.qml file

    @
    import Qt 4.7
    import QtMultimediaKit 1.1

    Camera {
    focus : visible // to receive focus and capture key events when visible

     flashMode: Camera.FlashRedEyeReduction
     whiteBalanceMode: Camera.WhiteBalanceFlash
     exposureCompensation: -1.0
    
     onImageCaptured : {
         photoPreview.source = preview  // Show the preview in an Image element
     }
    

    }
    @

    Do you know please if I have missed any other parameters?
    Thank you



  • Do you have right capability ?



  • Yes , here is part of my .pro file

    @
    symbian {
    TARGET.CAPABILITY += NetworkServices UserEnvironment NetworkServices Location ReadUserData WriteUserData
    }
    @

    thank you



  • In this example I can see the viewfinder with a black background but no camera images are displayed. However if I press the capture button then the preview image is filled with the camera's capture image. Also when taking a picture I can see the camera flash working. Any idea from this example why QML Camera element doesn't display the images when not taking a picture?
    Thank you

    @
    import QtQuick 1.0
    import QtMultimediaKit 1.1

    Rectangle {
    id: rotateCam
    state: 'CameraStarted'
    states: [
    State {
    name: "CameraStarted"
    PropertyChanges { target: previewImage; z: -1 }
    PropertyChanges { target: rotateCam; color: "black" }
    PropertyChanges { target: takePhotoButton; buttonText: "Take Image" }
    PropertyChanges { target: camera; captureResolution: Qt.size(camera.width,camera.height)}
    },
    State {
    name: "CapturingPhoto"
    PropertyChanges { target: previewImage; z: -1 }
    PropertyChanges { target: rotateCam; color: "red" }
    PropertyChanges { target: takePhotoButton; buttonText: "Cancel" }
    },
    State {
    name: "ShowingPreview"
    PropertyChanges { target: previewImage; z: 2 }
    PropertyChanges { target: rotateCam; color: "black" }
    PropertyChanges { target: takePhotoButton; buttonText: "Back" }
    }
    ]

    Camera {
        id: camera
        anchors.fill: parent
        anchors.margins: 4
        //focus : visible // to receive focus and capture key events when visible
        flashMode: Camera.FlashRedEyeReduction
        whiteBalanceMode: Camera.WhiteBalanceFlash
        exposureCompensation: -1.0
        onImageCaptured: {
            console.log("Image captured!")
            previewImage.source = preview
            rotateCam.state = 'ShowingPreview'
        }
    
        Image {
            id: previewImage
            anchors.fill: parent
            fillMode: Image.PreserveAspectFit
            smooth: true
        }
    }
    
    CameraButton {
        id: exitButton
        anchors.right: parent.right
        anchors.top: parent.top
        anchors.margins: 60
        buttonText: "Exit"
        onButtonPressed: Qt.quit()
    }
    
    CameraButton {
        id: takePhotoButton
        anchors.left: parent.left
        anchors.top: parent.top
        anchors.margins: 60
        buttonText: "Take Image"
        onButtonPressed: {
            if (rotateCam.state == 'CameraStarted') {
                camera.captureImage()
            } else if (rotateCam.state == 'ShowingPreview') {
                rotateCam.state = 'CameraStarted'
            }
        }
    }
    
    MouseArea {
        anchors.fill: parent
        onClicked: {
            console.log("Mouse pressed!")
            if (rotateCam.state == 'CameraStarted')
                camera.searchAndLock()
            else if (rotateCam.state == 'ShowingPreview')
                rotateCam.state = 'CameraStarted'
        }
    }
    

    }

    // End of file

    @



  • So, I have the same issue..When I use qml camera I see only black screen (Symbian^1, Nokia 5800).

    http://www.developer.nokia.com/info/sw.nokia.com/id/cc9937ed-9f1f-44b4-981f-38245bf9cae5/Qt_QCamera_Example.html
    This non-qml example works perfectly on my device.

    mascotti, did you find a way to fix this behaviour?



  • Hi,
    the problem in my case was that I was using a QT's version on my device that was older then the one I was using for developing. I suggest you make sure that you are using the same QT mobility version both on the device and QT sdk.

    Hope this help
    Maurizio



  • I have the same problem on a Symbian^1 phone (Nokia X6). Here is the minimal code for a Qt Quick Application generated from the wizard. I am using Qt 1.1.2 SDK downloaded yesterday (10/07/2011), which uses Qt Mobility 1.1.3 with Qt 4.7.3. I manually installed the two Qt /QtMobility library .sis files that are the SDK start menu group.

    // .pro contains following extra lines
    // symbian:TARGET.CAPABILITY += UserEnvironment
    // CONFIG += mobility
    // MOBILITY += multimedia

    // main.qml contains:
    import QtQuick 1.0
    import QtMultimediaKit 1.1

    Camera {
    }

    Result: viewfinder not appear. However the above works fine for a Symbian^3 build on Nokia N8 - viewfinder does turn on.



  • Raised bug report http://bugreports.qt.nokia.com/browse/QTMOBILITY-1769
    Please vote for it if you can repeat it yourself.


Log in to reply
 

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