Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Vec3Real64 Impala::Core::Array::Element::ColRGB2HSI ( const Vec3Real64 &  v  )  [inline]

Conversion from RGB to HSI.

No formula yet...

Definition at line 251 of file ColConvert.h.

References E1Min(), E1Sum(), TWO_PI, Impala::Core::Array::Element::Vec3Real64::X(), Impala::Core::Array::Element::Vec3Real64::Y(), and Impala::Core::Array::Element::Vec3Real64::Z().

Referenced by Impala::Core::Array::Element::Color::ToHSI().

00252 {
00253     double I = E1Sum(v) / 3.0;
00254     double S = (I == 0.0) ? 1.0 : 1.0 - (E1Min(v) / I);
00255     double H;
00256     if (v.X() == v.Y() && v.Y() == v.Z())
00257         H = 0.0;
00258     else {
00259         double tmp = acos((0.5*(v.X()-v.Y()+v.X()-v.Z())) / 
00260                 sqrt((v.X()-v.Y())*(v.X()-v.Y())+(v.X()-v.Z())*(v.Y()-v.Z())));
00261         H = (v.Y() > v.Z()) ? tmp : TWO_PI - tmp;
00262     }
00263     return Vec3Real64(H, S, I);
00264 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:59:58 2010 for ImpalaSrc by  doxygen 1.5.1