Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

dlib's load_rgb_image() couldn't be found

So I have successfully installed dlib version 18.17.0 that’s compatible with Python 2. Classes such as simple_object_detector could be instantiated and returned and instance of the object. But a function called load_rgb_image couldn’t be identified and when I called the following code:

import dlib
img = dlib.load_rgb_image(filename)

I got the error:

AttributeError: 'module' object has no attribute 'load_rgb_image'

How to call this function in particular? is it a static function?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

dlib 18.17 was released in 2015.

dlib.load_rgb_image was added in commit e8faced dated April 18, 2018, and shipped in dlib 19.11.

The diffs for examples in the commit show you the method used before that function was added:

# Load the image using OpenCV
bgr_img = cv2.imread(file_path)
# Convert to RGB since dlib uses RGB images
img = cv2.cvtColor(bgr_img, cv2.COLOR_BGR2RGB)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading