예제 #1
0
def _get_img_with_all_operations():
    logger.debug(operations)

    b = operations.brightness
    c = operations.contrast
    s = operations.sharpness

    img = _img_preview
    if b != 0:
        img = img_helper.brightness(img, b)

    if c != 0:
        img = img_helper.contrast(img, c)

    if s != 0:
        img = img_helper.sharpness(img, s)

    if operations.rotation_angle:
        img = img_helper.rotate(img, operations.rotation_angle)

    if operations.flip_left:
        img = img_helper.flip_left(img)

    if operations.flip_top:
        img = img_helper.flip_top(img)

    if operations.size:
        img = img_helper.resize(img, *operations.size)

    return img
예제 #2
0
def _get_img_with_all_operations():
    b = operations.brightness
    c = operations.contrast
    s = operations.sharpness

    img = _img_preview
    if b != 0:
        img = img_helper.brightness(img, b)

    if c != 0:
        img = img_helper.contrast(img, c)

    if s != 0:
        img = img_helper.sharpness(img, s)

    if operations.rotation_angle:
        img = img_helper.rotate(img, operations.rotation_angle)

    if operations.flip_left:
        img = img_helper.flip_left(img)

    if operations.flip_top:
        img = img_helper.flip_top(img)

    if operations.size:
        img = img_helper.resize(img, *operations.size)

    if operations.red != operations.red_prev:
        img = img_helper.hist_red(img, operations.red, operations.red_prev)
        operations.red_prev = operations.red

    if operations.green != operations.green_prev:
        img = img_helper.hist_green(img, operations.green,
                                    operations.green_prev)
        operations.green_prev = operations.green

    if operations.blue != operations.blue_prev:
        img = img_helper.hist_blue(img, operations.blue, operations.blue_prev)
        operations.blue_prev = operations.blue

    return img