I created the following gaussian kernel in OpenCV and comparing it with the GaussianBlur function of OpenCV. However, I'm getting a black image instead of a smooth image. Can someone throw some light on this?
Mat src, dst1,dst2;
Mat gaussiankrnl(3,3,CV_32F);
Point anchor;
double delta;
int ddepth;
anchor = Point( -1, -1 );
delta = 0;
ddepth = -1;
src = imread("coins.pgm");
gaussiankrnl.at<double>(0,0) = 1/16;
gaussiankrnl.at<double>(0,1) = 2/16;
gaussiankrnl.at<double>(0,2) = 1/16;
gaussiankrnl.at<double>(1,0) = 2/16;
gaussiankrnl.at<double>(1,1) = 4/16;
gaussiankrnl.at<double>(1,2) = 2/16;
gaussiankrnl.at<double>(2,0) = 1/16;
gaussiankrnl.at<double>(2,1) = 2/16;
gaussiankrnl.at<double>(2,2) = 1/16;
filter2D(src, dst1, ddepth , gaussiankrnl, anchor, delta, BORDER_DEFAULT );
GaussianBlur(src, dst2, Size(3,3), 1.0);
imshow("result1", dst1 );
imshow("result2", dst2 );
cvWaitKey(0);
return 0;