I take the equalization code from here
import numpy as np
from skimage import morphology
from skimage import color
from skimage import io
from matplotlib import pyplot as plt
from skimage import data, img_as_float
from skimage import exposure
img = color.rgb2gray(io.imread(path))
# Contrast stretching
p2 = np.percentile(img, 2)
p98 = np.percentile(img, 98)
#img_rescale = exposure.rescale_intensity(img, in_range=(p2, p98))
img_rescale = exposure.rescale_intensity(img, out_range=(0, 255))
# Equalization
img_eq = exposure.equalize_hist(img)
# Adaptive Equalization
img_adapteq = exposure.equalize_adapthist(img, clip_limit=0.03)
and when i use this kind of image:
i got this error:
Run time Error!
python stopped and respond:
this application has requested the runtime to terminate it in an unusual way!
at this line:
p2 = np.percentile(img, 2)