how to convert an RGB image to numpy array?

You can use newer OpenCV python interface (if I’m not mistaken it is available since OpenCV 2.2). It natively uses numpy arrays:

import cv2
im = cv2.imread("abc.tiff",mode="RGB")
print type(im)

result:

<type 'numpy.ndarray'>

Leave a Comment