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

Problem with Saturation Using ippiColorTwist

cippher
Beginner
320 Views

Hi,

I am trying get image saturation effect using Color Twist. As Image is ARGB32 and has integer pixel values I am using ippiColorTwist32f_8u_AC4IR function.

The problem:

I am using following color matrix function...

//IPP 5.0

//fSaturation varies from 0.0f to 2.0f

//Ipp32f m[4][4]

//Red

m[2][0] = (1.0f - fSaturation) * 0.3086f ;

m[2][1] = (1.0f - fSaturation) * 0.3086f;

m[2][2] = (1.0f - fSaturation) * 0.3086f + fSaturation;

m[2][3] = 0.0f;

// Green

m[1][0] = (1.0f - fSaturation) * 0.6094f;

m[1][1] = (1.0f - fSaturation) * 0.6094f + fSaturation;

m[1][2] = (1.0f - fSaturation) * 0.6094f;

m[1][3] = 0.0f;

// Blue

m[0][0] = (1.0f - fSaturation) * 0.082f + fSaturation;

m[0][1] = (1.0f - fSaturation) * 0.082f;

m[0][2] = (1.0f - fSaturation) * 0.082f ;

m[0][3] = 0.0f;

Above color matrix function gives perfect results in C# GDI+ operations but with ippiColorTwist32f it is giving completely incorrect results. For example when fSaturation = 0.0f instead of a grayscale image I am getting a green color saturated image.

0 Kudos
1 Reply
Vladimir_Dudnik
Employee
320 Views

Hello,

What I see, if you use ARGB image and saturate 3-th component (which is exactly green channel) you should get green-saturated image, isn't it?

Note, all IPP functions use saturation to map internal result to output, might it be a reason?

could you please provide simple test case to demostrate what is the wrong with function?

Regards,
Vladimir

0 Kudos
Reply