// casting-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)[0]=cv::saturate_cast<uchar>(128*img.at<cv::Vec3b>(i,j)[0]/(img.at<cv::Vec3b>(i,j)[1]+img.at<cv::Vec3b>(i,j)[2]+1));// blue
img.at<cv::Vec3b>(i,j)[1]=cv::saturate_cast<uchar>(128*img.at<cv::Vec3b>(i,j)[1]/(img.at<cv::Vec3b>(i,j)[0]+img.at<cv::Vec3b>(i,j)[2]+1));// green
img.at<cv::Vec3b>(i,j)[2]=cv::saturate_cast<uchar>(128*img.at<cv::Vec3b>(i,j)[2]/(img.at<cv::Vec3b>(i,j)[0]+img.at<cv::Vec3b>(i,j)[1]+1));// red
}}cv::imshow("熔铸滤镜",img);cv::waitKey(0);return0;}