OPENCV



Name blur()
Examples blur
import hypermedia.video.*;

size( 120, 160 );

OpenCV opencv = new OpenCV(this);
opencv.loadImage("niolon-190607.jpg");
opencv.ROI( 60, 0, 60, 160 );
opencv.blur( OpenCV.BLUR, 13 );

image( opencv.image(), 0, 0 );

Description Smooth the image in one of several ways.
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 Bilateral Filtering
Syntax blur(type, param1);
blur(type, param1, param2, param3, param4);
Parameters
param1 int : 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 int : 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 float : 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 float : In case of non-square Gaussian kernel the parameter may be used to specify a different (from param3) sigma in the vertical direction.
Return None
Usage Application