AutoCropAnalysis Class
The result of ImageProcessingExtensions.AnalyzeAutoCrop: the background and the content box detected in an image.
public abstract class AutoCropAnalysisRemarks
An analysis is an immutable snapshot: it does not follow later changes of the image. It can be applied to any image of the same canvas size with ImageProcessingExtensions.AutoCrop.
Every analysis is an AutoCropAnalysis<TPixel> of the pixel type of the analyzed image, which gives the background as a pixel. This base type gives it as an Rgba64, whatever the pixel type; it cannot be derived outside the library.
Properties
| Name | Description |
|---|---|
| BackgroundColor | Gets the detected background: the first border pixel of the most frequent border color, widened exactly to 16 bits. A fully transparent background is transparent black. The background of an image of floating-point pixels (RgbaFloat, RgbaHalf) is clipped to [0, 1] and rounded to 16 bits here: its exact value is AutoCropAnalysis<TPixel>.BackgroundColor, which is also the color an auto-crop that enlarges the canvas fills it with, and the analysis only applies to images of its own pixel type then. |
| Bounds | Gets the bounding box of the content in every frame and in the poster, in stored-pixel coordinates, without padding. It is the whole canvas when AutoCropAnalysis.Success is false. |
| CanvasSize | Gets the canvas size of the analyzed image. |
| Success | Gets a value indicating whether a border was found around a content box of at least 3x3 pixels. When false, an auto-crop leaves the image unchanged. |
| WeightX | Gets the horizontal weight of the image, from -1 (left) to 1 (right): the mean over all pixels of the horizontal position of the pixel center relative to the canvas center, multiplied by the difference of the pixel from the background (0 to 1, scaled by alpha). It is 0 unless AutoCropOptions.AnalyzeWeights is set. The samples of floating-point pixels are not clipped, so a difference, and the weight, can exceed 1 for colors outside [0, 1]. |
| WeightY | Gets the vertical weight of the image, from -1 (top) to 1 (bottom). See AutoCropAnalysis.WeightX. |
BackgroundColor
AutoCropAnalysis.csGets the detected background: the first border pixel of the most frequent border color, widened exactly to 16 bits. A fully transparent background is transparent black. The background of an image of floating-point pixels (RgbaFloat, RgbaHalf) is clipped to [0, 1] and rounded to 16 bits here: its exact value is AutoCropAnalysis<TPixel>.BackgroundColor, which is also the color an auto-crop that enlarges the canvas fills it with, and the analysis only applies to images of its own pixel type then.
public Rgba64 BackgroundColor { get; }Property value
Bounds
AutoCropAnalysis.csGets the bounding box of the content in every frame and in the poster, in stored-pixel coordinates, without padding. It is the whole canvas when AutoCropAnalysis.Success is false.
public Rectangle Bounds { get; }Property value
CanvasSize
AutoCropAnalysis.csSuccess
AutoCropAnalysis.csWeightX
AutoCropAnalysis.csGets the horizontal weight of the image, from -1 (left) to 1 (right): the mean over all pixels of the horizontal position of the pixel center relative to the canvas center, multiplied by the difference of the pixel from the background (0 to 1, scaled by alpha). It is 0 unless AutoCropOptions.AnalyzeWeights is set. The samples of floating-point pixels are not clipped, so a difference, and the weight, can exceed 1 for colors outside [0, 1].
public double WeightX { get; }Property value
WeightY
AutoCropAnalysis.csGets the vertical weight of the image, from -1 (top) to 1 (bottom). See AutoCropAnalysis.WeightX.
public double WeightY { get; }