1using System.Runtime.InteropServices;
18 private const string _levelKey =
"Level";
20 internal const uint DefaultLevel = 0;
22 private uint _level = DefaultLevel;
25 public override string TypeId =>
"Sharpening";
49 if (value < range.Minimum || value > range.
Maximum)
65 var levelRange =
new Backend.Types.peak_icv_interval_u();
66 DllHelper.ExecuteAndMapReturnCodes(() =>
67 CInterface.peak_icv_ImageFilter_Sharpening_GetRange(out levelRange));
68 return new IntervalU(levelRange.minimum, levelRange.maximum);
85 base.Serialize(archive);
119 base.Deserialize(archive);
153 var isSupportedMonoImage = pixelFormat is PixelFormat.Mono8 or PixelFormat.Mono10 or
PixelFormat.Mono12;
154 var isColorImage = info.HasChannel(
Channel.Red) && info.HasChannel(
Channel.Green) &&
156 var isSupportedColorImage = isColorImage && pixelFormat != PixelFormat.RGB10p32
158 if (!isSupportedMonoImage && !isSupportedColorImage)
163 DllHelper.ExecuteAndMapReturnCodes(() =>
164 CInterface.peak_icv_ImageFilter_Sharpening_ProcessInPlace(inputImage._handle, _level));
191 return base.Process(input);
203 base.ResetToDefault();
205 _level = DefaultLevel;
208 private static class CInterface
210 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
211 internal static extern Backend.Types.peak_icv_status peak_icv_ImageFilter_Sharpening_GetRange(
212 out Backend.Types.peak_icv_interval_u range);
214 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
215 internal static extern Backend.Types.peak_icv_status peak_icv_ImageFilter_Sharpening_ProcessInPlace(
216 Image.Handle inputImageHandle, uint level);
T Maximum
Gets the upper boundary of the interval.
Represents an interval with unsigned integer boundaries.
Occurs when a provided value falls outside the allowed valid range.
Base class for all pipeline modules.
virtual bool IsEnabled
Get whether this module is enabled.
Sharpening is an image pipeline module that applies a sharpening filter to enhance image detail.
override void Deserialize(IArchive archive)
Restores the object's state from the provided archive.
override Image Process(Image inputImage)
Processes the input image and returns a sharpened output image.
override void ResetToDefault()
Resets the sharpness level to the default value (0).
override object Process(object input)
Processes the input image and returns a sharpened output image.
override string TypeId
The unique type identifier for this module implementation.This should be a unique string identifying ...
uint Level
The current sharpness level.
IntervalU LevelRange
Gets the valid range for the sharpness level.
override void Serialize(IArchive archive)
Serializes the object's internal state into the provided archive.
Constructs an Image from an IImageView Instance.
PixelFormat PixelFormat
Gets the pixel format from the image.
Channel
Represents the various data channels in image or spatial data formats. /// This enumeration defines s...
PixelFormat
Each enumerator represents a specific pixel layout and bit-depth, used for interpreting raw image dat...
Represents a hierarchical, strongly-typed key-value archive.
long GetInt64(string key)
Retrieves a 64-bit integer value by key.
void SetInt64(string key, long value)
Stores a 64-bit integer value under the specified key.