2

For my project I need a plot showing how the quality of contrast in a video changes over time. At the moment I'm calculating the CDF of the image histogram for every frame - now I need to translate this into some kind of percentage/quality indicator. I'm thinking about comparing the CDF to an ideal CDF (maybe use histogram equalization to find a perfect CDF for each separate frame?) or some other value or function like assuming a perfectly flat histogram would be ideal?

This is part of my little script - I'm also rather new to python and image/video analysis - I would appreciate a hint into the right direction and/or maybe some sample code on how to compare CDFs or other functions in python using Numpy or OpenCV functions. Thanks in advance!

img = cv2.imread('picture.png')
hist,bins = np.histogram(img.ravel(),256,[0,256])
plt.hist(img.ravel(),256,[0,256])
cdf = hist.cumsum()
cdf_normalized = cdf * hist.max()/ cdf.max()
plt.plot(cdf_normalized, color = 'r')
2092Juli
  • 83
  • 1
  • 5

0 Answers0