// vintage-filter.cpp : 怀旧滤镜
// @mango
#include<iostream>#include<opencv2/opencv.hpp>intmain(){cv::Matimg=cv::imread("fruit.jpg");for(size_ti=0;i<img.rows;i++){for(size_tj=0;j<img.cols;j++){img.at<cv::Vec3b>(i,j)[1]=cv::saturate_cast<uchar>(0.349*img.at<cv::Vec3b>(i,j)[2]+0.686*img.at<cv::Vec3b>(i,j)[1]+0.168*img.at<cv::Vec3b>(i,j)[0]);// green
img.at<cv::Vec3b>(i,j)[2]=cv::saturate_cast<uchar>(0.393*img.at<cv::Vec3b>(i,j)[2]+0.769*img.at<cv::Vec3b>(i,j)[1]+0.189*img.at<cv::Vec3b>(i,j)[0]);// red
img.at<cv::Vec3b>(i,j)[0]=cv::saturate_cast<uchar>(0.272*img.at<cv::Vec3b>(i,j)[2]+0.534*img.at<cv::Vec3b>(i,j)[1]+0.131*img.at<cv::Vec3b>(i,j)[0]);// blue
}}cv::imshow("怀旧滤镜",img);cv::waitKey(0);return0;}