how to copy numpy array value into higher dimensions

后端 未结 7 2021
一生所求
一生所求 2020-12-06 10:22

I have a (w,h) np array in 2d. I want to make a 3d dimension that has a value greater than 1 and copy its value over along the 3rd dimensions. I was hoping broadcast would d

相关标签:
7条回答
  • 2020-12-06 11:12

    Better helpful in converting gray a-channel matrix into 3 channel matrix.

    img3 = np.zeros((gray.shape[0],gray.shape[1],3))
    img3[:,:,0] = gray
    img3[:,:,1] = gray
    img3[:,:,2] = gray
    fig = plt.figure(figsize = (15,15))
    plt.imshow(img3)
    
    0 讨论(0)
提交回复
热议问题