用法:
skimage.exposure.histogram(image, nbins=256, source_range='image', normalize=False, *, channel_axis=None)
返回圖像的直方圖。
與
numpy.histogram
如果channel_axis未設置,直方圖是在展平圖像上計算的。對於彩色或多通道圖像,設置
channel_axis
為所有通道使用公共分箱。或者,可以在每個通道上單獨應用該函數,以獲得具有單獨分箱的每個顏色通道的直方圖。- image:數組
輸入圖像。
- nbins:int 可選
用於計算直方圖的 bin 數量。對於整數數組,此值將被忽略。
- source_range:字符串,可選
‘image’(默認)確定輸入圖像的範圍。 ‘dtype’ 確定該數據類型圖像的預期範圍。
- normalize:布爾型,可選
如果為 True,則通過其值的總和對直方圖進行歸一化。
- channel_axis:int 或無,可選
如果為 None,則假定圖像是灰度(單通道)圖像。否則,此參數指示數組的哪個軸對應於通道。
- hist:數組
直方圖的值。當
channel_axis
不是 None 時, hist 將是一個二維數組,其中第一個軸對應於通道。- bin_centers:數組
bin 中心的值。
參數:
返回:
例子:
>>> from skimage import data, exposure, img_as_float >>> image = img_as_float(data.camera()) >>> np.histogram(image, bins=2) (array([ 93585, 168559]), array([0. , 0.5, 1. ])) >>> exposure.histogram(image, nbins=2) (array([ 93585, 168559]), array([0.25, 0.75]))
相關用法
- Python skimage.exposure.adjust_gamma用法及代碼示例
- Python skimage.exposure.rescale_intensity用法及代碼示例
- Python skimage.exposure.is_low_contrast用法及代碼示例
- Python skimage.exposure.cumulative_distribution用法及代碼示例
- Python skimage.feature.graycomatrix用法及代碼示例
- Python skimage.color.lab2lch用法及代碼示例
- Python skimage.draw.random_shapes用法及代碼示例
- Python skimage.feature.blob_doh用法及代碼示例
- Python skimage.feature.blob_dog用法及代碼示例
- Python skimage.filters.unsharp_mask用法及代碼示例
- Python skimage.registration.optical_flow_tvl1用法及代碼示例
- Python skimage.filters.rank.noise_filter用法及代碼示例
- Python skimage.filters.gaussian用法及代碼示例
- Python skimage.feature.graycoprops用法及代碼示例
- Python skimage.segmentation.active_contour用法及代碼示例
- Python skimage.feature.corner_orientations用法及代碼示例
- Python skimage.morphology.h_minima用法及代碼示例
- Python skimage.filters.threshold_otsu用法及代碼示例
- Python skimage.feature.structure_tensor用法及代碼示例
- Python skimage.transform.hough_circle_peaks用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.exposure.histogram。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。