代码在git
[r_gain, gr_gain, gb_gain, b_gain]
Out[5]: [1.5, 1.0, 1.0, 1.1]
rgb 矩阵
gb | b |
r | gr |
权重矩阵
gb_gain | b_gain |
r_gain | gr_gain |
for y in range(0, raw_h-1, 2):
for x in range(0, raw_w-1, 2):
if self.bayer_pattern == 'rggb':
r = self.img[y,x] * r_gain
gr = self.img[y,x+1] * gr_gain
gb = self.img[y+1,x] * gb_gain
b = self.img[y+1,x+1] * b_gain
awb_img[y,x] = r
awb_img[y,x+1] = gr
awb_img[y+1,x] = gb
awb_img[y+1,x+1] = b