Advertisement
dan-masek

Untitled

Aug 23rd, 2024
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <opencv2/opencv.hpp>
  2.  
  3. int main()
  4. {
  5.     uint8_t data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
  6.     cv::Mat bgr(2, 2, CV_8UC3, data);
  7.  
  8.     cv::Mat result = cv::Mat1b(bgr.rows * 3, bgr.cols);
  9.  
  10.     std::vector<cv::Mat> views = {
  11.         result.rowRange(0, bgr.rows)
  12.         , result.rowRange(bgr.rows, bgr.rows * 2)
  13.         , result.rowRange(bgr.rows * 2, bgr.rows * 3)
  14.     };
  15.     cv::split(bgr, views);
  16.  
  17.     std::cout << bgr << '\n';
  18.  
  19.     std::cout << result << '\n';
  20.  
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement