WO2019113888A1 - 一种基于交互式的中国水墨画风格笔画生成方法以及装置 - Google Patents

一种基于交互式的中国水墨画风格笔画生成方法以及装置 Download PDF

Info

Publication number
WO2019113888A1
WO2019113888A1 PCT/CN2017/116182 CN2017116182W WO2019113888A1 WO 2019113888 A1 WO2019113888 A1 WO 2019113888A1 CN 2017116182 W CN2017116182 W CN 2017116182W WO 2019113888 A1 WO2019113888 A1 WO 2019113888A1
Authority
WO
WIPO (PCT)
Prior art keywords
sample
stroke
path
morphological
final
Prior art date
Application number
PCT/CN2017/116182
Other languages
English (en)
French (fr)
Inventor
杜吉祥
杨丽洁
徐添辰
Original Assignee
华侨大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华侨大学 filed Critical 华侨大学
Priority to PCT/CN2017/116182 priority Critical patent/WO2019113888A1/zh
Publication of WO2019113888A1 publication Critical patent/WO2019113888A1/zh
Priority to US16/898,463 priority patent/US11288499B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/32Digital ink
    • G06V30/333Preprocessing; Feature extraction
    • G06V30/347Sampling; Contour coding; Stroke extraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/32Digital ink
    • G06V30/36Matching; Classification
    • G06V30/387Matching; Classification using human interaction, e.g. selection of the best displayed recognition candidate

