diff options
| author | Mike Wey | 2011-04-27 23:27:25 +0200 |
|---|---|---|
| committer | Mike Wey | 2011-04-27 23:27:25 +0200 |
| commit | 7c200e95b8704abcef650c2aa434e5ad505316e6 (patch) | |
| tree | c21f0a8b9e6cb81540b36776a017ab43a82b92a1 /dmagick/Image.d | |
| parent | 236765414d6dd0aca6ce7a3d720adcb9ab9b0597 (diff) | |
adaptiveSharpen and adaptiveThreshold
Diffstat (limited to 'dmagick/Image.d')
| -rw-r--r-- | dmagick/Image.d | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/dmagick/Image.d b/dmagick/Image.d index bea432a..0cb7d1e 100644 --- a/dmagick/Image.d +++ b/dmagick/Image.d @@ -221,6 +221,55 @@ class Image } /** + * Adaptively sharpens the image by sharpening more intensely near + * image edges and less intensely far from edges. The adaptiveSharpen + * method sharpens the image with a Gaussian operator of the given + * radius and standard deviation (sigma). For reasonable results, + * radius should be larger than sigma. Use a radius of 0 and + * adaptiveSharpen selects a suitable radius for you. + * + * Params: + * radius = The radius of the Gaussian in pixels, + * not counting the center pixel. + * sigma = The standard deviation of the Laplacian, in pixels. + * channel = If no channels are specified, blurs all the channels. + */ + void adaptiveSharpen(double radius = 0, double sigma = 1, ChannelType channel = ChannelType.DefaultChannels) + { + ExceptionInfo* exception = AcquireExceptionInfo(); + MagickCoreImage* image = + AdaptiveSharpenImageChannel(imageRef, channel, radius, sigma, exception); + + DMagickException.throwException(exception); + DestroyExceptionInfo(exception); + + imageRef = ImageRef(image); + } + + /** + * Selects an individual threshold for each pixel based on the range + * of intensity values in its local neighborhood. This allows for + * thresholding of an image whose global intensity histogram doesn't + * contain distinctive peaks. + * + * Params: + * width = define the width of the local neighborhood. + * heigth = define the height of the local neighborhood. + * offset = constant to subtract from pixel neighborhood mean. + */ + void adaptiveThreshold(size_t width = 3, size_t height = 3, ssize_t offset = 0) + { + ExceptionInfo* exception = AcquireExceptionInfo(); + MagickCoreImage* image = + AdaptiveThresholdImage(imageRef, width, height, offset, exception); + + DMagickException.throwException(exception); + DestroyExceptionInfo(exception); + + imageRef = ImageRef(image); + } + + /** * Returns the TypeMetric class witch provides the information * regarding font metrics such as ascent, descent, text width, * text height, and maximum horizontal advance. The units of @@ -402,7 +451,7 @@ class Image ///ditto bool alpha() const { - GetImageAlphaChannel(imageRef); + return GetImageAlphaChannel(imageRef) != 0; } /** @@ -607,9 +656,10 @@ class Image * ---------------------------------- * Color color = image.colormap[2]; * image.colormap()[2] = color; - * + * ---------------------------------- + * To asign the complete colormap at once: + * ---------------------------------- * Color[] colors = new Colors[255]; - * * image.colormap() = colors; * //Or * image.colormap.size = 255; |
