1 | initial version |
i can give you a c++ answer only, but looking at this it should be quite easy:
Mat img = imread("lena.jpg");
Mat_<float> sepia(3,3);
//sepia << .393,.769,.189 // rgb
// ,.349,.686,.168
// ,.272,.534,.131;
sepia << .131,.769,.272 // bgr (diag elems swapped)
,.349,.686,.168
,.189,.534,.393;
Mat out;
cv::transform(img,out,sepia);
imshow("i",out);
waitKey();
2 | No.2 Revision |
i can give you a c++ answer only, but looking at this it should be quite easy:
Mat img = imread("lena.jpg");
Mat_<float> sepia(3,3);
//sepia << .393,.769,.189 // rgb
// ,.349,.686,.168
// ,.272,.534,.131;
sepia << .131,.769,.272 .131,.534,.272 // bgr (diag elems (rows and cols swapped)
,.349,.686,.168
,.168,.686,.349
,.189,.534,.393;
,.189,.769,.393;
Mat out;
cv::transform(img,out,sepia);
imshow("i",out);
waitKey();
3 | No.3 Revision |
i can give you a c++ answer only, but looking at this it should be quite easy:
Mat img = imread("lena.jpg");
Mat_<float> sepia(3,3);
//sepia << .393,.769,.189 // rgb
// ,.349,.686,.168
// ,.272,.534,.131;
sepia << .131,.534,.272 // bgr (rows and as well as cols swapped)
,.168,.686,.349
,.189,.769,.393;
Mat out;
cv::transform(img,out,sepia);
imshow("i",out);
waitKey();