Advertisement
HappyPotato18

SelectChannel

Apr 23rd, 2020
2,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <opencv2/highgui/highgui.hpp>
  2. #include <opencv2/ml/ml.hpp>
  3. #include <opencv2/imgproc/imgproc.hpp>
  4.  
  5. using namespace cv;
  6.  
  7.  
  8. int main(int argc, char** argv) {
  9.  
  10.     printf("hhello!");
  11.     Mat src = imread(argv[1]);
  12.     Mat rgb = Mat(src.cols, src.rows, 8, 3);
  13.     std::vector<Mat> splitedRgb = std::vector<Mat>();
  14.     cvtColor(src, rgb, CV_BGR2RGB);
  15.     split(rgb, splitedRgb);
  16.  
  17.     for (int y = 0; y < rgb.cols; y++) {
  18.         for (int x = 0; x < rgb.rows; x++) {
  19.  
  20.            
  21.                 src.at<Vec3b>(x, y)[0] = 0;
  22.                 src.at<Vec3b>(x, y)[2] = 0;
  23.            
  24.         }
  25.     }
  26.     imwrite(argv[1], src);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement