CN107369185B - Oil painting stylization method based on image - Google Patents

Oil painting stylization method based on image Download PDF

Info

Publication number
CN107369185B
CN107369185B CN201710378375.5A CN201710378375A CN107369185B CN 107369185 B CN107369185 B CN 107369185B CN 201710378375 A CN201710378375 A CN 201710378375A CN 107369185 B CN107369185 B CN 107369185B
Authority
CN
China
Prior art keywords
image
color attribute
oil painting
color
attribute
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201710378375.5A
Other languages
Chinese (zh)
Other versions
CN107369185A (en
Inventor
陈丽
高杨
侯雯
刘媛
张强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Chenggong University Of Finance And Economics
Original Assignee
Zhengzhou Chenggong University Of Finance And Economics
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 Zhengzhou Chenggong University Of Finance And Economics filed Critical Zhengzhou Chenggong University Of Finance And Economics
Priority to CN201710378375.5A priority Critical patent/CN107369185B/en
Publication of CN107369185A publication Critical patent/CN107369185A/en
Application granted granted Critical
Publication of CN107369185B publication Critical patent/CN107369185B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Abstract

The invention discloses an oil painting stylization method based on an image, which comprises the following steps: selecting the style of the oil painting by a user; determining the stylized color attribute of the oil painting according to the style of the oil painting selected by a user; carrying out region division on the image to obtain an image of a divided region; performing smoothing treatment on the region boundary of the image of the divided region to obtain a smoothed image; for each image area of the image which is subjected to the smooth processing, counting the color attribute of the image area to obtain the color attribute of each image area; redistributing the color attribute of each image area to the image subjected to the smooth processing according to the color attribute subjected to the stylization of the oil painting and the color attribute of each image area to obtain the redistributed color attribute of each image area; and for each image area, resetting the color of each pixel point of the image area according to the redistributed color attribute of the image which is subjected to the smooth processing.

Description

Oil painting stylization method based on image
Technical Field
The invention relates to the field of image processing, in particular to an oil painting stylization method based on images.
Background
In recent years, technologies and application scenes for realizing non-photorealistic drawing of oil paintings, watercolor paintings and the like based on computer algorithms begin to appear in large numbers. The realization mode is various, and the effect of realization is also different. Most of the realization methods are simulation stroke shapes, and drawing is performed layer by layer through an optimization algorithm or a greedy algorithm. The styles of oil paintings are various, and the oil painting style expected by a user cannot be considered when the existing algorithm is realized.
Disclosure of Invention
In order to solve the problems, the invention provides an oil painting stylization method based on an image.
The invention provides an oil painting stylization method based on an image, which comprises the following steps:
step S1, selecting the style of the oil painting by the user, wherein the style of the oil painting comprises the following steps: classical, baroque, impressive, expressive, style presented to the user in the form of a drawing;
step S2, determining the stylized color attribute of the oil painting according to the style of the oil painting selected by the user, wherein the stylized color attribute of the oil painting comprises the following steps: hue, lightness, purity;
step S3, performing region division on the image to obtain a region-divided image, where the division method is as follows: dividing the image into different regions according to the color relationship;
step S4, smoothing the area boundary of the image divided into areas to obtain a smoothed image;
step S5, for each image region of the image subjected to the smoothing processing, counting the color attribute of the image region to obtain the color attribute of each image region, where the color attribute includes: hue, lightness, purity;
step S6, redistributing the color attribute of each image area to the smooth processed image according to the stylized color attribute of the oil painting and the color attribute of each image area to obtain the redistributed color attribute of each image area;
and step S7, for the image subjected to the smooth processing, resetting the color of each pixel point of each image area according to the color attribute after the reassignment.
Preferably, the determining the stylized color attribute of the oil painting includes:
determining the color attribute of the current image according to the color of each pixel point of the current image;
according to the style of the oil painting selected by a user, inquiring the color attribute of the oil painting closest to the color attribute of the current image from a database, and determining the color attribute as the stylized color attribute of the oil painting, wherein the color attribute of the oil painting closest to the color attribute of the current image is obtained by calculating the distance between the current image and the color attribute of the oil painting in the database through a first formula, selecting the color attribute of the oil painting with the minimum distance, and determining the color attribute as the stylized color attribute of the oil painting, and the first formula is as follows:
Figure BDA0001304251140000021
wherein, a 1、a 2、a 3、b 1、b 2、b 3N is a positive real number, dH, dB, dS are absolute values of differences in hue, lightness, and purity between the current image and the image in the database, respectively, and dC is a distance between the current image and a color attribute of the oil painting in the database.
Preferably, the determining the color attribute of the current image includes:
different weights are distributed to pixel points at different positions in the image, and the distribution method comprises the following steps: distributing weight according to the distance between the pixel point and the boundary; the closer to the boundary, the lower the weight; the distance is the distance with the minimum numerical value in the distances between the pixel point and all the boundaries;
and calculating the color attribute of the previous image according to the colors of different pixel points and the weights of the pixel points.
Preferably, the weight of the pixel point is calculated according to a second formula, where the second formula is:
Figure BDA0001304251140000022
wherein w represents the weight of the pixel point, k is a positive integer, x is the distance from the pixel point to the boundary, and x maxIs the maximum value in the values of x in the current image.
Preferably, the color relationship comprises a color gradient change.
Preferably, the smoothing process is performed on the region boundary of the image divided into regions, and includes an opening operation and a closing operation.
Preferably, the reassigning the color attribute of each image region includes:
calculating the difference between the color attribute of each region and the stylized color attribute of the oil painting;
and adjusting the color attribute of each area in proportion to ensure that the color attribute of the image subjected to the smoothing treatment is the same as the color attribute of the oil painting after stylization.
Preferably, the resetting the color of each pixel point of the image area includes:
and adjusting the color of each pixel point in the image area to make the color attribute of the image area the same as the color attribute of the image area after redistribution.
Some of the benefits of the present invention may include:
the invention provides an oil painting stylization method based on images, which can consider the oil painting style expected by a user and make the color attributes of the stylized images of the oil painting and the original images as close as possible.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
FIG. 1 is a flow chart of a method for stylizing an oil painting based on an image in an embodiment of the present invention;
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.
Fig. 1 is a flowchart of an oil painting stylization method based on an image in an embodiment of the present invention. As shown in fig. 1, the method comprises the steps of:
step S1, selecting the style of the oil painting by the user, wherein the style of the oil painting comprises the following steps: classical, baroque, impressive, expressive, style presented to the user in the form of a drawing;
step S2, determining the stylized color attribute of the oil painting according to the style of the oil painting selected by the user, wherein the stylized color attribute of the oil painting comprises the following steps: hue, lightness, purity;
step S3, performing region division on the image to obtain a region-divided image, where the division method is as follows: dividing the image into different regions according to the color relationship;
step S4, smoothing the area boundary of the image divided into areas to obtain a smoothed image;
step S5, for each image region of the image subjected to the smoothing processing, counting the color attribute of the image region to obtain the color attribute of each image region, where the color attribute includes: hue, lightness, purity;
step S6, redistributing the color attribute of each image area to the smooth processed image according to the stylized color attribute of the oil painting and the color attribute of each image area to obtain the redistributed color attribute of each image area;
and step S7, for the image subjected to the smooth processing, resetting the color of each pixel point of each image area according to the color attribute after the reassignment.
According to the method provided by the invention, the oil painting style desired by the user can be considered, and the color attributes of the oil painting stylized image and the original image are close to each other as much as possible.
In one embodiment of the present invention, determining the stylized color attributes of the painting includes:
determining the color attribute of the current image according to the color of each pixel point of the current image;
according to the style of the oil painting selected by a user, inquiring the color attribute of the oil painting closest to the color attribute of the current image from a database, and determining the color attribute as the stylized color attribute of the oil painting, wherein the color attribute of the oil painting closest to the color attribute of the current image is obtained by calculating the distance between the current image and the color attribute of the oil painting in the database through a first formula, selecting the color attribute of the oil painting with the minimum distance, and determining the color attribute as the stylized color attribute of the oil painting, and the first formula is as follows:
wherein, a 1、a 2、a 3、b 1、b 2、b 3N is a positive real number, dH, dB, dS are absolute values of differences in hue, lightness, and purity between the current image and the image in the database, respectively, and dC is a distance between the current image and a color attribute of the oil painting in the database.
In one embodiment of the present invention, determining the color attributes of the current image comprises:
different weights are distributed to pixel points at different positions in the image, and the distribution method comprises the following steps: distributing weight according to the distance between the pixel point and the boundary; the closer to the boundary, the lower the weight; the boundaries are all boundaries of the image, generally, one image has four boundaries, and the boundaries are four boundaries, and for the image with the irregular shape, the boundaries are each side for forming the image outline; the distance is the distance with the minimum numerical value in the distances between the pixel point and all the boundaries;
and calculating the color attribute of the previous image according to the colors of different pixel points and the weights of the pixel points.
According to the method provided by the invention, the difference of the importance of the pixel points at different positions in the image can be considered, so that the oil painting style expected by a user is better considered, and the color attributes of the oil painting stylized image and the original image are as close as possible.
In an embodiment of the present invention, the weight of the pixel point is calculated according to a second formula, where the second formula is:
Figure BDA0001304251140000052
wherein w represents the weight of the pixel point, k is a positive integer, x is the distance from the pixel point to the boundary, and x maxIs the maximum value in the values of x in the current image.
According to the method provided by the invention, the weight of the point in the middle part of the image can be increased, so that the oil painting style expected by a user is better considered, and the color attributes of the oil painting stylized image and the original image are close to each other as much as possible.
In one embodiment of the invention, the color relationship comprises a color gradient change. Different objects are more easily distinguished by a color gradient change. Therefore, each area is the same object, and the subsequent treatment is more convenient.
In one embodiment of the invention, the region boundary of the image divided by the region is subjected to smoothing processing, including opening operation and closing operation. Through operation and closed operation, the tiny characteristics which are difficult to draw in the oil painting can be removed, and the stylized image of the oil painting is closer to the real oil painting.
In one embodiment of the present invention, reassigning the color attributes of each image region comprises:
calculating the difference between the color attribute of each region and the stylized color attribute of the oil painting;
and adjusting the color attribute of each area in proportion to ensure that the color attribute of the image subjected to the smoothing treatment is the same as the color attribute of the oil painting after stylization.
According to the method provided by the invention, the color attributes of the oil painting stylized image and the original image can be as close as possible.
In an embodiment of the present invention, the resetting the color of each pixel point of the image area includes:
and adjusting the color of each pixel point in the image area to make the color attribute of the image area the same as the color attribute of the image area after redistribution.
According to the method provided by the invention, the stylized oil painting image can be closer to a real oil painting, and the color attributes of the stylized oil painting image and the original image are as close as possible.
The invention provides an oil painting stylization method based on images, which can consider the oil painting style expected by a user and make the color attributes of the stylized images of the oil painting and the original images as close as possible.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (7)

1. An oil painting stylization method based on images is characterized by comprising the following steps:
step S1, selecting the style of the oil painting by the user, wherein the style of the oil painting comprises the following steps: classical, baroque, impressive, expressive, style presented to the user in the form of a drawing;
step S2, determining the stylized color attribute of the oil painting according to the style of the oil painting selected by the user, wherein the stylized color attribute of the oil painting comprises the following steps: hue, lightness, purity;
step S3, performing region division on the image to obtain a region-divided image, where the division method is as follows: dividing the image into different regions according to the color relationship;
step S4, smoothing the area boundary of the image divided into areas to obtain a smoothed image;
step S5, for each image region of the image subjected to the smoothing processing, counting the color attribute of the image region to obtain the color attribute of each image region, where the color attribute includes: hue, lightness, purity;
step S6, redistributing the color attribute of each image area to the smooth processed image according to the stylized color attribute of the oil painting and the color attribute of each image area to obtain the redistributed color attribute of each image area;
step S7, for the image after the smooth processing, resetting the color of each pixel point of each image area according to the color attribute after the redistribution;
the determining the color attribute of the stylized oil painting comprises the following steps:
determining the color attribute of the current image according to the color of each pixel point of the current image;
according to the style of the oil painting selected by a user, inquiring the color attribute of the oil painting closest to the color attribute of the current image from a database, and determining the color attribute as the stylized color attribute of the oil painting, wherein the color attribute of the oil painting closest to the color attribute of the current image is obtained by calculating the distance between the current image and the color attribute of the oil painting in the database through a first formula, selecting the color attribute of the oil painting with the minimum distance, and determining the color attribute as the stylized color attribute of the oil painting, and the first formula is as follows:
Figure FDA0002162219300000021
wherein, a 1、a 2、a 3、b 1、b 2、b 3N is a positive real number, dH, dB, dS are absolute values of differences in hue, lightness, and purity between the current image and the image in the database, respectively, and dC is a distance between the current image and a color attribute of the oil painting in the database.
2. The method of claim 1, wherein determining color attributes of the current image comprises:
different weights are distributed to pixel points at different positions in the image, and the distribution method comprises the following steps: distributing weight according to the distance between the pixel point and the boundary; the closer to the boundary, the lower the weight; the distance is the distance with the minimum numerical value in the distances between the pixel point and all the boundaries;
and calculating the color attribute of the previous image according to the colors of different pixel points and the weights of the pixel points.
3. The method of claim 2, wherein:
calculating the weight of the pixel point according to a second formula, wherein the second formula is as follows:
wherein w represents the weight of the pixel point, k is a positive integer, x is the distance from the pixel point to the boundary, and x maxIs the maximum value in the values of x in the current image.
4. The method of claim 1, wherein the color relationship comprises a color gradient change.
5. The method of claim 1, wherein smoothing the region boundaries of the partitioned image comprises opening and closing operations.
6. The method of claim 1, wherein said reassigning the color attributes of each image region comprises:
calculating the difference between the color attribute of each region and the stylized color attribute of the oil painting;
and adjusting the color attribute of each area in proportion to ensure that the color attribute of the image subjected to the smoothing treatment is the same as the color attribute of the oil painting after stylization.
7. The method of claim 1, wherein said resetting the color of each pixel of the image region comprises:
and adjusting the color of each pixel point in the image area to make the color attribute of the image area the same as the color attribute of the image area after redistribution.
CN201710378375.5A 2017-05-25 2017-05-25 Oil painting stylization method based on image Active CN107369185B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710378375.5A CN107369185B (en) 2017-05-25 2017-05-25 Oil painting stylization method based on image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710378375.5A CN107369185B (en) 2017-05-25 2017-05-25 Oil painting stylization method based on image

Publications (2)

Publication Number Publication Date
CN107369185A CN107369185A (en) 2017-11-21
CN107369185B true CN107369185B (en) 2020-02-11

Family

ID=60304856

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710378375.5A Active CN107369185B (en) 2017-05-25 2017-05-25 Oil painting stylization method based on image

Country Status (1)

Country Link
CN (1) CN107369185B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108449590B (en) * 2018-03-30 2020-02-11 盎锐(上海)信息科技有限公司 Image processing method and device
CN110969676B (en) * 2019-12-23 2024-04-19 深圳市玛贝尔动漫文化发展有限公司 Rapid forming method for character design of hand-swimming oil painting

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794454A (en) * 2010-04-08 2010-08-04 西安交通大学 Oil painting stylizing method based on image
CN102496139A (en) * 2011-11-28 2012-06-13 江南大学 Image processing-based method for transforming photo to digital oil painting
CN104732506A (en) * 2015-03-27 2015-06-24 浙江大学 Character picture color style converting method based on face semantic analysis
CN105719327A (en) * 2016-02-29 2016-06-29 北京中邮云天科技有限公司 Art stylization image processing method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794454A (en) * 2010-04-08 2010-08-04 西安交通大学 Oil painting stylizing method based on image
CN102496139A (en) * 2011-11-28 2012-06-13 江南大学 Image processing-based method for transforming photo to digital oil painting
CN104732506A (en) * 2015-03-27 2015-06-24 浙江大学 Character picture color style converting method based on face semantic analysis
CN105719327A (en) * 2016-02-29 2016-06-29 北京中邮云天科技有限公司 Art stylization image processing method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Hierarchical Oil Painting Stylization with Limited Reference via Sparse Representation;Saboya Yang等;《2015 IEEE 17th International Workshop on Multimedia Signal Processing (MMSP)》;20151021;第1-6页 *
风格转移驱动的产品色彩方案设计技术研究;杨鹏等;《中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑》;20131215(第S2期);C028-14 *

Also Published As

Publication number Publication date
CN107369185A (en) 2017-11-21

Similar Documents

Publication Publication Date Title
US10424112B2 (en) Mesh boundary smoothing
US9734613B2 (en) Apparatus and method for generating facial composite image, recording medium for performing the method
CN109891880B (en) Method for improving the quality of 2D to 3D automatic conversion by machine learning techniques
WO2013106984A1 (en) Learning painting styles for painterly rendering
CN104899853A (en) Image region dividing method and device
US10762682B2 (en) Skinning weights and underlying object suppression of three-dimensional images
CN105844711A (en) Engraving a 2D image on a subdivision surface
CN107369185B (en) Oil painting stylization method based on image
CN108564541B (en) Image processing method and device
US10019848B2 (en) Edge preserving color smoothing of 3D models
CN113301409B (en) Video synthesis method and device, electronic equipment and readable storage medium
WO2023284738A1 (en) Method and system for beautifying image
Wong et al. A Graph‐based Approach to Continuous Line Illustrations with Variable Levels of Detail
US7515745B1 (en) Planar map to process a raster image
JP2008016006A (en) Reliable image sharpening method
WO2016172889A1 (en) Image segmentation method and device
CN113269888B (en) Hairstyle three-dimensional modeling method, character three-dimensional modeling method and system
Schäfer et al. Dynamic feature-adaptive subdivision
CN109783793A (en) Page editing composition method and device
US9639992B2 (en) Methods and systems for multilevel editing of subdivided polygonal data
JP2012238925A5 (en)
JP2017134596A (en) Image processing method and process simulation device
Yang et al. Binary image carving for 3D printing
CN109461198A (en) The processing method and processing device of grid model
CN102456221B (en) Method for rapidly eliminating image noise

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant