1

I have a file that uses opencv to apply a bayer filter to an image to a black and white picture to give it RGB values. It all works well when I run a 16 bit unsigned integer image through but then when I run a 8 bit unsigned integer I get the following error code:

OpenCV Error: Unspecified error (could not find a writer for the specified extension) in imwrite_, file /build/buildd/opencv-2.3.1/modules/highgui/src/loadsave.cpp, line 276
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/buildd/opencv-2.3.1/modules/highgui/src/loadsave.cpp:276: error: (-2) could not find a writer for the specified extension in function imwrite_

Do you know any plugin or extension I can download to deal with more image types? I am running the program with the Ubuntu command line and the processing program is written in C++. I did the initial processing to change it from 16bit unsigned integers with the python imaging library.

clifgray
  • 4,313
  • 11
  • 67
  • 116

1 Answers1

0

You could always write the code to convert a 8-bit unsigned int image to 16-bit unsigned int before running it through. This post shows you how, piece of cake!

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • I didn't actually write the c++ I am just doing the python conversion and don't have a lot of experience with C++ but I think I can figure it out. would that code just go right in the C++ code? – clifgray Jun 07 '12 at 20:54
  • this is the code I'm talking about: CvMat* depthMetersMat = cvCreateMat( 480, 640, CV_16UC1 ); cv::Mat m2(depthMetersMat, true); m2.convertTo(m2, CV_8U); with a few conversions of course for size and switching the types – clifgray Jun 07 '12 at 21:00
  • I could answer this question if I had access to your code, which I don't. So I guess you're going to have to try and see for yourself. – karlphillip Jun 07 '12 at 21:32