Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to read 10 bit tiff image in opencv?

Maximum pixel value of the tiff image is 481. But it is showing maximum is 1.So how to read properly.

How to read 10 bit tiff satellite image in opencv?

Maximum pixel value of the tiff image is 481. But it is showing maximum is 1.So how to read properly.

How to read 10 bit tiff satellite image in opencv?

Maximum pixel value of the tiff image is 481. But it is showing maximum is 1.So how to read properly.

include <opencv2 core="" core.hpp="">

include <opencv2\highgui\highgui.hpp>

include <opencv2\imgproc\imgproc.hpp>

include <opencv2\nonfree\features2d.hpp>

include <iostream>

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<vec3b>(0, 0)[0];; //int max = image.at<vec3b>(258, 519)[2]; for (int i = 0; i < R; i++) { for (int j = 0; j < C; j++) { if (max < image.at<vec3b>(i, j)[0]) max = image.at<vec3b>(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.

click to hide/show revision 4
No.4 Revision

updated 2016-10-21 03:57:19 -0600

berak gravatar image

How to read 10 bit tiff satellite image in opencv?

Maximum pixel value of the tiff image is 481. But it is showing maximum is 1.So how to read properly.

include <opencv2 core="" core.hpp="">

include <opencv2\highgui\highgui.hpp>

include <opencv2\imgproc\imgproc.hpp>

include <opencv2\nonfree\features2d.hpp>

include <iostream>

#include <opencv2/core/core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\nonfree\features2d.hpp>
#include <iostream>

using namespace std;
using namespace cv;

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); imread("C:\\Users\\IIST\\Desktop\\Madi\\NRSC_OCT\\a.tif",IMREAD_ANYDEPTH); //Mat image = imread("D:\SC15M053\PROGRAM imread("D:\\SC15M053\\PROGRAM AND OUTPUTS\NRSC\post_image\53N07_cl.img", 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<vec3b>(0, image.at<Vec3b>(0, 0)[0];; //int max = image.at<vec3b>(258, image.at<Vec3b>(258, 519)[2]; for (int i = 0; i < R; i++) { for (int j = 0; j < C; j++) { if (max < image.at<vec3b>(i, image.at<Vec3b>(i, j)[0]) max = image.at<vec3b>(i, image.at<Vec3b>(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.