Definitions

  • the invention relates to a style migration technique for computer graphics non-photorealistic rendering, in particular to an interactive Chinese ink painting style stroke generation method and device.
  • Flower ink painting is one of the main categories in Chinese ink painting, and it represents an important artistic feature of oriental painting.
  • the typical pen and ink in floral paintings form the unique artistic charm and value of ink painting: its strokes are curved or straight, or rigid or soft, or wide or narrow, or pale or thick; its The ink color spreads through a mixture of water and ink to achieve a variety of changes in dryness, wetness, and lightness. Therefore, the diversity and complexity of strokes and inks, as well as the professional skills of painting, make the work of generating paintings challenging.
  • non-photorealistic rendering refers to the production of artistic strokes by constructing different brush models, depicting specific objects like hand-drawn.
  • non-photorealistic drawing that are worth learning and learning.
  • a pen-like device simulates the physical process of painting by modeling the physical properties of a pen or other medium.
  • Chu and Tai in the literature [Chu NSH, Tai C.-L., "MoXi: Real-Time Ink Dispersion in Absorbent Paper", ACM Transactions on Graphics, vol. 24 (3), pp. 504-511, 2005 Design a real-time painting system to simulate ink diffusion on absorbent paper Effect.
  • Xu et al. [Xu S., Tang M., LAU F., et al., "Virtual Hairy Brush for Painterly Rendering", Graphical Models, vol.
  • a novel "electronic brush” for Chinese calligraphy and painting is proposed, which defines the basic characteristics of a real brush with only four attributes.
  • Lu et al. [Lu J., Barnes C., DiVerdi S., et al., "RealBrush: Painting with Examples of Physical Media", ACM Transactions on Graphics, vol. 32(4), pp. 117, 2013]
  • An interactive data-driven painting system is proposed, which can synthesize new strokes using scanned images of real media, avoiding the computation of complex physical simulations.
  • digital painting software such as Adobe brush packages, ArtRage, and Corel Painter, users use a real mouse to draw a mouse or digital pen.
  • image-based models Compared to physical models, such models avoid large-scale computations and complex manipulations.
  • Herzmann et al. Hertzmann A., Jacobs CE, Oliver N., et al., "Image analogies", In: Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, New York, USA , pp. 327-340, 2001] uses the "image analogy" technique to process photo images to produce artistically effective images, but in their experimental results, for Chinese painting, different images are drawn in different styles.
  • Texture mapping and texture synthesis techniques transform images into images with Chinese ink styles.
  • the existing models that simulate the oriental painting style mainly deal with the entire image, rather than the strokes that make up the image, which makes it difficult to express the rich and varied artistic characteristics of Chinese painting.
  • the present invention provides an interaction based
  • the Chinese ink painting style stroke generation method and device can provide a series of algorithms to transform the guide lines drawn by the user on the photo into strokes with a certain Chinese ink painting style, and realize the effect of the Chinese ink style migration to the photo image.
  • the present invention provides an interactive Chinese ink painting style stroke generating method, comprising the following steps:
  • an accurate stroke sample is obtained as a candidate stroke sample; and the candidate stroke sample is used as a reference to generate a morphological sample group;
  • the step of obtaining an accurate stroke sample as a candidate stroke sample by correcting a stroke contour in the stroke sample comprises:
  • each of the morphological sample groups includes at least four morphological samples, and the four morphological samples include the candidate as a reference a stroke sample, a mirror stroke sample of the candidate stroke sample, an inverse path stroke of the candidate stroke sample, and an inverse path stroke of the candidate stroke sample mirror stroke.
  • the step of correcting the preliminary basic path to obtain an accurate basic path includes:
  • the preliminary basic path is smoothed by a non-uniform rational B-spline curve algorithm to obtain the accurate basic path.
  • the selecting, in the group of the morphological samples, the morphological sample that best matches the accurate basic path is used as the final stroke sample, including:
  • a morphological sample that best matches the path portion is selected as the final stroke sample of the path portion in the morphological sample group.
  • the step of selecting, by using an energy formula, a morphological sample that best matches the path portion in the morphological sample group as a final stroke sample of the path portion includes:
  • the energy formula is The space defines an energy term for describing an overall difference between the displacement term of the stroke profile in the final stroke sample and the displacement term of the corresponding path portion, and minimizing the overall difference, thereby automatically selecting the final Stroke sample
  • the displacement item is used to describe a displacement amount between a stroke contour in the final stroke sample and a relative position vector and a stroke direction vector of an arbitrary point on the accurate basic path.
  • mapping of the style features of the final stroke sample to the accuracy includes:
  • the step of mapping the style feature of the final stroke sample onto the accurate basic path further includes:
  • the rasterized fill region is implemented with scan lines and filled into the path portion corresponding to the final stroke with pixels selected from within the final stroke.
  • the pixels are constrained by the following conditions:
  • p S is closest to the average color value of pixels around p P ;
  • p S is the best pixel selected in the ink stroke area
  • p F is any pixel in the fill area
  • p P is the pixel in the input image
  • E b (p S ) corresponding to the constraint a, describing the sum of the difference in color values of the neighboring pixels between p S and p F ;
  • E p (p S ) corresponds to constraint b, describing the degree of proximity between p S and p F and the corresponding skeleton path, respectively;
  • ⁇ (p) represents the color value of p
  • Is a neighborhood pixel of p S and Is a neighborhood pixel of p F
  • the closest point to the p F on the skeleton path, the same Value, Is a corresponding point on the skeleton path in the final stroke sample, r S and r P are respectively half of the width of the final stroke sample
  • N represents the total number of pixels in the circle of the specified radius R
  • the pixel-based texture mapping algorithm is utilized in An energy equation consisting of three energy terms is defined in the space and three of the energy terms are minimized to obtain the optimal pixel. This step satisfies the following formula:
  • ⁇ 1 , ⁇ 2 and ⁇ 3 represent equilibrium weight parameters.
  • the first aspect of the present invention has the beneficial effects that
  • the invention corrects the blank area in the circled operation by correcting the stroke sample, and obtains the stroke The exact contour in the sample.
  • the invention corrects the initial basic path, removes the unevenness of the initial basic path edge contour, and smoothes it.
  • the invention generates a mirror image, an inverse path and a mirrored inverse path based on the candidate sample group, and classifies the above four cases into a morphological sample group; in the process of optimally matching with the accurate basic path, the candidate sample is expanded.
  • the internal shape adapts to the line form of different accurate basic paths, and it is convenient for the path part to find the best matching candidate sample form.
  • the invention adopts the method of style feature mapping, maps the width feature and the color feature of the final stroke to the accurate basic path, and realizes the effect of replacing the accurate basic path of the final stroke sample.
  • the present invention provides an apparatus for generating an ink painting style stroke based on an interactive Chinese ink painting, comprising:
  • An image selection unit for selecting an image containing a pattern as an image object
  • a stroke sample selection unit for delineating at least one stroke sample on the pre-stored ink painting sample
  • a preliminary basic path selecting unit configured to draw a basic outline of the pattern on the image object, and constitute a preliminary basic path of the stroke to be generated
  • a stroke sample correcting unit configured to correct a stroke outline in the circled stroke sample, and obtain an accurate stroke sample as a candidate stroke sample
  • a morphological sample group generating unit configured to generate a morphological sample group by using the candidate stroke sample as a reference
  • a preliminary basic path correction unit for correcting the preliminary basic path to obtain an accurate basic path
  • a final stroke sample selection unit wherein a morphological sample that most closely matches the accurate basic path is selected as the final stroke sample in the morphological sample group
  • a style feature mapping unit is configured to map the style features of the final stroke sample onto the accurate basic path to generate an output image having a Chinese ink painting style.
  • Figure 3 is a schematic overall view of the apparatus of the present invention.
  • FIG. 1 is a first embodiment of the present invention, including the following steps:
  • the image content contained in the image object may be an animal, a plant, or the like, and may specifically be a cow, a horse, a flower, or a vegetation; the subject matter of the pre-stored ink painting sample may also be an animal, a plant, etc., and the subject matter of the ink painting sample needs to be
  • the patterns in the image objects are consistent.
  • the theme of ink painting is flower, and the theme of the pattern needs to be consistent; in other words, the image object is selected as the template of the basic path that the user wants to outline, and the stroke sample is what the user wants.
  • the stroke style characteristics of the basic path are consistent.
  • S20 Acquire a basic outline drawn by a user on the image object, where the basic outline constitutes a preliminary basic path of a stroke to be generated;
  • the sketch mentioned here may not achieve the effect of being completely consistent with the basic outline of the pattern, and may be a rough outline, and may also include the user's creativity in it, for example, adding a line that does not exist in the pattern template to the preliminary basic path.
  • the non-stroke area referred to here is the part that does not include the stroke line
  • the effect is that the information contained in the sample area of the stroke is not accurate.
  • the interference factor is not conducive to the extraction of the specific stroke outline in the stroke sample.
  • such interference factor is unavoidable, so the extraction of the stroke sample outline in the stroke sample cannot be Avoided.
  • a contour search algorithm is used to determine a contour of the stroke sample that is closest to the edge of the stroke, and the candidate stroke sample is obtained;
  • each of the morphological sample groups includes at least four morphological samples, and the four The morphological sample includes the candidate stroke sample as a reference, a mirror stroke sample of the candidate stroke sample, an inverse path stroke of the candidate stroke sample, and an inverse path stroke of the candidate stroke sample mirror stroke.
  • formula (1) is satisfied, and formula (1) is defined as:
  • n is the number of samples of a number of strokes, consisting of 4 cases of each stroke and a candidate set containing 4n elements: Then the four cases of strokes are
  • the initial basic path is outlined by the user. This rough outline will make the part of the path uneven and rough.
  • the edges of the stroke are all displayed in a relatively smooth posture.
  • the non-uniform rational B-spline curve algorithm is used to smooth the preliminary basic path to obtain a smooth and accurate basic path.
  • the preliminary basic path in the image object is represented by a three-curve structure (C P , L P , R P ), and the tri-curve structure (C P , L P , R P ) is smoothed by a non-uniform rational B-spline curve algorithm.
  • S50 selecting, in the morphological sample group, a morphological sample that most closely matches the accurate basic path as a final stroke sample;
  • the basic path is divided into a plurality of path portions, and a morphological sample that best matches the path portion is selected as the final stroke sample of the path portion by the energy formula.
  • the morphology of the candidate stroke samples is relatively simple, which makes it difficult to match the exact basic path.
  • the multiple candidate stroke patterns generated by the morphological sample group increase the matching probability of the path portion and the candidate strokes.
  • the energy formula is Spatial definition description
  • An overall difference in displacement term ⁇ from C P wherein the displacement term is used to describe a relationship between a stroke contour in the final stroke sample and a relative position vector and a stroke direction vector at any point on the accurate fundamental path The amount of displacement. This overall difference is then minimized to automatically select the optimal stroke template. Satisfy formula (2) and define formula (2) as:
  • the morphological sample corresponding to each path part is obtained by the energy formula, and then the morphological sample corresponding to each path part is substituted for the original path part, and the contour corresponding to the stroke sample feature selected by the user is generated; then the final adjustment is performed.
  • the aspect ratio of the stroke sample is such that the final stroke sample is consistent with the length to width ratio of the corresponding path portion; and the pixel-based texture mapping algorithm is used to implement the rasterization fill region with the scan line and use the final stroke The internally selected pixels are filled into the path portion corresponding to the final stroke.
  • the final stroke width w P (t) and the photo object The length of the exact base path C P is related to the curvature.
  • the w P (t) is calculated by the formula (4), and the formula (4) is defined as:
  • k w (t) is a coefficient that scales the width of the final stroke sample
  • L P and ⁇ P (t) represent the length and curvature of the exact base path, respectively.
  • the coefficient term k w (t) is calculated by the formula (5), and the formula (5) is defined as:
  • ⁇ S (t) represents the curvature of the fundamental path C S (t) and L S represents the length of C S (t).
  • the pixel is constrained by the following conditions:
  • p S is closest to the average color value of pixels around p P ;
  • p S is the best pixel selected in the ink stroke area
  • p F is any pixel in the filling area
  • p P is the pixel in the input image
  • E b (p S ) corresponds to the constraint a, describing the sum of the difference in color values of the neighboring pixels between p S and p F ;
  • E p (p S ) corresponds to constraint b, describing the degree of proximity between p S and p F and the corresponding skeleton path, respectively;
  • ⁇ (p) represents the color value of p
  • Is a neighborhood pixel of p S and Is a neighborhood pixel of p F
  • the closest point to the p F on the skeleton path, the same Value, Is a corresponding point on the skeleton path in the final stroke sample, r S and r P are respectively half of the width of the final stroke sample
  • N represents the total number of pixels in the circle of the specified radius R
  • the pixel-based texture mapping algorithm is utilized in An energy equation consisting of three energy terms is defined in the space and the three energy terms are minimized to obtain the optimal pixel. This step satisfies the following formula:
  • ⁇ 1 , ⁇ 2 and ⁇ 3 represent equilibrium weight parameters.
  • the decorative element is selected according to the user intention to implant the painting result, that is, the final drawing result is generated.
  • the painting element referred to here can be a literati inscription.
  • FIG. 3 is a second embodiment of the present invention, including:
  • An image selection unit for selecting an image containing a pattern as an image object
  • a stroke sample selection unit for delineating at least one stroke sample on the pre-stored ink painting sample
  • a preliminary basic path selecting unit configured to draw a basic outline of the pattern on the image object, and constitute a preliminary basic path of the stroke to be generated
  • a stroke sample correcting unit configured to correct the contour of the circled stroke sample, and obtain an accurate stroke sample as a candidate stroke sample
  • a morphological sample group generating unit configured to generate a morphological sample group by using the candidate stroke sample as a reference
  • a preliminary basic path correction unit for correcting the preliminary basic path to obtain an accurate basic path
  • a final stroke sample selection unit wherein a morphological sample that most closely matches the accurate basic path is selected as the final stroke sample in the morphological sample group
  • a style feature mapping unit is configured to map the style features of the final stroke sample onto the accurate basic path to generate an output image having a Chinese ink painting style.
  • a third embodiment of the present invention provides a cloud-based secure access device comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor executing the a computer program, such as the interactive Chinese ink painting style stroke generation program;
  • the computer program can be partitioned into one or more modules, one or more of which are stored in the memory and executed by the processor to perform the present embodiment.
  • the one or more of the modules may be a series of computer program instructions capable of performing a particular function for describing the execution of the computer program in an interactive Chinese ink painting style stroke generating terminal device.
  • the interactive Chinese ink painting style stroke generating device may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the interactive Chinese ink painting style stroke generating device may include, but is not limited to, processing , memory, display. It will be understood by those skilled in the art that the schematic diagram is merely an example of an interactive Chinese ink painting style stroke generating apparatus, and does not constitute a limitation on an interactive Chinese ink painting style stroke generating apparatus, and may include more than the illustration or Fewer components, or a combination of certain components, or different components, such as an interactive Chinese ink painting style stroke generating device, may also include input and output devices, network access devices, buses, and the like.
  • the so-called processor can be a central processing unit (CPU), or other general-purpose processor, digital signal processor (DSP), application specific integrated circuit (ASIC), ready-made Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is a control center of the interactive Chinese ink painting style stroke generating device, which is connected by various interfaces and lines. The entire part of the interactive Chinese-based ink painting style stroke generation device.
  • the memory can be used to store the computer program and/or module, the processor implementing the basis by running or executing a computer program and/or module stored in the memory, and invoking data stored in the memory
  • Interactive Chinese ink painting style strokes generate various functions of the device.
  • the memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, a text conversion function, etc.), and the like; the storage data area may be stored. Data created based on the use of the mobile phone (such as audio data, text message data, etc.).
  • the memory may include a high-speed random access memory, and may also include non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a Secure Digital (SD) card.
  • non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a Secure Digital (SD) card.
  • Flash Card at least one disk storage device, flash memory device, or other volatile solid-state storage device.
  • the module integrated by the interactive Chinese ink painting style stroke generating device can be stored in a computer readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product.
  • the present invention implements all or part of the processes in the foregoing embodiments, and may also be completed by a computer program for instructing related hardware.
  • the computer program may be stored in a computer readable storage medium. The steps of the various method embodiments described above may be implemented when the program is executed by the processor.
  • the computer program comprises computer program code, the meter
  • the computer program code can be in the form of source code, object code form, executable file or some intermediate form.
  • the computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM). , random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical. Units can be located in one place or distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • the connection relationship between the modules indicates that there is a communication connection between them, and specifically, one or more communication buses or signal lines can be realized.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Processing Or Creating Images (AREA)
  • Image Generation (AREA)

