IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
ColorMatrixTransformationModule.cs
Go to the documentation of this file.
1using System.Runtime.InteropServices;
8using Microsoft.Win32.SafeHandles;
10
12
47{
48 private const string _saturationKey = "Saturation";
49 private const string _matrixKey = "ColorCorrection";
50 private const string _chromaticAdaptionKey = "ChromaticAdaption";
51 private const string _valueKey = "Value";
52 private const string _algorithmKey = "Algorithm";
53 private const string _targetColorSpaceKey = "TargetColorSpace";
54 private const string _colorTemperatureKey = "ColorTemperature";
55
59 internal const float DefaultSaturation = 1.0f;
60
64 internal const ChromaticAdaptionAlgorithm DefaultChromaticAdaptionAlgorithm = ChromaticAdaptionAlgorithm.Bradford;
65
69 internal const ColorSpace DefaultColorSpace = ColorSpace.SRGB_D65;
70
71 private readonly Handle _handle;
72 private IAutoFeature? _autoFeatureModule;
73
78 {
79 Version = 2;
80 var handle = new Handle();
81 DllHelper.ExecuteAndMapReturnCodes(() =>
82 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_Create(out handle));
83 _handle = handle;
84 }
85
89 internal static ColorCorrectionMatrix DefaultColorCorrectionMatrix => ColorCorrectionMatrix.Identity();
90
92 public override string TypeId => "ColorMatrixTransformation";
93
95 public override bool IsEnabled
96 {
97 get => IsColorCorrectionEnabled || IsSaturationEnabled || IsChromaticAdaptionEnabled;
98 set
99 {
100 IsColorCorrectionEnabled = value;
101 IsSaturationEnabled = value;
102 IsChromaticAdaptionEnabled = value;
103 UpdateMatrixInAutoFeatureModule();
104 }
105 }
106
111 {
112 get
113 {
115 ColorCorrectionMatrix.Identity().ToBackend();
116 DllHelper.ExecuteAndMapReturnCodes(() =>
117 CInterface
118 .peak_icv_Preprocessing_ColorMatrixTransformation_GetColorCorrectionMatrix(
119 _handle, out backendMatrix));
120 return new ColorCorrectionMatrix(backendMatrix);
121 }
122 set
123 {
124 Backend.Types.peak_icv_color_correction_matrix backendMatrix = value.ToBackend();
125 DllHelper.ExecuteAndMapReturnCodes(() =>
126 CInterface
127 .peak_icv_Preprocessing_ColorMatrixTransformation_SetColorCorrectionMatrix(
128 _handle, backendMatrix));
129 UpdateMatrixInAutoFeatureModule();
130 }
131 }
132
139 public float Saturation
140 {
141 get
142 {
143 var saturation = 1.0f;
144 DllHelper.ExecuteAndMapReturnCodes(() =>
145 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_GetSaturation(
146 _handle, out saturation));
147 return saturation;
148 }
149 set
150 {
151 DllHelper.ExecuteAndMapReturnCodes(() =>
152 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_SetSaturation(
153 _handle, value));
154 UpdateMatrixInAutoFeatureModule();
155 }
156 }
157
162 {
163 get
164 {
165 var interval = new Backend.Types.peak_icv_interval_f();
166 DllHelper.ExecuteAndMapReturnCodes(() =>
167 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_GetSaturationRange(
168 _handle, out interval));
169 return new IntervalF(interval.minimum, interval.maximum);
170 }
171 }
172
177 {
178 get
179 {
180 Backend.Types.peak_icv_chromatic_adaption_algorithm algorithm = Backend.Types
181 .peak_icv_chromatic_adaption_algorithm.PEAK_ICV_CHROMATIC_ADAPTION_ALGORITHM_BRADFORD;
182 DllHelper.ExecuteAndMapReturnCodes(() =>
183 CInterface
184 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetAlgorithm(
185 _handle, out algorithm));
186 return (ChromaticAdaptionAlgorithm) algorithm;
187 }
188 set
189 {
190 var algorithm = (Backend.Types.peak_icv_chromatic_adaption_algorithm) value;
191 DllHelper.ExecuteAndMapReturnCodes(() =>
192 CInterface
193 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetAlgorithm(
194 _handle, algorithm));
195 UpdateMatrixInAutoFeatureModule();
196 }
197 }
198
203 {
204 get
205 {
206 Backend.Types.peak_icv_color_space colorSpace =
207 Backend.Types.peak_icv_color_space.PEAK_ICV_COLOR_SPACE_SRGB_D65;
208 DllHelper.ExecuteAndMapReturnCodes(() =>
209 CInterface
210 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetTargetColorSpace(
211 _handle, out colorSpace));
212 return (ColorSpace) colorSpace;
213 }
214 set
215 {
216 var colorSpace = (Backend.Types.peak_icv_color_space) value;
217 DllHelper.ExecuteAndMapReturnCodes(() =>
218 CInterface
219 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetTargetColorSpace(
220 _handle, colorSpace));
221 UpdateMatrixInAutoFeatureModule();
222 }
223 }
224
234 public uint? ColorTemperature
235 {
236 get
237 {
238 if (!HasColorTemperature())
239 {
240 return null;
241 }
242
243 var colorTemperature = 0u;
244 DllHelper.ExecuteAndMapReturnCodes(() =>
245 CInterface
246 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetColorTemperature(
247 _handle, out colorTemperature));
248 return colorTemperature;
249 }
250 set
251 {
252 if (value == null)
253 {
254 ResetColorTemperature();
255 return;
256 }
257
258 var colorTemperature = (uint) value;
259 DllHelper.ExecuteAndMapReturnCodes(() =>
260 CInterface
261 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetColorTemperature(
262 _handle, colorTemperature));
263
264 UpdateMatrixInAutoFeatureModule();
265 }
266 }
267
272 {
273 get
274 {
275 var range = new Backend.Types.peak_icv_range_u();
276 DllHelper.ExecuteAndMapReturnCodes(() =>
277 CInterface
278 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetColorTemperatureRange(
279 _handle, out range));
280 return new RangeU(range.minimum, range.maximum, range.increment);
281 }
282 }
283
284 internal bool IsColorCorrectionEnabled
285 {
286 get
287 {
288 var enabled = false;
289 DllHelper.ExecuteAndMapReturnCodes(() =>
290 CInterface
291 .peak_icv_Preprocessing_ColorMatrixTransformation_ColorCorrection_IsEnabled(
292 _handle, out enabled));
293 return enabled;
294 }
295 set
296 {
297 DllHelper.ExecuteAndMapReturnCodes(() =>
298 CInterface
299 .peak_icv_Preprocessing_ColorMatrixTransformation_ColorCorrection_SetEnabled(
300 _handle, value));
301 UpdateMatrixInAutoFeatureModule();
302 }
303 }
304
305 internal bool IsSaturationEnabled
306 {
307 get
308 {
309 var enabled = false;
310 DllHelper.ExecuteAndMapReturnCodes(() =>
311 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_Saturation_IsEnabled(
312 _handle, out enabled));
313 return enabled;
314 }
315 set
316 {
317 DllHelper.ExecuteAndMapReturnCodes(() =>
318 CInterface
319 .peak_icv_Preprocessing_ColorMatrixTransformation_Saturation_SetEnabled(
320 _handle, value));
321 UpdateMatrixInAutoFeatureModule();
322 }
323 }
324
325 internal bool IsChromaticAdaptionEnabled
326 {
327 get
328 {
329 var enabled = false;
330 DllHelper.ExecuteAndMapReturnCodes(() =>
331 CInterface
332 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_IsEnabled(
333 _handle, out enabled));
334 return enabled;
335 }
336 set
337 {
338 DllHelper.ExecuteAndMapReturnCodes(() =>
339 CInterface
340 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetEnabled(
341 _handle, value));
342 UpdateMatrixInAutoFeatureModule();
343 }
344 }
345
349 public void Dispose()
350 {
351 _handle.Dispose();
352 GC.SuppressFinalize(this);
353 }
354
355 SafeHandle IHasSafeHandle.Handle => _handle;
356
368 public override void Serialize(IArchive archive)
369 {
370 archive.SetInt64(VersionKey, Version);
371
372 IArchive saturationArchive = archive.CreateArchive();
373 saturationArchive.SetBool(EnabledKey, IsSaturationEnabled);
374 saturationArchive.SetDouble(_valueKey, Saturation);
375 archive.SetArchive(_saturationKey, saturationArchive);
376
377 IArchive matrixArchive = archive.CreateArchive();
378 matrixArchive.SetBool(EnabledKey, IsColorCorrectionEnabled);
379 Matrix.Serialize(matrixArchive);
380 archive.SetArchive(_matrixKey, matrixArchive);
381
382 IArchive chromaticAdaptionArchive = archive.CreateArchive();
383 chromaticAdaptionArchive.SetBool(EnabledKey, IsChromaticAdaptionEnabled);
384 chromaticAdaptionArchive.SetString(_algorithmKey,
385 ChromaticAdaptionAlgorithm.ToString());
386
387 chromaticAdaptionArchive.SetString(_targetColorSpaceKey, TargetColorSpace.ToString());
388 var colorTemperature = ColorTemperature;
389 if (colorTemperature is not null)
390 {
391 chromaticAdaptionArchive.SetInt64(_colorTemperatureKey, (long) colorTemperature);
392 }
393
394 archive.SetArchive(_chromaticAdaptionKey, chromaticAdaptionArchive);
395 }
396
424 public override void Deserialize(IArchive archive)
425 {
426 var version = archive.GetInt64(VersionKey);
427 ValidateVersion(version, TypeId);
428
429 IArchive saturationArchive = archive.GetArchive(_saturationKey);
430 IArchive matrixArchive = archive.GetArchive(_matrixKey);
431
432 IsColorCorrectionEnabled = matrixArchive.GetBool(EnabledKey);
433 IsSaturationEnabled = saturationArchive.GetBool(EnabledKey);
434
435 var matrix = ColorCorrectionMatrix.Identity();
436 matrix.Deserialize(matrixArchive);
437 Matrix = matrix;
438 Saturation = (float) saturationArchive.GetDouble(_valueKey);
439
440 if (version >= 2)
441 {
442 IArchive chromaticAdaptionArchive = archive.GetArchive(_chromaticAdaptionKey);
443 if (chromaticAdaptionArchive.HasKey(_colorTemperatureKey))
444 {
445 ColorTemperature = (uint) chromaticAdaptionArchive.GetInt64(_colorTemperatureKey);
446 }
447 else
448 {
449 ResetColorTemperature();
450 }
451
452 try
453 {
454 TargetColorSpace = (ColorSpace) Enum.Parse(typeof(ColorSpace),
455 chromaticAdaptionArchive.GetString(_targetColorSpaceKey));
457 chromaticAdaptionArchive.GetString(_algorithmKey));
458 }
459 catch (Exception e)
460 {
461 throw new IcvCorruptedException(e.Message);
462 }
463
464 IsChromaticAdaptionEnabled = chromaticAdaptionArchive.GetBool(EnabledKey);
465 }
466 else
467 {
468 ResetChromaticAdaption();
469 }
470
471 UpdateMatrixInAutoFeatureModule();
472 }
473
501 public override void ResetToDefault()
502 {
503 Matrix = DefaultColorCorrectionMatrix;
504 Saturation = DefaultSaturation;
505 ResetChromaticAdaption();
506 }
507
528 public override Image Process(Image inputImage)
529 {
530 if (!IsEnabled || !NeedsProcessing())
531 {
532 return inputImage;
533 }
534
535 PixelFormat pixelFormat = inputImage.PixelFormat;
536 var info = new PixelFormatInfo(pixelFormat);
537 var isColorImage = info.HasChannel(Channel.Red) && info.HasChannel(Channel.Green) &&
538 info.HasChannel(Channel.Blue);
539 if (!isColorImage || info.IsPacked)
540 {
541 return inputImage;
542 }
543
544 DllHelper.ExecuteAndMapReturnCodes(() =>
545 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_ProcessInplace(
546 _handle, inputImage._handle));
547
548 return inputImage;
549 }
550
571 public override object Process(object input)
572 {
573 return base.Process(input);
574 }
575
581 {
582 _autoFeatureModule = module;
583 UpdateMatrixInAutoFeatureModule();
584 }
585
586 internal void ResetChromaticAdaption()
587 {
588 ChromaticAdaptionAlgorithm = DefaultChromaticAdaptionAlgorithm;
589 TargetColorSpace = DefaultColorSpace;
590 ResetColorTemperature();
591
592 UpdateMatrixInAutoFeatureModule();
593 }
594
595 private void ResetColorTemperature()
596 {
597 DllHelper.ExecuteAndMapReturnCodes(() =>
598 CInterface
599 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_ResetColorTemperature(
600 _handle));
601
602 UpdateMatrixInAutoFeatureModule();
603 }
604
609 {
610 var value = false;
611
612 DllHelper.ExecuteAndMapReturnCodes(() =>
613 CInterface
614 .peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_HasColorTemperature(
615 _handle, out value));
616
617 return value;
618 }
619
620 private bool NeedsProcessing()
621 {
622 var value = false;
623
624 DllHelper.ExecuteAndMapReturnCodes(() =>
625 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_NeedsProcessing(
626 _handle, out value));
627
628 return value;
629 }
630
631 private void UpdateMatrixInAutoFeatureModule()
632 {
633 if (_autoFeatureModule == null)
634 {
635 return;
636 }
637
638 ColorCorrectionMatrix matrix = GetEffectiveMatrix();
639 _autoFeatureModule.SetColorCorrectionMatrix(matrix.Flatten());
640 }
641
642 private ColorCorrectionMatrix GetEffectiveMatrix()
643 {
645 DllHelper.ExecuteAndMapReturnCodes(() =>
646 CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_GetEffectiveMatrix(
647 _handle,
648 out ccm
649 )
650 );
651
652 return new ColorCorrectionMatrix(ccm);
653 }
654
655 internal sealed class Handle : SafeHandleZeroOrMinusOneIsInvalid
656 {
657 public Handle() : base(true)
658 {
659 }
660
661 protected override bool ReleaseHandle()
662 {
663 return CInterface.peak_icv_Preprocessing_ColorMatrixTransformation_Destroy(handle) ==
664 Backend.Types.peak_icv_status.PEAK_ICV_STATUS_SUCCESS;
665 }
666 }
667
668 private static class CInterface
669 {
670 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
671 public static extern Backend.Types.peak_icv_status peak_icv_Preprocessing_ColorMatrixTransformation_Create(
672 out Handle handle);
673
674 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
675 public static extern Backend.Types.peak_icv_status peak_icv_Preprocessing_ColorMatrixTransformation_Destroy(
676 IntPtr handle);
677
678 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
679 public static extern Backend.Types.peak_icv_status
680 peak_icv_Preprocessing_ColorMatrixTransformation_NeedsProcessing(
681 Handle handle, [MarshalAs(UnmanagedType.I1)] out bool needsProcessing);
682
683 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
684 public static extern Backend.Types.peak_icv_status
685 peak_icv_Preprocessing_ColorMatrixTransformation_ProcessInplace(
686 Handle handle, Image.Handle imageHandle);
687
688 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
689 public static extern Backend.Types.peak_icv_status
690 peak_icv_Preprocessing_ColorMatrixTransformation_SetColorCorrectionMatrix(
691 Handle handle, Backend.Types.peak_icv_color_correction_matrix matrix);
692
693 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
694 public static extern Backend.Types.peak_icv_status
695 peak_icv_Preprocessing_ColorMatrixTransformation_GetColorCorrectionMatrix(
696 Handle handle, out Backend.Types.peak_icv_color_correction_matrix matrix);
697
698 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
699 public static extern Backend.Types.peak_icv_status
700 peak_icv_Preprocessing_ColorMatrixTransformation_GetEffectiveMatrix(
701 Handle handle, out Backend.Types.peak_icv_color_correction_matrix matrix);
702
703 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
704 public static extern Backend.Types.peak_icv_status
705 peak_icv_Preprocessing_ColorMatrixTransformation_SetSaturation(
706 Handle handle, float saturation);
707
708 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
709 public static extern Backend.Types.peak_icv_status
710 peak_icv_Preprocessing_ColorMatrixTransformation_GetSaturation(
711 Handle handle, out float saturation);
712
713 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
714 public static extern Backend.Types.peak_icv_status
715 peak_icv_Preprocessing_ColorMatrixTransformation_GetSaturationRange(
716 Handle handle, out Backend.Types.peak_icv_interval_f range);
717
718 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
719 public static extern Backend.Types.peak_icv_status
720 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetTargetColorSpace(
721 Handle handle, out Backend.Types.peak_icv_color_space colorSpace);
722
723 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
724 public static extern Backend.Types.peak_icv_status
725 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetTargetColorSpace(
726 Handle handle, Backend.Types.peak_icv_color_space colorSpace);
727
728 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
729 public static extern Backend.Types.peak_icv_status
730 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetAlgorithm(
731 Handle handle, out Backend.Types.peak_icv_chromatic_adaption_algorithm algorithm);
732
733 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
734 public static extern Backend.Types.peak_icv_status
735 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetAlgorithm(
736 Handle handle, Backend.Types.peak_icv_chromatic_adaption_algorithm algorithm);
737
738 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
739 public static extern Backend.Types.peak_icv_status
740 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetColorTemperature(
741 Handle handle, uint colorTemperature);
742
743 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
744 public static extern Backend.Types.peak_icv_status
745 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetColorTemperature(
746 Handle handle, out uint colorTemperature);
747
748 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
749 public static extern Backend.Types.peak_icv_status
750 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_ResetColorTemperature(
751 Handle handle);
752
753 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
754 public static extern Backend.Types.peak_icv_status
755 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_GetColorTemperatureRange(
756 Handle handle, out Backend.Types.peak_icv_range_u range);
757
758 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
759 public static extern Backend.Types.peak_icv_status
760 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_HasColorTemperature(
761 Handle handle, [MarshalAs(UnmanagedType.I1)] out bool hasColorTemperature);
762
763 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
764 public static extern Backend.Types.peak_icv_status
765 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_SetEnabled(
766 Handle handle, [MarshalAs(UnmanagedType.I1)] bool enabled);
767
768 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
769 public static extern Backend.Types.peak_icv_status
770 peak_icv_Preprocessing_ColorMatrixTransformation_ChromaticAdaption_IsEnabled(
771 Handle handle, [MarshalAs(UnmanagedType.I1)] out bool enabled);
772
773 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
774 public static extern Backend.Types.peak_icv_status
775 peak_icv_Preprocessing_ColorMatrixTransformation_Saturation_SetEnabled(
776 Handle handle, [MarshalAs(UnmanagedType.I1)] bool enabled);
777
778 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
779 public static extern Backend.Types.peak_icv_status
780 peak_icv_Preprocessing_ColorMatrixTransformation_Saturation_IsEnabled(
781 Handle handle, [MarshalAs(UnmanagedType.I1)] out bool enabled);
782
783 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
784 public static extern Backend.Types.peak_icv_status
785 peak_icv_Preprocessing_ColorMatrixTransformation_ColorCorrection_SetEnabled(
786 Handle handle, [MarshalAs(UnmanagedType.I1)] bool enabled);
787
788 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
789 public static extern Backend.Types.peak_icv_status
790 peak_icv_Preprocessing_ColorMatrixTransformation_ColorCorrection_IsEnabled(
791 Handle handle, [MarshalAs(UnmanagedType.I1)] out bool enabled);
792 }
793}
IDSImaging.Peak.ICV.Backend.IHasSafeHandle IHasSafeHandle
Represents an interval with floating-point boundaries.
Definition Interval.cs:157
Provides information and utility functions for pixel formats. The PixelFormatInfo class offers method...
Represents a range with unsigned integer boundaries.
Definition Range.cs:161
Occurs when reading from a file or stream that is incomplete, damaged, or in an unexpected format.
Definition Exception.cs:75
Color matrix transformation is an image pipeline module that applies a Types.ColorCorrectionMatrix to...
override void Deserialize(IArchive archive)
Restores the object's state from the provided archive.
bool HasColorTemperature()
Returns whether a color temperature has been set.
ColorMatrixTransformationModule()
Creates an instance of class ColorMatrixTransformationModule.
override Image Process(Image inputImage)
Processes the input image and returns a color corrected and/or saturated output image.
ColorSpace TargetColorSpace
The current target color space for the chromatic adaptation transformation.
override void ResetToDefault()
Resets all parameters to their default values.
override object Process(object input)
Processes the input image and returns a color corrected and/or saturated output image.
void SetAutoFeatureModule(IAutoFeature? module)
Sets the auto feature module that should take the color correction matrix into account for automatic ...
override string TypeId
The unique type identifier for this module implementation.This should be a unique string identifying ...
uint? ColorTemperature
The current source color temperature in Kelvin to be used for chromatic adaptation.
override bool IsEnabled
Gets or sets whether the module is enabled.
ChromaticAdaptionAlgorithm ChromaticAdaptionAlgorithm
The current algorithm used for chromatic adaptation.
override void Serialize(IArchive archive)
Serializes the object's internal state into the provided archive.
Base class for all pipeline modules.
Definition ModuleBase.cs:13
static ColorCorrectionMatrix Identity()
Constructs a uniform identity matrix.
void Deserialize(IArchive archive)
Restores the object's state from the provided archive.
Constructs an Image from an IImageView Instance.
Definition Image.cs:18
PixelFormat PixelFormat
Gets the pixel format from the image.
Definition Image.cs:217
Represents a generic 2D matrix of elements with a specified number of rows and columns.
Definition Matrix.cs:19
Channel
Represents the various data channels in image or spatial data formats. /// This enumeration defines s...
Definition Channel.cs:13
PixelFormat
Each enumerator represents a specific pixel layout and bit-depth, used for interpreting raw image dat...
ColorSpace
Color spaces supported by the chromatic adaptation feature.
Definition ColorSpace.cs:11
ChromaticAdaptionAlgorithm
Algorithm used for chromatic adaption.
Interface for modules that provide auto-feature functionality.
void SetColorCorrectionMatrix(float[] matrix)
Notifies the auto-feature module of the currently used color correction matrix.
Represents a hierarchical, strongly-typed key-value archive.
Definition IArchive.cs:79
IArchive GetArchive(string key)
Retrieves a nested archive by key.
IArchive CreateArchive()
Creates a new, empty archive instance of the same concrete type.
bool HasKey(string key)
Determines whether a value exists for the specified key.
double GetDouble(string key)
Retrieves a double-precision floating-point value by key.
void SetBool(string key, bool value)
Stores a boolean value under the specified key.
long GetInt64(string key)
Retrieves a 64-bit integer value by key.
void SetArchive(string key, IArchive value)
Stores a nested archive under the specified key.
void SetInt64(string key, long value)
Stores a 64-bit integer value under the specified key.
bool GetBool(string key)
Retrieves a boolean value by key.
void SetDouble(string key, double value)
Stores a double-precision floating-point value under the specified key.
string GetString(string key)
Retrieves a string value by key.
void SetString(string key, string value)
Stores a string value under the specified key.