Normalizing images in OpenCV

前端 未结 3 1399
遥遥无期
遥遥无期 2021-01-31 03:25

I wrote the following code to work normalize an image using NORM_L1 in OpenCV. But the output image was just black.How to solve this ?

import cv2
import numpy as         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-31 03:41

    If you want to change the range to [0, 1], make sure the output data type is float.

    image = cv2.imread("lenacolor512.tiff", cv2.IMREAD_COLOR)  # uint8 image
    norm_image = cv2.normalize(image, None, alpha=0, beta=1, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_32F)
    

提交回复
热议问题