Reputation: 159
How can I search into a Mat type in opencv to find some spesific value?
This is what I have done until now:
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));
}
}
}
Upvotes: 0
Views: 184
Reputation: 39806
L[i][j] is invalid, as you probably found out already ;)
you have to know the type of the Mat to access its elements:
Mat L(8,8,CV_8U);
uchar elm = L.at<uchar>(i,j);
alternatively, there's
Mat_<uchar> L(8,8);
uchar elm = L(i,j);
Upvotes: 1