Ask Your Question
0

Unable to Read Tiff Images

asked 2016-11-24 06:45:02 -0600

gutenberg gravatar image

updated 2016-11-28 07:02:37 -0600

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.

edit retag flag offensive close merge delete

Comments

2

in a C/C++ string you must use double backslashes: D:\Documents\...

kbarni gravatar imagekbarni ( 2016-11-24 07:25:56 -0600 )edit

Actually they are double in editor but it looks single over here.

gutenberg gravatar imagegutenberg ( 2016-11-24 08:54:52 -0600 )edit

And there is no Problem about the Syntax. I can open the JPEG files without a Problem. The Problem is tiff Images.

gutenberg gravatar imagegutenberg ( 2016-11-24 08:55:34 -0600 )edit
1

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.

kbarni gravatar imagekbarni ( 2016-11-25 03:10:46 -0600 )edit

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 gravatar imagegutenberg ( 2016-11-28 07:01:45 -0600 )edit
1

@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 gravatar imageVintez ( 2016-11-28 08:07:02 -0600 )edit

@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 gravatar imagegutenberg ( 2016-11-28 08:13:06 -0600 )edit

@gutenberg I found a similar Question here I hope this solves your problem. It mentions the libtiff library you asked for.

Vintez gravatar imageVintez ( 2016-11-28 08:17:18 -0600 )edit

@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.

gutenberg gravatar imagegutenberg ( 2016-11-29 03:38:38 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-11-29 03:52:27 -0600

Vintez gravatar image

@gutenberg sorry to hear that, probably you did not build opencv with the libtiff? Probably the LibTiff has not been builded at your current version. If you cant check that, I would suggest, that you inform your company that you have to rebuild or get a newer version of OpenCV for your purposes.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-11-24 06:45:02 -0600

Seen: 1,217 times

Last updated: Nov 28 '16