• Home
  • Despre MMDB
  • Articole
    • Algoritmi prelucrare imagini
    • Algoritmi extragere caracteristici imagini
      • Caracteristici globale
      • Caracteristicile matricii de co-ocurenta
      • Caracteristici color
      • Filtre Gabor
    • Metode de indexare imagini in baze de date
    • Algortmi de cautare in baze de imagini
  • Cod JAVA
    • Algoritmi prelucrare imagini
    • Algoritmi extragere caracteristici imagini
      • Caracteristici globale
      • Caracteristicile matricii de co-ocurenta
      • Caracteristici color
    • Metode de indexare imagini in baze de date
    • Algortmi de cautare in baze de imagini
  • Baze de date de imagini
    • Grayscale Images Databases
    • Color/Hyperspectral Images
    • Biomedical Images
    • 3D Scanning
    • Biometric Images
  • Solutii implementate
  • Contact

Gaussian filter

Categorie: Algoritmi prelucrare imagini Publicat: 02 Septembrie 2015
Scris de Alex Accesări: 900
  • Tipărire
  • Email

In this chapter, we apply Gaussian filter to an image that blurs an image. We are going to use OpenCV function GaussianBlur to apply Gaussian filter to images. It can be found under Imgproc package. Its syntax is given below:

Imgproc.GaussianBlur(source, destination,Size,SigmaX);

The function arguments are described below:

Sr.No.Argument
1

source

It is source image.

2

destination

It is destination image.

3

Size

It is Gaussian kernel size.

4

SigmaX

It is Gaussian kernel standard deviation in X direction.

Apart from the GaussianBlur method, there are other methods provided by the Imgproc class. They are described briefly:

Sr.No.Methods
1

cvtColor(Mat src, Mat dst, int code, int dstCn)

It converts an image from one color space to another.

2

dilate(Mat src, Mat dst, Mat kernel)

It dilates an image by using a specific structuring element.

3

equalizeHist(Mat src, Mat dst)

It equalizes the histogram of a grayscale image.

4

filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta)

It convolves an image with the kernel.

5

GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX)

It blurs an image using a Gaussian filter.

6

integral(Mat src, Mat sum)

It calculates the integral of an image.

Example

The following example demonstrates the use of Imgproc class to apply Gaussian filter to an image.

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;

publicclassMain{

publicstaticvoid main(String[] args ){
try{
System.loadLibrary(Core.NATIVE_LIBRARY_NAME );
Mat source =Highgui.imread("digital_image_processing.jpg",Highgui.CV_LOAD_IMAGE_COLOR);
Mat destination =newMat(source.rows(),source.cols(),source.type());
Imgproc.GaussianBlur(source, destination,newSize(45,45),0);
Highgui.imwrite("Gaussian45.jpg", destination);
}
catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
}
}

Output

When you execute the given code, the following output is seen:

Original Image

Applying Gaussian Filter Tutorial

When this original image is convolved with the Gaussian filter of size 11 and 45, the following output is seen.

Gaussian filter of size 11

Applying Gaussian Filter Tutorial

Gaussian filter of size 45

Applying Gaussian Filter Tutorial

 

  • Prec
  • Mai departe
  • Contact
  • Termeni si conditii
Copyright © MMDB - Multimedia DataBase 2025 All rights reserved. Custom Design by Youjoomla.com
Algoritmi prelucrare imagini