Implements Impala::Core::VideoSet::HistogramExtractor. Definition at line 42 of file LabHist3dExtractor.h. References BINS_FOR_A_B, BINS_FOR_L, Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CH(), Impala::Core::VideoSet::HistogramExtractor::ComputeBin(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CPB(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), Impala::Core::Vector::DivAssign(), Impala::Core::VideoSet::HistogramExtractor::GetBinCount(), Impala::Core::Vector::VectorTem< ElemT >::GetData(), Impala::Core::Array::Element::RGB, Impala::Core::Array::Element::Color::ToLab(), Impala::Core::Array::Element::Color::Value(), Impala::Core::Array::Element::Vec3Real64::X(), Impala::Core::Array::Element::Vec3Real64::Y(), and Impala::Core::Array::Element::Vec3Real64::Z(). 00043 { 00044 const UInt8* data = image->CPB(0, 0); 00045 const int nPix = image->CW() * image->CH(); 00046 00047 VectorReal64 histogram(GetBinCount()); 00048 Real64* const histData = histogram.GetData(); 00049 for (int i = 0; i < GetBinCount(); i++) 00050 histData[i] = 0; 00051 00052 for (int j = 0; j < nPix; j++) 00053 { 00054 const Array::Element::Vec3Real64 pixel = 00055 Array::Element::Vec3Real64(data[0], data[1], data[2]); 00056 const Array::Element::Color crgb(pixel, Array::Element::RGB); 00057 00058 Array::Element::Color clab = crgb.ToLab(); 00059 Array::Element::Vec3Real64 lab = clab.Value(); 00060 00061 int l = ComputeBin(lab.X(), 0.0, 100.0, BINS_FOR_L); 00062 int a = ComputeBin(lab.Y(), -90.0, 90.0, BINS_FOR_A_B); 00063 int b = ComputeBin(lab.Z(), -90.0, 90.0, BINS_FOR_A_B); 00064 00065 int offset = 00066 (l * BINS_FOR_A_B * BINS_FOR_A_B) + (a * BINS_FOR_A_B) + b; 00067 histData[offset] += 1; 00068 00069 data += 3; 00070 } 00071 00072 const Real64 factor = nPix; 00073 Vector::DivAssign(histogram, factor); 00074 return histogram; 00075 }
Here is the call graph for this function:
|