Imread can't find file, relative path, process current working directory, Visual Studio

While using opencv, we are constantly experiencing errors in exception handling. I have attached a photo, so please leave it in the comments if you can help.Please help me.


that should have been a hint. check whether img.empty()

I used the same picture as other users, would that still be a problem? For other users, there was no problem.

use an absolute path to your picture file.

relative paths are relative to the current working directory of the process. VS doesn’t run your program in the source directory but the build directory (or elsewhere entirely).

1 Like