/// <summary> /// Initializes a new instance of the PerceptualHash class /// </summary> /// <param name="channel">The channel.></param> /// <param name="srgbHuPhash">SRGB hu perceptual hash.</param> /// <param name="hclpHuPhash">Hclp hu perceptual hash.</param> /// <param name="hash">A string representation of this hash.</param> public ChannelPerceptualHash(PixelChannel channel, double[] srgbHuPhash, double[] hclpHuPhash, string hash) { Channel = channel; _SrgbHuPhash = srgbHuPhash; _HclpHuPhash = hclpHuPhash; _Hash = hash; }
internal static ChannelMoments Create(PixelChannel channel, IntPtr instance) { if (instance == IntPtr.Zero) return null; return new ChannelMoments(channel, instance); }
private static ChannelPerceptualHash CreateChannelPerceptualHash(MagickImage image, IntPtr list, PixelChannel channel) { IntPtr instance = NativePerceptualHash.GetInstance(image, list, channel); if (instance == IntPtr.Zero) return null; return new ChannelPerceptualHash(channel, instance); }
private void AddChannel(IntPtr list, PixelChannel channel) { IntPtr instance = NativeMoments.GetInstance(list, channel); ChannelMoments result = ChannelMoments.Create(channel, instance); if (result != null) _Channels.Add(result.Channel, result); }
private void AddChannel(IntPtr list, PixelChannel channel) { IntPtr instance = NativeMoments.GetInstance(list, channel); ChannelMoments result = ChannelMoments.Create(channel, instance); if (result != null) { _Channels.Add(result.Channel, result); } }
public static IntPtr GetInstance(IntPtr list, PixelChannel channel) { if (NativeLibrary.Is64Bit) { return(NativeMethods.X64.Statistics_GetInstance(list, (UIntPtr)channel)); } else { return(NativeMethods.X86.Statistics_GetInstance(list, (UIntPtr)channel)); } }
public static IntPtr GetInstance(MagickImage image, IntPtr list, PixelChannel channel) { if (NativeLibrary.Is64Bit) { return(NativeMethods.X64.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel)); } else { return(NativeMethods.X86.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel)); } }
private void AddChannel(IntPtr list, PixelChannel channel) { var instance = NativeStatistics.GetInstance(list, channel); ChannelStatistics result = ChannelStatistics.Create(channel, instance); if (result != null) { _channels.Add(result.Channel, result); } }
/// <summary> /// Initializes a new instance of the ChannelMoments class. /// </summary> /// <param name="channel">The channel of the moment.</param> /// <param name="centroid">The centroid.</param> /// <param name="ellipseAxis">The ellipse axis.</param> /// <param name="ellipseAngle">The ellipse angle.</param> /// <param name="ellipseEccentricity">The ellipse eccentricity.</param> /// <param name="ellipseIntensity">The ellipse intensity.</param> /// <param name="huInvariants">The Hu invariants.</param> public ChannelMoments(PixelChannel channel, PointD centroid, PointD ellipseAxis, double ellipseAngle, double ellipseEccentricity, double ellipseIntensity, double[] huInvariants) { Channel = channel; Centroid = centroid; EllipseAxis = ellipseAxis; EllipseAngle = ellipseAngle; EllipseEccentricity = ellipseEccentricity; EllipseIntensity = ellipseIntensity; _HuInvariants = huInvariants; }
private ChannelMoments(PixelChannel channel, IntPtr instance) { Channel = channel; NativeChannelMoments nativeInstance = new NativeChannelMoments(instance); Centroid = PointD.FromPointInfo(nativeInstance.Centroid); EllipseAngle = nativeInstance.EllipseAngle; EllipseAxis = PointD.FromPointInfo(nativeInstance.EllipseAxis); EllipseEccentricity = nativeInstance.EllipseEccentricity; EllipseIntensity = nativeInstance.EllipseIntensity; SetHuInvariants(nativeInstance); }
private ChannelMoments(PixelChannel channel, IntPtr instance) { Channel = channel; NativeChannelMoments nativeInstance = new NativeChannelMoments(instance); Centroid = nativeInstance.Centroid.ToPointD(); EllipseAngle = nativeInstance.EllipseAngle; EllipseAxis = nativeInstance.EllipseAxis.ToPointD(); EllipseEccentricity = nativeInstance.EllipseEccentricity; EllipseIntensity = nativeInstance.EllipseIntensity; SetHuInvariants(nativeInstance); }
public static IntPtr GetInstance(MagickImage image, IntPtr list, PixelChannel channel) { #if ANYCPU if (NativeLibrary.Is64Bit) #endif #if WIN64 || ANYCPU return(NativeMethods.X64.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel)); #endif #if ANYCPU else #endif #if !WIN64 || ANYCPU return(NativeMethods.X86.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel)); #endif }
public static IntPtr GetInstance(MagickImage image, IntPtr list, PixelChannel channel) { #if ANYCPU if (NativeLibrary.Is64Bit) #endif #if WIN64 || ANYCPU return NativeMethods.X64.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel); #endif #if ANYCPU else #endif #if !WIN64 || ANYCPU return NativeMethods.X86.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel); #endif }
public static IntPtr GetInstance(IntPtr list, PixelChannel channel) { #if PLATFORM_AnyCPU if (OperatingSystem.Is64Bit) #endif #if PLATFORM_x64 || PLATFORM_AnyCPU return(NativeMethods.X64.Moments_GetInstance(list, (UIntPtr)channel)); #endif #if PLATFORM_AnyCPU else #endif #if PLATFORM_x86 || PLATFORM_AnyCPU return(NativeMethods.X86.Moments_GetInstance(list, (UIntPtr)channel)); #endif }
public static IntPtr GetInstance(IntPtr list, PixelChannel channel) { #if ANYCPU if (NativeLibrary.Is64Bit) #endif #if WIN64 || ANYCPU return(NativeMethods.X64.Statistics_GetInstance(list, (UIntPtr)channel)); #endif #if ANYCPU else #endif #if !WIN64 || ANYCPU return(NativeMethods.X86.Statistics_GetInstance(list, (UIntPtr)channel)); #endif }
public static IntPtr GetInstance(IMagickImage image, IntPtr list, PixelChannel channel) { #if PLATFORM_AnyCPU if (NativeLibrary.Is64Bit) #endif #if PLATFORM_x64 || PLATFORM_AnyCPU return(NativeMethods.X64.PerceptualHash_GetInstance(image.GetInstance(), list, (UIntPtr)channel)); #endif #if PLATFORM_AnyCPU else #endif #if PLATFORM_x86 || PLATFORM_AnyCPU return(NativeMethods.X86.PerceptualHash_GetInstance(image.GetInstance(), list, (UIntPtr)channel)); #endif }
public static IntPtr GetInstance(IntPtr list, PixelChannel channel) { #if PLATFORM_AnyCPU if (NativeLibrary.Is64Bit) #endif #if PLATFORM_x64 || PLATFORM_AnyCPU return(NativeMethods.X64.Statistics_GetInstance(list, (UIntPtr)channel)); #endif #if PLATFORM_AnyCPU else #endif #if PLATFORM_x86 || PLATFORM_AnyCPU return(NativeMethods.X86.Statistics_GetInstance(list, (UIntPtr)channel)); #endif }
public static IntPtr GetInstance(IntPtr list, PixelChannel channel) { #if ANYCPU if (NativeLibrary.Is64Bit) #endif #if WIN64 || ANYCPU return NativeMethods.X64.Moments_GetInstance(list, (UIntPtr)channel); #endif #if ANYCPU else #endif #if !WIN64 || ANYCPU return NativeMethods.X86.Moments_GetInstance(list, (UIntPtr)channel); #endif }
/// <summary> /// Initializes a new instance of the ChannelStatistics class. /// </summary> /// <param name="channel">The channel.</param> /// <param name="depth">Depth of the channel.</param> /// <param name="entropy">Entropy.</param> /// <param name="kurtosis">Kurtosis</param> /// <param name="maximum">Maximum value observed.</param> /// <param name="mean">Average (mean) value observed.</param> /// <param name="minimum">Minimum value observed.</param> /// <param name="skewness">Skewness.</param> /// <param name="standardDeviation">Standard deviation, sqrt(variance).</param> /// <param name="sum">Sum.</param> /// <param name="sumCubed">Sum cubed.</param> /// <param name="sumFourthPower">Sum fourth power.</param> /// <param name="sumSquared">Sum squared.</param> /// <param name="variance">Variance.</param> public ChannelStatistics(PixelChannel channel, int depth, double entropy, double kurtosis, double maximum, double mean, double minimum, double skewness, double standardDeviation, double sum, double sumCubed, double sumFourthPower, double sumSquared, double variance) { Channel = channel; Depth = depth; Entropy = entropy; Kurtosis = kurtosis; Maximum = maximum; Mean = mean; Minimum = minimum; Skewness = skewness; StandardDeviation = standardDeviation; Sum = sum; SumCubed = sumCubed; SumFourthPower = sumFourthPower; SumSquared = sumSquared; Variance = variance; }
private ChannelStatistics(PixelChannel channel, IntPtr instance) { Channel = channel; NativeChannelStatistics nativeInstance = new NativeChannelStatistics(instance); Depth = nativeInstance.Depth; Entropy = nativeInstance.Entropy; Kurtosis = nativeInstance.Kurtosis; Maximum = nativeInstance.Maximum; Mean = nativeInstance.Mean; Minimum = nativeInstance.Minimum; Skewness = nativeInstance.Skewness; StandardDeviation = nativeInstance.StandardDeviation; Sum = nativeInstance.Sum; SumCubed = nativeInstance.SumCubed; SumFourthPower = nativeInstance.SumFourthPower; SumSquared = nativeInstance.SumSquared; Variance = nativeInstance.Variance; }
public static IntPtr GetInstance(IntPtr list, PixelChannel channel) { IntPtr result; #if PLATFORM_AnyCPU if (OperatingSystem.IsArm64) #endif #if PLATFORM_arm64 || PLATFORM_AnyCPU result = NativeMethods.ARM64.Statistics_GetInstance(list, (UIntPtr)channel); #endif #if PLATFORM_AnyCPU else if (OperatingSystem.Is64Bit) #endif #if PLATFORM_x64 || PLATFORM_AnyCPU result = NativeMethods.X64.Statistics_GetInstance(list, (UIntPtr)channel); #endif #if PLATFORM_AnyCPU else #endif #if PLATFORM_x86 || PLATFORM_AnyCPU result = NativeMethods.X86.Statistics_GetInstance(list, (UIntPtr)channel); #endif return(result); }
public static IntPtr GetInstance(IMagickImage?image, IntPtr list, PixelChannel channel) { IntPtr result; #if PLATFORM_AnyCPU if (OperatingSystem.IsArm64) #endif #if PLATFORM_arm64 || PLATFORM_AnyCPU result = NativeMethods.ARM64.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel); #endif #if PLATFORM_AnyCPU else if (OperatingSystem.Is64Bit) #endif #if PLATFORM_x64 || PLATFORM_AnyCPU result = NativeMethods.X64.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel); #endif #if PLATFORM_AnyCPU else #endif #if PLATFORM_x86 || PLATFORM_AnyCPU result = NativeMethods.X86.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel); #endif return(result); }
/// <summary> /// Gets the moments for the specified channel. /// </summary> /// <param name="channel">The channel to get the moments for.</param> /// <returns>The moments for the specified channel.</returns> public ChannelMoments GetChannel(PixelChannel channel) { _channels.TryGetValue(channel, out ChannelMoments moments); return(moments); }
internal ChannelPerceptualHash(PixelChannel channel, string hash) : this(channel) { ParseHash(hash); }
///<summary> /// Returns the index of the specified channel. Returns -1 if not found. ///</summary> ///<param name="channel">The channel to get the index of.</param> public int GetIndex(PixelChannel channel) { return(_Image.ChannelOffset(channel)); }
public int GetIndex(PixelChannel channel) => Image.ChannelOffset(channel);
/// <summary> /// Gets the moments for the specified channel. /// </summary> /// <param name="channel">The channel to get the moments for.</param> /// <returns>The moments for the specified channel.</returns> public ChannelMoments GetChannel(PixelChannel channel) { ChannelMoments moments; _Channels.TryGetValue(channel, out moments); return moments; }
internal ChannelPerceptualHash(PixelChannel channel) { Channel = channel; _hclpHuPhash = new double[7]; _srgbHuPhash = new double[7]; }
public void Test_Channels() { PixelChannel[] rgb = new PixelChannel[] { PixelChannel.Red, PixelChannel.Green, PixelChannel.Blue }; PixelChannel[] rgba = new PixelChannel[] { PixelChannel.Red, PixelChannel.Green, PixelChannel.Blue, PixelChannel.Alpha }; PixelChannel[] gray = new PixelChannel[] { PixelChannel.Gray }; PixelChannel[] grayAlpha = new PixelChannel[] { PixelChannel.Gray, PixelChannel.Alpha }; PixelChannel[] cmyk = new PixelChannel[] { PixelChannel.Cyan, PixelChannel.Magenta, PixelChannel.Yellow, PixelChannel.Black }; PixelChannel[] cmyka = new PixelChannel[] { PixelChannel.Cyan, PixelChannel.Magenta, PixelChannel.Yellow, PixelChannel.Black, PixelChannel.Alpha }; using (MagickImage image = new MagickImage(Files.RoseSparkleGIF)) { CollectionAssert.AreEqual(rgba, image.Channels.ToArray()); image.Alpha(AlphaOption.Off); CollectionAssert.AreEqual(rgb, image.Channels.ToArray()); } using (MagickImage image = new MagickImage(Files.SnakewarePNG)) { CollectionAssert.AreEqual(grayAlpha, image.Channels.ToArray()); using (MagickImage redChannel = image.Separate(Channels.Red).First()) { CollectionAssert.AreEqual(gray, redChannel.Channels.ToArray()); redChannel.Alpha(AlphaOption.On); CollectionAssert.AreEqual(grayAlpha, redChannel.Channels.ToArray()); } } using (MagickImage image = new MagickImage(Files.SnakewarePNG)) { image.ColorSpace = ColorSpace.CMYK; CollectionAssert.AreEqual(cmyka, image.Channels.ToArray()); image.Alpha(AlphaOption.Off); CollectionAssert.AreEqual(cmyk, image.Channels.ToArray()); } }
private static ChannelPerceptualHash CreateChannelPerceptualHash(MagickImage image, IntPtr list, PixelChannel channel) { IntPtr instance = NativePerceptualHash.GetInstance(image, list, channel); if (instance == IntPtr.Zero) { return(null); } return(new ChannelPerceptualHash(channel, instance)); }
internal ChannelPerceptualHash(PixelChannel channel, IntPtr instance) : this(channel) { NativeChannelPerceptualHash nativeInstance = new NativeChannelPerceptualHash(instance); SetSrgbHuPhash(nativeInstance); SetHclpHuPhash(nativeInstance); SetHash(); }
public bool HasChannel(PixelChannel channel) { #if ANYCPU if (NativeLibrary.Is64Bit) #endif #if WIN64 || ANYCPU return NativeMethods.X64.MagickImage_HasChannel(Instance, (UIntPtr)channel); #endif #if ANYCPU else #endif #if !WIN64 || ANYCPU return NativeMethods.X86.MagickImage_HasChannel(Instance, (UIntPtr)channel); #endif }
/// <summary> /// Returns the perceptual hash for the specified channel. /// </summary> /// <param name="channel">The channel to get the has for.</param> /// <returns>The perceptual hash for the specified channel.</returns> public IChannelPerceptualHash GetChannel(PixelChannel channel) { _channels.TryGetValue(channel, out ChannelPerceptualHash perceptualHash); return(perceptualHash); }
private void AddChannel(MagickImage image, IntPtr list, PixelChannel channel) { ChannelPerceptualHash instance = CreateChannelPerceptualHash(image, list, channel); if (instance != null) _Channels.Add(instance.Channel, instance); }
internal ChannelPerceptualHash(PixelChannel channel) { Channel = channel; _HclpHuPhash = new double[7]; _SrgbHuPhash = new double[7]; }
/// <summary> /// Returns the perceptual hash for the specified channel. /// </summary> /// <param name="channel">The channel to get the has for.</param> /// <returns>The perceptual hash for the specified channel.</returns> public ChannelPerceptualHash GetChannel(PixelChannel channel) { ChannelPerceptualHash perceptualHash; _Channels.TryGetValue(channel, out perceptualHash); return perceptualHash; }
///<summary> /// Returns the index of the specified channel. Returns -1 if not found. ///</summary> ///<param name="channel">The channel to get the index of.</param> public int GetIndex(PixelChannel channel) { return(_Instance.GetIndex(channel)); }
/// <summary> /// Returns the statistics for the specified channel. /// </summary> /// <param name="channel">The channel to get the statistics for.</param> /// <returns>The statistics for the specified channel.</returns> public ChannelStatistics GetChannel(PixelChannel channel) { _channels.TryGetValue(channel, out ChannelStatistics channelStatistics); return(channelStatistics); }
public int ChannelOffset(PixelChannel channel) { #if ANYCPU if (NativeLibrary.Is64Bit) #endif #if WIN64 || ANYCPU return (int)NativeMethods.X64.MagickImage_ChannelOffset(Instance, (UIntPtr)channel); #endif #if ANYCPU else #endif #if !WIN64 || ANYCPU return (int)NativeMethods.X86.MagickImage_ChannelOffset(Instance, (UIntPtr)channel); #endif }