YuhuaDeng / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

SobelEdgeDetector mode #366

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Ability to set filter work mode:

    ...
    /// <summary>
    /// Kernel mode
    /// </summary>
    public enum SobelEdgeKernel
    {
        Both,
        Vertical,
        Horisontal
    }
    ...
    public class SobelEdgeDetector : BaseUsingCopyPartialFilter
    {
        ...
        public SobelEdgeKernel KernelMode { get; set; }
        ...
                    g = Math.Min( 255,
                                KernelMode == SobelEdgeKernel.Vertical ? 0 : Math.Abs(src[-srcStride - 1] + src[-srcStride + 1]
                                - src[ srcStride - 1] - src[ srcStride + 1]
                                + 2 * ( src[-srcStride] - src[srcStride] ) )
                                + KernelMode == SobelEdgeKernel.Horisontal ? 0 : Math.Abs(src[-srcStride + 1] + src[srcStride + 1]
                                - src[-srcStride - 1] - src[srcStride - 1]
                                + 2 * ( src[1] - src[-1] ) ) );
    }

Original issue reported on code.google.com by antpr...@gmail.com on 11 Nov 2013 at 6:36

Attachments: