hist_nir, hist_bins = np.histogram(masked, bins, (1, maxval))
hist_bins1 = hist_bins[:-1]
hist_bins2 = [float(round(l, 2)) for l in hist_bins1]
hist_nir1 = [float(l) for l in hist_nir]
// make hist percentage for plotting
After Change
hist_nir = [float(l[0]) for l in cv2.calcHist([gray_img], [0], mask, [bins], [0, maxval])]
// Create list of bin labels
bin_width = maxval / float(bins)
b = 0
bin_labels = [float(b)]
for i in range(bins - 1):
b += bin_width
bin_labels.append(b)
// make hist percentage for plotting
pixels = cv2.countNonZero(mask1)
hist_percent = [(p / float(pixels)) * 100 for p in hist_nir]
// No longer returning a pseudocolored image