8 public static partial class ColorModelOperations
20 int SrcOffset = M.
Start;
24 int[] Dest =
new int[w * h];
28 for (y = 0; y < h; y++, SrcOffset += SrcSkip)
30 for (x = 0; x < w; x++)
32 ui = Src[SrcOffset++];
34 f = 19672 * (int)(ui & 255);
36 f += 38620 * (int)(ui & 255);
38 f += 7500 * (int)(ui & 255);
40 Dest[DestOffset++] = f;
57 int SrcOffset = M.
Start;
61 int[] Dest =
new int[w * h];
63 for (y = 0; y < h; y++, SrcOffset += SrcSkip)
65 for (x = 0; x < w; x++)
66 Dest[DestOffset++] = 65793 * Src[SrcOffset++];
82 int SrcOffset = M.
Start;
86 int[] Dest =
new int[w * h];
88 for (y = 0; y < h; y++, SrcOffset += SrcSkip)
90 for (x = 0; x < w; x++)
91 Dest[DestOffset++] = (
int)(0x01000000 * Src[SrcOffset++] + 0.5);
125 throw new ArgumentException(
"Unsupported type: " + M.GetType().FullName, nameof(M));
static Matrix< int > GrayScaleFixed(this Matrix< byte > M)
Creates a matrix of grayscale values. Floating point scales are used to avoid round-off errors and lo...
static Matrix< int > GrayScaleFixed(this Matrix< float > M)
Creates a matrix of grayscale values. Floating point scales are used to avoid round-off errors and lo...
static Matrix< int > GrayScaleFixed(this Matrix< int > M)
Creates a matrix of grayscale values. Floating point scales are used to avoid round-off errors and lo...
static Matrix< int > GrayScaleFixed(this Matrix< uint > M)
Creates a matrix of grayscale values. Floating point scales are used to avoid round-off errors and lo...
static IMatrix GrayScaleFixed(this IMatrix M)
Creates a matrix of grayscale values. Floating point scales are used to avoid round-off errors and lo...
Implements a Matrix, basic component for computations in Image Processing and Computer Vision.
int Height
Height of matrix (number of rows)
T[] Data
Underlying data on which the matrix is defined.
int Width
Width of matrix (number of columns)
int Skip
Number of elements to skip from the right edge in the underlying data to the left edge of the new row...
int Start
Start offset of matrix in underlying data.