我对使用多个频道感到困惑.
以下哪一项是正确的?
以下哪一项是正确的?
// roi is the image matrix for(int i = 0; i < roi.rows; i++) { for(int j = 0; j < roi.cols; j+=roi.channels()) { int b = roi.at<cv::Vec3b>(i,j)[0]; int g = roi.at<cv::Vec3b>(i,j)[1]; int r = roi.at<cv::Vec3b>(i,j)[2]; cout << r << " " << g << " " << b << endl ; } }
要么,
for(int i = 0; i < roi.rows; i++) { for(int j = 0; j < roi.cols; j++) { int b = roi.at<cv::Vec3b>(i,j)[2]; cout << r << " " << g << " " << b << endl ; } }