【发布时间】:2014-06-08 03:44:09
【问题描述】:
我正在尝试在二进制图像中获取一组值以将其反转。但我无法索引矩阵,我的代码的第一行是。
std::string path = "img/lena.jpg";
//Our color image
cv::Mat imageMat = cv::imread(path, CV_LOAD_IMAGE_GRAYSCALE);
if(imageMat.empty())
{
std::cerr << "ERROR: Could not read image " << argv[1] << std::endl;
return 1;
}
//Grayscale matrix
cv::Mat grayscaleMat (imageMat.size(), CV_8U);
//Convert BGR to Gray
cv::cvtColor( imageMat, grayscaleMat, CV_BGR2GRAY );
//Binary image
cv::Mat binaryMat(grayscaleMat.size(), grayscaleMat.type());
//Apply thresholding
cv::threshold(grayscaleMat, binaryMat, 100, 255, cv::THRESH_BINARY);
现在我需要处理 binaryMat 中的值,但我不知道如何获取它...
【问题讨论】:
标签: c++ opencv visual-c++