OpenCV(4.1.2) C:\projects\opencv-python\open-cv\modules\highgui\src\window.cpp:376:error(-215:Assertion failed) size.width>0 && size.height>0 in function ‘imshow’
问题:考虑图片路径加载的问题,同时图片路径注意用“/“代替“\”或在路径前加“r”,如r"D:\BaiduNetdiskWorkspace\Annotions\out"
解决办法:
def cv_imread(filePath):
cv_img = cv2.imdecode(np.fromfile(filePath, dtype=np.uint8), -1)
return cv_img
img = cv_imread(im_path)
filepath为你读取的图片路径,来自于im_path传输