summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3
ModeNameSize
d---------algorithms434logplain
d---------data84logplain
-rw-r--r--ipa_context.cpp6206logplain
-rw-r--r--ipa_context.h1631logplain
-rw-r--r--ipu3-ipa-design-guide.rst8300logplain
-rw-r--r--ipu3.cpp23375logplain
-rw-r--r--meson.build907logplain
-rw-r--r--module.h493logplain
r">""" def lux_calc(Cam, Img, patches, channels): """ find means color channels on grey patches """ ap_r = np.mean(patches[0][3::4]) ap_g = (np.mean(patches[1][3::4])+np.mean(patches[2][3::4]))/2 ap_b = np.mean(patches[3][3::4]) Cam.log += '\nAverage channel values on grey patches:' Cam.log += '\nRed = {:.0f} Green = {:.0f} Blue = {:.0f}'.format(ap_r, ap_b, ap_g) # print(ap_r, ap_g, ap_b) """ calculate channel gains """ gr = ap_g/ap_r gb = ap_g/ap_b Cam.log += '\nChannel gains: Red = {:.3f} Blue = {:.3f}'.format(gr, gb) """ find means color channels on image and scale by gain note greens are averaged together (treated as one channel) """ a_r = np.mean(channels[0])*gr a_g = (np.mean(channels[1])+np.mean(channels[2]))/2 a_b = np.mean(channels[3])*gb Cam.log += '\nAverage channel values over entire image scaled by channel gains:' Cam.log += '\nRed = {:.0f} Green = {:.0f} Blue = {:.0f}'.format(a_r, a_b, a_g) # print(a_r, a_g, a_b) """ Calculate y with top row of yuv matrix """ y = 0.299*a_r + 0.587*a_g + 0.114*a_b Cam.log += '\nY value calculated: {}'.format(int(y)) # print(y) return int(y)