I am plotting a histogram in matplotlib using plt.hist, where density = True gives a normalized histogram with total area under histogram =1.
However, I moved to OpenCV in python because it can handle masks for images. I tried using cv2.normalize, but it seems to give different results than plt.hist(density=True). Is there any other function in OpenCV that is similar to plt.hist(… density=True) ?

there is no such thing builtin, but it’s not difficult to
normalize a histogram, so that the total area under it == 1:

s = sum(hist)
base = hist_range / num_bins
area = s * base
normalized_hist = hist / area

now, this will leave most histogram bins / values <1, so, to plot anything visible, you will need to multiply it again with an arbitrary scale factor, like 100