"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "skimage/exposure/histogram_matching.py" between
scikit-image-0.19.1.tar.gz and scikit-image-0.19.2.tar.gz

About: scikit-image is a collection of algorithms for image processing in Python.

histogram_matching.py  (scikit-image-0.19.1):histogram_matching.py  (scikit-image-0.19.2)
skipping to change at line 64 skipping to change at line 64
differ. differ.
References References
---------- ----------
.. [1] http://paulbourke.net/miscellaneous/equalisation/ .. [1] http://paulbourke.net/miscellaneous/equalisation/
""" """
if image.ndim != reference.ndim: if image.ndim != reference.ndim:
raise ValueError('Image and reference must have the same number ' raise ValueError('Image and reference must have the same number '
'of channels.') 'of channels.')
out_dtype = utils._supported_float_type(image.dtype)
if channel_axis is not None: if channel_axis is not None:
if image.shape[-1] != reference.shape[-1]: if image.shape[-1] != reference.shape[-1]:
raise ValueError('Number of channels in the input image and ' raise ValueError('Number of channels in the input image and '
'reference image must match!') 'reference image must match!')
matched = np.empty(image.shape, dtype=image.dtype) matched = np.empty(image.shape, dtype=image.dtype)
for channel in range(image.shape[-1]): for channel in range(image.shape[-1]):
matched_channel = _match_cumulative_cdf(image[..., channel], matched_channel = _match_cumulative_cdf(image[..., channel],
reference[..., channel]) reference[..., channel])
matched[..., channel] = matched_channel matched[..., channel] = matched_channel
else: else:
# _match_cumulative_cdf will always return float64 due to np.interp # _match_cumulative_cdf will always return float64 due to np.interp
matched = _match_cumulative_cdf(image, reference) matched = _match_cumulative_cdf(image, reference)
return matched.astype(out_dtype, copy=False) if matched.dtype.kind == 'f':
# output a float32 result when the input is float16 or float32
out_dtype = utils._supported_float_type(image.dtype)
matched = matched.astype(out_dtype, copy=False)
return matched
 End of changes. 2 change blocks. 
1 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)