Ask Your Question
1

Sharpening image

asked 2013-10-17 06:55:46 -0600

GiulSDU gravatar image

updated 2013-10-17 07:18:13 -0600

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 flag offensive close merge delete

Comments

1

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

  • show us the image.
  • show your code

please.

berak gravatar imageberak ( 2013-10-17 07:09:00 -0600 )edit

Question edited

GiulSDU gravatar imageGiulSDU ( 2013-10-17 07:22:14 -0600 )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)

berak gravatar imageberak ( 2013-10-17 07:30:37 -0600 )edit

as a scale i m applying -1.0 ..

GiulSDU gravatar imageGiulSDU ( 2013-10-17 07:36:42 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-10-17 10:58:55 -0600

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-10-17 06:55:46 -0600

Seen: 8,745 times

Last updated: Oct 17 '13