天天看点

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