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:24.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[ 62 This demo implements a real-time high-dynamic-range camera viewfinder, by alternating 63 the sensor's exposure time between two exposure values on even and odd frames, and then 64 compositing together the latest two frames whenever a new frame is captured. 65 ]]> 66 </description> 67 68 <intro> 69 <![CDATA[ 70 A small demo of advanced camera functionality with the Android camera2 API. 71 72 This demo implements a real-time high-dynamic-range camera viewfinder, 73 by alternating the sensor's exposure time between two exposure values on even and odd 74 frames, and then compositing together the latest two frames whenever a new frame is 75 captured. 76 77 The demo has three modes: Regular auto-exposure viewfinder, split-screen manual exposure, 78 and the fused HDR viewfinder. The latter two use manual exposure controlled by the user, 79 by swiping up/down on the right and left halves of the viewfinder. The left half controls 80 the exposure time of even frames, and the right half controls the exposure time of odd frames. 81 82 In split-screen mode, the even frames are shown on the left and the odd frames on the right, 83 so the user can see two different exposures of the scene simultaneously. In fused HDR mode, 84 the even/odd frames are merged together into a single image. By selecting different exposure 85 values for the even/odd frames, the fused image has a higher dynamic range than the regular 86 viewfinder. 87 88 The HDR fusion and the split-screen viewfinder processing is done with RenderScript; as is the 89 necessary YUV->RGB conversion. The camera subsystem outputs YUV images naturally, while the GPU 90 and display subsystems generally only accept RGB data. Therefore, after the images are 91 fused/composited, a standard YUV->RGB color transform is applied before the the data is written 92 to the output Allocation. The HDR fusion algorithm is very simple, and tends to result in 93 lower-contrast scenes, but has very few artifacts and can run very fast. 94 95 Data is passed between the subsystems (camera, RenderScript, and display) using the 96 Android [android.view.Surface][1] class, which allows for zero-copy transport of large 97 buffers 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