如何在OpenCV中实现类似Photoshop的效果OilPaint效果?

问题描述 投票:0回答:2

所以我发现最接近的是this Mathematica实现。但是Mathematica并不是开源的,也不容易在其他应用程序中包含...所以我想知道如何在PhotoC中像PhotoC一样在OpenCV中实现OilPaint效果?

示例输入数据:enter image description here

示例结果:enter image description here

示例差异(注意一个人实际上无法在差异图像中检测到处理结果中未包括的任何模式):enter image description here

并且最好的是处理后的图像看起来与专家在原始图像中看到的图像非常接近:enter image description here

图像source

因此,如何在OpenCV中(用Python或C ++实现)类似Photoshop的效果OilPaint效果?

opencv image-processing filter paint photoshop
2个回答
0
投票

OpenCV具有用于此link的方法


0
投票

这里是Python / OpenCV中油画效果的经典形式。只需将某种形态学应用于图像,然后使用cv2.normalize将较暗的区域稍微变亮即可。

输入:

enter image description here

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()

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.