Skip to content
shimat edited this page Jan 19, 2019 · 1 revision
// x + y = 10
// 2x + 3y = 26
// (x=4, y=6)

double[,] av = {{1, 1}, 
                {2, 3}};
double[] yv = {10, 26};

Mat a = new Mat(2, 2, MatType.CV_64FC1, av);
Mat y = new Mat(2, 1, MatType.CV_64FC1, yv);
Mat x = new Mat();

Cv2.Solve(a, y, x, MatrixDecomposition.LU);

// => X1 = 4, X2 = 6
Console.WriteLine("X1 = {0}, X2 = {1}", x.At<double>(0), x.At<double>(1));
Clone this wiki locally