Exemplo n.º 1
0
        public void DetectEdges_Rect_EdgeDetectorCompassProcessor_DefaultGrayScale_Set(EdgeDetectorCompassKernel kernel, bool _)
        {
            this.operations.DetectEdges(kernel, this.rect);
            EdgeDetectorCompassProcessor processor = this.Verify <EdgeDetectorCompassProcessor>(this.rect);

            Assert.True(processor.Grayscale);
            Assert.Equal(kernel, processor.Kernel);
        }
Exemplo n.º 2
0
        public void DetectEdges_Rect_EdgeDetectorCompassProcessorSet(EdgeDetectorCompassKernel kernel, bool grayscale)
        {
            this.operations.DetectEdges(kernel, grayscale, this.rect);
            EdgeDetectorCompassProcessor processor = this.Verify <EdgeDetectorCompassProcessor>(this.rect);

            Assert.Equal(grayscale, processor.Grayscale);
            Assert.Equal(kernel, processor.Kernel);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Detects any edges within the image using a <see cref="EdgeDetectorCompassKernel"/>.
        /// </summary>
        /// <param name="source">The image this method extends.</param>
        /// <param name="kernel">Thecompass edge detector kernel.</param>
        /// <param name="grayscale">
        /// Whether to convert the image to grayscale before performing edge detection.
        /// </param>
        /// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
        public static IImageProcessingContext DetectEdges(
            this IImageProcessingContext source,
            EdgeDetectorCompassKernel kernel,
            bool grayscale)
        {
            var processor = new EdgeDetectorCompassProcessor(kernel, grayscale);

            source.ApplyProcessor(processor);
            return(source);
        }