Permalink
Browse files

argsort deleted.

  • Loading branch information...
bytefish committed Feb 1, 2012
1 parent 0f1c0fc commit 0b84811ba962d68637a2724468373dd6f84418b8
Showing with 0 additions and 40 deletions.
  1. +0 −5 eigenfaces/include/helper.hpp
  2. +0 −35 eigenfaces/src/helper.cpp
@@ -53,11 +53,6 @@ Mat asColumnMatrix(const vector<Mat>& src, int type = CV_32FC1);
Mat toGrayscale(const Mat& src);
//! transposes a matrix
Mat transpose(const Mat& src);
-//! performs a matlab/numpy equivalent argsort (only 1 channel matrices supported)
-template<typename _Tp>
-vector<int> argsort_(const Mat& src, bool sortAscending=true);
-//! performs a matlab/numpy equivalent argsort (only 1 channel matrices supported)
-vector<int> argsort(const Mat& src, bool sortAscending=true);
}
#endif
View
@@ -72,41 +72,6 @@ Mat cv::sortMatrixByRow(const Mat& src, vector<int> sorted_indices) {
return dst;
}
-
-template<typename _Tp>
-vector<int> cv::argsort_(const Mat& src, bool asc) {
- if(src.rows != 1 && src.cols != 1)
- CV_Error(CV_StsBadArg, "Argsort only sorts 1D Vectors");
- // <value>,<index>
- vector< pair<_Tp,int> > val_indices;
- for(int i = 0; i < src.rows; i++)
- for(int j = 0; j < src.cols; j++)
- val_indices.push_back(make_pair(src.at<_Tp>(i,j),val_indices.size()));
- if(asc) {
- std::sort(val_indices.begin(), val_indices.end(), SortByFirstAscending_<_Tp>());
- } else {
- std::sort(val_indices.begin(), val_indices.end(), SortByFirstDescending_<_Tp>());
- }
-
- vector<int> indices;
- for(int i=0; i < val_indices.size(); i++)
- indices.push_back(val_indices[i].second);
- return indices;
-}
-
-//! get
-vector<int> cv::argsort(const Mat& src, bool asc) {
- switch(src.type()) {
- case CV_8SC1: return argsort_<char>(src,asc); break;
- case CV_8UC1: return argsort_<unsigned char>(src,asc); break;
- case CV_16SC1: return argsort_<short>(src,asc); break;
- case CV_16UC1: return argsort_<unsigned short>(src,asc); break;
- case CV_32SC1: return argsort_<int>(src,asc); break;
- case CV_32FC1: return argsort_<float>(src,asc); break;
- case CV_64FC1: return argsort_<double>(src,asc); break;
- }
-}
-
Mat cv::asColumnMatrix(const vector<Mat>& src, int type) {
int n = src.size();
int d = src[0].total();

0 comments on commit 0b84811

Please sign in to comment.