Abstract

本发明公开一种基于交互式的中国水墨画风格笔画生成方法,包括以下步骤,获取一张包含图案的图像作为图像对象;在预存的水墨画绘画样本上获取一个圈定操作,所述圈定操作至少包括一个笔画样本;获取用户在所述图像对象上勾画的基本轮廓,所述基本轮廓构成待生成笔画的初步基本路径;通过对所述笔画样本中的笔画轮廓进行纠正,得到准确的笔画样本作为候选笔画样本;以所述候选笔画样本为参照,生成形态样本组;纠正所述初步基本路径,得到准确基本路径;在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本;将所述最终笔画样本的风格特征映射到所述准确基本路径上,生成具有中国水墨画风格的输出图像。

Description

一种基于交互式的中国水墨画风格笔画生成方法以及装置 技术领域
本发明涉及计算机图形学非真实感绘制的风格迁移技术,尤其涉及一种基于交互式的中国水墨画风格笔画生成方法以及装置。
背景技术
中国写意水墨画与其它绘画种类(如西方油画、水彩画)不同,用寥寥几笔描述具体的景物对象或场景,表达画家的创作意图及艺术个性。写意水墨画以它独特的艺术性吸引越来越多的人们学习创作水墨画,包括没有绘画技术基础的绘画爱好者。而且,目前大多数的图形类商业软件(如Adobe Illustrator,Adobe Photoshop,CorelDRAW等)均支持中国艺术风格的生成工具。然而,生成高质量的绘画作品通常需要专业的知识与技能,且现有的绘画工具在绘制技巧方面要求复杂和准确的输入,同时,利用风格迁移生成绘画的工具(如图1(b))仅将某种绘画风格整体迁移至给定的对象,极少地考虑局部的笔画形态与颜色。
花卉水墨画是中国水墨画中的主要类别之一,它代表着东方绘画的重要艺术特征。换句话说,花卉画中典型的用笔、用墨手法形成了水墨画独特的艺术魅力与价值:它的笔画或曲或直,或刚劲或柔软,或宽或窄,或苍白或浑厚;它的墨色通过水与墨之间的混合扩散达到干湿浓淡的多种变化。因此,笔画与墨色的多样性和复杂性,以及绘画的专业技巧使生成绘画的工作富有挑战性。
一般来说,非真实感绘制是指通过构建不同的笔刷模型,输出具有艺术风格的笔画,像手绘一样描绘特定的物体。近年来,已有一些与非真实感绘制相关的优秀工作值得学习和借鉴。主要有以下两个方面的工作:
一方面是基于物理的模型:为了给用户提供直观自然的感受,像笔一样的设备通过对笔或其它媒介的物理属性进行建模,模拟绘画的物理过程。其中,Chu和Tai在文献[Chu N.S.H.,Tai C.-L.,“MoXi:Real-Time Ink Dispersion in Absorbent Paper”,ACM Transactions on Graphics,vol.24(3),pp.504-511,2005]中设计一个实时绘画系统来模拟在具有吸收力的纸上墨扩散 的效果。同时,Xu等在文献[Xu S.,Tang M.,LAU F.,et al.,“Virtual Hairy Brush for Painterly Rendering”,Graphical Models,vol.66(5),pp.263-302,2004]中提出一种新颖的用于中国书法和绘画的“电子笔刷”,仅用四种属性定义了真实笔刷的基本特征。Lu等在文献[Lu J.,Barnes C.,DiVerdi S.,et al.,“RealBrush:Painting with Examples of Physical Media”,ACM Transactions on Graphics,vol.32(4),pp.117,2013]中提出一个交互式的数据驱动的绘画系统,它可以利用真实媒体的扫描图像合成新的笔画,避免了复杂的物理模拟的计算。对于数字化绘画软件,如Adobe brush packages,ArtRage,and Corel Painter,用户就像使用真实的笔刷一样,操作鼠标或数码笔进行绘画。然而,对于没有相关绘画经验的用户来说,如果不对他们进行此类虚拟设备的操作培训,则轻松而准确地操作此类设备是复杂而困难的。另一方面是基于图像的模型:与物理模型相比,此类模型避免了大规模的计算量和复杂的操控。在模拟西方绘画方面,Herzmann等在文献[Hertzmann A.,Jacobs C.E.,Oliver N.,et al.,“Image analogies”,In:Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques,New York,USA,pp.327-340,2001]中使用“图像类比”技术处理照片图像,生成具有艺术效果的图像,但在他们的实验结果里,对于中国绘画而言,由于采用不同的风格绘制不同的图像区域,算法无法区分这些区域,所以得到不理想的风格化结果。在模拟东方绘画方面,Xie等在文献[Xie N.,Laga H.,Saito S.,“IR2s:interactive real photo to Sumi-e”,In:Proceedings of the 8th International Symposium on Non-Photorealistic Animation and Rendering,Annecy,France,pp.63-71,2010]中设计了一个基于草绘的交互式系统,将真实的照片转换为日本的墨画绘画。Dong等在文献[Dong L.,Lu S.and Jin X.,“Real-time Image-based Chinese Ink Painting Rendering”,Multimedia Tools&Applications,vol.69(3),pp.605-620,2014]中通过纹理映射和纹理合成技术将图像转换为具有中国水墨风格的图像。然而,已有的模拟东方绘画风格的模型主要处理整个图像,而不是构成图像的笔画,这样很难表现出中国绘画丰富多变的艺术特性。
发明内容
针对上述的技术问题,克服现有技术存在的不足,本发明提供一种基于交互 式的中国水墨画风格笔画生成方法以及装置;能够提供一系列算法将照片上的用户粗略画出的指导线条转化为具有某种中国水墨画风格的笔画,实现中国水墨风格的迁移至照片图像的效果。
第一方面,本发明提供了一种基于交互式的中国水墨画风格笔画生成方法,包括以下步骤:
获取一张包含图案的图像作为图像对象;
在预存的水墨画绘画样本上获取一个圈定操作,所述圈定操作包括至少一个笔画样本;
获取用户在所述图像对象上勾画的基本轮廓,所述基本轮廓构成待生成笔画的初步基本路径;
通过对所述笔画样本中的笔画轮廓进行纠正,得到准确的笔画样本作为候选笔画样本;以所述候选笔画样本为参照,生成形态样本组;
纠正所述初步基本路径,得到准确基本路径;
在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本;
将所述最终笔画样本的风格特征映射到所述准确基本路径上,生成具有中国水墨画风格的输出图像。
在第一方面的第一种可能的实施方式中,所述通过对所述笔画样本中的笔画轮廓进行纠正,得到准确的笔画样本作为候选笔画样本的步骤包括:
采用相向搜索算法确定所述笔画样本中最贴近笔画边缘的轮廓,得到所述候选笔画样本;
以所述候选笔画样本作为参照,通过镜像与反路径的方式生成形态样本组;其中,每一所述形态样本组至少包括四个形态样本,四个所述形态样本包括作为参照的所述候选笔画样本、该候选笔画样本的镜像笔画样本、所述候选笔画样本的反路径笔画以及所述候选笔画样本镜像笔画的反路径笔画。
在第一方面的第二种可能的实施方式中,所述纠正所述初步基本路径,得到准确基本路径的步骤包括:
采用非均匀有理B样条曲线算法平滑所述初步基本路径,得到所述准确基本路径。
在第一方面的第三种可能的实施方式中,所述在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本,包括:
将所述基本路径划分成若干路径部分,
通过能量公式,在所述形态样本组中选取与所述路径部分最匹配的形态样本作为该路径部分的最终笔画样本。
在第一方面的第四种可能的实施方式中,所述通过能量公式,在所述形态样本组中选取与所述路径部分最匹配的形态样本作为该路径部分的最终笔画样本的步骤包括:
所述能量公式在
Figure PCTCN2017116182-appb-000001
空间定义一能量项,用于描述所述最终笔画样本中的笔画轮廓的位移项以及与其对应的路径部分的位移项的总体差异,并使所述总体差异最小化,从而自动选择所述最终的笔画样本;
其中,所述位移项用于描述所述最终笔画样本中的笔画轮廓与所述准确基本路径上任意一点的相对位置向量与笔画方向向量之间的位移量。
在第一方面第五种可能的实施方式中,其在第一方面第四种可能的实施方式的基础上进一步改进,具体地,所述将所述最终笔画样本的风格特征映射到所述准确基本路径上的步骤包括:
调整所述最终笔画样本的长宽比例,使得所述最终笔画样本与对应的所述路径部分的长宽比例相一致。
作为第五种可能的实施方式的进一步改进,所述将所述最终笔画样本的风格特征映射到所述准确基本路径上的步骤还包括:
通过基于像素的纹理映射算法,用扫描线实现光栅化填充区域并用从所述最终笔画内选择出的像素填充至与所述最终笔画对应的路径部分中。
作为第五种可能的实施方式的进一步改进,所述像素由以下列条件约束:
a、pS的相邻像素具有距离pF的邻域最近的颜色值;
b、pS与pF相对其各自骨骼路径的位置是最近的;
c、pS与pP周围的像素的平均颜色值最接近;
其中,pS是在水墨笔画区域内选出的最佳像素;pF为填充区域内的任一 像素;pP为输入图像中的像素;且由3个能量项衡量以上约束条件,Eb(pS)对应约束条件a,描述pS与pF之间邻域像素的颜色值差异的总和;
Ep(pS)对应约束条件b,描述pS与pF分别与对应的骨架路径之间的接近程度;
Ea(pS)对应约束条件c,描述pS与pP分别以某个R为半径的圆内像素的平均颜色值的差异;
具体地满足以下公式:
Figure PCTCN2017116182-appb-000002
其中,λ(p)表示p的颜色值,
Figure PCTCN2017116182-appb-000003
是pS的邻域像素,且
Figure PCTCN2017116182-appb-000004
是pF的邻域像素,
Figure PCTCN2017116182-appb-000005
骨架路径上距离pF最近的点,相同的
Figure PCTCN2017116182-appb-000006
值下,
Figure PCTCN2017116182-appb-000007
是所述最终笔画样本中的骨架路径上的对应一点,rS和rP分别是所述最终笔画样本宽度的一半,N表示在指定半径R的圆内所有像素总数,
Figure PCTCN2017116182-appb-000008
表示圆内在pS附近的像素,且
Figure PCTCN2017116182-appb-000009
表示在照片图像内,在指定圆内pP附近的像素。
作为进一步改进,所述基于像素的纹理映射算法,利用在
Figure PCTCN2017116182-appb-000010
空间内定义由3个能量项所构成的能量方程并将三个所述能量项最小化得到最佳像素,此步骤满足以下公式:
Figure PCTCN2017116182-appb-000011
其中,α1,α2和α3表示平衡权重参数。
与现有技术相比,本发明第一方面的有益效果为,
本发明通过对笔画样本进行纠正,消除了圈定操作内的空白区域,得到笔画 样本中准确的轮廓。
本发明通过对初步基本路径进行纠正,去除了初步基本路径边缘轮廓的凹凸不平处,对其进行平滑处理。
本发明以候选样本组作为基础,生成其镜像、反路径以及镜像反路径,并将以上四种情况归类为形态样本组;在与准确基本路径进行最优匹配的过程中,扩展了候选样本内的形态,适应了不同准确基本路径的线条形式,便于路径部分找到最匹配的候选样本形态。
本发明采用风格特征映射的方法,将最终笔画的宽度特征、颜色特征映射至准确基本路径上,实现最终笔画样本替换准确基本路径的效果。
第二方面,本发明提供一种基于交互式的中国水墨画风格笔画生成的装置,包括:
图像选取单元,用于选取一张包含图案的图像作为图像对象;
笔画样本选取单元,用于在预存的水墨画绘画样本上圈定至少一个笔画样本;
初步基本路径选取单元,用于在所述图像对象上勾画该图案的基本轮廓,构成待生成笔画的初步基本路径;
笔画样本纠正单元,用于对圈定出的所述笔画样本中的笔画轮廓进行纠正,得到准确的笔画样本作为候选笔画样本;
形态样本组生成单元,用于以所述候选笔画样本为参照,生成形态样本组;
初步基本路径纠正单元,用于纠正所述初步基本路径,得到准确基本路径;
最终笔画样本选取单元,在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本;
风格特征映射单元,用于将所述最终笔画样本的风格特征映射到所述准确基本路径上,生成具有中国水墨画风格的输出图像。
附图说明
为了更清楚地说明本发明的技术方案,下面将对实施方式中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明生成的水墨图像与现有的绘画工具生成的水墨图像对比图,其中(b)为现有的绘画工具生成的水墨图像,(C)为本发明生成的水墨图像。
图2为本发明方法的整体流程图。
图3为本发明装置的整体示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明提供多种实施例,具体的,请参阅图1,图1为本发明的第一种实施例,包括以下步骤:
S10,获取一张包含图案的图像作为图像对象;
在预存的水墨画绘画样本上获取一个圈定操作,所述圈定操作包括至少一个笔画样本;
图像对象所包含的图像内容,其图案可以是动物、植物等,具体的可以是牛、马、花卉、草木;预存的水墨画样本的题材也可以是动物、植物等,水墨画样本的题材并需要与图像对象中的图案相一致,例如水墨画的题材是花卉,图案的题材也需保持一致;换言之,图像对象所选定的是用户所想勾勒的基本路径的模板,而笔画样本是用户所想要的基本路径的笔画风格特征。
S20,获取用户在所述图像对象上勾画的基本轮廓,所述基本轮廓构成待生成笔画的初步基本路径;
这里所提及的勾画可以不达到与图案基本轮廓完全一致的效果,可以是一种粗略的勾勒,同时也可以包含用户的创意在其中,例如加入图案模板中不存在的线条至初步基本路径。
S30,通过对圈定出的所述笔画样本的轮廓进行纠正,得到准确的笔画样本作为候选笔画样本;以所述候选笔画样本为参照,生成形态样本组。
在圈定笔画样本的过程中,因为仅是圈定了想要的笔画在笔画样本中的区域,这其中会出现非笔画区域(这里所指的非笔画区域为不包括笔画线条的部分),这样的影响是笔画样本区域包含的信息并不是准确的笔画轮廓信息也包括 了干扰因素,不利于对笔画样本内具体笔画轮廓的提取,同时为保证用户在选取笔画样本时的效率以及体验,这种干扰因素是无法避免的,故笔画样本中笔画样本轮廓的提取是无法避免的。在本实施例中,采用相向搜索算法确定所述笔画样本中最贴近笔画边缘的轮廓,得到所述候选笔画样本;
在相向搜索算法中,笔画样本中的笔画轮廓由一个三曲线结构(CS,LS,RS)表示,其中CS(t)∈IS由CS(t)=(LS(t)+RS(t))/2得到,且它的域FS在LS和RS之间被作为候选笔画样本的大致轮廓,LS以及RS是该大致轮廓的两侧边;随后将侧边LS和RS拟合为曲线LS(t)和RS(t),并分割其为相同数量的曲线片段;假定每个曲线片段上的端点作为LS(t)和RS(t)上的特征点,将从LS(t)指向RS(t)的线条方向定义为搜索的正方向ω(t),分别沿ω(t)和-ω(t)方向,计算每个像素灰度值的方向导数D和D,最后将每对特征点重置到该方向导数全局最小值的位置上;调整侧边LS以及侧边RS成最贴近笔画样本内的笔画的轮廓。
并且以所述候选笔画样本为参照,通过镜像与反路径的方式生成形态样本组,模拟候选笔画样本不同的姿态;其中,每一所述形态样本组至少包括四个形态样本,四个所述形态样本包括作为参照的所述候选笔画样本、所述候选笔画样本的镜像笔画样本、所述候选笔画样本的反路径笔画以及所述候选笔画样本镜像笔画的反路径笔画。
根据三曲线结构,满足公式(1),定义公式(1)为:
Figure PCTCN2017116182-appb-000012
其中,n为若干笔画样本个数,由每个笔画的4种情况组成一个包含4n个元素的候选集合:
Figure PCTCN2017116182-appb-000013
则笔画的4种情况依次为
Figure PCTCN2017116182-appb-000014
S40,纠正所述初步基本路径,得到准确基本路径;
初步的基本路径是由用户勾勒的,这种粗略的勾勒会使得路径中部分的凹凸不平、粗糙,在水墨画风格的绘画作品中,其笔画的边缘都是以相对平滑的姿态所展现,为了更准确的还原水墨画风格的绘画作品线条,本实施例中采用非均匀有理B样条曲线算法平滑所述初步基本路径,得到平滑的准确基本路径。
图像对象中的初步基本路径由一个三曲线结构(CP,LP,RP)表示,采用非均匀有理B样条曲线算法平滑三曲线结构(CP,LP,RP)。
S50,在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本;
将所述基本路径划分成若干路径部分,通过能量公式,在所述形态样本组中选取与所述路径部分最匹配的形态样本作为该路径部分的最终笔画样本。候选笔画样本的形态比较单一,导致难以与准确基本路径进行匹配,形态样本组生成的多种候选笔画形态增加了路径部分与候选笔画的匹配几率。
结合能量公式进行说明,能量公式在
Figure PCTCN2017116182-appb-000015
空间定义
Figure PCTCN2017116182-appb-000016
描述
Figure PCTCN2017116182-appb-000017
与CP之间位移项δ的总体差异,其中,所述位移项用于描述所述最终笔画样本中的笔画轮廓与所述准确基本路径上任意一点的相对位置向量与笔画方向向量之间的位移量。然后使该总体差异最小化,从而自动选择最优的笔画模版。满足公式(2),定义公式(2)为:
Figure PCTCN2017116182-appb-000018
其中,位移项δ由公式(3)计算得到,定义公式(3)为:
Figure PCTCN2017116182-appb-000019
其中,
Figure PCTCN2017116182-appb-000020
为任一基本路径,
Figure PCTCN2017116182-appb-000021
Figure PCTCN2017116182-appb-000022
Figure PCTCN2017116182-appb-000023
的线条方向,
Figure PCTCN2017116182-appb-000024
Figure PCTCN2017116182-appb-000025
上任 意一点
Figure PCTCN2017116182-appb-000026
的相对位置向量
Figure PCTCN2017116182-appb-000027
Figure PCTCN2017116182-appb-000028
的映射,
Figure PCTCN2017116182-appb-000029
为距离最近点的位移量。
S60,将所述最终笔画样本的风格特征映射到所述准确基本路径上,生成具有中国水墨画风格的输出图像。
在上述部分中通过能量公式得到了每一路径部分对应的形态样本,随后将每一路径部分对应的形态样本取代原路径部分,生成符合用户所选择的笔画样本特征的轮廓;随后调整所述最终笔画样本的长宽比例,使得所述最终笔画样本与对应的所述路径部分的长宽比例相一致;并通过基于像素的纹理映射算法,用扫描线实现光栅化填充区域并用从所述最终笔画内选择出的像素填充至与所述最终笔画对应的路径部分中。
在调整所述最终笔画样本的长宽比例,使得所述最终笔画样本与对应的所述路径部分的长宽比例相一致的过程中,最终笔画宽度wP(t)与所述照片对象上的准确基本路径CP的长度和曲率相关。所述wP(t)由公式(4)计算得到,定义公式(4)为:
Figure PCTCN2017116182-appb-000030
其中,kw(t)是按比例缩放最终笔画样本宽度的系数,LP和κP(t)分别表示准确基本路径的长度和曲率。系数项kw(t)由公式(5)计算得到,定义公式(5)为:
Figure PCTCN2017116182-appb-000031
其中,κS(t)表准确基本路径CS(t)的曲率,LS表示CS(t)的长度。
在通过基于像素的纹理映射算法用扫描线实现光栅化填充区域并用从所述最终笔画内选择出的像素填充至与所述最终笔画对应的路径部分过程中,以下列条件约束所述像素:
a、pS的相邻像素具有距离pF的邻域最近的颜色值;
b、pS与pF相对其各自骨骼路径的位置是最近的;
c、pS与pP周围的像素的平均颜色值最接近;
其中,pS是在水墨笔画区域内选出的最佳像素;pF为填充区域内的任一像素;pP为输入图像中的像素;且由3个能量项衡量以上约束条件:
Eb(pS)对应约束条件a,描述pS与pF之间邻域像素的颜色值差异的总和;
Ep(pS)对应约束条件b,描述pS与pF分别与对应的骨架路径之间的接近程度;
Ea(pS)对应约束条件c,描述pS与pP分别以某个R为半径的圆内像素的平均颜色值的差异;
其满足以下公式:
Figure PCTCN2017116182-appb-000032
其中,λ(p)表示p的颜色值,
Figure PCTCN2017116182-appb-000033
是pS的邻域像素,且
Figure PCTCN2017116182-appb-000034
是pF的邻域像素,
Figure PCTCN2017116182-appb-000035
骨架路径上距离pF最近的点,相同的
Figure PCTCN2017116182-appb-000036
值下,
Figure PCTCN2017116182-appb-000037
是所述最终笔画样本中的骨架路径上的对应一点,rS和rP分别是所述最终笔画样本宽度的一半,N表示在指定半径R的圆内所有像素总数,
Figure PCTCN2017116182-appb-000038
表示圆内在pS附近的像素,且
Figure PCTCN2017116182-appb-000039
表示在照片图像内,在指定圆内pP附近的像素。
所述基于像素的纹理映射算法,利用在
Figure PCTCN2017116182-appb-000040
空间内定义由3个能量项所构成的能量方程并将所述三个能量项最小化得到最佳像素,此步骤满足以下公式:
Figure PCTCN2017116182-appb-000041
其中,α1,α2和α3表示平衡权重参数。
S70,生成所述水墨画风格笔画绘画结果后,根据用户意图选装饰性元素植入绘画结果,即生成最终绘画结果。
这里所指的绘画元素可以是,文人题字。
请参阅图3,图2为本发明的第二种实施例,包括;
图像选取单元,用于选取一张包含图案的图像作为图像对象;
笔画样本选取单元,用于在预存的水墨画绘画样本上圈定至少一个笔画样本;
初步基本路径选取单元,用于在所述图像对象上勾画该图案的基本轮廓,构成待生成笔画的初步基本路径;
笔画样本纠正单元,用于对圈定出的所述笔画样本的轮廓进行纠正,得到准确的笔画样本作为候选笔画样本;
形态样本组生成单元,用于以所述候选笔画样本为参照,生成形态样本组;
初步基本路径纠正单元,用于纠正所述初步基本路径,得到准确基本路径;
最终笔画样本选取单元,在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本;
风格特征映射单元,用于将所述最终笔画样本的风格特征映射到所述准确基本路径上,生成具有中国水墨画风格的输出图像。
本发明第三实施例提供了一种基于云端的安全访问的设备包括,处理器、存储器以及存储在所述存储器中且被配置为由所述处理器执行的计算机程序,所述处理器执行所述计算机程序,例如所述基于交互式的中国水墨画风格笔画生成程序;
示例性的,所述计算机程序可以被分割成一个或多个模块,一个或者多个所述模块被存储在所述存储器中,并由所述处理器执行,以完成本实施例。一个或多个所述模块可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在基于交互式的中国水墨画风格笔画生成终端设备中的执行过程。
所述基于交互式的中国水墨画风格笔画生成设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。
所述基于交互式的中国水墨画风格笔画生成设备可包括,但不仅限于,处理 器、存储器、显示器。本领域技术人员可以理解,所述示意图仅仅是基于交互式的中国水墨画风格笔画生成设备的示例,并不构成对基于交互式的中国水墨画风格笔画生成设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如基于交互式的中国水墨画风格笔画生成设备还可以包括输入输出设备、网络接入设备、总线等。
所称处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器是所述基于交互式的中国水墨画风格笔画生成设备的控制中心,利用各种接口和线路连接整个所述基于交互式的中国水墨画风格笔画生成设备的各个部分。
所述存储器可用于存储所述计算机程序和/或模块,所述处理器通过运行或执行存储在所述存储器内的计算机程序和/或模块,以及调用存储在存储器内的数据,实现所述基于交互式的中国水墨画风格笔画生成设备的各种功能。所述存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、文字转换功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、文字消息数据等)等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
其中,所述基于交互式的中国水墨画风格笔画生成设备集成的模块如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一个计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计 算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。
需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本发明提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。

