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);
推荐一个零声学院项目课,个人觉得老师讲得不错,分享给大家:
零声白金学习卡(含基础架构/高性能存储/golang云原生/音视频/Linux内核)
https://xxetb.xet.tech/s/3Zqhgt