I am trying to create a sepia effect. This is the code I am trying:
Mat image_copy;
cvtColor(image, image_copy, CV_BGRA2BGR);
Mat kern = (Mat_<char>(4,4) << 0.272, 0.534, 0.131, 0,
0.349, 0.686, 0.168, 0,
0.393, 0.769, 0.189, 0,
0, 0, 0, 1);
cv::transform(image_copy, image, kern);
But it doesn't work. I get a black image. No error, no exception, just black image. Any ideas?
I have tried applying different kernels and they do work. For example:
Mat kern = (Mat_<char>(4,4) << 10, 0, 0, 0,
0, 10, 0, 0,
0, 0, 10, 0,
0, 0, 0, 10);
cv::transform(image_copy, image, kern);
image += cv::Scalar(10, 10, 10, 0);
Please help.