C# Класс Accord.Imaging.Filters.Grayscale

Base class for image grayscaling.

This class is the base class for image grayscaling. Other classes should inherit from this class and specify RGB coefficients used for color image conversion to grayscale.

The filter accepts 24, 32, 48 and 64 bpp color images and produces 8 (if source is 24 or 32 bpp image) or 16 (if source is 48 or 64 bpp image) bpp grayscale image.

Sample usage:

// create grayscale filter (BT709) Grayscale filter = new Grayscale( 0.2125, 0.7154, 0.0721 ); // apply the filter Bitmap grayImage = filter.Apply( image );

Initial image:

Result image:

Наследование: BaseFilter
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
BlueCoefficient double
GreenCoefficient double
RedCoefficient double

Открытые методы

Метод Описание
Grayscale ( double cr, double cg, double cb ) : System

Initializes a new instance of the Grayscale class.

Защищенные методы

Метод Описание
ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData ) : void

Process the filter on the specified image.

Описание методов

Grayscale() публичный метод

Initializes a new instance of the Grayscale class.
public Grayscale ( double cr, double cg, double cb ) : System
cr double Red coefficient.
cg double Green coefficient.
cb double Blue coefficient.
Результат System

ProcessFilter() защищенный метод

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData ) : void
sourceData UnmanagedImage Source image data.
destinationData UnmanagedImage Destination image data.
Результат void

Описание свойств

BlueCoefficient публичное свойство

Portion of blue channel's value to use during conversion from RGB to grayscale.
public double BlueCoefficient
Результат double

GreenCoefficient публичное свойство

Portion of green channel's value to use during conversion from RGB to grayscale.
public double GreenCoefficient
Результат double

RedCoefficient публичное свойство

Portion of red channel's value to use during conversion from RGB to grayscale.
public double RedCoefficient
Результат double