linjieccc commited on
Commit
1c9ae5c
1 Parent(s): 94f7555

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -91,7 +91,15 @@ def dbc2sbc(s):
91
  return rs
92
 
93
 
 
 
 
 
 
 
 
94
  def np2base64(image_np):
 
95
  image = cv2.imencode('.jpg', image_np)[1]
96
  base64_str = str(base64.b64encode(image))[2:-1]
97
  return base64_str
 
91
  return rs
92
 
93
 
94
+ def BGR2RGB(img):
95
+ pilimg = img.copy()
96
+ pilimg[:, :, 0] = img[:, :, 2]
97
+ pilimg[:, :, 2] = img[:, :, 0]
98
+ return pilimg
99
+
100
+
101
  def np2base64(image_np):
102
+ image_np = BGR2RGB(image_np)
103
  image = cv2.imencode('.jpg', image_np)[1]
104
  base64_str = str(base64.b64encode(image))[2:-1]
105
  return base64_str