ddepth parameter of the Laplacian filter
Here how I used to implement the Laplacian filter over my images:
int scale = 1;
int delta = 0;
int ddepth = CV_16S;
int kernel_size = 3;
Mat res,imgGrayScale, imgGrayScaleGaussianBlurred;
cv::cvtColor(sourceImage, imgGrayScale, CV_RGB2GRAY);
imwrite("Im3downsampledimgGrayScale.png",imgGrayScale);
GaussianBlur( imgGrayScale, imgGrayScaleGaussianBlurred, Size(3,3), 0, 0, BORDER_DEFAULT );
imwrite("Im3downsampledimgBlurred.png",imgGrayScaleGaussianBlurred);
//Laplace
Laplacian( imgGrayScale, res, ddepth, kernel_size, scale, delta, BORDER_DEFAULT );
convertScaleAbs( res, result);
Can someone clarify what it does the "ddepth" parameter? Why it states in the documentation that should be CV_16S to avoid overflow? What does it mean this?
ddepth: Depth of the destination image. Since our input is CV_8U we define ddepth = CV_16S to avoid overflow