Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added adjust_brightness and adjust_contrast to transforms.py #15046 #18363

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion ivy/functional/frontends/paddle/vision/transforms.py
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# global
#global

import numpy as np
from PIL import Image
from . import transforms

def adjust_brightness(img, brightness_factor):

# 0 gives a black image, 1 gives the original image while 2 doubles the brightness

fake_img_np = np.array(img)
fake_img = Image.fromarray(fake_img_np)
converted_img = transforms.adjust_brightness(fake_img, brightness_factor)
return converted_img

def adjust_contrast(img, contrast_factor):

# 0 gives a solid gray image, 1 gives the original image while 2 increases the contrast by a factor of 2

fake_img_np = np.array(img)
fake_img = Image.fromarray(fake_img_np)
converted_img = transforms.adjust_contrast(fake_img, contrast_factor)
return converted_img