Applying a hreshold on an Image

Thanks for the solution but unfortunately when I apply each of two examples, I face the following error in another line of my script:

Exception has occurred: error
OpenCV(4.6.0) /io/opencv/modules/imgproc/src/colormap.cpp:736: error: (-5:Bad argument) cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function 'operator()'
  File "/test.py", line 140, in main
    img = cv2.applyColorMap(frames_mask[i],cv2.COLORMAP_HOT)

How I can fix the problem?