Example #1
0
        public void DetectEdges_Rect_EdgeDetectorProcessor_DefaultGrayScale_Set(EdgeDetectorKernel kernel, bool _)
        {
            this.operations.DetectEdges(kernel, this.rect);
            EdgeDetectorProcessor processor = this.Verify <EdgeDetectorProcessor>(this.rect);

            Assert.True(processor.Grayscale);
            Assert.Equal(kernel, processor.Kernel);
        }
Example #2
0
        public void DetectEdges_Rect_EdgeDetectorProcessorSet(EdgeDetectorKernel kernel, bool grayscale)
        {
            this.operations.DetectEdges(kernel, grayscale, this.rect);
            EdgeDetectorProcessor processor = this.Verify <EdgeDetectorProcessor>(this.rect);

            Assert.Equal(grayscale, processor.Grayscale);
            Assert.Equal(kernel, processor.Kernel);
        }
        /// <summary>
        /// Detects any edges within the image using a <see cref="EdgeDetectorKernel"/>.
        /// </summary>
        /// <param name="source">The image this method extends.</param>
        /// <param name="kernel">The 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,
            EdgeDetectorKernel kernel,
            bool grayscale)
        {
            var processor = new EdgeDetectorProcessor(kernel, grayscale);

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