How to change numpy array into grayscale opencv image

As the assertion states, adaptiveThreshold() requires a single-channeled 8-bit image.

Assuming your floating-point image ranges from 0 to 1, which appears to be the case, you can convert the image by multiplying by 255 and casting to np.uint8:

float_img = np.random.random((4,4))
im = np.array(float_img * 255, dtype = np.uint8)
threshed = cv2.adaptiveThreshold(im, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 3, 0)

This one worked for me:

uint_img = np.array(float_arr*255).astype('uint8')

grayImage = cv2.cvtColor(uint_img, cv2.COLOR_GRAY2BGR)