2024-06-02 05:45:36 发布
网友
我有一个单通道图像的形状(10241024)。你知道吗
我想用彩色图像覆盖它的形状(10241024,3)使用 dst = cv2.addWeighted(im, 1, newimg, 1, 0)
dst = cv2.addWeighted(im, 1, newimg, 1, 0)
首先,我想知道,如何将newimg转换成1024x1024x3…因为im的形状是1024x1024x3
im
这似乎是一个使用numpy的简单解决方案。你知道吗
Create a 3-channel black image Put your same grayscale image into each channel
newimage = np.zeros((grayimage.shape[0],grayimage.shape[1],3)) newimage[:,:,0] = grayimage newimage[:,:,1] = grayimage newimage[:,:,2] = grayimage
见how to copy numpy array value into higher dimensions
这似乎是一个使用numpy的简单解决方案。你知道吗
见how to copy numpy array value into higher dimensions
相关问题 更多 >
编程相关推荐