# Importing the libraries
import numpy as np
import cv2
# Load two images
img1 = cv2.imread(r'C:\Users\user1\Pictures\messi.jpg')
img2 = cv2.imread(r'C:\Users\user1\Pictures\opencvimp.jpg')
# I want to put logo on top-left corner, So I create a ROI
rows,cols,channels = img2.shape
以上代码给出了以下错误。
rows,cols,channels = img2.shape
AttributeError: 'NoneType' object has no attribute 'shape
img2.shape我做错了什么?
答案 0 :(得分:1)
img2
为None
。看起来该文件不是有效图像