From 25ce6e0ecd59be727ee23f4d2c725fecae8df437 Mon Sep 17 00:00:00 2001 From: Oleg Dzhimiev Date: Tue, 14 May 2019 14:52:17 -0600 Subject: [PATCH] completed the last bayer configuration - Gb,B/R,Gr --- jp4.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/jp4.py b/jp4.py index bdc0156..473392b 100644 --- a/jp4.py +++ b/jp4.py @@ -110,6 +110,11 @@ class JP4: if self.bayer==[["Gr","R"],["B","Gb"]]: self.bayer = [["B","Gb"],["Gr","R"]] + elif self.exif.data['Orientation']==1: + self.bayer = [["Gb","B"],["R","Gr"]] + + + #im = ImageOps.mirror(im) #im = im.rotate(270) @@ -354,6 +359,24 @@ class JP4: G[1::2,1::2] = (p10 + narc(p10) + p01 + nabr(p01))/4 B[1::2,1::2] = (p00 + nabr(p00) + narc(p00 + nabr(p00)))/4 + elif bayer==[["Gb","B"],["R","Gr"]]: + + R[0::2,0::2] = (p10 + naur(p10))/2 + G[0::2,0::2] = (4*p00 + p11 + naur(p11) + nalc(p11 + naur(p11)))/8 + B[0::2,0::2] = (p01 + nalc(p01))/2 + + R[0::2,1::2] = (p10 + naur(p10) + narc(p10 + naur(p10)))/4 + G[0::2,1::2] = (p00 + narc(p00) + p11 + naur(p11))/4 + B[0::2,1::2] = p01 + + R[1::2,0::2] = p10 + G[1::2,0::2] = (p00 + nabr(p00) + p11 + nalc(p11))/4 + B[1::2,0::2] = (p01 + nabr(p01) + nalc(p01 + nabr(p01)))/4 + + R[1::2,1::2] = (p10 + narc(p10))/2 + G[1::2,1::2] = (4*p11 + p00 + nabr(p00) + narc(p00 + nabr(p00)))/8 + B[1::2,1::2] = (p01 + nabr(p01))/2 + # OpenCV uses BGR format I = np.dstack([B,G,R]) self.image = I -- 2.18.1