I have this piece of code:
int main()
{
string file = "stuff.jpg";
Mat img = imread(file);
if (img.empty())
{
printf("EMPTY");
system("PAUSE");
return -1;
}
imshow("display", img );
waitKey(0);
return 0;
}
When i launch this program in visual, i get that the img is empty, but if i run in from command line or by simply double clicking, it works fine. The path at the top when i run it in both visual and command line is the same. Why is that?
The working directory when run from visual studio is controlled by the project properties:
Set that appropriately or specify a full, absolute path instead of just
"stuff.jpg"for the filename.