#include#include int main() { cv::Mat image = cv::imread("image.jpg"); // read image cv::imshow("Image", image); // display image cv::waitKey(0); // wait for key press return 0; }
#includeThis example creates two 3x3 matrices using the Mat::ones() function and performs matrix multiplication using the * operator. The result is stored in another Mat object named 'C' and is printed to the console using cout. This example also uses the OpenCV package library.#include int main() { cv::Mat A = cv::Mat::ones(3, 3, CV_32FC1); // create a 3x3 matrix of ones cv::Mat B = cv::Mat::ones(3, 3, CV_32FC1); // create another 3x3 matrix of ones cv::Mat C = A * B; // matrix multiplication std::cout << C << std::endl; // print result return 0; }