天天看點

cv2.line Layout of the output array img is incompatible with cv::Mat

原因應該是image的記憶體不連續導緻(猜測)。 解決辦法:

#method 1
img = img.copy()
#method 2
img = np.ascontiguousarray(img)     #np is numpy