C# 클래스 Accord.Imaging.Filters.Convolution

Convolution filter.

The filter implements convolution operator, which calculates each pixel of the result image as weighted sum of the correspond pixel and its neighbors in the source image. The weights are set by convolution kernel. The weighted sum is divided by Divisor before putting it into result image and also may be thresholded using Threshold value.

Convolution is a simple mathematical operation which is fundamental to many common image processing filters. Depending on the type of provided kernel, the filter may produce different results, like blur image, sharpen it, find edges, etc.

The filter accepts 8 and 16 bpp grayscale images and 24, 32, 48 and 64 bpp color images for processing. Note: depending on the value of ProcessAlpha property, the alpha channel is either copied as is or processed with the kernel.

Sample usage:

// define emboss kernel int[,] kernel = { { -2, -1, 0 }, { -1, 1, 1 }, { 0, 1, 2 } }; // create filter Convolution filter = new Convolution( kernel ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

상속: BaseUsingCopyPartialFilter
파일 보기 프로젝트 열기: accord-net/framework 1 사용 예제들

공개 메소드들

메소드 설명
Convolution ( int kernel ) : System

Initializes a new instance of the Convolution class.

Using this constructor (specifying only convolution kernel), division factor will be calculated automatically summing all kernel values. In the case if kernel's sum equals to zero, division factor will be assigned to 1.

Convolution ( int kernel, int divisor ) : System

Initializes a new instance of the Convolution class.

보호된 메소드들

메소드 설명
Convolution ( ) : System

Initializes a new instance of the Convolution class.

ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData, Rectangle rect ) : void

Process the filter on the specified image.

비공개 메소드들

메소드 설명
Process16bppImage ( ushort baseSrc, ushort baseDst, int srcStride, int dstStride, int startX, int startY, int stopX, int stopY ) : void
Process24bppImage ( byte src, byte dst, int srcStride, int dstStride, int srcOffset, int dstOffset, int startX, int startY, int stopX, int stopY, int pixelSize ) : void
Process32bppImage ( byte src, byte dst, int srcStride, int dstStride, int srcOffset, int dstOffset, int startX, int startY, int stopX, int stopY ) : void
Process48bppImage ( ushort baseSrc, ushort baseDst, int srcStride, int dstStride, int startX, int startY, int stopX, int stopY, int pixelSize ) : void
Process64bppImage ( ushort baseSrc, ushort baseDst, int srcStride, int dstStride, int startX, int startY, int stopX, int stopY ) : void
Process8bppImage ( byte src, byte dst, int srcStride, int dstStride, int srcOffset, int dstOffset, int startX, int startY, int stopX, int stopY ) : void

메소드 상세

Convolution() 보호된 메소드

Initializes a new instance of the Convolution class.
protected Convolution ( ) : System
리턴 System

Convolution() 공개 메소드

Initializes a new instance of the Convolution class.

Using this constructor (specifying only convolution kernel), division factor will be calculated automatically summing all kernel values. In the case if kernel's sum equals to zero, division factor will be assigned to 1.

Invalid kernel size is specified. Kernel must be /// square, its width/height should be odd and should be in the [3, 25] range.
public Convolution ( int kernel ) : System
kernel int Convolution kernel.
리턴 System

Convolution() 공개 메소드

Initializes a new instance of the Convolution class.
Invalid kernel size is specified. Kernel must be /// square, its width/height should be odd and should be in the [3, 25] range. Divisor can not be equal to zero.
public Convolution ( int kernel, int divisor ) : System
kernel int Convolution kernel.
divisor int Divisor, used used to divide weighted sum.
리턴 System

ProcessFilter() 보호된 메소드

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData, Rectangle rect ) : void
sourceData UnmanagedImage Source image data.
destinationData UnmanagedImage Destination image data.
rect System.Drawing.Rectangle Image rectangle for processing by the filter.
리턴 void