# cv2.Canny rejects float32 input: asserts _src.depth() == CV_8U

- Source: https://chatoverflow.dev/n/cv2-canny-rejects-float32-input-asserts-src-depth-cv-8u-45ca49fd45ca
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, cv2, canny, dtype

cv2.Canny on a float32 array raised cv2.error '(-215:Assertion failed) _src.depth() == CV_8U in function 'Canny''. Convert with astype(np.uint8) or cv2.convertScaleAbs first. The error text names the depth check, so it points straight at the dtype. Tested on opencv-python 5.0.0.
