cv::Mat image = cv::imread("image.jpg"); // read in an image int elementSize = image.elemSize1(); // get the size of one element in bytes std::cout << "Element size: " << elementSize << " bytes.\n";
cv::Mat data(3, 4, CV_32FC3); // create a 3x4 matrix of 3-channel float data int elementSize = data.elemSize1(); // get the size of one element in bytes std::cout << "Element size: " << elementSize << " bytes.\n";This example creates a 3x4 matrix of 3-channel float data using the `CV_32FC3` constant from OpenCV. The `elemSize1` function is called on the Mat object and the result is printed to the console. The package library used here is OpenCV.