Layout of the output array img is incompatible with cv::Mat (step[ndims-1] !

Layout of the output array img is incompatible with cv::Mat (step[ndims-1] 

 

https://blog.csdn.net/tqcai666/article/details/81751207

 

解决方法:调用copy方法就可以了,原因未知

image = image.copy() # Change

 

注意:

得在下面一行加,上面一行加还是报错:

 a=img1.numpy()*255
        img = a.transpose(1, 2, 0).astype(np.uint8).copy()

你可能感兴趣的:(python宝典,pytorch知识宝典)