How to convert a python numpy array to an RGB image with Opencv 2.4?

前端 未结 6 1912
不思量自难忘°
不思量自难忘° 2020-12-13 02:09

I have searched for similar questions, but haven\'t found anything helpful as most solutions use older versions of OpenCV.

I have a 3D numpy array, and I would like

6条回答
  •  粉色の甜心
    2020-12-13 02:25

    You are looking for scipy.misc.toimage:

    import scipy.misc
    rgb = scipy.misc.toimage(np_array)
    

    It seems to be also in scipy 1.0, but has a deprecation warning. Instead, you can use pillow and PIL.Image.fromarray

提交回复
热议问题