8 public static partial class ArithmeticsOperations
19 throw new ArgumentOutOfRangeException(nameof(
Matrix),
"Heights to do not match.");
23 throw new ArgumentOutOfRangeException(nameof(
Matrix),
"Widths to do not match.");
25 int DestOffset = M.
Start;
27 int DestSkip = M.
Skip;
29 float[] Dest = M.
Data;
33 for (y = 0; y < h; y++, DestOffset += DestSkip, SrcOffset += SrcSkip)
35 for (x = 0; x < w; x++)
37 v = Dest[DestOffset] - Src[SrcOffset++];
38 Dest[DestOffset++] = v < 0 ? -v : v;
52 throw new ArgumentOutOfRangeException(nameof(
Matrix),
"Heights to do not match.");
56 throw new ArgumentOutOfRangeException(nameof(
Matrix),
"Widths to do not match.");
58 int DestOffset = M.
Start;
60 int DestSkip = M.
Skip;
66 for (y = 0; y < h; y++, DestOffset += DestSkip, SrcOffset += SrcSkip)
68 for (x = 0; x < w; x++)
70 v = Dest[DestOffset] - Src[SrcOffset++];
71 Dest[DestOffset++] = v < 0 ? -v : v;
static void AbsoluteDifference(this Matrix< int > M, Matrix< int > Matrix)
Computes the absolute difference of two matrices.
static void AbsoluteDifference(this Matrix< float > M, Matrix< float > Matrix)
Computes the absolute difference of two matrices.
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.