numpy 3D-image array to 2D

后端 未结 1 2069
感情败类
感情败类 2021-02-19 21:52

I have a 3D-numpy array of a gray image, which looks something like this:

[[[120,120,120],[67,67,67]]...]

Obviously I have eve

1条回答
  •  渐次进展
    2021-02-19 22:07

    If the shape of your ndarray is (M, N, 3), then you can get an (M, N) gray-scale image like this:

    >>> gray = img[:,:,0]
    

    0 讨论(0)
提交回复
热议问题