I have implemented Difference of Gaussian using OpenCV java.
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;
import com.atul.JavaOpenCV.Imshow;
public class demodog
{
public static void main(String args[])
{
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat img=Highgui.imread("C:\\testdatabase\\illumination1.jpg");
Mat g1=new Mat();
Mat g2=new Mat();
Mat g3=new Mat();
Mat g4=new Mat();
Mat g5=new Mat();
Mat r1=new Mat();
Mat r2=new Mat();
Mat r3=new Mat();
Mat r4=new Mat();
Imgproc.GaussianBlur(img, g1, new Size(1,1), 0);
Imgproc.GaussianBlur(img, g2, new Size(3,3), 20);
Imgproc.GaussianBlur(img, g3, new Size(5,5), 40);
Imgproc.GaussianBlur(img, g4, new Size(7,7), 50);
Imgproc.GaussianBlur(img, g5, new Size(11,11),70);
Core.subtract(g2, g1, r1);
Core.subtract(g3, g2, r2);
Core.subtract(g4, g3, r3);
Core.subtract(g5, g4, r4);
Imshow im9 = new Imshow("DOG4");
im9.showImage(r4);
Imshow im8 = new Imshow("DOG3");
im8.showImage(r3);
Imshow im7 = new Imshow("DOG2");
im7.showImage(r2);
Imshow im6 = new Imshow("DOG1");
im6.showImage(r1);
Imshow im = new Imshow("Input Image");
im.showImage(img);
}
}
The results are shown below
Question :
I have used kernel size of 1,3,5,7,11 with sigma values 20,40,50,70 to obtain the result.Did i use the suitable values or can i improve the result by changing the values..??
Aucun commentaire:
Enregistrer un commentaire