使用opencv和scikit-image规范化后,图像会重新缩放

时间:2018-08-14 22:42:55

标签: python opencv normalization scikit-image

我正在尝试将OPENCV和scikit-image结合到图像处理中。我需要进行一些直方图均衡化,并且还要使用一些过滤器,但是我首先需要对视频进行规格化以使值保持在0到1之间。问题是在我对图像进行灰度规格化并尝试对图像进行直方图均衡之后重新缩放到0到25​​5。我不知道为什么会这样。 有什么想法吗?

问候

import matplotlib.pyplot as plt
import matplotlib.image as img
import numpy as np
import cv2
import numpy as np
import matplotlib.pyplot as plt
from skimage.io import imread
from skimage.transform import radon, iradon
import skimage.filters as fil
from skimage import exposure
from skimage.morphology import disk
from skimage.transform import resize
from skimage.morphology import erosion, dilation, opening, closing, white_tophat
from skimage.color import rgb2gray

#IM=img.imread("img01.jpg")
#nF,nC=IM.shape #Obtiene el tamaño de la imagen



camera = cv2.VideoCapture(0)
cv2.namedWindow('Ventana1')

while cv2.waitKey(1)==-1:

    retval, img = camera.read()
    img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    img2 = cv2.normalize(img, None, alpha=0, beta=1, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_32F)

    EQU = fil.rank.equalize(img2, disk(120))
    EQU2 = fil.rank.equalize(EQU, disk(25))
    FRA = fil.frangi(EQU2)
    cv2.imshow("FRA",FRA)
    #plt.imshow(FRA, cmap="gray")
    plt.show()

#CIERRA
cv2.destroyAllWindows()
camera.release()

0 个答案:

没有答案