Maximum pixel value of the tiff image is 481. But it is showing maximum is 1.So how to read properly.
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
Mat IMG(5620, 4894, CV_8UC3, Scalar(0, 0, 0));
int main()
{
/* Input Image of 4894*5620 size */
Mat image = imread("C:\\Users\\IIST\\Desktop\\Madi\\NRSC_OCT\\a.tif",IMREAD_ANYDEPTH);
//Mat image = imread("D:\\SC15M053\\PROGRAM AND OUTPUTS\\NRSC\\post_image\\53N07_cl.img", IMREAD_ANYDEPTH);
int ch = image.channels();
int R = image.rows;
int C = image.cols;
cout << "Channles : " << ch << endl << "Rows are : " << R << endl << "Cols are : " << C << endl;
int max = image.at(0, 0)[0];;
//int max = image.at(258, 519)[2];
for (int i = 0; i < R; i++)
{
for (int j = 0; j < C; j++)
{
if (max < image.at(i, j)[0])
max = image.at(i, j)[0];
}
}
cout << "Maximum value of band : " << max << endl;
cin.get();
return(0);
}
Exception:
Unhandled exception at 0x000007FFFF05AEA8 in FirstOpencv2.exe: Microsoft C++ exception: cv::Exception at memory location 0x00000034A04EF4E0.
↧