0
我已經實現了使用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);
}
}
結果示下面
問題:
我已經使用的1,3,5,7,11內核大小與西格馬值20,40,50,70至獲得結果。我使用合適的值還是可以通過更改值來改善結果。