Error: (-215:Assertion failed) src.type() == (((0) & ((1 << 3) - 1)) + (((1)-1) << 3)) in function 'cv::adaptiveThreshold'

that’s an unfortunate expansion of the assertion.

it basically says it wants a single-channel CV_8U type matrix, and you gave it something else (float32, which is CV_32F)