OpenCV  4.5.1
Open Source Computer Vision
Oil painting effect

Introduction

Image is converted in a color space default color space COLOR_BGR2GRAY. For every pixel in the image a program calculated a histogram (first plane of color space) of the neighbouring of size 2*size+1. and assigned the value of the most frequently occurring value. The result looks almost like an oil painting. Parameter 4 of oilPainting is used to decrease image dynamic and hence increase oil painting effect.

Example

Mat img;
Mat dst;
img = imread("opencv/samples/data/baboon.jpg");
imshow("oil painting effect", dst);

Original

baboon.jpg

Oil painting effect

baboon_oil_painting_effect.jpg