Claims (10)

  1. 一种基于交互式的中国水墨画风格笔画生成方法,其特征在于,包括以下步骤,
    获取一张包含图案的图像作为图像对象;
    在预存的水墨画绘画样本上获取一个圈定操作,所述圈定操作包括至少一个笔画样本;
    获取用户在所述图像对象上勾画的基本轮廓,所述基本轮廓构成待生成笔画的初步基本路径;
    通过对所述笔画样本中的笔画轮廓进行纠正,得到准确的笔画样本作为候选笔画样本;以所述候选笔画样本为参照,生成形态样本组;
    纠正所述初步基本路径,得到准确基本路径;
    在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本;
    将所述最终笔画样本的风格特征映射到所述准确基本路径上,生成具有中国水墨画风格的输出图像。
  2. 根据权利要求1所述的方法,其特征在于,通过对所述笔画样本中的笔画轮廓进行纠正,得到准确的笔画样本作为候选笔画样本的步骤包括:
    采用相向搜索算法确定所述笔画样本中最贴近笔画边缘的轮廓,得到所述候选笔画样本;
    以所述候选笔画样本作为参照,通过镜像与反路径的方式生成形态样本组;其中,每一所述形态样本组至少包括四个形态样本,四个所述四个形态样本包括作为参照的所述候选笔画样本、该候选笔画样本的镜像笔画样本、所述候选笔画样本的反路径笔画以及所述候选笔画样本镜像笔画的反路径笔画。
  3. 根据权利要求1所述的方法,其特征在于,所述纠正所述初步基本路径,得到准确基本路径的步骤包括,
    采用非均匀有理B样条曲线算法平滑所述初步基本路径,得到所述准确基本路径。
  4. 根据权利要求1所述的方法,其特征在于,所述在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本,包括,
    将所述基本路径划分成若干路径部分,通过能量公式,在所述形态样本组中选取与所述路径部分最匹配的形态样本作为该路径部分的最终笔画样本。
  5. 根据权利要求4所述的方法,其特征在于,所述通过能量公式,在所述形态样本组中选取与所述路径部分最匹配的形态样本作为该路径部分的最终笔画样本的步骤包括,
    所述能量公式在l2空间定义一能量项,用于描述所述最终笔画样本中的笔画轮廓的位移项以及与其对应的路径部分的位移项的总体差异,并使所述总体差异最小化,从而自动选择所述最终的笔画样本;
    其中,所述位移项用于描述所述最终笔画样本中的笔画轮廓与所述准确基本路径上任意一点的相对位置向量与笔画方向向量之间的位移量。
  6. 根据权利要求5所述的方法,其特征在于,所述将所述最终笔画样本的风格特征映射到所述准确基本路径上的步骤包括,
    调整所述最终笔画样本的长宽比例,使得所述最终笔画样本与对应的所述路径部分的长宽比例相一致。
  7. 根据权利要求5所述的方法,其特征在于,所述将所述最终笔画样本的风格特征映射到所述准确基本路径上的步骤还包括,
    通过基于像素的纹理映射算法,用扫描线实现光栅化填充区域并用从所述最终笔画内选择出的像素填充至与所述最终笔画对应的路径部分中。
  8. 根据权利要求7所述的方法,其特征在于,包括:
    以下列条件约束所述像素:
    a、pS的相邻像素具有距离pF的邻域最近的颜色值;
    b、pS与pF相对其各自骨骼路径的位置是最近的;
    c、pS与pP周围的像素的平均颜色值最接近;
    其中,pS是在水墨笔画区域内选出的最佳像素;pF为填充区域内的任一像素;pP为输入图像中的像素;且由3个能量项衡量以上约束条件,Eb(pS)对应约束条件a,描述pS与pF之间邻域像素的颜色值差异的总和;
    Ep(pS)对应约束条件b,描述pS与pF分别与对应的骨架路径之间的接近 程度;
    Ea(pS)对应约束条件c,描述pS与pP分别以某个R为半径的圆内像素的平均颜色值的差异;
    具体地满足以下公式:
    Figure PCTCN2017116182-appb-100001
    其中,λ(p)表示p的颜色值,
    Figure PCTCN2017116182-appb-100002
    是pS的邻域像素,且
    Figure PCTCN2017116182-appb-100003
    是pF的邻域像素,
    Figure PCTCN2017116182-appb-100004
    骨架路径上距离pF最近的点,相同的
    Figure PCTCN2017116182-appb-100005
    值下,
    Figure PCTCN2017116182-appb-100006
    是所述最终笔画样本中的骨架路径上的对应一点,rS和rP分别是所述最终笔画样本宽度的一半,N表示在指定半径R的圆内所有像素总数,
    Figure PCTCN2017116182-appb-100007
    表示圆内在pS附近的像素,且
    Figure PCTCN2017116182-appb-100008
    表示在照片图像内,在指定圆内pP附近的像素。
  9. 根据权利要求7所述的方法,其特征在于,
    所述基于像素的纹理映射算法,利用在l1空间内定义由3个能量项所构成的能量方程并将三个所述能量项最小化得到最佳像素,此步骤满足以下公式:
    Figure PCTCN2017116182-appb-100009
    其中,α1,α2和α3表示平衡权重参数。
  10. 一种基于交互式的中国水墨画风格笔画生成的装置,其特征在于,包括
    图像选取单元,用于选取一张包含图案的图像作为图像对象;
    笔画样本选取单元,用于在预存的水墨画绘画样本上圈定至少一个笔画样本;
    初步基本路径选取单元,用于在所述图像对象上勾画该图案的基本轮廓,构成待生成笔画的初步基本路径;
    笔画样本纠正单元,用于对圈定出的所述笔画样本的轮廓进行纠正,得到准 确的笔画样本作为候选笔画样本;
    形态样本组生成单元,用于以所述候选笔画样本为参照,生成形态样本组;
    初步基本路径纠正单元,用于纠正所述初步基本路径,得到准确基本路径;
    最终笔画样本选取单元,在所述形态样本组中选择与所述准确基本路径最匹配的形态样本作为最终笔画样本;
    风格特征映射单元,用于将所述最终笔画样本的风格特征映射到所述准确基本路径上,生成具有中国水墨画风格的输出图像。
