Load image(加载图像)
cv::Mat image = cv::imread("path");
cv::imshow("window_name", image);
Load Video(加载视频)
cv::Mat frame;
cv::VideoCapture capture;
capture.open("video_name");
for(;;) {
capture>>frame;
if(frame.empty()) break;
cv::imshow("window",frame);
}
Accessing and modifying pixel (获取和改变像素值)
cv::Mat image;
image = cv::imshow("image_name");
Vec3b intensity = image.at<Vec3b> (10,10);获取image矩阵10行10列的三通道像素值
int blue = intensity.val[0];
cout << "blue " << blue << "\n";
int green = intensity.val[1];
cout << "green " << green << "\n";
int red = intensity.val[2];
cout << "red " << red << "\n";