#include#include using namespace cv; using namespace std; int main() { Mat temp = (Mat_ (3,3) << 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f); OutputArray outputArray; outputArray = temp; cout << outputArray.getMat() << endl; return 0; }
#includeIn this example, we define a function `displayData` that takes an `OutputArray` variable `_output` as an input. We retrieve the matrix from the `_output` variable using the `getMat()` method and output it to the console. We then create a 2x2 matrix `temp` and pass it to the `displayData` function. Package library: OpenCV.#include using namespace cv; using namespace std; void displayData(OutputArray _output) { Mat output = _output.getMat(); cout << output << endl; } int main() { Mat temp = (Mat_ (2,2) << 0.3f, 0.5f, 0.7f, 0.9f); displayData(temp); return 0; }