C# Class Accord.Imaging.Filters.Crop

Crop an image.

The filter crops an image providing a new image, which contains only the specified rectangle of the original image.

The filter accepts 8 and 16 bpp grayscale images and 24, 32, 48 and 64 bpp color images for processing.

Sample usage:

// create filter Crop filter = new Crop( new Rectangle( 75, 75, 320, 240 ) ); // apply the filter Bitmap newImage = filter.Apply( image );

Initial image:

Result image:

Inheritance: BaseTransformationFilter
Exibir arquivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
Crop ( Rectangle rect ) : System

Initializes a new instance of the Crop class.

Protected Methods

Method Description
CalculateNewImageSize ( UnmanagedImage sourceData ) : Size

Calculates new image size.

ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData ) : void

Process the filter on the specified image.

Method Details

CalculateNewImageSize() protected method

Calculates new image size.
protected CalculateNewImageSize ( UnmanagedImage sourceData ) : Size
sourceData UnmanagedImage Source image data.
return System.Drawing.Size

Crop() public method

Initializes a new instance of the Crop class.
public Crop ( Rectangle rect ) : System
rect System.Drawing.Rectangle Rectangle to crop.
return System

ProcessFilter() protected method

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage sourceData, UnmanagedImage destinationData ) : void
sourceData UnmanagedImage Source image data.
destinationData UnmanagedImage Destination image data.
return void