Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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

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);

follows:

addWeighted(blurred,1,laplacian,1,0,output,-1);

thanks