Python scipy.ndimage.filters.sobel() Examples

The following are 3 code examples of scipy.ndimage.filters.sobel(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module scipy.ndimage.filters , or try the search function .
Example #1
Source File: qps_rings.py    From qkit with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #2
Source File: qps_rings.py    From qkit with GNU General Public License v2.0 5 votes vote down vote up
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)) 
Example #3
Source File: saw_utils.py    From CGIntrinsics with MIT License 5 votes vote down vote up
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)