Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Optimizing the train data computation from HOGs

Currently I am using the following function to convert a vector of HOG descriptors to a cv::Mat trainData to be used from a SVM classifier:

void HOGs2Mat(std::vector<std::vector<float>> & HOGs, cv::Mat & mat) {
    size_t descriptorsSize = HOGs[0].size();
    for ( size_t i = 0; i < HOGs.size(); ++i )
         for ( size_t j = 0; j < descriptorsSize; ++j )
              mat.at<float>(i, j) = HOGs[i][j];

}

However I am currently looking for a faster way of doing the same thing by avoiding the nested loops. Is there a way to update the trainData with some matrix operations?

Optimizing the train data computation from HOGs

Currently I am using the following function to convert a vector of HOG descriptors to a cv::Mat trainData to be used from a SVM classifier:

void HOGs2Mat(std::vector<std::vector<float>> & HOGs, cv::Mat & mat) {
    size_t descriptorsSize = HOGs[0].size();
    for ( size_t i = 0; i < HOGs.size(); ++i )
         for ( size_t j = 0; j < descriptorsSize; ++j )
              mat.at<float>(i, j) = HOGs[i][j];

}

However I am currently looking for a faster way of doing the same thing by avoiding the nested loops. Is there a way to update the trainData with some matrix operations?

Optimizing the train data computation from HOGs

Currently I am using the following function to convert a vector of HOG descriptors to a cv::Mat trainData to be used from a SVM classifier:

void HOGs2Mat(std::vector<std::vector<float>> & HOGs, cv::Mat & mat) {
    size_t descriptorsSize = HOGs[0].size();
    for ( size_t i = 0; i < HOGs.size(); ++i )
         for ( size_t j = 0; j < descriptorsSize; ++j )
              mat.at<float>(i, j) = HOGs[i][j];

}

However I am currently looking for a faster way of doing the same thing by avoiding the nested loops. Is there a way to update the trainData with some matrix operations?

Optimizing the train data computation from HOGs

Currently I am using the following function to convert a vector of HOG descriptors to a cv::Mat trainData to be used from by a SVM classifier:

void HOGs2Mat(std::vector<std::vector<float>> & HOGs, cv::Mat & mat) {
    size_t descriptorsSize = HOGs[0].size();
    for ( size_t i = 0; i < HOGs.size(); ++i )
         for ( size_t j = 0; j < descriptorsSize; ++j )
              mat.at<float>(i, j) = HOGs[i][j];

}

However I am currently looking for a faster way of doing the same thing by avoiding the nested loops. Is there a way to update the trainData with some matrix operations?

Optimizing the train data computation from HOGs

Currently I am using the following function to convert a vector of HOG descriptors to a cv::Mat trainData to be used by a SVM classifier:

void HOGs2Mat(std::vector<std::vector<float>> & HOGs, cv::Mat & mat) {
    size_t descriptorsSize = HOGs[0].size();
    for ( size_t i = 0; i < HOGs.size(); ++i )
         for ( size_t j = 0; j < descriptorsSize; ++j )
              mat.at<float>(i, j) = HOGs[i][j];
 }

However I am currently looking for a faster way of doing the same thing by avoiding the nested loops. Is there a way to update the trainData with some matrix operations?