Sharpening image
Hi, i want to sharp an image and i am using the laplacian operator. I have the blurred image, compute the laplacian (the grayish image where is easy to see the boarder ) but when i add them i have a weird output. The image get worst. The same by subtraction..d you know why? Thank you
this is how i compute the lalpacian..
#include "LaplacianZC.h"
LaplacianZC::LaplacianZC() : aperture(3) {}
void LaplacianZC::setAperture(int a)
{
aperture=a;
}
Mat LaplacianZC::computeLaplacian(const Mat& image)
{
Laplacian(image,laplace,CV_32F);
img=image.clone();
return laplace;
}
Mat LaplacianZC::getLaplacianImage(double scale)
{
if (scale <0)
{
double lapmin,lapmax;
minMaxLoc(laplace,&lapmin,&lapmax);
scale=127/max(-lapmin,lapmax);
}
Mat laplaceImage;
laplace.convertTo(laplaceImage,CV_8U,scale,128);
return laplaceImage;
}
here is my image C:\fakepath\blurred.png
and the laplacian C:\fakepath\laplacian.png
I just add them as follows:
addWeighted(blurred,1,laplacian,1,0,output,-1);
thanks
"do you know why ?" - no. how can we ?
please.
Question edited
your scaling looks broken. what do you apply for 'scale' ? also the offset value in convertTo is applied after the scaling (your laplacian image looks like 128+-(something_very_small)
as a scale i m applying -1.0 ..