# 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

edit retag close merge delete

1

"do you know why ?" - no. how can we ?

• show us the image.

( 2013-10-17 07:09:00 -0500 )edit

Question edited

( 2013-10-17 07:22:14 -0500 )edit
1

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)

( 2013-10-17 07:30:37 -0500 )edit

as a scale i m applying -1.0 ..

( 2013-10-17 07:36:42 -0500 )edit

Sort by ยป oldest newest most voted
more

Official site

GitHub

Wiki

Documentation