使用下面提到的代码,我试图重塑图像并将其用于特定的行和列参数
import cv2
import numpy as np
#shapes of both the image has to same
img1 = cv2.imread('3DScatter.png')
img2 = cv2.imread('python2.png')
# I want to put logo on top-left corner, So I create a ROI
rows,cols,channels = img2.shape
roi = img1[0:rows, 0:cols ]
# Now create a mask of logo and create its inverse mask
img2gray = cv2.cvtColor(img2,cv2.COLOR_BGR2GRAY)
cv2.imshow('mask', mask)
cv2.waitKey(0)
cv2.destroyAllWindows()
但是在使用此co面对错误时,由于该错误我无法重塑图像
Traceback (most recent call last):
File "C:/Users/Misha/Desktop/test/CV/ImageArithmatics and Logics.py", line 29, in <module>
rows,cols,channels = img2.shape
AttributeError: 'NoneType' object has no attribute 'shape'
对此的任何建议都将真正有帮助