/usr/share/qt5/doc/qtmultimedia/cameraoverview.html is in qtmultimedia5-doc-html 5.2.1-0ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- cameraoverview.qdoc -->
<title>Camera Overview | QtMultimedia 5.2</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.2</li>
<li><a href="qtmultimedia-index.html">Qt Multimedia</a></li>
<li>Camera Overview</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#camera-features">Camera Features</a></li>
<li class="level2"><a href="#the-lens-assembly">The Lens Assembly</a></li>
<li class="level2"><a href="#the-sensor">The Sensor</a></li>
<li class="level2"><a href="#image-processing">Image Processing</a></li>
<li class="level2"><a href="#recording-for-posterity">Recording for Posterity</a></li>
<li class="level1"><a href="#camera-implementation-details">Camera Implementation Details</a></li>
<li class="level2"><a href="#viewfinder">Viewfinder</a></li>
<li class="level2"><a href="#still-images">Still Images</a></li>
<li class="level2"><a href="#movies">Movies</a></li>
<li class="level2"><a href="#controlling-the-imaging-pipeline">Controlling the Imaging Pipeline</a></li>
<li class="level3"><a href="#focus-and-zoom">Focus and Zoom</a></li>
<li class="level3"><a href="#exposure-aperture-shutter-speed-and-flash">Exposure, Aperture, Shutter Speed and Flash</a></li>
<li class="level3"><a href="#image-processing">Image Processing</a></li>
<li class="level3"><a href="#canceling-asynchronous-operations">Canceling Asynchronous Operations</a></li>
<li class="level1"><a href="#examples">Examples</a></li>
<li class="level2"><a href="#c-examples">C++ Examples</a></li>
<li class="level2"><a href="#qml-examples">QML Examples</a></li>
<li class="level1"><a href="#reference-documentation">Reference Documentation</a></li>
<li class="level2"><a href="#c-classes">C++ Classes</a></li>
<li class="level2"><a href="#qml-types">QML Types</a></li>
</ul>
</div>
<h1 class="title">Camera Overview</h1>
<span class="subtitle"></span>
<!-- $$$cameraoverview.html-description -->
<div class="descr"> <a name="details"></a>
<p>The Qt Multimedia API provides a number of camera related classes, so you can access images and videos from mobile device cameras or webcameras. There are both C++ and QML APIs for common tasks.</p>
<a name="camera-features"></a>
<h2>Camera Features</h2>
<p>In order to use the camera classes a quick overview of the way a camera works is needed. If you're already familiar with this, you can skip ahead to <a href="#camera-tldr">Camera implementation details</a>.</p>
<a name="the-lens-assembly"></a>
<h3>The Lens Assembly</h3>
<p>At one end of the camera assembly is the lens assembly (one or more lenses, arranged to focus light onto the sensor). The lenses themselves can sometimes be moved to adjust things like focus and zoom, or they might be fixed in an arrangement to give a good balance between objects in focus, and cost.</p>
<p>Some lens assemblies can automatically be adjusted so that an object at different distances from the camera can be kept in focus. This is usually done by measuring how sharp a particular area of the frame is, and by adjusting the lens assembly until it is maximally sharp. In some cases the camera will always use the center of the frame for this. Other cameras may also allow the region to focus to be specified (for "touch to zoom", or "face zoom" features).</p>
<a name="the-sensor"></a>
<h3>The Sensor</h3>
<p>Once light arrives at the sensor, it gets converted into digital pixels. This process can depend on a number of things but ultimately comes down to two things - how long the conversion is allowed to take, and how bright the light is. The longer a conversion can take, the better the quality. Using a flash can assist with letting more light hit the sensor, allowing it to convert pixels faster, giving better quality for the same amount of time. Conversely, allowing a longer conversion time can let you take photos in darker environments, as long as the camera is steady.</p>
<a name="image-processing"></a>
<h3>Image Processing</h3>
<p>After the image has been captured by the sensor, the camera firmware performs various image processing tasks on it to compensate for various sensor characteristics, current lighting, and desired image properties. Faster sensor pixel conversion times tend to introduce digital noise, so some amount of image processing can be done to remove this based on the camera sensor settings.</p>
<p>The color of the image can also be adjusted at this stage to compensate for different light sources - fluorescent lights and sunlight give very different appearances to the same object, so the image can be adjusted based on the white balance of the picture (due to the different color temperatures of the light sources).</p>
<p>Some forms of "special effects" can also be performed at this stage. Black and white, sepia, or "negative" style images can be produced.</p>
<a name="recording-for-posterity"></a>
<h3>Recording for Posterity</h3>
<p>Finally, once a perfectly focused, exposed and processed image has been created, it can be put to good use. Camera images can be further processed by application code (for example, to detect barcodes, or to stitch together a panoramic image), or saved to a common format like JPEG, or used to create a movie. Many of these tasks have classes to assist them.</p>
<a name="camera-tldr"></a><a name="camera-implementation-details"></a>
<h2>Camera Implementation Details</h2>
<a name="viewfinder"></a>
<h3>Viewfinder</h3>
<p>While not strictly necessary, it's often useful to be able to see what the camera is pointing at. Most digital cameras allow an image feed from the camera sensor at a lower resolution (usually up to the size of the display of the camera) so you can compose a photo or video, and then switch to a slower but higher resolution mode for capturing the image.</p>
<p>Depending on whether you're using QML or C++, you can do this in multiple ways. In QML, you can use <a href="qml-qtmultimedia-camera.html">Camera</a> and <a href="qml-qtmultimedia-videooutput.html">VideoOutput</a> together to show a simple viewfinder:</p>
<pre class="qml">import QtQuick 2.0
import QtMultimedia 5.0
<span class="type"><a href="qml-qtmultimedia-videooutput.html">VideoOutput</a></span> {
<span class="name">source</span>: <span class="name">camera</span>
<span class="type"><a href="qml-qtmultimedia-camera.html">Camera</a></span> {
<span class="name">id</span>: <span class="name">camera</span>
<span class="comment">// You can adjust various settings in here</span>
}
}</pre>
<p>In C++, your choice depends on whether you are using widgets, or QGraphicsView. The QVideoWidget class is used in the widgets case, and QGraphicsVideoItem is useful for QGraphicsView.</p>
<pre class="cpp">camera <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcamera.html">QCamera</a></span>;
viewfinder <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QCameraViewfinder</span>;
camera<span class="operator">-</span><span class="operator">></span>setViewfinder(viewfinder);
viewfinder<span class="operator">-</span><span class="operator">></span>show();
camera<span class="operator">-</span><span class="operator">></span>start(); <span class="comment">// to start the viewfinder</span></pre>
<p>For advanced usage (like processing viewfinder frames as they come, to detect objects or patterns), you can also derive from <a href="qabstractvideosurface.html">QAbstractVideoSurface</a> and set that as the viewfinder for the <a href="qcamera.html">QCamera</a> object. In this case you will need to render the viewfinder image yourself.</p>
<pre class="cpp">camera <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcamera.html">QCamera</a></span>;
mySurface <span class="operator">=</span> <span class="keyword">new</span> MyVideoSurface;
camera<span class="operator">-</span><span class="operator">></span>setViewfinder(mySurface);
camera<span class="operator">-</span><span class="operator">></span>start();
<span class="comment">// MyVideoSurface::present(..) will be called with viewfinder frames</span></pre>
<a name="still-images"></a>
<h3>Still Images</h3>
<p>After setting up a viewfinder and finding something photogenic, to capture an image we need to initialize a new <a href="qcameraimagecapture.html">QCameraImageCapture</a> object. All that is then needed is to start the camera, lock it so that things are in focus and the settings are not different from the viewfinder while the image capture occurs, capture the image, and finally unlock the camera ready for the next photo.</p>
<pre class="cpp">imageCapture <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcameraimagecapture.html">QCameraImageCapture</a></span>(camera);
camera<span class="operator">-</span><span class="operator">></span>setCaptureMode(<span class="type"><a href="qcamera.html">QCamera</a></span><span class="operator">::</span>CaptureStillImage);
camera<span class="operator">-</span><span class="operator">></span>start(); <span class="comment">// Viewfinder frames start flowing</span>
<span class="comment">//on half pressed shutter button</span>
camera<span class="operator">-</span><span class="operator">></span>searchAndLock();
<span class="comment">//on shutter button pressed</span>
imageCapture<span class="operator">-</span><span class="operator">></span>capture();
<span class="comment">//on shutter button released</span>
camera<span class="operator">-</span><span class="operator">></span>unlock();</pre>
<a name="movies"></a>
<h3>Movies</h3>
<p>Previously we saw code that allowed the capture of a still image. Recording video requires the use of a <a href="qmediarecorder.html">QMediaRecorder</a> object.</p>
<p>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.</p>
<pre class="cpp">camera <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcamera.html">QCamera</a></span>;
recorder <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qmediarecorder.html">QMediaRecorder</a></span>(camera);
camera<span class="operator">-</span><span class="operator">></span>setCaptureMode(<span class="type"><a href="qcamera.html">QCamera</a></span><span class="operator">::</span>CaptureVideo);
camera<span class="operator">-</span><span class="operator">></span>start();
<span class="comment">//on shutter button pressed</span>
recorder<span class="operator">-</span><span class="operator">></span>record();
<span class="comment">// sometime later, or on another press</span>
recorder<span class="operator">-</span><span class="operator">></span>stop();</pre>
<p>Signals from the <i>mediaRecorder</i> can be connected to slots to react to changes in the state of the recorder or error events. Recording itself starts with the <a href="qmediarecorder.html#record">record()</a> function of mediaRecorder being called, this causes the signal <a href="qmediarecorder.html#state-prop">stateChanged()</a> to be emitted. The recording process can be changed with the <a href="qmediarecorder.html#record">record()</a>, <a href="qmediarecorder.html#stop">stop()</a> and <a href="qmediarecorder.html#muted-prop">setMuted()</a> slots in <a href="qmediarecorder.html">QMediaRecorder</a>.</p>
<a name="controlling-the-imaging-pipeline"></a>
<h3>Controlling the Imaging Pipeline</h3>
<p>Now that the basics of capturing images or movies are covered, there are a number of ways to control the imaging pipeline to implement some interesting techniques. As explained earlier, several physical and electronic elements combine to determine the final images, and you can control them with different classes.</p>
<a name="focus-and-zoom"></a>
<h4>Focus and Zoom</h4>
<p>Focusing (and zoom) is managed primarily by the <a href="qcamerafocus.html">QCameraFocus</a> class. <a href="qcamerafocus.html">QCameraFocus</a> allows the developer to set the general policy by means of the enums for the <a href="qcamerafocus.html#FocusMode-enum">FocusMode</a> and the <a href="qcamerafocus.html#FocusPointMode-enum">FocusPointMode</a>. <a href="qcamerafocus.html#FocusMode-enum">FocusMode</a> deals with settings such as <a href="qcamerafocus.html#FocusMode-enum">AutoFocus</a>, <a href="qcamerafocus.html#FocusMode-enum">ContinuousFocus</a> and <a href="qcamerafocus.html#FocusMode-enum">InfinityFocus</a>, whereas <a href="qcamerafocus.html#FocusMode-enum">FocusPointMode</a> deals with the various focus zones within the view that are used for autofocus modes. <a href="qcamerafocus.html#FocusMode-enum">FocusPointMode</a> has support for face recognition (where the camera supports it), center focus and a custom focus where the focus point can be specified.</p>
<p>For camera hardware that supports it, <a href="qcamerafocus.html#FocusMode-enum">Macro focus</a> allows imaging of things that are close to the sensor. This is useful in applications like barcode recognition, or business card scanning.</p>
<p>In addition to focus, <a href="qcamerafocus.html">QCameraFocus</a> allows you to control any available optical or digital zoom. In general, optical zoom is higher quality, but more expensive to manufacture, so the available zoom range might be limited (or fixed to unity).</p>
<a name="exposure-aperture-shutter-speed-and-flash"></a>
<h4>Exposure, Aperture, Shutter Speed and Flash</h4>
<p>There are a number of settings that affect the amount of light that hits the camera sensor, and hence the quality of the resulting image. The <a href="qcameraexposure.html">QCameraExposure</a> class allows you to adjust these settings. You can use this class to implement some techniques like High Dynamic Range (HDR) photos by locking the exposure parameters (with <a href="qcamera.html#searchAndLock">QCamera::searchAndLock</a>()), or motion blur by setting slow shutter speeds with small apertures.</p>
<p>The main settings for automatic image taking are the <a href="qcameraexposure.html#ExposureMode-enum">exposure mode</a> and <a href="qcameraexposure.html#FlashMode-enum">flash mode</a>. Several other settings (aperture, ISO setting, shutter speed) are usually managed automatically but can also be overridden if desired.</p>
<p>You can also adjust the <a href="qcameraexposure.html#meteringMode-prop">QCameraExposure::meteringMode</a>() to control which parts of the camera frame to measure exposure at. Some camera implementations also allow you to specify a specific point that should be used for exposure metering - this is useful if you can let the user touch or click on an interesting part of the viewfinder, and then use this point so that the image exposure is best at that point.</p>
<p>Finally, you can control the flash hardware (if present) using this class. In some cases the hardware may also double as a torch (typically when the flash is LED based, rather than a xenon or other bulb). See also <a href="qml-qtmultimedia-torch.html">Torch</a> for an easy to use API for torch functionality.</p>
<a name="camera-image-processing"></a><a name="image-processing"></a>
<h4>Image Processing</h4>
<p>The <a href="qcameraimageprocessing.html">QCameraImageProcessing</a> class lets you adjust the image processing part of the pipeline. This includes the <a href="qcameraimageprocessing.html#WhiteBalanceMode-enum">white balance</a> (or color temperature), <a href="qcameraimageprocessing.html#contrast">contrast</a>, <a href="qcameraimageprocessing.html#saturation">saturation</a>, <a href="qcameraimageprocessing.html#setSharpeningLevel">sharpening</a> and <a href="qcameraimageprocessing.html#setDenoisingLevel">denoising</a>. Most cameras support automatic settings for all of these, so you shouldn't need to adjust them unless the user wants a specific setting.</p>
<p>If you're taking a series of images (for example, to stitch them together for a panoramic image), you should lock the image processing settings so that all the images taken appear similar with <i>QCamera::lock(<a href="qcamera.html#LockType-enum">QCamera::LockWhiteBalance</a>)</i>/</p>
<a name="canceling-asynchronous-operations"></a>
<h4>Canceling Asynchronous Operations</h4>
<p>Various operations such as image capture and auto focusing occur asynchrously. These operations can often be canceled by the start of a new operation as long as this is supported by the camera. For image capture, the operation can be canceled by calling <a href="qcameraimagecapture.html#cancelCapture">cancelCapture()</a>. For AutoFocus, autoexposure or white balance cancellation can be done by calling <i>QCamera::unlock(<a href="qcamera.html#LockType-enum">QCamera::LockFocus</a>)</i>.</p>
<a name="examples"></a>
<h2>Examples</h2>
<p>There are both C++ and QML examples available.</p>
<a name="c-examples"></a>
<h3>C++ Examples</h3>
<a name="qml-examples"></a>
<h3>QML Examples</h3>
<a name="reference-documentation"></a>
<h2>Reference Documentation</h2>
<a name="c-classes"></a>
<h3>C++ Classes</h3>
<table class="annotated">
<tr class="odd topAlign"><td class="tblName"><p><a href="qcamera.html">QCamera</a></p></td><td class="tblDescr"><p>Interface for system camera devices</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qcameraexposure.html">QCameraExposure</a></p></td><td class="tblDescr"><p>Interface for exposure related camera settings</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qcamerafocuszone.html">QCameraFocusZone</a></p></td><td class="tblDescr"><p>Information on zones used for autofocusing a camera</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qcamerafocus.html">QCameraFocus</a></p></td><td class="tblDescr"><p>Interface for focus and zoom related camera settings</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qcameraimagecapture.html">QCameraImageCapture</a></p></td><td class="tblDescr"><p>Used for the recording of media content</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qcameraimageprocessing.html">QCameraImageProcessing</a></p></td><td class="tblDescr"><p>Interface for image processing related camera settings</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qimageencodersettings.html">QImageEncoderSettings</a></p></td><td class="tblDescr"><p>Set of image encoder settings</p></td></tr>
</table>
<a name="qml-types"></a>
<h3>QML Types</h3>
<table class="annotated">
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtmultimedia-camera.html">Camera</a></p></td><td class="tblDescr"><p>Access viewfinder frames, and take photos and movies.</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtmultimedia-cameracapture.html">CameraCapture</a></p></td><td class="tblDescr"><p>An interface for capturing camera images</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtmultimedia-cameraexposure.html">CameraExposure</a></p></td><td class="tblDescr"><p>An interface for exposure related camera settings.</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtmultimedia-cameraflash.html">CameraFlash</a></p></td><td class="tblDescr"><p>An interface for flash related camera settings.</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtmultimedia-camerafocus.html">CameraFocus</a></p></td><td class="tblDescr"><p>An interface for focus related camera settings.</p></td></tr>
<tr class="even topAlign"><td class="tblName"><p><a href="qml-qtmultimedia-cameraimageprocessing.html">CameraImageProcessing</a></p></td><td class="tblDescr"><p>An interface for camera capture related settings.</p></td></tr>
<tr class="odd topAlign"><td class="tblName"><p><a href="qml-qtmultimedia-camerarecorder.html">CameraRecorder</a></p></td><td class="tblDescr"><p>Controls video recording with the Camera.</p></td></tr>
</table>
</div>
<!-- @@@cameraoverview.html -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|