Registered Member
|
Hi, I went to write some code to histogram a vector in Eigen and, knowing that Eigen generally solves my most difficult problems with ease, thought that my implementation seemed un-elegant and there is probably a better way.
thoughts? Eigen::ArrayXf m_imageData; image->getImage(m_imageData); // c-style get data by reference Eigen::Array<unsigned int,1,Eigen::Dynamic> val; val = (m_imageData / m_imageData.maxCoeff() * m_nbins).cast<unsigned int>(); for(unsigned long i=0;i<val.size();++i) { ++m_histogram[val(i)]; //std::vector<int> m_histogram; } |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]