Ask Your Question

Revision history [back]

Your code no problem.

    int lengthOfArray1 = 10;
    int lengthOfArray2 = 10;

    double* array1 = new double[lengthOfArray1];
    double* array2 = new double[lengthOfArray2];

    for (int i=0;i < 10;i++)
    {
        array1[i] = 20;
        array2[i] = 10;
    }

  cv::Mat_<double> A (lengthOfArray1, 1, array1);
  cv::Mat_<double> B (lengthOfArray2, 1, array2);
  cv::Mat_<double> C = A - B;

  cout << C << endl;

image description