rahulch

Untitled

Sep 5th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. Mat temp_1_mat,temp_2_mat,temp_3_mat;
  2.  
  3.     temp_1_mat = imread("./img_1.jpg",CV_LOAD_IMAGE_COLOR);
  4.     imwrite("temp_1_mat_before.jpg", temp_1_mat);
  5.     //temp_2_mat = cv::Mat::zeros(cv::Size(temp_1_mat.rows, temp_1_mat.cols), CV_8UC3);
  6.     try {
  7.         std::cout << "cvtColor being\n";
  8.         std::cout << "rows = " << temp_1_mat.rows << std::endl;
  9.         std::cout << "cols = " << temp_1_mat.cols << std::endl;
  10.         std::cout << "channels = " << temp_1_mat.channels() << std::endl;
  11.         cv::cvtColor(temp_1_mat, temp_2_mat, CV_BGR2GRAY);
  12.         imwrite("temp_1_mat_after.jpg", temp_1_mat);
  13.         imwrite("temp_2_mat_1.jpg", temp_2_mat);
  14.         cv::cvtColor(temp_1_mat, temp_2_mat, CV_BGR2GRAY);
  15.         imwrite("temp_2_mat_2.jpg", temp_2_mat);
  16.         std::cout << "cvtColor end\n";
  17.     } catch (const std::exception& e) {
  18.         std::cout << "CVTCOLOR EXCEPTION :: " << e.what() << std::endl;
  19.     }
Add Comment
Please, Sign In to add comment