#include <opencv2/opencv.hpp>
void remove_red(cv::Mat src)
{
int width = src.cols;
int height = src.rows;
int ws = src.step1();
unsigned char* data = src.data;
for (int y = 0; y < height; y++)
{
unsigned char* row = data + y * ws;
for (int x = 0; x < width; x++)
{
unsigned char* px = row + x * 3;
px[2] = 0;
}
}
}
int main()
{
cv::Mat mat = cv::imread("image.jpg");
remove_red(mat);
cv::imshow("remove_red", mat);
cv::waitKey(0);
}