Current Issue Cover
自适应的线条画绘制

王少荣1,2, 敖知琪1, 要曙丽1, 陈毅松2,3, 汪国平2,3(1.北京林业大学信息学院, 北京 100083;2.北京市虚拟仿真与可视化工程技术研究中心, 北京 100871;3.北京大学图形与交互技术实验室, 北京 100871)

摘 要
目的 基于参考图像的线条画生成是非真实感绘制最为常见的应用之一。尽可能模拟艺术家的创作风格生成疏密得当、具有层次感的线条画是这类工作的主要目标和挑战。本文提出一个自适应线画图绘制算法。方法 首先,将场景图像分割成若干个区域,分别计算每个区域亮度的方差以及每个像素到边界的最小距离,将每个区域的方差和面积的比值作为该区域的复杂度。然后,计算能反映其显著视觉特征的边缘切向流场。最后,使用基于流的各向异性高斯差分滤波生成线条画。在构造边缘切向流时,每个位置的切向量由其邻域的切向量加权而得到。文中增加了一个新的系数项,对于邻域的任意一个位置,如果它和参考位置在区域分类中属同一个类别。则该位置的权值更大。基于流的高斯差分自适应滤波过程中,高斯差分滤波的尺度参数和复杂度以及到区域边界距离有关。细节越丰富,离边界越近,尺度参数取值越小,这样得到的边缘比较细,同时可以防止将相邻小细线条连接成粗线条。然后,将高斯差分滤波结果沿着流线方向进行高斯滤波,对于细节丰富的区域,边缘比较多,尺度参数取值比较小,所连接边缘比较短,可以减少错误边缘可能。结果 对生物、树林、建筑、山河等具有代表性的图像,采用本文算法进行自动实时进行线条绘制,实验结果表明,采用本文算法所生成的线条随着区域场景的复杂程度呈现不同粗细和浓淡的变化,具有一定的层次感。因而本文算法能生成视觉特征鲜明、风格化效果突出的线条画,且能处理各种复杂场景的图像。结论 本文自适应参数的线条画生成算法,其算法参数调节以及算法效果优于固定参数的算法,本文算法在处理日常生活中各类主题场景的图像时均能取得良好效果。
关键词
Adaptive line drawing

Wang Shaorong1,2, Ao Zhiqi1, Yao Shuli1, Chen Yisong2,3, Wang Guoping2,3(1.School of Information Science and Technology, Beijing Forestry University, Beijing 100083, China;2.Beijing Research Center of Virtual Simulation and Visualization, Beijing 100871, China;3.Graphics and Interactive Technology Lab, Peking University, Beijing 100871, China)

Abstract
Objective Generating line drawings based on reference images is the most common application of non-photorealistic rendering, which is widely used in creative arts, scientific graphing, animation, video games, and print advertisement. During the creation of a line drawing, artists outline the contours of objects. The artists emphasize the main structure with long and thick lines and present the simple details with short and thin lines. Meanwhile, the artists barely use any ink for those unimportant regions on visual observation. A good line drawing successfully balances density and thickness features, thereby providing a sense of layering. Method A line-drawing-simulating algorithm initially analyzes the features and visual importance of an input image and subsequently detects the edges to generate a contour line and form a line drawing with a certain flavor. Given its simplicity, difference of Gaussians (DoG) may be calculated as a simple approximation of the Marr operator, which is widely used for edge detection. A flow-based anisotropic filtering framework is produced to improve the continuity of edges. The new filtering framework initially forms an edge tangent field and subsequently applies a flow-based difference of Gaussians (FDoG) on the intermediate results. Finally, the hyperbolic tangent function in the framework will soften the calculated result and link the detected edge points to form a line drawing. Different spatial parameters of DoG can only detect the edge of different scales in the image. DoG with small-scale parameter finds thin edges, but most probably takes noise as an edge. By contrast, DoG with large-scale parameter finds thick edges and is capable of ignoring some noise, but most probably takes neighboring edges as noise. Thus, selecting the appropriate parameters of DoG is important. For images with multiple edge scales, the FDoG method based on fixed parameters is not adapted to detect the edges, which leads to unsatisfactory line drawings. This study presents an adaptive non-photorealistic rendering technique for stylizing a photograph in the line drawing style. Generating the final line drawing has three main steps. 1) We segment the reference image into different regions. In each region, we calculate the intensity variance and minimum distance to the region boundary of all of its pixels. We define the ratio of the intensity variance to the region boundary as its complexity. 2) We use the preprocessed results to construct a smooth and direction-enhanced edge flow field to indicate the visual significance of the region. 3) We use the flow field to guide the line drawing process with anisotropy Gaussian filter, in which the parameters are adaptively determined. Finally, the hyperbolic tangent function in the framework will soften the calculated result and link the detected edge points to form a line drawing. Several improvements have been made on the three steps. During the procedure acquiring the edge flow field, the tangential vector of each pixel is the weighted mean of the tangential vector of its neighbor. The tangent vectors from the same category have a similar direction, whereas the tangent vectors from different categories may behave differently. We introduce a new weight item to balance the weight of these vectors. If the pixel of the neighbor and the reference pixel are located in the same segmented region, then the weight is strong. During the DoG filtering process, the scale parameter of each pixel is based on the regional complexity of the pixel and the precomputed minimum distance between the pixel and the region boundary. If a pixel is in a detailed area or near the region boundary, then a small-scale parameter is set and weak and thin lines are highlighted. By applying this strategy, we prevent the formation of thick curves from thin curves. During Gaussian filtering of the DoG flow, if a pixel is in a detailed area or near the region boundary, then the scale parameter is small and short and thin lines are observed in complex areas. Thus, we have an improved chance of decreasing the possibility of incorrectly highlighting long and thick lines. Result Experimental results show that the thickness and shade of the line produced by our approach change with the complexity of the image. Therefore, our approach can produce attractive and impressive line illustrations with a variety of photographs. Conclusion Compared with the fixed-parameter line drawing algorithm, our line drawing algorithm is more adaptive and has better results.
Keywords

订阅号|日报