Initial copy of QtMultimediaKit.
Comes from original repo, with SHA1: 2c82d5611655e5967f5c5095af50c0991c4378b2
This commit is contained in:
188
doc/src/camera.qdoc
Normal file
188
doc/src/camera.qdoc
Normal file
@@ -0,0 +1,188 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** No Commercial Usage
|
||||
** This file contains pre-release code and may not be distributed.
|
||||
** You may use this file in accordance with the terms and conditions
|
||||
** contained in the Technology Preview License Agreement accompanying
|
||||
** this package.
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
// XXX OMG its so bad
|
||||
// namespace warning
|
||||
// why mention control?
|
||||
// bad brief
|
||||
// control list
|
||||
// links?
|
||||
|
||||
/*!
|
||||
|
||||
\page camera.html
|
||||
|
||||
\title Camera
|
||||
\brief An API to control camera devices.
|
||||
|
||||
The Camera API provides control of system camera devices. Providing support
|
||||
for still or video image capture with sound support.
|
||||
|
||||
\tableofcontents
|
||||
|
||||
|
||||
\section1 Namespace
|
||||
|
||||
The QtMobility APIs are placed into the \i{QtMobility} namespace. This is done
|
||||
to facilitate the future migration of QtMobility APIs into Qt. See the
|
||||
\l {Quickstart guide} for an example on how the
|
||||
namespace impacts on application development.
|
||||
|
||||
|
||||
\section1 Overview
|
||||
|
||||
The Camera API allows high level control of various aspects of still images
|
||||
and video. Camera is a part of the Multimedia API and this relationship is
|
||||
apparent when you notice that certain core classes are subclassed from some
|
||||
Multimedia base classes including \l QMediaObject and \l QMediaControl.
|
||||
|
||||
|
||||
|
||||
\section1 Still Images
|
||||
|
||||
In order to capture an image we need to create a \l QCamera object and use
|
||||
it to initialize a \l QVideoWidget, so we can see where the camera is
|
||||
pointing - a viewfinder. The camera object is also used to initialize a new
|
||||
QCameraImageCapture object, imageCapture. All that is then needed is to start
|
||||
the camera, lock it so that the settings are not changed while the image
|
||||
capture occurs, capture the image, and finally unlock the camera ready for
|
||||
the next photo.
|
||||
|
||||
\code
|
||||
camera = new QCamera;
|
||||
viewFinder = new QCameraViewfinder;
|
||||
camera->setViewfinder(viewFinder);
|
||||
viewFinder->show();
|
||||
|
||||
imageCapture = new QCameraImageCapture(camera);
|
||||
|
||||
camera->setCaptureMode(QCamera::CaptureStillImage);
|
||||
camera->start();
|
||||
|
||||
//on half pressed shutter button
|
||||
camera->searchA{QCameraFocus::FocusMode}{ndLock();
|
||||
|
||||
//on shutter button pressed
|
||||
imageCapture->capture();
|
||||
|
||||
//on shutter button released
|
||||
camera->unlock();
|
||||
\endcode
|
||||
|
||||
Alternatively, we could have used a QGraphicsVideoItem as a viewfinder.
|
||||
|
||||
|
||||
\section1 Video Clips
|
||||
|
||||
Previously we saw code that allowed the capture of a still image. Recording
|
||||
video requires the use of a \l QMediaRecorder object and a \l
|
||||
QAudioCaptureSource for sound.
|
||||
|
||||
To record video we need to create a camera object as before but this time as
|
||||
well as creating a viewfinder, we will also initialize a media recorder object.
|
||||
|
||||
\code
|
||||
camera = new QCamera;
|
||||
mediaRecorder = new QMediaRecorder(camera);
|
||||
|
||||
camera->setCaptureMode(QCamera::CaptureVideo);
|
||||
camera->start();
|
||||
|
||||
//on shutter button pressed
|
||||
mediaRecorder->record();
|
||||
\endcode
|
||||
|
||||
Signals from the \i mediaRecorder can be connected to slots to react to
|
||||
changes in the state of the recorder or error events. Recording itself
|
||||
starts with the \l {QMediaRecorder::record()}{record()} function of
|
||||
mediaRecorder being called, this causes the signal \l
|
||||
{QMediaRecorder::stateChanged()}{stateChanged()} to be emitted. The
|
||||
recording process can be changed with the \l {QMediaRecorder::record()}{record()},
|
||||
\l {QMediaRecorder::pause()}{pause()}, \l {QMediaRecorder::stop()}{stop()} and
|
||||
\l {QMediaRecorder::setMuted()}{setMuted()} slots in \l QMediaRecorder.
|
||||
|
||||
When the camera is in video mode, as decided by the application, then as the
|
||||
shutter button is pressed the camera is locked as before but instead the
|
||||
\l {QMediaRecorder::record()}{record()} function in \l QMediaRecorder is used.
|
||||
|
||||
|
||||
|
||||
\section1 Focus
|
||||
|
||||
Focusing is managed by the classes \l QCameraFocus and \l QCameraFocusControl.
|
||||
QCameraFocus allows the developer to set the general policy by means of the
|
||||
enums for the \l {QCameraFocus::FocusMode}{FocusMode} and the
|
||||
\l {QCameraFocus::FocusPointMode}{FocusPointMode}. \l {QCameraFocus::FocusMode}{FocusMode}
|
||||
deals with settings such as \l {QCameraFocus::FocusMode}{AutoFocus},
|
||||
\l {QCameraFocus::FocusMode}{ContinuousFocus} and \l {QCameraFocus::FocusMode}{InfinityFocus}, whereas \l {QCameraFocus::FocusMode}{FocusPointMode} deals with the various focus zones within the view. \l {QCameraFocus::FocusMode}{FocusPointMode} has support for face recognition, center focus and a custom
|
||||
focus where the focus point can be specified.
|
||||
|
||||
|
||||
|
||||
\section1 Cancelling Asynchronous Operations
|
||||
|
||||
Various operations such as image capture and auto focusing occur
|
||||
asynchrously. These operations can often be cancelled by the start of a new
|
||||
operation as long as this is supported by the backend. For image capture,
|
||||
the operation can be cancelled by calling
|
||||
\l {QCameraImageCapture::cancelCapture()}{cancelCapture()}. For AutoFocus,
|
||||
autoexposure or white balance cancellation can be done by calling
|
||||
\i {QCamera::unlock(QCamera::LockFocus)}.
|
||||
|
||||
|
||||
|
||||
\section1 Camera Controls
|
||||
|
||||
\table
|
||||
\header
|
||||
\o Control Name
|
||||
\o Description
|
||||
\row
|
||||
\o camera
|
||||
\o the interface for system camera devices
|
||||
\row
|
||||
\o exposure
|
||||
\o Includes: flash mode; flash power; metering mode; aperture; shutter speed, iso setting
|
||||
\row
|
||||
\o focus
|
||||
\o Includes: optical zoom; digital zoom; focus point; focus zones
|
||||
\row
|
||||
\o image processing
|
||||
\o white balance; contrast; saturation; sharpen; denoise
|
||||
\row
|
||||
\o locks
|
||||
\o handles the locking and unlocking of camera devices
|
||||
\endtable
|
||||
|
||||
|
||||
\section1 Classes
|
||||
\annotatedlist camera
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user