question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FR] Grayscale to RGB

See original GitHub issue

Hi, I’m using albumentations for my project, but my image is GrayScale with shape [H, W] but I need to use RGB image (3 channels or [H, W, 3]) for training neural networks. Does the library provides any transformation to convert grayscale to RGB, which is similar to tf.image.grayscale_to_rgb? thank you

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
domefcommented, May 12, 2022

A transformation A.ToRGB would be very usefull.

2reactions
hoangtnmcommented, Oct 8, 2021

@BloodAxe I understand your idea, but I think having a transformation like A.RepeatChannels(3) or A.ToRGB will be more easy-to-use rather than use cv2.cvtColor outside A.Compose[...]. Another question is how to scale image in range [0, 255] to [0, 1] like torchvision’s ToTensor, but when I try albumentations.pytorch.transforms.ToTensorV2, it just swaps channels from [H, W, C] to [C, H, W]. Does albumentations have any equivalent transform?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grayscale to RGB Conversion - Tutorialspoint
Average method is the most simple one. You just have to take the average of three colors. Since its an RGB image, so...
Read more >
DIP Grayscale to RGB Conversion - Javatpoint
To convert a grayscale image into color or RGB format, we have two methods. Both methods have their advantages as well as disadvantages....
Read more >
How Do I Change From Grayscale to RGB in Photoshop?
There are a few ways to change from gray to RGB in Photoshop. One way is to go to the Image menu and...
Read more >
How to Convert an RGB Image to a Grayscale - Baeldung
Grayscale is the simplest model since it defines colors using only one component that is lightness. The amount of lightness is described using...
Read more >
Transform Grayscale Images to RGB Using Python's Matplotlib
Add two additional channels to a grayscale! There are a variety of ways to do this, so my way is below: copy the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found