opencv bgr2rgb转换其实就是在Channel维度B通道和R通道互换:
import numpy as np
img = np.arange(12).reshape((2,2,3))
print(img)
结果:
[[[ 0 1 2]
[ 3 4 5]]
[[ 6 7 8]
[ 9 10 11]]]
img_ = img[:,:,::-1]
print(img_)
结果:
[[[ 2 1 0]
[ 5 4 3]]
[[ 8 7 6]
[11 10 9]]]