OpenCV
index
 
Name blur ( )
Examples
OpenCV blur

import hypermedia.video.*; size( 160, 120 ); OpenCV opencv = new OpenCV(this); opencv.loadImage("P1000201.jpg"); opencv.ROI( 0, 60, 160, 60 ); opencv.blur( OpenCV.BLUR, 13 ); image( opencv.image(), 0, 0 );
Description Smoothes the image in one of several ways.

Type of the smoothing operation: CV_BLUR_NO_SCALE (simple blur with no scaling) - for each pixel the result is a sum of pixels values in param1×param2 neighborhood of the pixel. If the neighborhood size varies from pixel to pixel, compute the sums using integral image (cvIntegral). CV_BLUR (simple blur) - for each pixel the result is a mean of pixel values param1×param2 neighborhood of the pixel. CV_GAUSSIAN (Gaussian blur) - the image is smoothed using the Gaussian kernel of size param1×param2. param3 and param4 may optionally be used to specify shape of the kernel. CV_MEDIAN (median blur) - the image is smoothed using medial filter of size param1×param1. That is, for each pixel the result is the median computed over param1×param1 neighborhood. CV_BILATERAL (bilateral filter) - the image is smoothed using a bilateral 3x3 filter with color sigma=param1 and space sigma=param2. Information about bilateral filtering can be found at http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html - param1 The first parameter of smoothing operation. It should be odd (1, 3, 5, ...), so that a pixel neighborhood used for smoothing operation is symmetrical relative to the pixel. - param2 The second parameter of smoothing operation. In case of simple scaled/non-scaled and Gaussian blur if param2 is zero, it is set to param1. When not 0, it should be odd too. - param3 In case of Gaussian kernel this parameter may specify Gaussian sigma (standard deviation). If it is zero, it is calculated from the kernel size: sigma = (n/2 - 1)*0.3 + 0.8, where n=param1 for horizontal kernel, n=param2 for vertical kernel. With the standard sigma for small kernels (3×3 to 7×7) the performance is better. If param3 is not zero, while param1 and param2 are zeros, the kernel size is calculated from the sigma (to provide accurate enough operation). - param4 In case of non-square Gaussian kernel the parameter may be used to specify a different (from param3) sigma in the vertical direction.

Syntax
blur(type, param);
blur(type, param1, param2, sigma, diffsigma);
Returns None
Usage Web & Application
Related