Ask Your Question

jgmao's profile - activity

2014-08-07 15:18:02 -0500 asked a question TIFF imread() fail std::bad_alloc in Ubuntu 14.04


I installed a fresh Ubuntu 14.04 and use cmake and gcc 4.8 with -std=c++11 flag to build OpenCV from source. Where I select "With TIFF" and "Build TIFF" in CMake-GUI. The simple code :

#include "opencv2/opencv.hpp"
int main(void)
  Mat rst = cv::imread("test.tiff",0);
  return 0;

compiled by:

g++ -o testcv -I/usr/local/include testcv.cpp -lopencv_core -lopencv_highgui -std=c++11

When it runs failed with info:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

I tried compiling OpenCV 2.4.9 (Release) and 3.0.0-dev (in GitHub) source. But both of them has the same failure.I tried PNG and JPEG, they work well. What is the problem? Is this OS related problem? I used the same code in my Ubuntu 12.04, and it has no problem at all.