Android-x86
Fork
Spenden

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-media: Commit

system/media


Commit MetaInfo

Revision00d504d2d3d14a8a11113993aa9c28ff61541d36 (tree)
Zeit2018-06-08 02:44:00
AutorYin-Chia Yeh <yinchiayeh@goog...>
CommiterYin-Chia Yeh

Log Message

Camera: update tonemap images

Also check in the plot script.

Bug: 74942037
Merged-In: If3cf99c83470f146f5e68714274b74d8e719e372
Change-Id: If3cf99c83470f146f5e68714274b74d8e719e372

Ändern Zusammenfassung

Diff

Binary files a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png differ
Binary files a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png differ
Binary files a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png differ
Binary files a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png differ
Binary files a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png differ
--- a/camera/docs/metadata-generate
+++ b/camera/docs/metadata-generate
@@ -36,6 +36,7 @@ fi
3636 thisdir=$(cd "$(dirname "$0")"; pwd)
3737 fwkdir="$ANDROID_BUILD_TOP/frameworks/base/core/java/android/hardware/camera2/"
3838 fwkdir_html="$ANDROID_BUILD_TOP/frameworks/base/docs/html/reference"
39+ndkdir_html="$ANDROID_BUILD_TOP/frameworks/native/docs"
3940 hidldir="$ANDROID_BUILD_TOP/hardware/interfaces/camera/metadata"
4041 ctsdir="$ANDROID_BUILD_TOP/cts/tests/camera/src/android/hardware/camera2/cts"
4142 outdir="$ANDROID_PRODUCT_OUT/obj/ETC/system-media-camera-docs_intermediates"
@@ -183,6 +184,7 @@ function copy_directory() {
183184 echo "ERROR: Failed to copy $(relpath "$src") to $(relpath "$dst")" >& 2
184185 else
185186 echo "OK: Copied $(relpath "$src") to $(relpath "$dst")"
187+ out_files+=$'\n'" $dst"
186188 fi
187189
188190 return $retval
@@ -238,6 +240,9 @@ gen_file camera_device_info.mako ./camera_device_info.proto || exit 1
238240 # Copy ./images directory into javadoc directory
239241 copy_directory "images" "$fwkdir_html" || exit 1
240242
243+# Copy ./images directory into ndk doc directory
244+copy_directory "images" "$ndkdir_html" || exit 1
245+
241246 echo ""
242247 echo "===================================================="
243248 echo "Successfully generated all metadata source files"
--- /dev/null
+++ b/camera/docs/plots.py
@@ -0,0 +1,211 @@
1+#!/bin/ipython
2+
3+import argparse
4+import numpy as np
5+import matplotlib.pyplot as plt
6+import sys
7+
8+## general defines
9+
10+linecolor = "#%x%x%x" % ( 217, 234, 211 )
11+markercolor = "#%x%x%x" % ( 217/2, 234/2, 211/2 )
12+
13+# Draw pretty plot
14+def doc_plot(fig, x, y):
15+
16+ plt.figure(fig.number)
17+ fig.clear()
18+
19+ lines, = plt.plot(x,y)
20+ lines.set_color(linecolor)
21+ lines.set_linewidth(4)
22+ lines.set_marker('o')
23+ lines.set_markeredgecolor(markercolor)
24+ lines.set_markersize(6)
25+ lines.set_markeredgewidth(2)
26+
27+ axes = fig.get_axes()[0]
28+ axes.set_aspect(1)
29+ axes.set_ybound(0,1)
30+ axes.set_xbound(0,1)
31+ axes.grid(True)
32+ axes.xaxis.label.set_text(r'$P_{IN}$')
33+ axes.xaxis.label.set_fontsize(14)
34+ axes.yaxis.label.set_text(r'$P_{OUT}$')
35+ axes.yaxis.label.set_fontsize(14)
36+
37+# Print out interleaved coefficients for HAL3 tonemap curve tags
38+def doc_coeff(x,y):
39+ coeffs = np.vstack((x, y)).reshape(-1,order='F')
40+ coeff_str = "[ "
41+ for val in coeffs[:-1]:
42+ coeff_str += "%0.4f, " % val
43+
44+ coeff_str += "%0.4f ]" % coeffs[-1]
45+
46+ print coeff_str
47+
48+def doc_map(fig, imgMap, index):
49+ plt.figure(fig.number)
50+ fig.clear()
51+ plt.imshow(imgMap - 1, interpolation='nearest')
52+ for x in range(0, np.size(imgMap, 1)):
53+ for y in range(0, np.size(imgMap, 0)):
54+ plt.text(x,y, imgMap[y,x,index], color='white')
55+
56+ axes = fig.get_axes()[0]
57+ axes.set_xticks(range(0, np.size(imgMap, 1)))
58+ axes.set_yticks(range(0, np.size(imgMap, 0)))
59+
60+## Check arguments
61+
62+parser = argparse.ArgumentParser(description='Draw plots for camera HAL3.x implementation spec doc')
63+parser.add_argument('--save_figures', default=False, action='store_true',
64+ help='Save figures as pngs')
65+
66+args = parser.parse_args()
67+
68+## Linear mapping
69+
70+x_lin = np.linspace(0,1,2)
71+y_lin = x_lin
72+
73+lin_fig = plt.figure(1)
74+doc_plot(lin_fig, x_lin, y_lin)
75+
76+lin_title = 'Linear tonemapping curve'
77+plt.title(lin_title)
78+print lin_title
79+doc_coeff(x_lin, y_lin)
80+
81+if args.save_figures:
82+ plt.savefig('linear_tonemap.png',bbox_inches='tight')
83+
84+## Inverse mapping
85+
86+x_inv = x_lin
87+y_inv = 1 - x_lin
88+
89+inv_fig = plt.figure(2)
90+doc_plot(inv_fig, x_inv, y_inv)
91+
92+inv_title = 'Inverting tonemapping curve'
93+plt.title(inv_title)
94+print inv_title
95+doc_coeff(x_inv, y_inv)
96+
97+if args.save_figures:
98+ plt.savefig('inverse_tonemap.png',bbox_inches='tight')
99+
100+## Gamma 1/2.2
101+
102+x_gamma = np.linspace(0, 1, 16);
103+
104+y_gamma = x_gamma**(1/2.2)
105+
106+gamma_fig = plt.figure(3)
107+doc_plot(gamma_fig, x_gamma, y_gamma)
108+
109+gamma_title = r'$\gamma=1/2.2$ tonemapping curve'
110+plt.title(gamma_title)
111+print gamma_title
112+doc_coeff(x_gamma, y_gamma)
113+
114+if args.save_figures:
115+ plt.savefig('gamma_tonemap.png',bbox_inches='tight')
116+
117+## sRGB curve
118+
119+x_srgb = x_gamma
120+y_srgb = np.where(x_srgb <= 0.0031308, x_srgb * 12.92, 1.055*x_srgb**(1/2.4)-0.055)
121+
122+srgb_fig = plt.figure(4)
123+doc_plot(srgb_fig, x_srgb, y_srgb)
124+
125+srgb_title = 'sRGB tonemapping curve'
126+plt.title(srgb_title)
127+print srgb_title
128+doc_coeff(x_srgb, y_srgb)
129+
130+if args.save_figures:
131+ plt.savefig('srgb_tonemap.png',bbox_inches='tight')
132+
133+## Sample lens shading map
134+
135+shadingMapSize = np.array([3, 4])
136+shadingMap1 = np.array(
137+ [ 1.3, 1.2, 1.15, 1.2, 1.2, 1.2, 1.15, 1.2, 1.1, 1.2, 1.2, 1.2, 1.3, 1.2, 1.3, 1.3,
138+ 1.2, 1.2, 1.25, 1.1, 1.1, 1.1, 1.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.2, 1.3, 1.25, 1.2,
139+ 1.3, 1.2, 1.2, 1.3, 1.2, 1.15, 1.1, 1.2, 1.2, 1.1, 1.0, 1.2, 1.3, 1.15, 1.2, 1.3 ])
140+redMap = shadingMap1[0::4].reshape(shadingMapSize)
141+greenEMap = shadingMap1[1::4].reshape(shadingMapSize)
142+greenOMap = shadingMap1[2::4].reshape(shadingMapSize)
143+blueMap = shadingMap1[3::4].reshape(shadingMapSize)
144+
145+rgbMap = np.dstack( (redMap, (greenEMap + greenOMap) / 2, blueMap) )
146+redMap = np.dstack( (redMap, np.zeros(shadingMapSize), np.zeros(shadingMapSize) ) )
147+greenEMap = np.dstack( (np.zeros(shadingMapSize), greenEMap, np.zeros(shadingMapSize) ) )
148+greenOMap = np.dstack( (np.zeros(shadingMapSize), greenOMap, np.zeros(shadingMapSize) ) )
149+blueMap = np.dstack( (np.zeros(shadingMapSize), np.zeros(shadingMapSize), blueMap ) )
150+
151+redImg = plt.figure(5)
152+doc_map(redImg, redMap, 0)
153+plt.title('Red lens shading map')
154+
155+if args.save_figures:
156+ plt.savefig('red_shading.png',bbox_inches='tight')
157+
158+greenEImg = plt.figure(6)
159+doc_map(greenEImg, greenEMap, 1)
160+plt.title('Green (even rows) lens shading map')
161+
162+if args.save_figures:
163+ plt.savefig('green_e_shading.png',bbox_inches='tight')
164+
165+greenOImg = plt.figure(7)
166+doc_map(greenOImg, greenOMap, 1)
167+plt.title('Green (odd rows) lens shading map')
168+
169+if args.save_figures:
170+ plt.savefig('green_o_shading.png',bbox_inches='tight')
171+
172+blueImg = plt.figure(8)
173+doc_map(blueImg, blueMap, 2)
174+plt.title('Blue lens shading map')
175+
176+if args.save_figures:
177+ plt.savefig('blue_shading.png',bbox_inches='tight')
178+
179+rgbImg = plt.figure(9)
180+
181+rgbImg.clear()
182+plt.imshow(1/rgbMap,interpolation='bicubic')
183+
184+axes = rgbImg.get_axes()[0]
185+axes.set_xticks(range(0, np.size(rgbMap, 1)))
186+axes.set_yticks(range(0, np.size(rgbMap, 0)))
187+
188+plt.title('Image of uniform white wall (inverse shading map)')
189+
190+if args.save_figures:
191+ plt.savefig('inv_shading.png',bbox_inches='tight')
192+
193+# Rec. 709
194+x_rec709 = x_gamma
195+y_rec709 = np.where(x_rec709 <= 0.018, x_rec709 * 4.500, 1.099*x_rec709**0.45-0.099)
196+
197+rec709_fig = plt.figure(10)
198+doc_plot(rec709_fig, x_rec709, y_rec709)
199+
200+rec709_title = 'Rec. 709 tonemapping curve'
201+plt.title(rec709_title)
202+print rec709_title
203+doc_coeff(x_rec709, y_rec709)
204+
205+if args.save_figures:
206+ plt.savefig('rec709_tonemap.png',bbox_inches='tight')
207+
208+
209+# Show figures
210+
211+plt.show()
Show on old repository browser