Briefly, I would like to sum up values in a Mat matrix. For now I have a 256 by 1 Mat(which is actually a vector, but the Mat format will be important later on). In order to see what happens I'm trying to print it in the loop
`
calcFractile(Mat* in){
cout << "Input = " << *in << endl;
cout << "?!?! ";
for(int k = 0; k<in->rows; k++){
cout << static_cast<int>(in->at<uint8_t>(0,k)) << ", ";
sum += (int)in->at<uint8_t>(0,k);
}
cout <<endl;
}
`
I totally don't understand why, but the cout << "Input[...] line produces correct result, but the loop accessing individual elements fails giving different results It's not just the value issue, but also positions in the array.
The Mat I'm passing is a histogram of an image, the histogram is single channel, 256 bins.
uint8_tis causing some problems. I guess that if the input matrix is a histogram than it has some other type (wouldn't make sense to be able to store values less than 256). For better answers you should provide an SSCCE - Sigroad