Cv::imread() fails when I use opencv and dlib in single c++ project edit

OpenCv is failing to read jpeg when working with Dlib

Similar symptoms as this post:

opencv 4.5
dlib 19.21

anyone else experiencing this issue and/or have solutions

Have you try to compile dlib or opencv without jpeg support?

Then you can try :

[> OpenCV image objects can be converted into a form usable by dlib routines by using cv_image. You can also convert from a dlib matrix or image to an OpenCV Mat using dlib::toMat().](dlib C++ Library - Frequently Asked Questions)

Hi Laurent,

Thank you for you tip and I tried this but it still failed.

After writing another sample project and going back to the basics it worked.

The mistake was forgetting a forward slash in my path to the image.
I am sure this kind of mistake happens a lot and wonder if the imread method should be defensive to a path that it does not exist?

many thanks