medianBlur Assertion error (-215)


I am trying to run some code to perform a median blur. When I run:

differenceImage = cv2.medianBlur(differenceImage,17)

I get an error:

OpenCV Error: Assertion failed (src.depth() == CV_8U && (cn == 1 || cn == 3 || cn == 4)) in medianBlur, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/smooth.cpp, line 3552
Traceback (most recent call last):
  File "", line 78, in <module>
    differenceImage = cv2.medianBlur(differenceImage,17)
cv2.error: /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/smooth.cpp:3552: error: (-215) src.depth() == CV_8U && (cn == 1 || cn == 3 || cn == 4) in function medianBlur

Does anyone know what this means?

Many thanks,


what do you think it means? take the error apart into pieces. the first line already says what’s going on.

your single line of code isn’t enough. do you think it’s useful to know what’s inside of differenceImage before that call?

welcome to customer service 101.

don’t you think it’s better to explain the error to the newbie rather than be an asshole?

Maybe your programming achievements doesn’t translate into affability and being a good moderator.