[go: nahoru, domu]

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

Question: I don't want to fill the png transparent part. #1146

Open
naknakLEE opened this issue Aug 7, 2019 · 7 comments
Open

Question: I don't want to fill the png transparent part. #1146

naknakLEE opened this issue Aug 7, 2019 · 7 comments
Assignees
Labels
enhancement New feature or request external contribution welcome A good place to start contributing to the project

Comments

@naknakLEE
Copy link

Hi.
I want to load the empty space (transparent) of the png file.In Dali, if i load the png file, the space is filled. Is there a solution?

@naknakLEE naknakLEE changed the title I don't want to fill the png transparent part. Question: I don't want to fill the png transparent part. Aug 7, 2019
@ghost
Copy link
ghost commented Aug 7, 2019

I got this issue, too. Anyone can help us?

@awolant
Copy link
Contributor
awolant commented Aug 7, 2019

Hi, thanks for the question. Could you clarify a bit what you do expect here?
Do you want to have 4-channel image with separate alpha channel? Or you want to clear the input based on the alpha value?
Ultimately, to decode PNGs we use OpenCV and by default the alpha channel is discarded, I think. Probably, to implement this, we need a custom code path for PNGs with reading the alpha channel.

@awolant awolant added enhancement New feature or request question Further information is requested labels Aug 7, 2019
@JanuszL JanuszL added this to ToDo in Users requests via automation Aug 7, 2019
@naknakLEE
Copy link
Author

Hi.
i want to have 4-channel image with separate alpha channel

@JanuszL
Copy link
Contributor
JanuszL commented Aug 13, 2019

@naknakLEE - as @awolant said, we need custom code path to output the alpha channel from the decoder. Moreover, some operators may not work properly with this kind of input/require dedicated code path with the special treatment of this 4th channel - like color based operations (hue, saturation, brightness).
Adding this to our backlog.

@JanuszL JanuszL added external contribution welcome A good place to start contributing to the project and removed question Further information is requested labels Jan 21, 2020
@JanuszL
Copy link
Contributor
JanuszL commented Apr 1, 2021

Hi @naknakLEE,
In the meantime you can use an external library to load the image with 4 channels and use the external_source operator, please check parallel and prefetch_queue_depth parameters to make this process efficient.

@Renzzauw
Copy link
Renzzauw commented Dec 1, 2022

Hi @awolant & @JanuszL,

I was wondering if there was any progress or changes regarding this issue, since it's been a while since this question was asked.

I'm trying to decode 4-channel (with alpha channel) images (.png or .bmp). As a work-around, I extracted the alpha-channels as 8-bit grayscale images to later reassemble them with the corresponding RGB images in my script, but it would be nice to not have to decode the alpha channels separately.

Thanks!

@mzient
Copy link
Contributor
mzient commented Dec 1, 2022

Hello @Renzzauw
There's a new operator, fn.experimental.decoders.image which handles alpha channel (sort of) and also higher bit depths.
When you specify img = fn.experimental.decoders.image(enc, output_type=dali.types.ANY_DATA), you will get the image with alpha. Currently there is no first-class support for alpha, so the channel order may vary - indeed, for PNGs they are returned as BGRA whereas for JPEG 2000 the channel order depends on the backend - CPU decoder returns BGRA and the GPU decoder returns RGBA. Despite those limitations, you should be able to do what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request external contribution welcome A good place to start contributing to the project
Projects
Development

No branches or pull requests

5 participants