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

**URL:** <https://forum.opencv.org/t/imread-cant-find-file-relative-path-process-current-working-directory-visual-studio/2007>\
**Category:** C++\
**Created:** [March 7, 2021, 10:23am UTC](https://forum.opencv.org/t/imread-cant-find-file-relative-path-process-current-working-directory-visual-studio/2007 "2021-03-07T10:23:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdh24](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/bdh24/32/1283_2.png) [@bdh24](https://forum.opencv.org/u/bdh24)\
**Post date:** [March 7, 2021, 10:23am UTC](https://forum.opencv.org/t/imread-cant-find-file-relative-path-process-current-working-directory-visual-studio/2007/1 "2021-03-07T10:23:52Z")

</div>

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.

 ![4](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/7/7b08164561d92035c2cb74845ef07862539236f7.jpeg)

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [March 7, 2021, 11:56am UTC](https://forum.opencv.org/t/imread-cant-find-file-relative-path-process-current-working-directory-visual-studio/2007/2 "2021-03-07T11:56:32Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/0/0cdd47ac467a98ec2e3e784781569ffdc2975a13.png)

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

[https://docs.opencv.org/master/d3/d63/classcv\_1\_1Mat.html#abbec3525a852e77998aba034813fded4](https://docs.opencv.org/master/d3/d63/classcv_1_1Mat.html#abbec3525a852e77998aba034813fded4)

---

<div class="post-metadata">

**Author:** ![bdh24](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/bdh24/32/1283_2.png) [@bdh24](https://forum.opencv.org/u/bdh24)\
**Post date:** [March 7, 2021, 12:10pm UTC](https://forum.opencv.org/t/imread-cant-find-file-relative-path-process-current-working-directory-visual-studio/2007/3 "2021-03-07T12:10:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [March 7, 2021, 4:57pm UTC](https://forum.opencv.org/t/imread-cant-find-file-relative-path-process-current-working-directory-visual-studio/2007/4 "2021-03-07T16:57:11Z")

</div>

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).
