Reading Image without Meta-Data fails (Bug #3838)


Added by M B over 10 years ago. Updated over 9 years ago.


Status:Open Start date:2014-08-04
Priority:Normal Due date:
Assignee:Alexander Smorkalov % Done:

0%

Category:highgui-images
Target version:2.4.10
Affected version:2.4.9 (latest release) Operating System:Windows
Difficulty: HW Platform:x86
Pull request:

Description

Long report:
The error occurs when I try to load an 16bit tiff grayscale image without a meta data set in its details created by a camera software.
It can be viewed with ImageJ without problem.

When I try to load it with imread it results in an empty matrix, which has the wrong type, as well as one wrong dimension.
It should be UINT16, 1x768x768, but the debugger tells me it is UINT8, 1x768x0.

Not working image:
https://docs.google.com/file/d/0B5AU_enXY31NQlJ2eVU2WmdwRVk/edit

If I open the preferences of the image and change the title in details to anything and press ok, I can open it and its read perfectly.

Same image with title changed:
https://docs.google.com/file/d/0B5AU_enXY31NbWxFSmJnbWhuZ2s/edit

I use ImageWatch which tells me that my matrix has no dimensions when I try to load the first sample image.

The images are uncompressed 16bit tiff files, generated by a 12bit camera.
If I open and save the image with ImageJ and set a certain display range (eg 16bit) and save it, the described "trick" will not help anymore.

My setup:
Win 8.1 (64bit)
C++ VS2013 (32bit)
OpenCv 2.4.9

My test code:

#include "stdafx.h" 
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    string path = "C:\\Users\\...\\Pictures\\testimage.tiff";

    Mat A;
    A = cv::imread(path, CV_LOAD_IMAGE_GRAYSCALE);

    namedWindow("A", CV_WINDOW_NORMAL);
    resizeWindow("A", A.cols, A.rows);
    imshow("A", A);

    waitKey(0);
    return 0;
}


Associated revisions

Revision e92645c5
Added by Vadim Pisarevsky almost 10 years ago

Merge pull request #3838 from PhilLab:patch-3

History

Updated by Dmitry Retinskiy over 10 years ago

Alexander, could you check this?
Thanks.

  • Status changed from New to Open
  • Assignee set to Alexander Smorkalov

Updated by Maksim Shabunin over 9 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4800

Also available in: Atom PDF