http://beautifulapps.mobi/acne/
还有另一个例子:
我也需要在我自己的应用程序中实现这样的痤疮去除。我尝试在 Stack Overflow 上搜索,发现了几十个问题,但它们都与简单的图像过滤器有关。我想过应用模糊,但后来我想了想,我认为模糊不是这里的解决方案。
Brad GPUImage 库也在那里。它有很多影响,我已经经历过它们对我的情况没有帮助。我可能错过了一个重要的事情。我怎样才能实现这个目标?
GPUImage 框架将为您提供帮助。看看这里描述的过滤器:JH Labs。你需要做的是(这并不容易;很多工作)
也许这对概念有帮助。我用 python Opencv 项目做了粉刺去除器,下面是代码(我已经在需要的地方对代码进行了解释):
from fileinput import filename
import cv2 as cv
from cv2 import waitKey
from cv2 import destroyAllWindows
from cv2 import VideoWriter
from cv2 import minMaxLoc
from more_itertools import padded
import numpy as py
import matplotlib.pyplot as plt
import matplotlib as mat
import math
from sympy import fps
# OpenCV Utility Class for Mouse Handling
# With functions for to mouse callback to work on
class Sketcher:
def __init__(self, windowname, dests, colors_func):
self.prev_pt = None
self.windowname = windowname
self.dests = dests
self.colors_func = colors_func
self.dirty = False
self.show()
cv.setMouseCallback(self.windowname, self.on_mouse)
# Displaying windows
def show(self):
cv.imshow(self.windowname, self.dests[0])
cv.imshow(self.windowname + ": mask", self.dests[1])
# onMouse function for Mouse Handling
def on_mouse(self, event, x, y, flags, param):
pt = (x, y)
if event == cv.EVENT_LBUTTONDOWN:
self.prev_pt = pt
elif event == cv.EVENT_LBUTTONUP:
self.prev_pt = None
# Draw the line between mouse clicks
if self.prev_pt and flags & cv.EVENT_FLAG_LBUTTON:
for dst, color in zip(self.dests, self.colors_func()):
cv.line(dst, self.prev_pt, pt, color, 5)
self.dirty = True
self.prev_pt = pt
self.show()
src = cv.imread("C:/Python/Python_OpenCV/pics/blemish.png", -1)
plt.figure(figsize=(10,5))
plt.imshow(src, cmap="gray")
plt.title("Original Image")
if src is None:
print("Failed to load the image: {}".format(filename))
# Create the copy mage
src_mask = src.copy()
# Create a black copy of the original image
# Acts as a mask
inpaintMask = py.zeros(src.shape[:2], py.uint8)
# Create sketch using Opencv Utility Class:Sketcher
sketch = Sketcher("image", [src_mask, inpaintMask], lambda:((255, 255, 25), 255))
while True:
ch = cv.waitKey()
if ch == 27:
break
if ch == ord("t"):
# Use Fast Marching Algorithm method
res = cv.inpaint(src= src_mask, inpaintMask= inpaintMask, inpaintRadius= 3, flags= cv.INPAINT_TELEA)
cv.imshow("Inpaint output using FMM", res)
if ch == ord("n"):
# Use Navier-Stokes Algorithm method
res = cv.inpaint(src= src_mask, inpaintMask= inpaintMask, inpaintRadius= 3, flags= cv.INPAINT_NS)
cv.imshow("Inpaint using NS technique", res)
if ch == ord("r"):
# ord = Return the Unicode code point for a one-character string.
# original image
src_mask[:] = src
inpaintMask[:] = 0
sketch.show()
plt.show()
cv.waitKey(0)
cv.destroyAllWindows()