本文整理汇总了Python中scipy.ndimage.filters.sobel方法的典型用法代码示例。如果您正苦于以下问题:Python filters.sobel方法的具体用法?Python filters.sobel怎么用?Python filters.sobel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy.ndimage.filters
的用法示例。
在下文中一共展示了filters.sobel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_jumps2
# 需要导入模块: from scipy.ndimage import filters [as 别名]
# 或者: from scipy.ndimage.filters import sobel [as 别名]
def find_jumps2(self,ds,threshold=30000):
self._prepare_find_jumps()
ds = self._hf[ds]
offset=ds[0]
# first we remove a bit of noise
#flt = gaussian_filter1d(ds,10)
flt = median_filter(ds,size=10)
#flt = ds
# the sobel filter finds the "jumps"
sb=sobel(flt)
for i in sb:
self.qps_jpn_hight.append(float(i))
for i in flt: self.qps_jpn_spec.append(float(i))
"""
for i in xrange(flt.shape[0]-1):
if(abs(sb[i])>threshold):
offset -= sb[i]
self.qps_jpn_spec.append(float(flt[i]-offset))
else:
self.qps_jpn_spec.append(float(flt[i]-offset))
"""
#for i in sb
示例2: split_traces
# 需要导入模块: from scipy.ndimage import filters [as 别名]
# 或者: from scipy.ndimage.filters import sobel [as 别名]
def split_traces(self,ds,threshold=30000):
self._prepare_find_jumps()
ds = self._hf[ds]
# first we remove a bit of noise, size is the number of averages
#flt = gaussian_filter1d(ds,10)
flt = median_filter(ds,size=3)
#flt = ds
# the sobel filter finds the "jumps"
sb=sobel(flt)
for i in sb:
self.qps_jpn_hight.append(float(i))
#for i in flt: self.qps_jpn_spec.append(float(i))
offset=ds[0]
tr_num = 0
tr_name = "qps_tr_"+str(tr_num)
tr_obj = self._hf.add_value_vector(tr_name,
folder = 'analysis',
x = self._x_co,
unit = 'Hz')
keepout = 4
for i,tr in enumerate(flt):
keepout += 1
if abs(sb[i])>threshold and keepout>3:
keepout = 0
# new trace
tr_num +=1
tr_name = "qps_tr_"+str(tr_num)
tr_obj = self._hf.add_value_vector(tr_name,
folder = 'analysis',
x = self._x_co,
unit = 'Hz')
print tr , i
#tr_obj.append(float(tr))
else:
if keepout>2:
tr_obj.append(float(tr-offset))
示例3: compute_gradmag
# 需要导入模块: from scipy.ndimage import filters [as 别名]
# 或者: from scipy.ndimage.filters import sobel [as 别名]
def compute_gradmag(image_arr):
""" Compute gradient magnitude image of a 2D (grayscale) image. """
assert image_arr.ndim == 2
dy = sobel(image_arr, axis=0)
dx = sobel(image_arr, axis=1)
return np.hypot(dx, dy)