Convert np.array of type float64 to type uint8 scaling values

后端 未结 3 1278
清酒与你
清酒与你 2020-12-07 22:40

I have a particular np.array data which represents a particular grayscale image. I need to use SimpleBlobDetector() that unfortunately only accepts 8bit images, so

3条回答
  •  广开言路
    2020-12-07 23:29

    you can use skimage.img_as_ubyte(yourdata) it will make you numpy array ranges from 0->255

    from skimage import img_as_ubyte
    
    img = img_as_ubyte(data)
    cv2.imshow("Window", img)
    

提交回复
热议问题