Skip to content

Instantly share code, notes, and snippets.

@mlashcorp
Created January 19, 2012 16:52
Show Gist options
  • Save mlashcorp/1641134 to your computer and use it in GitHub Desktop.
Save mlashcorp/1641134 to your computer and use it in GitHub Desktop.
opencv documentation description of unsharp mask algorithm
// sharpen image using "unsharp mask" algorithm
Mat blurred; double sigma = 1, threshold = 5, amount = 1;
GaussianBlur(img, blurred, Size(), sigma, sigma);
Mat lowConstrastMask = abs(img - blurred) < threshold;
Mat sharpened = img*(1+amount) + blurred*(-amount);
img.copyTo(sharpened, lowContrastMask);
@RoyiAvital
Copy link

Hi,
Will it replicate Photoshop's Unsharp Mask result perfectly?

@Ashutosh-Tiwari
Copy link

Ashutosh-Tiwari commented May 30, 2018

@mlashcorp How can I use this file in android project? Any links or resources, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment