Reputation: 810
So the closest of what I found is this Mathematica implementation. Yet Mathematica is not opensource nor easily includable in other applications... So I wonder how to do Photoshop like effect OilPaint effect in OpenCV?
Example Difference (note one can not really detect in difference-image any patterns not included in processing result):
And the best thing is it processed image looks close to what experts see in original image:
Images source.
So how to implement a Photoshop like effect OilPaint effect in OpenCV (in Python or C++)?
Upvotes: 2
Views: 3438
Reputation: 53164
Here is a classic form of the oil painting effect in Python/OpenCV. Simply apply some morphology open to the image and then brighten the darker regions a little using cv2.normalize.
Input:
import cv2
import numpy as np
# load image
img = cv2.imread("windmill.jpg")
# apply morphology open to smooth the outline
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (6,6))
morph = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
# brighten dark regions
result = cv2.normalize(morph,None,20,255,cv2.NORM_MINMAX)
# write result to disk
cv2.imwrite("windmill_oilpaint.jpg", result)
cv2.imshow("IMAGE", img)
cv2.imshow("OPEN", morph)
cv2.imshow("RESULT", result)
cv2.waitKey(0)
cv2.destroyAllWindows()
Upvotes: 4