Esempio n. 1
0
def autocontrast(img, prob, mag=0):
    # maximize the image contrst to black and white
    if random.random() < prob:
        enhancer = Contrast(img)
        return enhancer.enhance(4)
    else:
        return img
Esempio n. 2
0
def contrast(img, prob=0.2, mag=1.3):
    # mag : 0: balck 1: original  3.0 almost max    [0.1, 1.9]
    if random.random() < prob:
        enhancer = Contrast(img)
        return enhancer.enhance(mag)
    else:
        return img
Esempio n. 3
0
def _do_enh_contrast(c):
    img = editWindow.controlImg()
    if img and c and c!=1:
        enh = Contrast(img)
        img = enh.enhance(c)
        editWindow.updateImage(img) #win.update_img(img, True, label='enh_contrast %f'%c, operation=do_enh_contrast, params=(c,))
    editWindow.unsetCtrl()
Esempio n. 4
0
def _onContrastChange(value):
    img = editWindow.controlImg(False)
    try:
        val = float(value)
        contr = Contrast(img)
        img = contr.enhance(val)
        editWindow.updateImage(img)
    except:
        pass
Esempio n. 5
0
def _do_set_brightness(vals): #b, c):
    img = editWindow.controlImg()
    if not vals: # rollback
        editWindow.updateImage(editWindow.savedImg)
    if img and vals and vals != (1,1):
        if vals[0] != 1:
            bright = Brightness(img)
            img = bright.enhance(vals[0])

        if vals[1] != 1:
            contr = Contrast(img)
            img = contr.enhance(vals[0])
        editWindow.updateImage(img) #win.update_img(img, True, label='set_brightness %f, %f'%(b, c), operation=do_set_brightness, params=(b,c))
    editWindow.unsetCtrl()