I wrote my function by `threshold_otsu` pattern. There was used *skimage.exposure histogram*. Although, my code not depend from it I use histogram function below and wrote code apart of scikit-image. Also `np.histogram` return the bin edges (length(hist)+1), not bin centres.

    def histogram(image, nbins=256):
        hist, bin_edges = np.histogram(image.flat, nbins)
        bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2.
        return hist, bin_centers

About `normed=True`. According to documentation,
> This keyword is deprecated in Numpy 1.6 due to confusing/buggy behavior. It will be removed in Numpy 2.0.