IPixelNeighborhoodOperation<TPixel> Interface

A custom image processor that computes each row from the unmodified pixels of the frame (a neighborhood filter, such as a blur or an edge detector), applied to every frame of an image by ImageProcessingExtensions.ApplyNeighborhoodOperation.

public interface IPixelNeighborhoodOperation<TPixel> where TPixel : unmanaged

Type parameters

TPixel
The pixel type of the rows: the pixel type of the image, or a wider working type.

Remarks

Implement the operation as a struct: the processing loop is then compiled for it, without an interface call per row. IPixelNeighborhoodOperation<TPixel>.Invoke is called from several threads at once when ImageConfiguration.MaxDegreeOfParallelism is greater than 1, for different rows of the same instance: it must not change the state of the operation.

Methods

NameDescription
Invoke(int, PixelRowSource<TPixel>, Span<TPixel>)Computes one row.

Invoke(int, PixelRowSource<TPixel>, Span<TPixel>)

Computes one row.

void Invoke(int y, PixelRowSource<TPixel> source, Span<TPixel> destination)

Parameters

y int
The index of the row in the frame.
source PixelRowSource<TPixel>
The pixels of the frame before the operation, in rows. Valid until the method returns.
destination Span<TPixel>
The row to write. Its initial content is unspecified: write every pixel. Valid until the method returns.