Class DefaultPixelSamplingStrategy
A pixel sampling strategy that enumerates a limited amount of rows from different frames, if the total number of pixels is over a threshold.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Processing.Processors.Quantization
Assembly: SixLabors.ImageSharp.dll
Syntax
public class DefaultPixelSamplingStrategy : IPixelSamplingStrategy
Constructors
| Edit this page View SourceDefaultPixelSamplingStrategy()
Initializes a new instance of the DefaultPixelSamplingStrategy class.
Declaration
public DefaultPixelSamplingStrategy()
DefaultPixelSamplingStrategy(int, double)
Initializes a new instance of the DefaultPixelSamplingStrategy class.
Declaration
public DefaultPixelSamplingStrategy(int maximumPixels, double minimumScanRatio)
Parameters
| Type | Name | Description |
|---|---|---|
| int | maximumPixels | The maximum number of pixels to process. |
| double | minimumScanRatio | always scan at least this portion of total pixels within the image. |
Properties
| Edit this page View SourceMaximumPixels
Gets the maximum number of pixels to process. (The threshold.)
Declaration
public long MaximumPixels { get; }
Property Value
| Type | Description |
|---|---|
| long |
MinimumScanRatio
Gets a value indicating: always scan at least this portion of total pixels within the image. The default is 0.1 (10%).
Declaration
public double MinimumScanRatio { get; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
| Edit this page View SourceEnumeratePixelRegions<TPixel>(ImageFrame<TPixel>)
Enumerates pixel regions within a single image frame as Buffer2DRegion<T>.
Declaration
public IEnumerable<Buffer2DRegion<TPixel>> EnumeratePixelRegions<TPixel>(ImageFrame<TPixel> frame) where TPixel : unmanaged, IPixel<TPixel>
Parameters
| Type | Name | Description |
|---|---|---|
| ImageFrame<TPixel> | frame | The image frame. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Buffer2DRegion<TPixel>> | An enumeration of pixel regions. |
Type Parameters
| Name | Description |
|---|---|
| TPixel | The pixel type. |
EnumeratePixelRegions<TPixel>(Image<TPixel>)
Enumerates pixel regions for all frames within the image as Buffer2DRegion<T>.
Declaration
public IEnumerable<Buffer2DRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPixel> image) where TPixel : unmanaged, IPixel<TPixel>
Parameters
| Type | Name | Description |
|---|---|---|
| Image<TPixel> | image | The image. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Buffer2DRegion<TPixel>> | An enumeration of pixel regions. |
Type Parameters
| Name | Description |
|---|---|
| TPixel | The pixel type. |