Advertisement
dan-masek

Untitled

Jun 6th, 2019
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. void splitTo8UC3_dan(const cv::Mat& input, std::vector<cv::Mat>& output)
  2. {
  3.     // Allocate outputs
  4.     cv::Mat b(cv::Mat::zeros(input.size(), input.type()));
  5.     cv::Mat g(cv::Mat::zeros(input.size(), input.type()));
  6.     cv::Mat r(cv::Mat::zeros(input.size(), input.type()));
  7.  
  8.     // Collect outputs
  9.     cv::Mat out[] = { b, g, r };
  10.  
  11.     // Set up index pairs
  12.     int from_to[] = { 0,0, 1,4, 2,8 }; // r
  13.  
  14.     cv::mixChannels(&input, 1, out, 3, from_to, 3);
  15.     output.assign(std::begin(out), std::end(out));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement