Depth error in 2D image with OpenCV Python

前端 未结 3 851
無奈伤痛
無奈伤痛 2021-01-17 07:14

I am trying to compute the Canny Edges in an image (ndarray) using OpenCV with Python.

slice1 = slices[15,:,:]
slice1 = slice1[40:80,60:100]
print slice1.sha         


        
3条回答
  •  佛祖请我去吃肉
    2021-01-17 08:09

    In order to avoid losing precision while changing the data type to uint8, you can first adapt the scale to the 255 format just doing:

    (image*255).astype(np.uint8)
    

    Here I'm considering that image is a numpy array and np stand for numpy. I hope it can help someone!

提交回复
热议问题