我有以下MATLAB代码,并想用Python重写它:
mean_ssd = sum(sum((imSrc1 - imSrc2).^2))/numel(imSrc1);
我在Python中所做的工作如下:
width, height = Image.open(open(im1)).size
number_of_pixels = width * height
mean_ssd = sum[math.pow(sum[(imSrc1 - imSrc2)], 2)] / number_of_pixels
但是,我在Python中遇到以下错误:
TypeError: unsupported operand type(s) for -: 'instance' and 'instance'
如何用Python重写MATLAB代码
谢谢
试试这个:
相关问题 更多 >
编程相关推荐