View Full Version : QML won't save camera settings
Pixtar
13th February 2015, 12:05
Hi all,
I am using Qt5.2.1 (GCC 4.8, armeabi-v7a) at Windows8.1(x64) and a Samsung Galaxy S4 Mini with Android 4.2.2.
I tried to compile the qml example "qdeclarative-camera" and it worked to start the app with the smartphone and save images.
I tried also to modify the source to test some settings like changing exposuretime, iso, focus, contrast, etc.
Whatever I tried to change - contrast, iso or saturation - nothing happened.
What states or status do the camera should have to save the settings? Does it need to be stopped? Does it need a special captureMode? Are the settings reset by the function searchAndLock? Is it a bug at Qt5.2.1? Is Samsung blocking such functions? Do I need special variables in the pro-file like MOBILITY or TARGET.CAPABILITY?
It's very annoying, that I can't find any hint to solve the problem on my own.
Any hint is appreciated.
Greetings,
Pixtar
wysota
13th February 2015, 15:51
What do you mean by "save the settings"? save them where?
Pixtar
16th February 2015, 07:39
What do you mean by "save the settings"? save them where?
I mean the simple fact, when I'm using i.e. this little snippet:
camera.imageProcessing.saturation = 1
console.debug( camera.imageProcessing.saturation )
The output is 0 instead of 1.
I'm facing this problem with all settings:
camera.imageProcessing.contrast = 1
console.debug( camera.imageProcessing.contrast)
The output is 0 instead of 1.
wysota
16th February 2015, 07:49
Have you tried setting the values by declaring them directly in the QML document?
Pixtar
16th February 2015, 08:30
Wysota I don't know exactly what you mean, but I've tried the following:
Item{
Camera {
id: camera
imageProcessing.saturation: 1.0
imageProcessing.contrast: 1.0
....
imageCapture {
onImageSaved: {
console.debug( camera.imageProcessing.contrast )
}
}
}
}
I also tried it with a gui element:
Rectangle{
property Camera camera
id: mainRectangle
Slider{
id: contrastSpin
minimumValue: -10.0
maximumValue: 10.0
value: 1
stepSize: 1
onValueChanged: {
camera.imageProcessing.contrast = value/10.0
}
}
}
wysota
16th February 2015, 09:13
Maybe your camera simply does not allow modifying those values. At least the first approach should have worked otherwise.
Pixtar
16th February 2015, 11:48
For integrity here the main.cpp:
#include <QGuiApplication>
#include <QQmlComponent>
#include <QQmlContext>
#include <QObject>
#include <QQuickItem>
#include <QQuickView>
#include <QQuickImageProvider>
#include <QVariant>
#include <QCamera>
int main( int argc, char *argv[] ){
QGuiApplication app( argc, argv );
QQuickView view;
view.setResizeMode( QQuickView::SizeRootObjectToView );
view.setSource( QUrl("qrc:///QML/main.qml") );
QObject *item = view.rootObject( );
view.show( );
return app.exec( );
}
An here the code for main.qml:
import QtQuick 2.2
import QtMultimedia 5.2
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1
import "qrc:///QML"
Item {
focus: true
visible: true
id: item
Camera {
id: camera
captureMode: Camera.CaptureStillImage
imageProcessing.saturation: -1.0
imageProcessing.contrast: -1.0
}
Rectangle{
id: rectangleImage
visible: true
ColumnLayout{
spacing: 10
Button{
id: menuButton
text: "Check Camera"
onClicked: {
camera.imageProcessing.contrast = -1.0
console.debug( camera.imageProcessing.contrast )
}
}
VideoOutput {
id: output
source: camera
focus : visible
visible: true
autoOrientation: true
anchors.fill: parent
x: parent.height > parent.width ? 0 : parent.width/2*2
y: parent.height > parent.width ? parent.height/2*2+5 : 0
height: parent.height > parent.width ? parent.height/2 : parent.height/2
width: parent.height > parent.width ? parent.width/2 : parent.width/2
}
}
}
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.