我有一个形状为(1024,1024)的单通道图像。
我想使用dst = cv2.addWeighted(im, 1, newimg, 1, 0)将其与形状(1024,1024,3)的彩色图像叠加
首先,我想知道如何将newimg转换为形状为1024x1024x3的1024x1024x3...Because im
发布于 2019-08-31 13:39:56
这似乎是一个使用numpy的简单解决方案。
Create a 3-channel black image
Put your same grayscale image into each channelnewimage = np.zeros((grayimage.shape[0],grayimage.shape[1],3))
newimage[:,:,0] = grayimage
newimage[:,:,1] = grayimage
newimage[:,:,2] = grayimage发布于 2020-11-17 21:50:51
mask = cv2.inRange(frame, lower_blue, upper_blue)
print(mask.shape)
mask2 = cv2.cvtColor(mask, cv2.COLOR_GRAY2BGR)
print(mask2.shape)
Output:
(480, 640)
(480, 640, 3)这会将图像转换为3通道。
https://stackoverflow.com/questions/57735396
复制相似问题