Combining Sketch and Tone for Pencil Drawing Production
C. W. Lu, L. Xu, J. Y. Jia, Combining Sketch and Tone for Pencil Drawing Production, NPAR (2012) Best Paper
摘要
组合色调与线条结构(combining the tone and stroke structures)
铅笔画先验信息(prior knowledge on pencil drawing)
1 引言
铅笔画合成(pencil drawing synthesis)方法:(1)二维图像渲染(2D image-based rendering);三维模型渲染(3D model-based rendering)。
素描(sketch):缺乏细节的速写作品(a quickly finished work without a lot of details),用于描绘整体构图(global shape)和主要轮廓(main contours);影线(hatching):在相应区域中用平行暗线条描绘色调或阴影(tone or shading)。
本文提出一种二阶段线条、色调管理(a two-stage system with important stroke and tone management):
(1)素描(sketch):采用卷积框架线条生成(put stroke generation into a convolution framework)获取素描特征(capture the essential characteristics of pencil sketch)、模拟笔尖快速移动(simulate rapid nib movement in drawing)
(2)影线(hatching):引入色调模式(tonal patterns)(没有主方向的密集线条(dense pencil strokes without dominant directions)),防止产生伪影(artifacts);提出参数直方图模型用于色调调整(parametric histogram models are proposed to adjust the tone)
(3)全局最优指数模型(exponential model with global optimization):色调调整、改善重纹理区域(heavily textured regions)和物体轮廓的渲染效果(object contours)
将该方法应用于彩色图像的亮度通道(luminance channel)可生成彩铅素描(color pencil drawing)。
2 相关工作
以往工作一般是根据局部结构确定线条和影线的方向(determines orientation of strokes and hatches based on local structures),但在高纹理或噪声区域中(highly textured or noisy regions),该方法并不稳定(unstable)。
3 模型
本文提出的基于图像的铅笔素描方法(Fig. (2))包括两个步骤:(1)线条生成(pencil stroke generation);(2)色调绘制(pencil tone drawing)。
线条表达场景构图(general structures of the scene);色调侧重(focus)形状(shapes)和阴影(shadow,)。后者用于增强全局光照(depict global illumination)、阴影区域(accentuate shading and dark regions)的表现力。
3.1 线条(Line Drawing with Strokes)
在素描中,线条(stroke)的属性包括:线宽(thickness)、起伏(wiggliness)、明暗(brightness);线条通常结束于弯曲点(points of curvature)或交叉点(junctions)且几乎没有连续长曲线。
分类(classification):
输入图像灰度图(grayscale)的梯度(gradient)为:
G = ( ( ∂ x I ) 2 + ( ∂ y I ) 2 ) 1 2 (1) \mathbf{G} = \left( (\partial_{x} \mathbf{I})^{2} + (\partial_{y} \mathbf{I})^{2} \right)^{\frac{1}{2}} \tag {1} G=((∂xI)2+(∂yI)2)21(1)
其中, I \mathbf{I} I为灰度图(grayscale input); ∂ x \partial_{x} ∂x、 ∂ y \partial_{y} ∂y表示梯度算子(gradient operators),可通过前向差分(forward difference)计算。实际图像(natural image)的梯度图(gradient map)通常是有噪的且不包含用于线条生成的连续边缘(continuous edges immediately ready for stroke generation)。
线条方向估计(the estimation of line direction for each pixel):
(1)选择间隔为 45 ° 45 \degree 45°的8个参考方向(eight reference directions at 45 degrees apart),记为线段(line segments) { L i } , i ∈ { 1 , … , 8 } \left\{ \mathscr{L}_{i} \right\}, \ i \in \left\{ 1, \dots, 8 \right\} { Li}, i∈{ 1,…,8}。某个方向的响应图(the response map for a certain direction)为:
G i = L i ∗ G (2) \mathbf{G}_{i} = \mathscr{L}_{i} * \mathbf{G} \tag {2} Gi=Li∗G(2)
其中, L i \mathscr{L}_{i} Li为第 i i i上方向的线段,并表示成卷积核形式(convolution kernel);线段长度取值(经验值(empirically))为输入图像长(宽)的 1 30 \frac{1}{30} 301; ∗ * ∗表示卷积算子(convolution operator),计算梯度在各方向上投影,构造滤波器响应图 G i \mathbf{G}_{i} Gi(groups gradient magnitudes along direction i i i to form the filter response map G i \mathbf{G}_{i} Gi)。
分类(classification):按梯度在所有方向上投影的最大值对梯度分类(classification is performed by selecting the maximum value among the responses in all directions),
C i = { G ( p ) if arg max i G i = i 0 otherwise (3) \mathbf{C}_{i} = \begin{cases} \mathbf{G}(p) & \text{if }\argmax_{i} \mathbf{G}_{i} = i \\ 0 & \text{otherwise} \end{cases} \tag {3} Ci=⎩⎨⎧G(p)0if iargmaxGi=iotherwise(3)
其中, p p p为像素索引; C i \mathbf{C}_{i} Ci为方向 i i i的幅度图(magnitude map),如Fig. (4),且满足 ∑ i = 1 8 C i = G \sum_{i = 1}^{8} \mathbf{C}_{i} = \mathbf{G} ∑i=18Ci=G。分类策略的鲁棒性高(very robust against different types of noise),对噪声不敏感(no matter whether the gradient of the current pixel is noise contaminated or not)。
■■
原文Eq. (3)为
C i = { G ( p ) if arg min i G i = i 0 otherwise \mathbf{C}_{i} = \begin{cases} \mathbf{G}(p) & \text{if }\argmin_{i} \mathbf{G}_{i} = i \\ 0 & \text{otherwise} \end{cases} Ci=⎩⎨⎧G(p)0if iargminGi=iotherwise
有误
■
线条生成(line shaping)
给定集合 C i \mathbf{C}_{i} Ci,在各像素点处,线条生成表示为:
S ′ = ∑ i = 1 8 L i ∗ C i \mathbf{S}^{\prime} = \sum_{i = 1}^{8} \mathscr{L}_{i} * \mathbf{C}_{i} S′=i=1∑8Li∗Ci
沿给定方向进行卷积平滑,能够连接原始梯度图中不相连的边缘像素(convolution aggregates nearby pixels along direction L i \mathscr{L}_{i} Li, which links edge pixels that are even not connected in the original gradient map)。 S ′ \mathbf{S}^{\prime} S′经逆向处理并归一化后得到输出线条图(pencil stroke map) S \mathbf{S} S(inverting pixel values and mapping them to [ 0 , 1 ] [0, 1] [0,1])。
讨论(discussion)
生成线条时,该方法考虑了边缘形状和邻域像素(edge shape and neighborhood pixel support),能够准确捕捉素描特征(sketch nature)。
-
卷积能够沿长线条在交叉点处的端点(the convolution step extends the ends of two lines at the junction point)。由于定向卷积只考虑直线上的像素(directional convolution only aggregates pixels along strictly straight lines),因此只有原始边缘图(the original edge map)中的长直线(long straight lines)才会被延长。
-
由于直线中心区域的像素受两侧像素的影响,因此线条中心区域的笔墨比两端更重(pixels at the center of a long line would receive pixel values from both sides, which make the line center darker than the ends)。
-
通过连接原始边缘图中不相连的像素,模仿人类画线过程,提高鲁棒性(link pixels that are not necessarily connected in the original edge map when nearby pixels are mostly aligned along the straight line, imitating human line drawing process and resisting noise)。
由于自然图像的纹理区域可能包含大量细节(natural images contain many textured surfaces with fine details),导致其梯度图中存在大量噪声(Fig. (7)),本文所提方法能够有效处理有噪梯度图。
3.2 色调(Tone Drawing)
影线(hatching),即稠密线条(dense strokes),用于表现阴影(shadow, shading)和较暗物体。本节给出一种纹理渲染(render pencil texture)方案。
色调图生成(tone map generation)
首先,根据原始灰度输入的信息,确定各像素色调值(determine the tone value for each pixel leveraging information in the original grayscale input)。
本文提出一种参数模型用于拟合素描的色调分布(a parametric model to fit tone distributions of pencil sketch)。自然图像的色调通常变化明显(highly variable tones),而素描色调直方图(a sketch tone histogram)服从特定定模式(certain patterns)。这是因为素描有两种基本色调:(1)高光区域(bright regions);(2)阴影区域(heavy strokes)。在两种基本色调之间是过渡区域,用于丰富画面层次感(mild tone strokes are produced to enrich the layer information)。
基于模型的色调转移(model-based tone transfer)
拟合色调分布(target tone distribution)参数模型(a parametric model):
p ( v ) = 1 Z ∑ i = 1 3 w i p i ( v ) (4) p(v) = \frac{1}{Z} \sum_{i = 1}^{3} w_{i} p_{i}(v) \tag {4} p(v)=Z1i=1∑3wipi(v)(4)
其中, v v