cv::Mat matA(3, 3, CV_32FC1); cv::Mat matB(3, 3, CV_32FC1); cv::Mat result; // Initialize matrices with values cv::mul(matA, matB, result);
cv::Mat matA(3, 3, CV_32FC1); cv::Mat vecB(3, 1, CV_32FC1); cv::Mat result; // Initialize matrix and vector with values cv::mul(matA, vecB, result);In both examples, the cv Mat mul function is used to perform matrix multiplication between the input matrices and the resulting matrix is stored in the output cv Mat variable. The OpenCV library is required for using the cv Mat mul function.