mtcnn

本文用 Python 实现 PS 滤镜中的素描特效,具体的算法原理和效果可以参考之前的博客:

http://blog.csdn.net/matrix_space/article/details/38687427

from skimage import img_as_float
import matplotlib.pyplot as plt
from skimage import io
from skimage.filters._gaussian import gaussian

file_name=\'D:/Visual Effects/PS Algorithm/4.jpg\'
img=io.imread(file_name)

img = img_as_float(img)

I_out = (img[:, :, 0] + img[:, :, 1] + img[:, :, 2]) / 3.0

I_invert = 1.0 - I_out

I_gauss = gaussian(I_invert, sigma=5)

delta = 0.0001
I_dodge = (I_out + delta) / (1 + delta - I_gauss)

th = 0.95
mask = I_dodge > th
max_val = I_dodge.max()
I_dodge = I_dodge * (1-mask) + (th + I_dodge / max_val * (1 - th)) * mask

img_out = I_dodge.copy()

plt.figure(1)
plt.imshow(img)
plt.axis(\'off\')

plt.figure(2)
plt.imshow(img_out, plt.cm.gray)
plt.axis(\'off\')

plt.show()

分类:

技术点:

相关文章:

  • 2022-01-02
  • 2021-12-23
  • 2021-12-08
  • 2021-12-22
  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
  • 2021-04-14
猜你喜欢
  • 2021-12-23
  • 2021-07-20
  • 2021-12-23
  • 2022-01-02
  • 2021-12-23
相关资源
相似解决方案