Opencv 中BRG转化为RBG格式

BGR to RGB

OpenCV image to Matplotlib

rgb = bgr[...,::-1]

RGB to BGR

Matplotlib image to OpenCV

bgr = rgb[...,::-1]
  •  

RGB to GBR

gbr = rgb[...,[2,0,1]]

 

展示结果: 

print("before",gray)
gray=gray[...,::-1]   #BRG to RGB
print("after gray",gray)


before: 
[[[172 168 187]
  [171 167 185]
  [174 169 181]

after: 
[[[187 168 172]
  [185 167 171]
  [181 169 174]

 

你可能感兴趣的:(Opencv 中BRG转化为RBG格式)