• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

Application/23-Nov-2023-1,7701,093

buildSrc/23-Nov-2023-1613

gradle/wrapper/23-Nov-2023-65

screenshots/23-Nov-2023-

CONTRIB.mdD23-Nov-20231.6 KiB3627

LICENSED23-Nov-202311.1 KiB204170

README.mdD23-Nov-20233.8 KiB9266

big_icon.pngD23-Nov-202366.6 KiB

build.gradleD23-Nov-2023251 129

gradlewD23-Nov-20235.2 KiB173128

gradlew.batD23-Nov-20232.2 KiB8561

packaging.yamlD23-Nov-2023457 1610

settings.gradleD23-Nov-202322 21

template-params.xmlD23-Nov-20234.4 KiB10575

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 28
47- Android Build Tools v28.0.3
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 2019 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