×
Namespaces

Variants
Actions
(Difference between revisions)

CamFeatures: QML component to get camera capabilities

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee -)
kiran10182 (Talk | contribs)
m (Kiran10182 -)
 
Line 181: Line 181:
 
== Summary ==
 
== Summary ==
  
This component is part of the [http://projects.developer.nokia.com/omgcam OMGcam project] which uses [[StarMenu: custom QML component plugin]] component to build the settings menu with available camera features. OMGcam uses also [[Using QSettings in QML with also json and XML support|settings]] context property in QML to store user settings.
+
This component is part of the [[Media:OMGcam-src-v0.0.1.zip|OMCcam project]] which uses [[StarMenu: custom QML component plugin]] component to build the settings menu with available camera features. OMGcam uses also [[Using QSettings in QML with also json and XML support|settings]] context property in QML to store user settings.
  
 
== Download ==
 
== Download ==
  
 
[[File:camfeatures-v1.0.zip]]
 
[[File:camfeatures-v1.0.zip]]

Latest revision as of 21:23, 2 October 2013

This article explains how to use the custom QML Element CameraFeatures to get camera capabilities in QML.

Article Metadata
Code ExampleTested with
SDK: Nokia Qt SDK 1.2.1
Devices(s): Nokia C7-00, Nokia N950
Compatibility
Platform(s): Symbian^3 and later, Harmattan
Symbian
Device(s): All* (must have camera)
Article
Created: lildeimos (08 May 2012)
Last edited: kiran10182 (02 Oct 2013)

Note.pngNote: This is an entry in the PureView Imaging Competition 2012Q2

Contents

[edit] Introduction

The standard QML Camera Element allows developers to set most camera capabilities, including flash mode, exposure mode, white balance, ISO modes etc. However there is no in-built mechanism to query whether these modes are supported on a particular device camera and no mechanism for getting an error back if the setting is not supported.

This component allows the camera capabilities to be queried from within QML code, thereby allowing the UI to be customised for the actual capabilities of the supported camera.

[edit] Usage

Start copying camfeatures.cpp and camfeatures.h into your project source directory. In the Icode|main.cpp file include the .h:

#include "camfeatures.h"

then register the component:

qmlRegisterType<cameraFeatures>("CameraFeatures", 1, 0, "CameraFeatures");

In your qml file you can now declare the CameraFeatures component:

CameraFeatures {
id: camFeatures
property int cameraDevice: 0
 
function getFeatures()
{
var devices;
devices = getAvailableDevices();
startGetFeatures(devices[cameraDevice]);
}
 
Component.onCompleted: getFeatures()
onCameraDeviceChanged: getFeatures()
 
onFeaturesRetrieved: camera.start() // camera is your QML camera component
}

After the component is completed we can fetch its capabilities by calling startGetFeatures() with the device name as a parameter. The list of available devices can be retrieved by first calling getAvailableDevices().

When all the features are stored, the featuresRetrieved signal is emitted you can query the CameraFeatures object using the JavaScript methods in the following sections to determine exactly what features are supported. In the code above, we also start the QML Camera.

The QML Camera Element does not support the front camera (at time of writing), but this component can get its information.

[edit] Exposure modes

This section shows how to retrieve the exposure modes - for more information see QCameraExposure (reference doc).

bool isExposureSupported(mode)

Example:

var b = camFeatures.isExposureSupported(CameraFeatures.ExposureAuto)

Modes:

CameraFeatures.ExposureManual
CameraFeatures.ExposureAuto
CameraFeatures.ExposureNight
CameraFeatures.ExposureBacklight
CameraFeatures.ExposureSpotlight
CameraFeatures.ExposureSports
CameraFeatures.ExposureSnow
CameraFeatures.ExposureBeach
CameraFeatures.ExposureLargeAperture
CameraFeatures.ExposureSmallAperture
CameraFeatures.ExposurePortrait
CameraFeatures.ExposureModeVendor

[edit] Flash modes

You can refer to flash modes.

bool camFeatures.isFlashModeSupported(mode)

Example:

var b = camFeatures.isFlashModeSupported(CameraFeatures.FlashAuto)

Modes:

CameraFeatures.FlashOff
CameraFeatures.FlashOn
CameraFeatures.FlashAuto
CameraFeatures.FlashRedEyeReduction
CameraFeatures.FlashFill
CameraFeatures.FlashTorch
CameraFeatures.FlashSlowSyncFrontCurtain
CameraFeatures.FlashSlowSyncRearCurtain
CameraFeatures.FlashManual

[edit] White balance modes

You can refer to white balance modes.

bool camFeatures.isWhiteBalanceSupported(mode)

Example:

var b =  camFeatures.isWhiteBalanceSupported(CameraFeatures.WhiteBalanceAuto)

Modes:

CameraFeatures.WhiteBalanceAuto
CameraFeatures.WhiteBalanceManual
CameraFeatures.WhiteBalanceSunlight
CameraFeatures.WhiteBalanceCloudy
CameraFeatures.WhiteBalanceShade
CameraFeatures.WhiteBalanceTungsten
CameraFeatures.WhiteBalanceFluorescent
CameraFeatures.WhiteBalanceIncandescent
CameraFeatures.WhiteBalanceFlash
CameraFeatures.WhiteBalanceSunset
CameraFeatures.WhiteBalanceVendor

[edit] Iso modes

QList<int> camFeatures.getIsoModesSupportedList()

Example:

ListModel {
id: isosModel
}
Component.onCompleted: {
var isoList = camFeatures.getIsoModesSupportedList()
isosModel.clear();
for (var i=0; i<isoList.length; i++)
isosModel.append( {"iso": isoList[i]} );
}

[edit] Compensation modes

This function return a list of values that are commonly used by cameras. It come handy to have this for example to have a list of choice to give to the user.

QStringList camFeatures.getCompensationsModes()

Example:

ListModel {
id: compensationsModel
}
Component.onCompleted: {
var evList = camFeatures.getCompensationsModes();
compensationsModel.clear();
for (i=0; i<evList.length; i++)
compensationsModel.append( {"compensation": evList[i]} );
}

[edit] Summary

This component is part of the OMCcam project which uses StarMenu: custom QML component plugin component to build the settings menu with available camera features. OMGcam uses also settings context property in QML to store user settings.

[edit] Download

File:Camfeatures-v1.0.zip

This page was last modified on 2 October 2013, at 21:23.
64 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×