• Home
Name Date Size #Lines LOC

..--

.google/03-May-2024-2519

Application/03-May-2024-1,9771,134

gradle/wrapper/03-May-2024-66

screenshots/03-May-2024-

CONTRIB.mdD03-May-20241.6 KiB3627

CONTRIBUTING.mdD03-May-20241.5 KiB3627

LICENSED03-May-202411.1 KiB204170

README.mdD03-May-20243.8 KiB9266

big_icon.pngD03-May-202466.6 KiB

build.gradleD03-May-202411 120

gradlewD03-May-20245 KiB165122

gradlew.batD03-May-20242.3 KiB9166

packaging.yamlD03-May-2024457 1610

settings.gradleD03-May-202422 21

README.md

1
2Android HdrViewfinder Sample
3===================================
4
5This demo implements a real-time high-dynamic-range camera viewfinder, by alternating
6the sensor's exposure time between two exposure values on even and odd frames, and then
7compositing together the latest two frames whenever a new frame is captured.
8
9Introduction
10------------
11
12A small demo of advanced camera functionality with the Android camera2 API.
13
14This demo implements a real-time high-dynamic-range camera viewfinder,
15by alternating the sensor's exposure time between two exposure values on even and odd
16frames, and then compositing together the latest two frames whenever a new frame is
17captured.
18
19The demo has three modes: Regular auto-exposure viewfinder, split-screen manual exposure,
20and the fused HDR viewfinder.  The latter two use manual exposure controlled by the user,
21by swiping up/down on the right and left halves of the viewfinder.  The left half controls
22the exposure time of even frames, and the right half controls the exposure time of odd frames.
23
24In split-screen mode, the even frames are shown on the left and the odd frames on the right,
25so the user can see two different exposures of the scene simultaneously.  In fused HDR mode,
26the even/odd frames are merged together into a single image.  By selecting different exposure
27values for the even/odd frames, the fused image has a higher dynamic range than the regular
28viewfinder.
29
30The HDR fusion and the split-screen viewfinder processing is done with RenderScript; as is the
31necessary YUV->RGB conversion. The camera subsystem outputs YUV images naturally, while the GPU
32and display subsystems generally only accept RGB data.  Therefore, after the images are
33fused/composited, a standard YUV->RGB color transform is applied before the the data is written
34to the output Allocation. The HDR fusion algorithm is very simple, and tends to result in
35lower-contrast scenes, but has very few artifacts and can run very fast.
36
37Data is passed between the subsystems (camera, RenderScript, and display) using the
38Android [android.view.Surface][1] class, which allows for zero-copy transport of large
39buffers between processes and subsystems.
40
41[1]: http://developer.android.com/reference/android/view/Surface.html
42
43Pre-requisites
44--------------
45
46- Android SDK 27
47- Android Build Tools v27.0.2
48- Android Support Repository
49
50Screenshots
51-------------
52
53<img src="screenshots/image1.png" height="400" alt="Screenshot"/>
54
55Getting Started
56---------------
57
58This sample uses the Gradle build system. To build this project, use the
59"gradlew build" command or use "Import Project" in Android Studio.
60
61Support
62-------
63
64- Google+ Community: https://plus.google.com/communities/105153134372062985968
65- Stack Overflow: http://stackoverflow.com/questions/tagged/android
66
67If you've found an error in this sample, please file an issue:
68https://github.com/googlesamples/android-HdrViewfinder
69
70Patches are encouraged, and may be submitted by forking this project and
71submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
72
73License
74-------
75
76Copyright 2017 The Android Open Source Project, Inc.
77
78Licensed to the Apache Software Foundation (ASF) under one or more contributor
79license agreements.  See the NOTICE file distributed with this work for
80additional information regarding copyright ownership.  The ASF licenses this
81file to you under the Apache License, Version 2.0 (the "License"); you may not
82use this file except in compliance with the License.  You may obtain a copy of
83the License at
84
85http://www.apache.org/licenses/LICENSE-2.0
86
87Unless required by applicable law or agreed to in writing, software
88distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
89WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
90License for the specific language governing permissions and limitations under
91the License.
92