Reading Image without Meta-Data fails (Bug #3838)
Description
- Bug concering imread -> imread does not read image without metadata
- fixed by editing image meta data (e.g. setting a title or cameratype)
- testimages:
not working: https://docs.google.com/file/d/0B5AU_enXY31NQlJ2eVU2WmdwRVk/edit
and working: https://docs.google.com/file/d/0B5AU_enXY31NbWxFSmJnbWhuZ2s/edit - Asked @Q&A 4 weeks ago without an answer: http://answers.opencv.org/question/35944/imread-without-exif-title-results-in-invalid-mat/
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
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