写了一个程序,来实现对输入图像进行水平翻折时再次遇到
AttributeError: 'NoneType' object has no attribute 'shape'
这个错误
D:\Python\python.exe E:/XX/XXXX/XXX/XXXX/XX/XX/左右翻折图像.py
Traceback (most recent call last):
File "E:/XX/XXXX/XXX/XXXX/XX/XX/左右翻折图像.py", line 56, in <module>
augment_data_by_rot(img_dir, dst_dir)
File "E:/XX/XXXX/XXX/XXXX/XX/XX/左右翻折图像.py", line 38, in augment_data_by_rot
(h, w) = img.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'
进程已结束,退出代码 1
解决方法: 将绝对路径替换成相对路径问题就解决了(/ω\),不知道是否和使用pycharm有关
水平翻折图像的代码如下: