-1

I'm trying to sharpen an image using EmguCv using the following code

Image<Bgr, Byte> myImage = new Image<Bgr, Byte>(bm_dest);
CvInvoke.GaussianBlur(myImage, myImage, new Size(0, 0), 3);
Image<Bgr, byte> blur = myImage.AddWeighted(myImage, 1.5, -0.5, 0);
bm_dest = blur.Bitmap;

An referring this blog post http://opencv-help.blogspot.in/2013/01/how-to-sharpen-image-using-opencv.html

But the output image gets blurry.What im i doing wrong? Please advice.

techno
  • 6,100
  • 16
  • 86
  • 192
  • I don't think that this is ideal way for sharpening. Can you add your input and output images? Also try to tweak the parameters in AddWeighted() – Garvita Tiwari May 18 '18 at 05:00
  • 1
    @GarvitaTiwari I have tried convolution,but it produces out of memory exception with large images.Please see https://stackoverflow.com/questions/50388992/emgucv-out-of-memory-expcetion-in-x86-release-mode-only-sharpening-images – techno May 18 '18 at 05:02

1 Answers1

-1

You are overwriting your original image in

CvInvoke.GaussianBlur(myImage, myImage, new Size(0, 0), 3);

with the blurred image.

Try this:

CvInvoke.GaussianBlur(myImage, someNewMatrix, new Size(0, 0), 3); Image blur = myImage.AddWeighted(someNewMatrix, 1.5, -0.5, 0);

Micka
  • 19,585
  • 4
  • 56
  • 74
  • what is the suggested matrix.I'm getting out of memory exception with convolution matrix.Please see https://stackoverflow.com/questions/50388992/emgucv-out-of-memory-expcetion-in-x86-release-mode-only-sharpening-images – techno May 18 '18 at 05:04
  • sorry I don't know the emgucv details on how you have to create output mats manually or automatic. – Micka May 24 '18 at 15:38