So basically I'm converting images from BGR (used by OpenCV) to RGB (used by dlib) for some image vision stuff.
Here's some code:
for (i, imagePath) in enumerate(imagePaths):
# load the input image and convert it from RGB (OpenCV ordering)
# to dlib ordering (RGB)
image = cv2.imread(imagePath)
rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)`
I'm getting the error
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor
on rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
The full error is cv2.error: /home/Ben/opencv-3.2.0/modules/imgproc/src/color.cpp:9716: error: (-215) scn == 3 || scn == 4 in function cvtColor
Usually I know these errors are caused by incorrect image paths, but I've run the same code with different pictures, so it must be something with the pictures.
Looking at the picture properties, the only difference I can see is that the pics that don't work are 1080x1920 while the pictures that do work are a variety of sizes, such as 512x440 or 291x512.
What am I doing wrong?
Thanks, Ben