pytorch/vision

torchvision.transforms.functional.adjust_hue does not respect alpha channel

Open

#3,219 建立於 2021年1月4日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)Python (15,050 star) (6,858 fork)batch import
enhancementhelp wantedmodule: documentationmodule: transforms

描述

🐛 Bug

when working with RGBA images, the adjust_hue function does not seem to respect the alpha channel and imposes a max_value of 255 after the transform. Taking a quick look at the source code, it seems that the image is immediately converted to HSV without retaining the alpha channel. It should be a quick fix to retain the alpha channel and include it when merging back into RGBA.

To Reproduce

Steps to reproduce the behavior:

img = Image.open('xyz.png')
img_ = adjust_hue(img, 0.1)
print(np.array(img.split()[-1]).mean())
print(np.array(img_.split()[-1]).mean())

cc @vfdev-5

貢獻者指南