[Insight-users] Separating saturation from RGB image

Piotr Majkrzak petrol.91 at gmail.com
Mon Feb 21 07:13:52 EST 2011


Dear all,
I'm writing to you because i have a problem with ITK library. It's my first 
program with it.
I don't know how to use ITK to separate saturation layer of RGB image.
My function:
double Sat(itk::RGBPixel<uint8_t> & RGB)
{
   return static_cast<double>(std::max(RGB[0],std::max(RGB[1],RGB[2])) - 
std::min(RGB[0],std::min(RGB[1],RGB[2]))) / 
static_cast<double>(std::max(RGB[0],std::max(RGB[1],RGB[2])));
}
is good for one pixel, but I don't know how to apply it for all pixels and 
create new image.
Yours sincerely
Piotr Majkrzak


More information about the Insight-users mailing list