1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2014 The Android Open Source Project
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<sample>
18    <name>HdrViewfinder</name>
19    <group>Media</group>
20    <package>com.example.android.hdrviewfinder</package>
21
22    <minSdk>21</minSdk>
23
24    <dependency>com.android.support:design:28.0.0</dependency>
25
26    <strings>
27        <intro>
28            <![CDATA[
29            This demo implements a real-time high-dynamic-range camera viewfinder, by alternating
30            the sensor\'s exposure time between two exposure values on even and odd frames, and then
31            compositing together the latest two frames whenever a new frame is captured.
32            ]]>
33        </intro>
34    </strings>
35
36    <template src="base"/>
37
38    <metadata>
39        <status>PUBLISHED</status>
40        <categories>Media</categories>
41        <technologies>Android</technologies>
42        <languages>Java</languages>
43        <solutions>Mobile</solutions>
44        <level>ADVANCED</level>
45        <icon>big_icon.png</icon>
46        <screenshots>
47            <img>screenshots/image1.png</img>
48        </screenshots>
49    <api_refs>
50        <android>android.hardware.camera2.CameraAccessException</android>
51        <android>android.hardware.camera2.CameraCaptureSession</android>
52        <android>android.hardware.camera2.CameraCharacteristics</android>
53        <android>android.hardware.camera2.CameraDevice</android>
54        <android>android.hardware.camera2.CameraManager</android>
55        <android>android.hardware.camera2.CaptureRequest</android>
56        <android>android.hardware.camera2.CaptureResult</android>
57        <android>android.hardware.camera2.TotalCaptureResult</android>
58    </api_refs>
59
60    <description>
61            <![CDATA[
62This demo implements a real-time high-dynamic-range camera viewfinder, by alternating
63the sensor's exposure time between two exposure values on even and odd frames, and then
64compositing together the latest two frames whenever a new frame is captured.
65            ]]>
66    </description>
67
68    <intro>
69            <![CDATA[
70A small demo of advanced camera functionality with the Android camera2 API.
71
72This demo implements a real-time high-dynamic-range camera viewfinder,
73by alternating the sensor's exposure time between two exposure values on even and odd
74frames, and then compositing together the latest two frames whenever a new frame is
75captured.
76
77The demo has three modes: Regular auto-exposure viewfinder, split-screen manual exposure,
78and the fused HDR viewfinder.  The latter two use manual exposure controlled by the user,
79by swiping up/down on the right and left halves of the viewfinder.  The left half controls
80the exposure time of even frames, and the right half controls the exposure time of odd frames.
81
82In split-screen mode, the even frames are shown on the left and the odd frames on the right,
83so the user can see two different exposures of the scene simultaneously.  In fused HDR mode,
84the even/odd frames are merged together into a single image.  By selecting different exposure
85values for the even/odd frames, the fused image has a higher dynamic range than the regular
86viewfinder.
87
88The HDR fusion and the split-screen viewfinder processing is done with RenderScript; as is the
89necessary YUV->RGB conversion. The camera subsystem outputs YUV images naturally, while the GPU
90and display subsystems generally only accept RGB data.  Therefore, after the images are
91fused/composited, a standard YUV->RGB color transform is applied before the the data is written
92to the output Allocation. The HDR fusion algorithm is very simple, and tends to result in
93lower-contrast scenes, but has very few artifacts and can run very fast.
94
95Data is passed between the subsystems (camera, RenderScript, and display) using the
96Android [android.view.Surface][1] class, which allows for zero-copy transport of large
97buffers between processes and subsystems.
98
99[1]: http://developer.android.com/reference/android/view/Surface.html
100            ]]>
101    </intro>
102</metadata>
103
104</sample>
105