本文整理匯總了Java中org.opencv.imgproc.Imgproc.bilateralFilter方法的典型用法代碼示例。如果您正苦於以下問題:Java Imgproc.bilateralFilter方法的具體用法?Java Imgproc.bilateralFilter怎麽用?Java Imgproc.bilateralFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.opencv.imgproc.Imgproc
的用法示例。
在下文中一共展示了Imgproc.bilateralFilter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: blur
import org.opencv.imgproc.Imgproc; //導入方法依賴的package包/類
/**
* Softens an image using one of several filters.
*
* @param input
* The image on which to perform the blur.
* @param type
* The blurType to perform.
* @param doubleRadius
* The radius for the blur.
* @param output
* The image in which to store the output.
*/
private void blur(Mat input, BlurType type, double doubleRadius, Mat output) {
int radius = (int) (doubleRadius + 0.5);
int kernelSize;
switch (type) {
case BOX:
kernelSize = 2 * radius + 1;
Imgproc.blur(input, output, new Size(kernelSize, kernelSize));
break;
case GAUSSIAN:
kernelSize = 6 * radius + 1;
Imgproc.GaussianBlur(input, output, new Size(kernelSize, kernelSize), radius);
break;
case MEDIAN:
kernelSize = 2 * radius + 1;
Imgproc.medianBlur(input, output, kernelSize);
break;
case BILATERAL:
Imgproc.bilateralFilter(input, output, -1, radius, radius);
break;
}
}
示例2: blur
import org.opencv.imgproc.Imgproc; //導入方法依賴的package包/類
/**
* Softens an image using one of several filters.
* @param input The image on which to perform the blur.
* @param type The blurType to perform.
* @param doubleRadius The radius for the blur.
* @param output The image in which to store the output.
*/
private void blur(Mat input, BlurType type, double doubleRadius,
Mat output) {
int radius = (int)(doubleRadius + 0.5);
int kernelSize;
switch(type){
case BOX:
kernelSize = 2 * radius + 1;
Imgproc.blur(input, output, new Size(kernelSize, kernelSize));
break;
case GAUSSIAN:
kernelSize = 6 * radius + 1;
Imgproc.GaussianBlur(input,output, new Size(kernelSize, kernelSize), radius);
break;
case MEDIAN:
kernelSize = 2 * radius + 1;
Imgproc.medianBlur(input, output, kernelSize);
break;
case BILATERAL:
Imgproc.bilateralFilter(input, output, -1, radius, radius);
break;
}
}
示例3: blur
import org.opencv.imgproc.Imgproc; //導入方法依賴的package包/類
/**
* Softens an image using one of several filters.
* @param input The image on which to perform the blur.
* @param type The blurType to perform.
* @param doubleRadius The radius for the blur.
* @param output The image in which to store the output.
*/
private void blur(Mat input, Blur.Type type, double doubleRadius,
Mat output) {
int radius = (int)(doubleRadius + 0.5);
int kernelSize;
switch(type){
case BOX:
kernelSize = 2 * radius + 1;
Imgproc.blur(input, output, new Size(kernelSize, kernelSize));
break;
case GAUSSIAN:
kernelSize = 6 * radius + 1;
Imgproc.GaussianBlur(input,output, new Size(kernelSize, kernelSize), radius);
break;
case MEDIAN:
kernelSize = 2 * radius + 1;
Imgproc.medianBlur(input, output, kernelSize);
break;
case BILATERAL:
Imgproc.bilateralFilter(input, output, -1, radius, radius);
break;
}
}
示例4: blur
import org.opencv.imgproc.Imgproc; //導入方法依賴的package包/類
/**
* Softens an image using one of several filters.
*
* @param input
* The image on which to perform the blur.
* @param type
* The blurType to perform.
* @param doubleRadius
* The radius for the blur.
* @param output
* The image in which to store the output.
*/
private void blur(Mat input, BlurType type, double doubleRadius, Mat output) {
int radius = (int) (doubleRadius + 0.5);
int kernelSize;
switch (type) {
case BOX:
kernelSize = 2 * radius + 1;
Imgproc.blur(input, output, new Size(kernelSize, kernelSize));
break;
case GAUSSIAN:
kernelSize = 6 * radius + 1;
Imgproc.GaussianBlur(input, output, new Size(kernelSize, kernelSize), radius);
break;
case MEDIAN:
kernelSize = 2 * radius + 1;
Imgproc.medianBlur(input, output, kernelSize);
break;
case BILATERAL:
Imgproc.bilateralFilter(input, output, -1, radius, radius);
break;
}
}
示例5: apply_filters
import org.opencv.imgproc.Imgproc; //導入方法依賴的package包/類
public Mat apply_filters(Mat input_mat) {
Mat blurred = new Mat();
Mat edges = new Mat();
Mat structure = new Mat();
Imgproc.GaussianBlur(input_mat,blurred,new Size(3,3),1); //Jack-ify the image
Imgproc.bilateralFilter(blurred,blurred,11,17,17);
Imgproc.Canny(blurred,edges,20,50);
structure = Imgproc.getStructuringElement(Imgproc.MORPH_RECT,new Size(45,45));
Imgproc.morphologyEx(edges,edges,Imgproc.MORPH_CLOSE,structure);
return edges;
}