opencv入门知识略讲

文章目录

  • Load image(加载图像)
  • Load Video(加载视频)
  • Accessing and modifying pixel (获取和改变像素值)

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矩阵1010列的三通道像素值
// print individual component [B G R]
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";

你可能感兴趣的:(opencv笔记,opencv)