get element in Mat c++

Step 1: Include the necessary header file

#include <opencv2/core/core.hpp>

Step 2: Define a Mat variable to store the image data

cv::Mat image;

Step 3: Access a specific element in the Mat using the at method

int elementValue = image.at<int>(row, col);