- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using ColorTwist for image saturation manipulation. The image is 8u 3c.
// BGR to RGB
int swapStep;
Ipp8u* swap = ippiMalloc_8u_C3(roi.width, roi.height, &swapStep);
int swapOrder[] = { 2, 1, 0 };
status = ippiSwapChannels_8u_C3R(img, lineStep, swap, swapStep, roi, swapOrder);
// convert to float and scale 0.f - 1.f
int imgFStep;
Ipp32f* imgF = ippiMalloc_32f_C3(roi.width, roi.height, &imgFStep);
IppStatus ippStat = ippiScale_8u32f_C3R(swap, swapStep, imgF, imgFStep, roi, 0.f, 1.f);
const float rf = 0.299f;
const float gf = 0.587f;
const float bf = 0.114f;
float s = -1.f;
float a = (1.f - s) * rf + s;
float b = (1.f - s) * rf;
float c = (1.f - s) * rf;
float d = (1.f - s) * gf;
float e = (1.f - s) * gf + s;
float f = (1.f - s) * gf;
float g = (1.f - s) * bf;
float h = (1.f - s) * bf;
float i = (1.f - s) * bf + s;
const Ipp32f twist[3][4] =
{
a, b, c, 0.f,
d, e, f, 0.f,
g, h, i, 0.f,
};
ippStat = ippiColorTwist_32f_C3IR(imgF, imgFStep, roi, twist);
ippStat = ippiScale_32f8u_C3R(imgF, imgFStep, img, lineStep, roi, 0.f, 1.f);
// swap back to BGR
ippStat = ippiSwapChannels_8u_C3IR(img, lineStep, roi, swapOrder);
But the resulting image is green? It's supposed to be desaturated - I saw another thread with this issue - but I am not using any alpha channels.
Link Copied

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page