QString appPath = QCoreApplication::applicationDirPath(); imagePath = appPath + "/A.jpg"; img = cv::imread(imagePath.toStdString()); if (img.empty()) return; std::vector<Mat> mv; cv::split(img, mv); imshow("B", mv[0]); imshow("G", mv[1]); imshow("R", mv[2]); cv::Mat dst; mv[1] = 0; mv[2] = 0; cv::merge(mv, dst); imshow("Blue", dst); int from_to[] = { 0,2,1,1,2,0 }; cv::mixChannels(&img, 1, &dst, 1, from_to,3); imshow("通道混合", dst);