PCT/CN2017/116182 2017-12-14 2017-12-14 一种基于交互式的中国水墨画风格笔画生成方法以及装置 WO2019113888A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/116182 WO2019113888A1 (zh) 2017-12-14 2017-12-14 一种基于交互式的中国水墨画风格笔画生成方法以及装置
US16/898,463 US11288499B2 (en) 2017-12-14 2020-06-11 Interactive method for generating strokes with Chinese ink painting style and device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/116182 WO2019113888A1 (zh) 2017-12-14 2017-12-14 一种基于交互式的中国水墨画风格笔画生成方法以及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/898,463 Continuation US11288499B2 (en) 2017-12-14 2020-06-11 Interactive method for generating strokes with Chinese ink painting style and device thereof

Publications (1)

Publication Number Publication Date
WO2019113888A1 true WO2019113888A1 (zh) 2019-06-20

Family

ID=66818774

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/116182 WO2019113888A1 (zh) 2017-12-14 2017-12-14 一种基于交互式的中国水墨画风格笔画生成方法以及装置

Country Status (2)

Country Link
US (1) US11288499B2 (zh)
WO (1) WO2019113888A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110570346A (zh) * 2019-08-19 2019-12-13 西安理工大学 一种基于循环生成对抗网络对书法进行风格迁移的方法
CN115063808A (zh) * 2022-08-18 2022-09-16 京华信息科技股份有限公司 一种基于聚类特征提取的ocr字体识别方法及系统

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019113888A1 (zh) * 2017-12-14 2019-06-20 华侨大学 一种基于交互式的中国水墨画风格笔画生成方法以及装置
US11113578B1 (en) * 2020-04-13 2021-09-07 Adobe, Inc. Learned model-based image rendering
EP4029579A1 (en) * 2021-01-18 2022-07-20 Société BIC Generating artwork tutorials
CN114063872A (zh) * 2021-11-25 2022-02-18 广州繁星互娱信息科技有限公司 图画生成方法和装置、存储介质及电子设备

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1991915A (zh) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 一种交互式水墨风格实时3d渲染及实现动画的方法
CN102354402A (zh) * 2011-09-21 2012-02-15 西安交通大学 基于风格学习的绘画渲染方法
CN103793930A (zh) * 2014-01-27 2014-05-14 汉王科技股份有限公司 铅笔画图像生成方法及装置

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH066386B2 (ja) * 1988-04-18 1994-01-26 キヤノン株式会社 出力装置
JP2962937B2 (ja) * 1992-07-14 1999-10-12 キヤノン株式会社 文字処理装置及び方法
US5734748A (en) * 1993-12-30 1998-03-31 Canon Kabushiki Kaisha Character pattern generation apparatus and method
US5621868A (en) * 1994-04-15 1997-04-15 Sony Corporation Generating imitation custom artwork by simulating brush strokes and enhancing edges
JP3576611B2 (ja) * 1994-12-05 2004-10-13 キヤノン株式会社 文字発生装置ならびに方法
US5847712A (en) * 1995-01-03 1998-12-08 University Of Washington Method and system for generating graphic illustrations according to a stroke texture and a tone
US6179485B1 (en) * 1996-11-18 2001-01-30 Xerox Corporation Printing black and white reproducible colored stroke documents
US20030001864A1 (en) * 2001-06-29 2003-01-02 Bitflash Graphics, Inc. Method and system for manipulation of garphics information
US8203564B2 (en) * 2007-02-16 2012-06-19 Qualcomm Incorporated Efficient 2-D and 3-D graphics processing
JP4367511B2 (ja) * 2007-03-26 2009-11-18 セイコーエプソン株式会社 文字描画装置、表示装置及び印刷装置
WO2019113888A1 (zh) * 2017-12-14 2019-06-20 华侨大学 一种基于交互式的中国水墨画风格笔画生成方法以及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1991915A (zh) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 一种交互式水墨风格实时3d渲染及实现动画的方法
CN102354402A (zh) * 2011-09-21 2012-02-15 西安交通大学 基于风格学习的绘画渲染方法
CN103793930A (zh) * 2014-01-27 2014-05-14 汉王科技股份有限公司 铅笔画图像生成方法及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110570346A (zh) * 2019-08-19 2019-12-13 西安理工大学 一种基于循环生成对抗网络对书法进行风格迁移的方法
CN110570346B (zh) * 2019-08-19 2022-11-04 西安理工大学 一种基于循环生成对抗网络对书法进行风格迁移的方法
CN115063808A (zh) * 2022-08-18 2022-09-16 京华信息科技股份有限公司 一种基于聚类特征提取的ocr字体识别方法及系统

