imread not working on Windows (Bug #3817)


Added by Josiah Yoder over 10 years ago. Updated over 10 years ago.


Status:Cancelled Start date:2014-07-17
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Affected version:2.4.9 (latest release) Operating System:Windows
Difficulty: HW Platform:x64
Pull request:

Description

imread fails to open files on Windows, while cvLoadImage works.

Works:
#include "stdafx.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>

int _tmain(int argc, _TCHAR* argv[]) {
char * filename = "Desert.jpg";
cv::Mat image = cvLoadImage(filename, CV_LOAD_IMAGE_COLOR);
if(image.data == NULL) {
std::cout << "Warning: Could not open file: \""<< filename << "\"" << std::endl;
} else {
cv::Mat_<int> hist = cv::Mat(1,256, cv::DataType<int>::type);
cv::imshow("main", image);
cv::waitKey(0);
}
return 0;
}

Fails, printing 'Warning: Could not open file: "Desert.jpg"'
#include "stdafx.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>

int _tmain(int argc, _TCHAR* argv[]) {
char * filename = "Desert.jpg";
cv::Mat image = cv::imread(filename);
if(image.data == NULL) {
std::cout << "Warning: Could not open file: \""<< filename << "\"" << std::endl;
} else {
cv::Mat_<int> hist = cv::Mat(1,256, cv::DataType<int>::type);
cv::imshow("main", image);
cv::waitKey(0);
}
return 0;
}

I am on Windows 7 Pro, SP1, 64bit.
I installed from opencv-2.4.9.exe

A few others have reported this at
http://stackoverflow.com/questions/7417637/imread-not-working-in-opencv


Associated revisions

Revision 06703c9d
Added by Vadim Pisarevsky almost 11 years ago

Merge pull request #3817 from SpecLad:forward-ports

History

Updated by Josiah Yoder over 10 years ago

Sorry ... classic debug error...

Both examples above work when compiled with the DEBUG library.

  • Status changed from New to Done

Updated by Steven Puttemans over 10 years ago

  • Status changed from Done to Cancelled

Also available in: Atom PDF