Skip to content

Commit

Permalink
Moved WaveletDenoise to IMagickImageCreateOperations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Jan 2, 2025
1 parent 843abfc commit cb4c521
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 33 deletions.
13 changes: 0 additions & 13 deletions src/Magick.NET.Core/IMagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2220,19 +2220,6 @@ public partial interface IMagickImage : IMagickImageCreateOperations, IDisposabl
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Trim(Percentage percentBackground);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="thresholdPercentage">The threshold for smoothing.</param>
void WaveletDenoise(Percentage thresholdPercentage);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="thresholdPercentage">The threshold for smoothing.</param>
/// <param name="softness">Attenuate the smoothing threshold.</param>
void WaveletDenoise(Percentage thresholdPercentage, double softness);

/// <summary>
/// Apply a white balancing to an image according to a grayworld assumption in the LAB colorspace.
/// </summary>
Expand Down
13 changes: 13 additions & 0 deletions src/Magick.NET.Core/IMagickImageCreateOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,4 +1278,17 @@ public interface IMagickImageCreateOperations
/// <param name="length">The length of the wave.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Wave(PixelInterpolateMethod method, double amplitude, double length);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="thresholdPercentage">The threshold for smoothing.</param>
void WaveletDenoise(Percentage thresholdPercentage);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="thresholdPercentage">The threshold for smoothing.</param>
/// <param name="softness">Attenuate the smoothing threshold.</param>
void WaveletDenoise(Percentage thresholdPercentage, double softness);
}
13 changes: 13 additions & 0 deletions src/Magick.NET.Core/IMagickImageCreateOperations{TQuantumType}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,17 @@ public interface IMagickImageCreateOperations<TQuantumType> : IMagickImageCreate
/// <param name="color">A color value used for tinting.</param>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
void Tint(IMagickGeometry opacity, IMagickColor<TQuantumType> color);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="threshold">The threshold for smoothing.</param>
void WaveletDenoise(TQuantumType threshold);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="threshold">The threshold for smoothing.</param>
/// <param name="softness">Attenuate the smoothing threshold.</param>
void WaveletDenoise(TQuantumType threshold, double softness);
}
13 changes: 0 additions & 13 deletions src/Magick.NET.Core/IMagickImage{TQuantumType}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -926,17 +926,4 @@ public partial interface IMagickImage<TQuantumType> : IMagickImageCreateOperatio
/// <returns>The unique colors of an image.</returns>
/// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>
IMagickImage<TQuantumType>? UniqueColors();

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="threshold">The threshold for smoothing.</param>
void WaveletDenoise(TQuantumType threshold);

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="threshold">The threshold for smoothing.</param>
/// <param name="softness">Attenuate the smoothing threshold.</param>
void WaveletDenoise(TQuantumType threshold, double softness);
}
12 changes: 12 additions & 0 deletions src/Magick.NET/MagickImage.CloneMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,18 @@ public void Wave()
public void Wave(PixelInterpolateMethod method, double amplitude, double length)
=> SetResult(NativeMagickImage.Wave(method, amplitude, length));

public void WaveletDenoise(QuantumType threshold)
=> WaveletDenoise(threshold, 0.0);

public void WaveletDenoise(QuantumType threshold, double softness)
=> SetResult(NativeMagickImage.WaveletDenoise(threshold, softness));

public void WaveletDenoise(Percentage thresholdPercentage)
=> WaveletDenoise(PercentageHelper.ToQuantumType(nameof(thresholdPercentage), thresholdPercentage));

public void WaveletDenoise(Percentage thresholdPercentage, double softness)
=> WaveletDenoise(PercentageHelper.ToQuantumType(nameof(thresholdPercentage), thresholdPercentage), softness);

protected virtual void SetResult(IntPtr result)
{
if (_result != IntPtr.Zero)
Expand Down
20 changes: 16 additions & 4 deletions src/Magick.NET/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6965,30 +6965,42 @@ public void Wave(PixelInterpolateMethod method, double amplitude, double length)
/// </summary>
/// <param name="threshold">The threshold for smoothing.</param>
public void WaveletDenoise(QuantumType threshold)
=> WaveletDenoise(threshold, 0.0);
{
using var mutator = new Mutator(_nativeInstance);
mutator.WaveletDenoise(threshold);
}

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="threshold">The threshold for smoothing.</param>
/// <param name="softness">Attenuate the smoothing threshold.</param>
public void WaveletDenoise(QuantumType threshold, double softness)
=> _nativeInstance.WaveletDenoise(threshold, softness);
{
using var mutator = new Mutator(_nativeInstance);
mutator.WaveletDenoise(threshold, softness);
}

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="thresholdPercentage">The threshold for smoothing.</param>
public void WaveletDenoise(Percentage thresholdPercentage)
=> WaveletDenoise(PercentageHelper.ToQuantumType(nameof(thresholdPercentage), thresholdPercentage));
{
using var mutator = new Mutator(_nativeInstance);
mutator.WaveletDenoise(thresholdPercentage);
}

/// <summary>
/// Removes noise from the image using a wavelet transform.
/// </summary>
/// <param name="thresholdPercentage">The threshold for smoothing.</param>
/// <param name="softness">Attenuate the smoothing threshold.</param>
public void WaveletDenoise(Percentage thresholdPercentage, double softness)
=> WaveletDenoise(PercentageHelper.ToQuantumType(nameof(thresholdPercentage), thresholdPercentage), softness);
{
using var mutator = new Mutator(_nativeInstance);
mutator.WaveletDenoise(thresholdPercentage, softness);
}

/// <summary>
/// Apply a white balancing to an image according to a grayworld assumption in the LAB colorspace.
Expand Down
5 changes: 2 additions & 3 deletions src/Magick.NET/Native/MagickImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,10 @@ private unsafe sealed partial class NativeMagickImage : NativeInstance, INativeM
public partial IntPtr Wave(PixelInterpolateMethod method, double amplitude, double length);

[Throws]
public partial void WhiteBalance();
public partial IntPtr WaveletDenoise(double threshold, double softness);

[Throws]
[SetInstance]
public partial void WaveletDenoise(double threshold, double softness);
public partial void WhiteBalance();

[Throws]
public partial void WhiteThreshold(string threshold, Channels channels);
Expand Down

0 comments on commit cb4c521

Please sign in to comment.