Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 什么是Matlab的python等价物';s stdfilt()函数?_Python 2.7 - Fatal编程技术网

Python 2.7 什么是Matlab的python等价物';s stdfilt()函数?

Python 2.7 什么是Matlab的python等价物';s stdfilt()函数?,python-2.7,Python 2.7,我试图将Matlab中的一段代码转换为python。在那里,我可以找到一个标准偏差过滤器函数“stdfilt()”,在python中找不到任何等效的API。 下面给出了Matlab代码 Ig_med = medfilt2(Input_Image); h_gauss = fspecial('gaussian',11,2); h_avg = fspecial('average',121); I = imfilter(Ig_med,h_gauss,'corr','replicate'); P = s

我试图将Matlab中的一段代码转换为python。在那里,我可以找到一个标准偏差过滤器函数“stdfilt()”,在python中找不到任何等效的API。 下面给出了Matlab代码

Ig_med = medfilt2(Input_Image);
h_gauss = fspecial('gaussian',11,2);
h_avg = fspecial('average',121);
I = imfilter(Ig_med,h_gauss,'corr','replicate');

P = stdfilt(I,ones(121));
P = P.^2; 

Q = imfilter(P,h_avg,'corr','replicate');
有人能帮我用Python实现上面的代码吗

提前谢谢

我在网上找到了一些东西

也许会有帮助! (考虑到3年的延迟,我想不是你,而是网络上的某个人)

from scipy.ndimage.filters import generic_filter
import numpy as np

I_filt = generic_filter(I, np.std, size=3)