Ask Your Question

c++ imread filepath in windows

Greetings,

I've tried to google this to no avail. Please help me understand what is wrong with this file path:

Mat lena = imread("C:\\Users\dasboomer\Desktop\Building-Computer-Vision-Projects-with-OpenCV4-and-CPlusPlus-master\Chapter03/lena.jpg");


I've tried changing:

• backslash to double backslash
• backslash to forward slash backslash
• to double forward slash

Thank you for your assistance

edit retag close merge delete

1 answer

Sort by » oldest newest most voted

change ALL occurences of \to either \\ or / (not only the last)

(it's not even an opencv specific problem, you'll have to do this, whenever you encounter a file path in c++ on win)

more

Comments

Thank you for your time. I tried double backslash or forward and double forward slashes to no avail.

( 2020-07-26 12:53:37 -0500 )edit
1

You are correct, it turns out the tutorial code was faulty. My my, where has packt gone?

( 2020-07-26 13:03:55 -0500 )edit

Stats

Asked: 2020-07-26 12:17:45 -0500

Seen: 430 times

Last updated: Aug 05 '20