opencv_transforms_torchvision icon indicating copy to clipboard operation
opencv_transforms_torchvision copied to clipboard

Grayscale transformations

Open adamxyang opened this issue 4 years ago • 2 comments

Hi, thanks for the great package. I found affine transformations always turn my Grayscale images into three-channel images. Is there any additional parameters that would prevent this and only output one-channel grayscale images?

I simply used the code in Readme:

train_transform = cvtransforms.Compose([
cvtransforms.RandomAffine(degrees=10, translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-10, 0)),
cvtransforms.ToTensor()
                ])

ToTensor method preserves dimensions but RandomAffine does not.

adamxyang avatar Aug 25 '19 18:08 adamxyang

Hi, thanks for the great package. I found affine transformations always turn my Grayscale images into three-channel images. Is there any additional parameters that would prevent this and only output one-channel grayscale images?

I simply used the code in Readme:

train_transform = cvtransforms.Compose([
cvtransforms.RandomAffine(degrees=10, translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-10, 0)),
cvtransforms.ToTensor()
                ])

ToTensor method preserves dimensions but RandomAffine does not.

Thank you for pointing out the bugs, I think I have adjust the affine transform and the perspective transform for grayscale image

hityzy1122 avatar Aug 26 '19 05:08 hityzy1122

Thanks for the update! Is that possible to push the change to the public package? I used pip install for the package, it would be great if I can upgrade it using pip.

adamxyang avatar Aug 26 '19 13:08 adamxyang