文献阅读 - Combining Sketch and Tone for Pencil Drawing Production
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)为:
其中,为灰度图(grayscale input);、表示梯度算子(gradient operators),可通过前向差分(forward difference)计算。实际图像(natural image)的梯度图(gradient map)通常是有噪的且不包含用于线条生成的连续边缘(continuous edges immediately ready for stroke generation)。
线条方向估计(the estimation of line direction for each pixel):
(1)选择间隔为的8个参考方向(eight reference directions at 45 degrees apart),记为线段(line segments)。某个方向的响应图(the response map for a certain direction)为:
其中,为第上方向的线段,并表示成卷积核形式(convolution kernel);线段长度取值(经验值(empirically))为输入图像长(宽)的;表示卷积算子(convolution operator),计算梯度在各方向上投影,构造滤波器响应图(groups gradient magnitudes along direction to form the filter response map )。
分类(classification):按梯度在所有方向上投影的最大值对梯度分类(classification is performed by selecting the maximum value among the responses in all directions),
其中,为像素索引;为方向的幅度图(magnitude map),如Fig. (4),且满足。分类策略的鲁棒性高(very robust against different types of noise),对噪声不敏感(no matter whether the gradient of the current pixel is noise contaminated or not)。
■■
原文Eq. (3)为
有误
■
线条生成(line shaping)
给定集合,在各像素点处,线条生成表示为:
沿给定方向进行卷积平滑,能够连接原始梯度图中不相连的边缘像素(convolution aggregates nearby pixels along direction , which links edge pixels that are even not connected in the original gradient map)。经逆向处理并归一化后得到输出线条图(pencil stroke map)(inverting pixel values and mapping them to )。
讨论(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):
其中,表示色调值(tone value);表示像素色调取值为时的概率;为归一化因子,;表示铅笔画的三个色调层(tonal layer);权值与各层像素数量相关(the weights coarsely corresponding to the number of pixels in each tonal layer)。此外,色调值需做归一化处理(scale the values into the range to cancel out illumination difference in computing the distributions)。
由Fig. (9)可知,高光层和阴影层均有峰值存在,而过渡层呈均匀分布(the bright and dark layers have obvious peaks while the mild tone layer does not correspond to a unique peak)。因此,本文用拉普拉斯分布(Laplacian distribution)■单边拉普拉斯分布、指数分布■对高光层建模,其峰值(with its peak at the brightest value)为255(归一化后为1)
其中,为分布的尺度(the scale of the distribution);用均匀分布(uniform distribution)对过渡层(mild tone layer)建模
其中,、分别为分布范围的上、下界;用高斯分布对阴影层建模
其中,为深色线条(dark strokes)均值,为尺度参数。
参数学习(parameter learning)
对输入灰度图轻微高斯平滑(slightly Gaussian smoothed)。设定各层的色调门限(the bright and dark tone layers are manually indicated with threshold of intensities and the remaining pixels are in the mild-tone layer),权值取决于各层中的像素数量(the number of pixels in each layer decides weights);使用最大似然估计(Maximum Likelihood Estimation,MLE)计算各层参数。各层的均值(mean)和标准差(standard deviation)分别记为、,则各层参数的解析解(closed-form)分别为:
其中,为像素值(pixel value);为该层所含像素个数。
■■
(1),,表示高光层所有像素的集合
令,则
(2),,表示过渡层所有像素的集合,对、进行区间估计
(3),,表示阴影层所有像素的集合
■
■、写反了■
根据参数模型、、,分别在三个子层上对输入图像直方图匹配,并将结果合并(based on the parametric , , and , for each new input image, we adjust the tone maps using simple histogram matching in all the three layers and superpose them again),如Fig. (11)。输出结果记为。
纹理渲染(pencil texture rendering)
色调纹理是指没有明显方向的线条图样,只表示色调信息(tonal texture refers to pencil patterns without obvious direction, which reveal only the tone information)。本文利用色调图(tone maps)学习手绘色调图样(tonal patterns),如图12所示。
人工手绘色调纹理是在同一位置反复绘制(in human drawing, tonal pencil texture is generated by repeatedly drawing at the same place),本文使用多层线条(multiplication of strokes)模拟这一过程,其输出表示为指数组合(exponential combination)(或),即为拟合的局部色调,将反复绘制次(drawing pattern times to approximate the local tone in ),如Fig. (12)。
此外,必需满足局部平滑(locally smooth),可通过最小化方程(8)求解:
其中,取。方程(8)可转化为标准线性方程(a standard linear equation),用共轭梯度法(conjugate gradient)求解。
■■
方程(8)中的乘法为按元素相乘(element-wise);结构风险项的作用是限制的梯度,使其局部平滑。
■
最终铅笔纹理图(final pencil texture map)为:
3.3 框架(Overall Framework)
将铅笔线条与色调纹理按像素相乘,计算最终输出:
3.4 彩铅(Color Pencil Drawing)
彩铅素描:将生成的灰度铅笔素描(the generated grayscale pencil sketch)作为彩色图像亮度通道(the brightness layer),即YUV色彩空间中的Y通道,然后将YUV空间映射到RGB空间。