matplot RGB vs opencv BGR vs caffe images | C++ Python. Computer Vision Deep Learning | KeZunLin's Blog
Guide Matplot (skimage/ PIL Image) import matplotlib.pyplot as plt import matplotlib.image as img image = img.imread("images/cat.jpg") print image.shape print image[:5,:5,0] plt.imshow(image) plt.show() (360, 480, 3) [[26 27 25 28 30] [26 27 25 26 28] [26
kezunlin.me
각 라이브러리마다 이미지 정보를 담는 형식이 다르다.
dims | order | range | dtype | |
matplotlib.pyplot | HWC | RGB | [0,255] | uint8 |
PIL.Image | HWC | RGB | [0,255] | uint8 |
skimage | HWC | RGB | [0,255] | unit8 |
OpenCV | HWC | BGR | [0,255] | uint8 |
caffe.io.load_image | HWC | RGB | [0,1] | float32 |
※ channel last 로 다 되어있는 이유는 벡엔드를 Theano로 하지 않아서인듯
A Gentle Introduction to Channels-First and Channels-Last Image Formats
Color images have height, width, and color channel dimensions. When represented as three-dimensional arrays, the channel dimension for the image data is last by default, but may be moved to be the first dimension, often for performance-tuning reasons. The
machinelearningmastery.com
백엔드에 따라서 Channel 순서가 달라진다.
[2] Selective Search (0) | 2021.04.12 |
---|---|
[1] CNN Image Classifier to Object Detector (0) | 2021.04.12 |
OpenCV fundamentals (0) | 2021.04.09 |
Scene Text Recognition (0) | 2021.04.01 |
Object Detection (R-CNN) (0) | 2021.03.26 |