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

Brightness Augmentation issue #2

Closed
calicratis19 opened this issue May 26, 2017 · 1 comment
Closed

Brightness Augmentation issue #2

calicratis19 opened this issue May 26, 2017 · 1 comment

Comments

@calicratis19
Copy link

Brightness Augmentation is done by scaling. Sometimes the value might get more than 255 and then will be set to scaledValue%256 which is erroneous. The following is one way to solve this problem,

def RandomBrightness(img):
    img = cv2.cvtColor(img, cv2.COLOR_RGB2HSV)
    h, s, v = cv2.split(img)

    scale = random.uniform(1, 1.5)

    v = np.clip(v * scale, 0, 255, out=v)
    img = cv2.merge((h, s, v))
    img = cv2.cvtColor(img, cv2.COLOR_HSV2RGB)
    return img
@vxy10
Copy link
Owner

vxy10 commented May 26, 2017

yeah, i changed it in my implementation, forgot to update on github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants