cv2.error: OpenCV(4.5.5) /io/opencv/modules/core/src/arithm.cpp:652: error: (-215:Assertion failed)

[ WARN:[email protected]] global /io/opencv/modules/imgcodecs/src/loadsave.cpp (239) findDecoder imread_('/home/ubuntu/data/imgnet2012-lsfsl/train_split/base/n06785654_11701.JPEG'): can't open/read file: check file path/integrity
Traceback (most recent call last):
  File "/home/ubuntu/code/ls_multi_model/utils/img2mask.py", line 130, in 
    add_mask2image_files(images_path, masks_path, fore_path, back_path)
  File "/home/ubuntu/code/ls_multi_model/utils/img2mask.py", line 107, in add_mask2image_files
    output_back = cv2.subtract(img, img_ori, mask=mask_back)  #将image的相素值和mask像素值相加得到结果
cv2.error: OpenCV(4.5.5) /io/opencv/modules/core/src/arithm.cpp:652: error: (-215:Assertion failed) type2 == CV_64F && (sz2.height == 1 || sz2.height == 4) in function 'arithm_op'

解决方法
90%的问题出现在路径上!先查看路径是否出错,再查看文件本身是否有错误!

此处地址为:

/base/n06785654_11701.JPEG

正确地址为:

/base/n06785654/n06785654_11701.JPEG

你可能感兴趣的:(python,debug,ubuntu,opencv,linux)