This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // convert an OpenCV multi-channel matrix to Armadillo cube. A copy is made | |
| template <typename T, int NC> | |
| Cube<T> to_arma(const cv::Mat_<cv::Vec<T, NC>> &src) | |
| { | |
| vector<cv::Mat_<T>> channels; | |
| Cube<T> dst(src.cols, src.rows, NC); | |
| for (int c = 0; c < NC; ++c) | |
| channels.push_back({src.rows, src.cols, dst.slice(c).memptr()}); | |
| cv::split(src, channels); | |
| return dst; |