MCPcopy Create free account
hub / github.com/PyImageSearch/imutils / adjust_brightness_contrast

Function adjust_brightness_contrast

imutils/convenience.py:304–319  ·  view source on GitHub ↗

Adjust the brightness and/or contrast of an image :param image: OpenCV BGR image :param contrast: Float, contrast adjustment with 0 meaning no change :param brightness: Float, brightness adjustment with 0 meaning no change

(image, brightness=0., contrast=0.)

Source from the content-addressed store, hash-verified

302
303
304def adjust_brightness_contrast(image, brightness=0., contrast=0.):
305 """
306 Adjust the brightness and/or contrast of an image
307
308 :param image: OpenCV BGR image
309 :param contrast: Float, contrast adjustment with 0 meaning no change
310 :param brightness: Float, brightness adjustment with 0 meaning no change
311 """
312 beta = 0
313 # See the OpenCV docs for more info on the `beta` parameter to addWeighted
314 # https://docs.opencv.org/3.4.2/d2/de8/group__core__array.html#gafafb2513349db3bcff51f54ee5592a19
315 return cv2.addWeighted(image,
316 1 + float(contrast) / 100.,
317 image,
318 beta,
319 float(brightness))

Callers 1

contrast_demo.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…