Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Is there an inverse to AlphaPremul?

David_N_
Beginner
432 Views

Hello,

Is there an inverse to the AlphaPremul method?

Based on the thread here, it seems that AlphaComp always produces pre-multiplied results. If I want to save those results to PNG, I have to un-premultiply them. I dont see an inverse to the AlphaPremul method. Is there some other way of un-premultiplying an image, or so I have to write it by hand?

0 Kudos
6 Replies
Zhen_Z_Intel
Employee
432 Views

Hi David,

I am afraid we do not have, you probably could consider implemented by self. If you use AlphaPremul that means you already get Cr|g|b= Ar|g|b * αA , (αA=αC) and you would like to get RGB value of A, you could calculate by Cr|g|b*1/αC 

0 Kudos
David_N_
Beginner
432 Views

Hello,

Maybe you can consider this an addition for the future. Since you already have optimized code for doing the premul, it should be really easy do 1/alpha at the same time. Of course I can do it myself, but it likely will not be as optimized as the code you have for premul.

0 Kudos
BMart1
New Contributor II
432 Views

Have you tried ippsDiv?

0 Kudos
David_N_
Beginner
432 Views

We did not try that. Do you think that one of the div functions will help in this case?

0 Kudos
BMart1
New Contributor II
432 Views

Yesterday I checked that ippiMul and ippiAlphaPremul are equivalent and remembered this thread, so ippiDiv should work with the caveat that it won't support the alpha packed with the RGB.  You would need separate planes.

0 Kudos
Adriaan_van_Os
New Contributor I
432 Views

ippiDiv has the problem of division by zero (returning an warning error code for u and s integer types and producing NAN_32F, INF_32F or INF_NEG_32F values for floating-point types). So, I do feel that AlphaUnPremul functions are missing. For example, Apple's vImage library has vImageUnpremultiplyData functions for the purpose.

Regards,

Adriaan van Os

 

0 Kudos
Reply