예제 #1
0
def gaussianBlur(image, filterSize=43, sigma=opencvFilt2sigma(43)):
    """Blur an image with a particular strength filter.
    Default is 43, 139 gives a very strong blur, but takes a while
    """

    # Carry out the filter operation
    cv.cvSmooth(image, image, cv.CV_GAUSSIAN, filterSize, 0, sigma)
    return image
예제 #2
0
def gaussianBlur(image, filterSize=43, sigma=opencvFilt2sigma(43)):
    """Blur an image with a particular strength filter.
    Default is 43, 139 gives a very strong blur, but takes a while
    """
    
    # Carry out the filter operation
    cv.cvSmooth(image, image, cv.CV_GAUSSIAN, filterSize, 0, sigma)
    return image
예제 #3
0
def mlGaussianBlur(image):
    """Method using code from Sturla on the [email protected]"""
    img = array(image)
    sigma = opencvFilt2sigma(43.0)
    gain = gaussian2D(np.ones(image.shape[0:2]), sigma)  # corrects edges

    for i in range(3):
        img[:, :, i] = gaussian2D(img[:, :, i], sigma) / gain
    return img
예제 #4
0
파일: blur_scipy.py 프로젝트: Foued70/pycam
def mlGaussianBlur(image):
    """Method using code from Sturla on the [email protected]"""
    img = array(image)
    sigma = opencvFilt2sigma(43.0)
    gain = gaussian2D(np.ones(image.shape[0:2]), sigma) # corrects edges
    
    for i in range(3):
       img[:,:,i] = gaussian2D(img[:,:,i], sigma) / gain
    return img
예제 #5
0
파일: blur_scipy.py 프로젝트: Foued70/pycam
def gaussianBlur3Way(np_image, sigma=opencvFilt2sigma(43.0)):
    """Blur an image with scipy using 3 seperate gaussian filters
    This is exactly equivalent to the above function"""
    
    r = ndimage.filters.gaussian_filter(np_image[:,:,0], sigma=(sigma, sigma))
    g = ndimage.filters.gaussian_filter(np_image[:,:,1], sigma=(sigma, sigma))
    b = ndimage.filters.gaussian_filter(np_image[:,:,2], sigma=(sigma, sigma))

    return array([r,g,b]).transpose((1,2,0))
예제 #6
0
def gaussianBlur3Way(np_image, sigma=opencvFilt2sigma(43.0)):
    """Blur an image with scipy using 3 seperate gaussian filters
    This is exactly equivalent to the above function"""

    r = ndimage.filters.gaussian_filter(np_image[:, :, 0],
                                        sigma=(sigma, sigma))
    g = ndimage.filters.gaussian_filter(np_image[:, :, 1],
                                        sigma=(sigma, sigma))
    b = ndimage.filters.gaussian_filter(np_image[:, :, 2],
                                        sigma=(sigma, sigma))

    return array([r, g, b]).transpose((1, 2, 0))
예제 #7
0
@scipyFromOpenCV
def mlGaussianBlur(image):
    """Method using code from Sturla on the [email protected]"""
    img = array(image)
    sigma = opencvFilt2sigma(43.0)
    gain = gaussian2D(np.ones(image.shape[0:2]), sigma)  # corrects edges

    for i in range(3):
        img[:, :, i] = gaussian2D(img[:, :, i], sigma) / gain
    return img


########

sigma = opencvFilt2sigma(43.0)


@scipyFromOpenCV
def gaussianBlur(np_image):
    """Blur an image with scipy"""

    result = ndimage.filters.gaussian_filter(np_image,
                                             sigma=(sigma, sigma, 0),
                                             order=0,
                                             mode='reflect')
    return result


def testGaussianBlur():
    """Test that the guassian blur function gives the exact same output
예제 #8
0
파일: blur_scipy.py 프로젝트: Foued70/pycam
   return tmp[:n,:m]
   

@scipyFromOpenCV
def mlGaussianBlur(image):
    """Method using code from Sturla on the [email protected]"""
    img = array(image)
    sigma = opencvFilt2sigma(43.0)
    gain = gaussian2D(np.ones(image.shape[0:2]), sigma) # corrects edges
    
    for i in range(3):
       img[:,:,i] = gaussian2D(img[:,:,i], sigma) / gain
    return img
########

sigma = opencvFilt2sigma(43.0)

@scipyFromOpenCV
def gaussianBlur(np_image):
    """Blur an image with scipy"""
    
    
    result = ndimage.filters.gaussian_filter(np_image, 
                            sigma=(sigma, sigma, 0),
                            order=0,
                            mode='reflect'
                            )
    return result

def testGaussianBlur():
    """Test that the guassian blur function gives the exact same output