vendredi 25 juin 2021

Algorithm: Randomize Brightness and Contrast Values, With Constraints

I want to do a random brightness and contrast adjustment to an image, such that...

brightness = random in range (brightness_min, brightness_max)
contrast = random in range (contrast_min, contrast_max)   
outputImage = inputImage * contrast + brightness;

But when I do this, because the range of brightness and contrast values in my application are so large, I often output an image which is all white or all black.

I want an algorithm to choose a random brightness and contrast pair such that: no output is a solid color (unless already so), and: the output retains some specifiable amount of detail (this part is less important).

I don't know how to describe what I want in technical terms, nor begin constructing the solution. Any help is greatly appreciated. Thank you.




Aucun commentaire:

Enregistrer un commentaire