Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 4
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
Exemplo n.º 5
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))
Exemplo n.º 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))
Exemplo n.º 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
Exemplo n.º 8
0
   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