Method: Magick::Image#unsharp_mask_channel

Defined in:
ext/RMagick/rmimage.cpp

#unsharp_mask(radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05, channel = Magick::AllChannels) ⇒ Magick::Image #unsharp_mask(radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05, *channels) ⇒ Magick::Image

Sharpen an image. “amount” is the percentage of the difference between the original and the blur image that is added back into the original. “threshold” is the threshold in pixels needed to apply the diffence amount.

Only the specified channels are sharpened.

Overloads:

  • #unsharp_mask(radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05, channel = Magick::AllChannels) ⇒ Magick::Image

    Parameters:

    • radius (Numeric) (defaults to: 0.0)

      The radius of the Gaussian operator.

    • sigma (Numeric) (defaults to: 1.0)

      The standard deviation of the Gaussian operator.

    • amount (Numeric) (defaults to: 1.0)

      The percentage of the blurred image to be added to the receiver, specified as a fraction between 0 and 1.0

    • threshold (Numeric) (defaults to: 0.05)

      The threshold needed to apply the amount, specified as a fraction between 0 and 1.0

    • channel (Magick::ChannelType) (defaults to: Magick::AllChannels)

      a ChannelType arguments.

  • #unsharp_mask(radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05, *channels) ⇒ Magick::Image

    Parameters:

    • radius (Numeric) (defaults to: 0.0)

      The radius of the Gaussian operator.

    • sigma (Numeric) (defaults to: 1.0)

      The standard deviation of the Gaussian operator.

    • amount (Numeric) (defaults to: 1.0)

      The percentage of the blurred image to be added to the receiver, specified as a fraction between 0 and 1.0

    • threshold (Numeric) (defaults to: 0.05)

      The threshold needed to apply the amount, specified as a fraction between 0 and 1.0

    • *channels (Magick::ChannelType)

      one or more ChannelType arguments.

Returns:



15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
# File 'ext/RMagick/rmimage.cpp', line 15333

VALUE
Image_unsharp_mask_channel(int argc, VALUE *argv, VALUE self)
{
    Image *image, *new_image;
    ChannelType channels;
    double radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05;
    ExceptionInfo *exception;

    image = rm_check_destroyed(self);
    channels = extract_channels(&argc, argv);
    if (argc > 4)
    {
        raise_ChannelType_error(argv[argc-1]);
    }

    unsharp_mask_args(argc, argv, &radius, &sigma, &amount, &threshold);

    exception = AcquireExceptionInfo();
#if defined(IMAGEMAGICK_7)
    BEGIN_CHANNEL_MASK(image, channels);
    GVL_STRUCT_TYPE(UnsharpMaskImage) args = { image, radius, sigma, amount, threshold, exception };
    new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnsharpMaskImage), &args);
    CHANGE_RESULT_CHANNEL_MASK(new_image);
    END_CHANNEL_MASK(image);
#else
    GVL_STRUCT_TYPE(UnsharpMaskImageChannel) args = { image, channels, radius, sigma, amount, threshold, exception };
    new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnsharpMaskImageChannel), &args);
#endif
    rm_check_exception(exception, new_image, DestroyOnError);
    DestroyExceptionInfo(exception);

    return rm_image_new(new_image);
}