/// <summary> /// Applies a binary blob thinning operation, to achieve a skeletization of the input image. /// The function transforms a binary blob image into a skeletized form using the technique of Zhang-Suen. /// </summary> /// <param name="src">Source 8-bit single-channel image, containing binary blobs, with blobs having 255 pixel values.</param> /// <param name="dst">Destination image of the same size and the same type as src. The function can work in-place.</param> /// <param name="thinningType">Value that defines which thinning algorithm should be used. </param> public static void Thinning( InputArray src, OutputArray dst, ThinningTypes thinningType = ThinningTypes.ZHANGSUEN) { if (src == null) { throw new ArgumentNullException(nameof(src)); } if (dst == null) { throw new ArgumentNullException(nameof(dst)); } src.ThrowIfDisposed(); dst.ThrowIfNotReady(); NativeMethods.ximgproc_thinning(src.CvPtr, dst.CvPtr, (int)thinningType); GC.KeepAlive(src); dst.Fix(); }
private static extern void cveThinning(IntPtr src, IntPtr dst, ThinningTypes thinningType);
/// <summary> /// Applies a binary blob thinning operation, to achieve a skeletization of the input image. /// The function transforms a binary blob image into a skeletized form using the technique of Zhang-Suen. /// </summary> /// <param name="src">Source 8-bit single-channel image, containing binary blobs, with blobs having 255 pixel values.</param> /// <param name="dst">Destination image of the same size and the same type as src. The function can work in-place.</param> /// <param name="thinningType">Value that defines which thinning algorithm should be used.</param> public static void Thinning(IInputArray src, IOutputArray dst, ThinningTypes thinningType) { using (InputArray iaSrc = src.GetInputArray()) using (OutputArray oaDst = dst.GetOutputArray()) cveThinning(iaSrc, oaDst, thinningType); }