Unable to Read Tiff Images
Hello, here I am adding my basic code. I want to give the path of the Image like that, but I cannot read the TIFF images. I am using OpenCV 2.2 with Visual Studio 2010/C++. Here is the code:
#include "opencv2\imgproc\imgproc.hpp"
#include "opencv2\highgui\highgui.hpp"
#include <fstream>
#include <iostream>
using namespace cv; using namespace std;
int main( int argc, char** argv ) {
Mat src, src_gray, dst;
src = imread("D:\\Documents\\My\\Photos\\Project\\XXX.tiff"); if( !src.data ) { return -1; }
GaussianBlur( src,src, Size(3,3), 0, 0, BORDER_DEFAULT);
imshow( window_name, src );
waitKey(0);
return 0; }
Thank you for your help.
in a C/C++ string you must use double backslashes: D:\Documents\...
Actually they are double in editor but it looks single over here.
And there is no Problem about the Syntax. I can open the JPEG files without a Problem. The Problem is tiff Images.
Are they 8 bit greyscale or RGB images? TIFF files can have exotic formats (multi-channel or high bit depth) that OpenCV can't read. In that case you have to use directly the libtiff library.
Hello, this tiff Images are RGB Images. Channel depth is 3, I looked at it on R(EBImage). The thing is, I am using OpenCV 2.2 Version. Is it just because the old Version of OpenCV?
How can I use libtiff library?
Thank you!
@gutenberg have you already tried to update the OpenCV Version? If it is not necessary to use 2.2 for your purpose, i would suggest you to always hold the library version to the latest release.
@Vintez, it was not my decision, it was the companies decision. Now, I will write my code for JPEG Images, in the end we will try to update the OpenCV Version. I hope it will be OK in last Version of OpenCV.
@gutenberg I found a similar Question here I hope this solves your problem. It mentions the libtiff library you asked for.
@Vintez, this gave me error: "#include "tiffio.h"" and says "no such file or directory"...
In the following weeks, I will try to update the OpenCV Version and try the codes in this link. Thank you for your help.