cv::Mat mat1 = (cv::Mat_(3, 3) << 1, 2, 3, 4, 5, 6, 7, 8, 9); cv::Mat mat2 = (cv::Mat_ (3, 3) << 10, 11, 12, 13, 14, 15, 16, 17, 18); cv::Mat result = mat1.dot(mat2);
cv::Mat mat = (cv::Mat_Here, we create a matrix and a vector and multiply them using the dot function. The resulting matrix is a single-column matrix that contains the result of multiplying the matrix and vector. The package library used in these examples is OpenCV, which is a popular computer vision library in C++.(2, 2) << 1, 2, 3, 4); cv::Mat vec = (cv::Mat_ (2, 1) << 5, 6); cv::Mat result = mat.dot(vec);