i just want to know which opencv with java API perforems the Difference Of Gaussian DoG?
Asked
Active
Viewed 723 times
1 Answers
2
DOG is just, what the name says, the difference of 2 convolutions with an image.
let's just do it:
//
// grayscale:
//
Mat gray = new Mat();
Imgproc.cvtColor(ocv,gray, Imgproc.COLOR_BGR2GRAY);
//
// make 2 kernels:
//
Mat k1 = Imgproc.getGaussianKernel(5, 0.6);
Mat k2 = Imgproc.getGaussianKernel(5, 4.2);
//
// apply them on your image:
//
Mat f1 = new Mat();
Imgproc.filter2D(gray, f1, CvType.CV_32F, k1);
Mat f2 = new Mat();
Imgproc.filter2D(gray, f2, CvType.CV_32F, k2);
//
// difference:
//
Mat dog = new Mat();
Core.subtract(f1,f2,dog);
[edit:]
this is even a rare case of where you can swap consecutive convolution with different fitlers with applying the diff of the filters,
G(img,fa)-G(img,fb) == G(img, fa-fb)

berak
- 39,159
- 9
- 91
- 89
-
thank you, but i have a question. i know that to obtain the saliency map, you have to compute the intensity, color, and orientation using center surround mechanism "which is as far as i researched, it is the DoG". my question is hw can the DoG could be aplied on the color and orientation? – Amrmsmb Apr 21 '15 at 17:09
-
oh, that's *you* ;) maybe hint me at the respective paper ? – berak Apr 21 '15 at 17:11
-
1it is here https://www.tu-chemnitz.de/informatik/KI/scripts/ws0910/Attention_Saliency.pdf the section called center-surround diferences – Amrmsmb Apr 21 '15 at 17:21