mat::ones last element is set as 4.9407e-324 (Bug #3857)
Description
When I create an image from mat::ones(8193,1)
and save data to file using ofstream; I get two different results
1. printing with a for loop with each element, last item is printed to file as 4.9407e-324
2. printing the image as a whole everything seems fine
for (int imNum = 0; imNum < fileNames.size(); imNum++)
{
ofstream responseFile;
responseFile.open ( fileNames[imNum] );
responseFile<<EstimatedResponses[imNum];
//responseFile <<std::setprecision(5);
//for(int col = 0; col < EstimatedResponses[imNum].rows; col++)
//{
// responseFile<<EstimatedResponses[imNum].at<double>(col, 1)<<endl;
//}
responseFile.close();
}
History
Updated by be rak over 10 years ago
that's not a bug, but a plain programming error on your side.
your Mat has 8193 rows, 1 column, so , to iterate over that you would have to:
@@
for (int row=0; row<img.rows; row++) // iterate and compare over rows, not cols.
{
double d = img.at<double>(row,0); // 0, not 1 is the first and only valid index
}
@@
Updated by be rak over 10 years ago
that's not a bug, but a plain programming error on your side.
your Mat has 8193 rows, 1 column, so , to iterate over that you would have to:
for (int row=0; row<img.rows; row++) // iterate and compare over rows, not cols. { double d = img.at<double>(row,0); // 0, not 1 is the first and only valid index }
Updated by Dmitry Retinskiy over 10 years ago
- Status changed from New to Cancelled