Also Published As

Publication number Publication date
US11288499B2 (en) 2022-03-29
US20200327316A1 (en) 2020-10-15

Similar Documents

Publication Publication Date Title
WO2019113888A1 (zh) 一种基于交互式的中国水墨画风格笔画生成方法以及装置
CN110211192B (zh) 一种基于深度学习的三维模型到二维图像的渲染方法
CN108171650B (zh) 一种具有笔画优化功能中国花卉水墨画风格笔画生成方法
US8917283B2 (en) Polygon processing techniques in procedural painting algorithms
US8896622B2 (en) Methods and apparatus for marker-based stylistic rendering
CN108122264A (zh) 促进草图到绘画变换
Lu et al. Decobrush: Drawing structured decorative patterns by example
US7876336B2 (en) Scale-dependent rendering of natural media styles
CN105374007A (zh) 融合骨架笔画和纹理特征的铅笔画生成方法和装置
CN114037802A (zh) 三维人脸模型重建方法、装置、存储介质及计算机设备
CN108876868B (zh) 通过根据方向指导放置简单形状的实例来计算机化生成装饰设计
Yang et al. Easy drawing: Generation of artistic Chinese flower painting by stroke-based stylization
CN108171766B (zh) 一种具有笔画轮廓纠正功能的图像生成方法
Doyle et al. Automated pebble mosaic stylization of images
Wang et al. Stroke-GAN Painter: Learning to paint artworks using stroke-style generative adversarial networks
Yang et al. Animating Chinese ink painting through generating reproducible brush strokes
Yang et al. Binary image carving for 3D printing
CN108038819B (zh) 一种基于交互式的笔画生成方法
CN108171767B (zh) 一种具有曲线纠正功能的图像生成方法
CN107481184B (zh) 一种低多边形风格图生成交互系统
Liu et al. Animating characters in Chinese painting using two-dimensional skeleton-based deformation
Seah et al. Modeling and Rendering with eXpressive B-Spline Curves
Huang et al. Stereoscopic oil paintings from RGBD images
Yang et al. Sketch-based stroke generation in Chinese flower painting
TWI525585B (zh) An image processing system and method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17934592

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17934592

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17934592

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 03.12.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17934592

Country of ref document: EP

Kind code of ref document: A1