#include<opencv2/opencv.hpp>
#include<opencv2/imgproc.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img,img2;
img = imread("E:/test.jpg");
imshow("BGR", img);
int i = 0;
int j = 0;
int cPointB, cPointG, cPointR;
for (i = 1; i < img.rows; i++)
for (j = 1; j < img.cols; j++)
{
cPointB = img.at<Vec3b>(i, j)[0];
cPointG = img.at<Vec3b>(i, j)[1];
cPointR = img.at<Vec3b>(i, j)[2];
if (cPointB > 100 & cPointR < 100 & cPointG < 100)
{
img.at<Vec3b>(i, j)[0] = 0;
img.at<Vec3b>(i, j)[1] = 0;
img.at<Vec3b>(i, j)[2] = 0;
}
}
imshow("da", img);
waitKey(0);
system("pause");
return 0;
}
C++改变图像颜色
最新推荐文章于 2024-02-18 15:02:42 发布