How to Apply Sepia Filter to Images Using OpenCV

You can use OpenCV to easily and quickly apply a Sepia filter to your images, as seen in these pictures. Here is how:

First of all create a Kernel Matrix, like this:

cv::Mat kernel =
	(cv::Mat_<float>(3, 3)
		<<
		0.272, 0.534, 0.131,
		0.349, 0.686, 0.168,
		0.393, 0.769, 0.189);

Next, just apply this Kernel using transform OpenCV transform function to your image.

cv::transform(input_img, output_img, kernel);


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.