Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 opencv 中搜索 Mat 类型以找到一些特殊的值?
这是我到目前为止所做的:
Mat L; for(int i=0; i<height; i++){ for(int j=0; j<width; j++){ if( L[i][j]> 0){ Index.push_back(std::make_pair(i,j)); } } }
L[i][j] 是无效的,你可能已经发现了;)
您必须知道 Mat 的类型才能访问其元素:
Mat L(8,8,CV_8U); uchar elm = L.at<uchar>(i,j);
或者,有
Mat_<uchar> L(8,8); uchar elm = L(i,j);