本文整理匯總了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)