报错:
error: OpenCV(4.0.1) ../modules/imgproc/src/resize.cpp:3784: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
原因1:图片无法识别
解决方法1:需要打印出来
原因2:图片路径不对
解决办法2:修改路径
两种方法对应标红的代码:
if __name__ == "__main__":
data_dir ="/home/zhongjia/Spaceweather/primary/trainset/continuum/alpha_new/"
for imagefile1 in os.listdir(data_dir):
for imagefile2 in os.listdir(data_dir):
print(os.path.join(data_dir,imagefile1))
print(os.path.join(data_dir,imagefile2))
img1 = cv2.imread(os.path.join(data_dir,imagefile1))
plt.imshow(img1)
plt.colorbar()
plt.show()
img2 = cv2.imread(os.path.join(data_dir,imagefile2))
plt.imshow(img2)
plt.colorbar()
plt.show()
runAllImageSimilaryFun(os.path.join(data_dir,imagefile1),os.path.join(data_dir,imagefile1))
i = i+1
if i >= 20:
break
之前错误代码:runAllImageSimilaryFun(imagefile1,imagefile2)