CN110675463B - Method and device for generating partial color pencil drawing - Google Patents

Method and device for generating partial color pencil drawing Download PDF

Info

Publication number
CN110675463B
CN110675463B CN201910894963.3A CN201910894963A CN110675463B CN 110675463 B CN110675463 B CN 110675463B CN 201910894963 A CN201910894963 A CN 201910894963A CN 110675463 B CN110675463 B CN 110675463B
Authority
CN
China
Prior art keywords
image
color
value
pixel
brightness
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
CN201910894963.3A
Other languages
Chinese (zh)
Other versions
CN110675463A (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.)
Henan University of Technology
Original Assignee
Henan University of Technology
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 Henan University of Technology filed Critical Henan University of Technology
Publication of CN110675463A publication Critical patent/CN110675463A/en
Application granted granted Critical
Publication of CN110675463B publication Critical patent/CN110675463B/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
    • 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
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/28Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Processing (AREA)

Abstract

The invention provides a method and a device for generating a partial color pencil drawing, and belongs to the technical field of image processing. The method comprises the following steps: inputting an original color image; performing image segmentation on an original color image to obtain a color segmentation image, performing gray scale processing on the color segmentation image to obtain a gray scale segmentation image, performing binarization processing on the gray scale segmentation image to obtain a binary image, and determining a foreground region and a background region of the original color image according to the binary image; carrying out image processing on the original color image to obtain a contour map and a texture map, and merging the contour map and the texture map to obtain a gray pencil drawing; and adding color information of the foreground area of the original color image to a corresponding area in the gray pencil drawing to obtain and output a local color pencil drawing. According to the invention, the color information of the foreground area of the original color image is added to the corresponding area in the gray pencil drawing to obtain the local color pencil drawing, so that the local color can be better highlighted, and the artistic expression form of the color pencil drawing is enriched.

Description

Method and device for generating partial color pencil drawing
Technical Field
The invention relates to a method and a device for generating a partial color pencil drawing, belonging to the technical field of image processing.
Background
The color pencil is a drawing tool with various expression techniques, the intensity of force can change the color depth differently, and the staggered fusion of tens of colors can create infinite color effect and fine gradation and space. In order to solve the problem that the creation of a color pencil drawing work needs to consider factors such as pencil material, hardness, paper and the like, a method for automatically generating the color pencil drawing by utilizing a computer image processing technology is available, for example Xie Dangen, zhang Zhili and the like are disclosed in a literature named an improved two-dimensional color pencil drawing automatic drawing algorithm in 2013 computer application and software volume 30 8.
However, the existing color pencil drawing generation methods are basically all realized full-color pencil drawing, and for some applications needing to highlight the local colors of the image, the existing color pencil drawing generation methods cannot meet the requirement of highlighting the local colors of the image.
Disclosure of Invention
The invention aims to provide a method and a device for generating partial color pencil drawings, which are used for solving the problem that the existing method for generating the color pencil drawings cannot meet the requirement of highlighting the partial color of an image.
To achieve the above object, the present invention provides a partial color pencil drawing generating method including the steps of:
1) Inputting an original color image;
2) Performing image segmentation on an original color image to obtain a color segmentation image, performing gray scale processing on the color segmentation image to obtain a gray scale segmentation image, performing binarization processing on the gray scale segmentation image to obtain a binary image, and determining a foreground region and a background region of the original color image according to the binary image;
3) Carrying out image processing on the original color image to obtain a contour map and a texture map, and merging the contour map and the texture map to obtain a gray pencil drawing;
4) And adding color information of the foreground area of the original color image to a corresponding area in the gray pencil drawing to obtain and output a local color pencil drawing.
The invention also provides a device for generating the partial color pencil drawing, which comprises a memory and a processor, wherein the processor is used for running program instructions stored in the memory so as to realize the method for generating the partial color pencil drawing.
The beneficial effects of the invention are as follows: the method comprises the steps of sequentially carrying out image segmentation, gray level processing and binarization processing on an original color image to obtain a binary image, determining a foreground region of the original color image according to the binary image, and adding color information of the foreground region of the original color image to a corresponding region in a gray level pencil drawing to obtain a local color pencil drawing. The partial color pencil drawing obtained by the invention can better highlight the partial color, enriches the artistic expression form of the color pencil drawing, is not a single gray pencil drawing or full-color pencil drawing, and has richer and more vivid pencil drawing effect.
Further, in the above method and apparatus, the step of obtaining the texture map includes:
converting an original color image from an RGB color space to an HSV color space to obtain an HSV color space image, and extracting brightness components on brightness channels of the HSV color space image to obtain a brightness component image;
according to each divided area of the color divided image, each divided area of the brightness component image is correspondingly obtained, white noise is added to the brightness component image according to the areas to obtain a white noise image, and the texture direction of each divided area of the brightness component image is determined;
and carrying out line integral convolution on the white noise image and a vector field generated according to the texture direction to obtain a texture image.
Further, in the above method and apparatus, the step of obtaining the white noise map includes:
calculating the average brightness value of all pixels in each partition area of the brightness component graph, and taking the average brightness value as the area brightness average value of the corresponding area;
comparing the pixel value of each pixel point in the brightness component diagram with the regional brightness average value of the corresponding dividing region, and solving the white noise value corresponding to each pixel point by using a white noise formula;
replacing the pixel value of each pixel point in the brightness component graph with a corresponding white noise value to obtain a white noise graph;
wherein, the white noise formula is:
Figure BDA0002209918550000031
wherein T is 1 =k 1 (1-I input_i ),k 1 Is a proportionality coefficient, k 1 ∈[0,1.0],I input_i Is the luminance component image pixel value of the I-th divided region, I is a constant, R i For the average luminance value of all pixels in region I, I noise Is the output pixel value, I max For maximum luminance value, p is a random number.
The white noise formula is improved, so that the generation condition of the white noise figure is simplified, the drawing requirement of the color pencil drawing can be met, the brightness relationship of the image can be reflected, the information of the image can be reserved, and the generated white noise is finer.
Further, in the above method and apparatus, the step of obtaining the texture direction includes:
converting the pixel value of the brightness component image into an radian value by using a conversion formula;
determining a primary direction and a secondary direction of the composition, calculating an average radian value of each divided region of the brightness component diagram, comparing the average radian value with a set threshold value, and if the average radian value is larger than the set threshold value, enabling the texture direction of the divided region corresponding to the average radian value to be the primary direction, otherwise, enabling the texture direction of the divided region corresponding to the average radian value to be the secondary direction;
wherein, the conversion formula is:
Figure BDA0002209918550000032
wherein I (I, j) is a pixel value of a pixel point (I, j) in the luminance component map, and radian (I, j) is an radian value corresponding to I (I, j).
Further, in the method and the device, the contour map is obtained by neon processing on the HSV color space image by using a neon processing formula, wherein the neon processing formula is as follows:
Figure BDA0002209918550000033
Figure BDA0002209918550000034
Figure BDA0002209918550000035
wherein the hue, saturation and brightness components of the pixel points Ig (i, j) in the HSV color space image are respectively h 1 、s 1 、v 1 The hue, saturation and luminance components of the pixel Ig1 (i, j+1) of the same row as the pixel Ig (i, j) are h 2 、s 2 、v 2 The hue, saturation, and luminance components of pixel Ig2 (i+1, j) in the same column as pixel Ig (i, j) are h 3 、s 3 、v 3 The hue, saturation, and luminance components of the pixel point Img (i, j) in the processed image are H, S, V, respectively.
Further, in the above method and apparatus, the original color image is subjected to image segmentation using the mean shift segmentation method.
Further, in the method and the device, binarization processing is performed on the gray level division map by using a maximum inter-class variance method.
The method has the advantages that a mean shift segmentation method is utilized to obtain a color segmentation image, and a maximum inter-class variance method is utilized to process a gray segmentation image to obtain a binary image, and the method has the following advantages: the method can effectively weaken the over-segmentation of the image, can merge the regions of the segmented image again by using the maximum inter-class variance method, reduces the number of the segmented regions, improves the segmentation effectiveness, and can extract the near-complete target image after binarization.
Drawings
Fig. 1 is a flow chart of a partial color pencil drawing map generation method in an embodiment of the method of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail with reference to the accompanying drawings and specific embodiments.
Method embodiment:
as shown in fig. 1, the partial color pencil drawing generating method of the present embodiment includes the steps of:
step 1, inputting an original color image.
And 2, performing image segmentation on the original color image to obtain a color segmentation map, performing gray scale treatment on the color segmentation map to obtain a gray scale segmentation map, performing binarization treatment on the gray scale segmentation map to obtain a binary image, and determining a foreground region and a background region of the original color image according to the binary image.
In this embodiment, mean shift segmentation is performed on the original color image to obtain a color segmentation map. The specific process of obtaining the color segmentation map is as follows:
1) Searching the modulus point of the original color image;
given d-dimensional space R d N sample points x i (i=1, 2,3,) n, the basic form of the mean shift vector at the x point is as follows:
Figure BDA0002209918550000051
wherein S is h For a Gao Weiqiu region of radius h, point y within the region should satisfy the following condition: s is S h (x)={y:(y-x i ) T (y-x i )≤h 2 -a }; k is S h The number of sample points within the region; x is x i -x is the sample point x i Offset from the center point x; m is M h (x) To fall into S h All sample points x within the region i The average of the offset from the center point x, the mean shift vector.
Wherein the sample point x i Obeying the probability density distribution function f (x), S h Sample points within the region fall more in the direction along the probability density gradient, with the modulus point being the point at which the probability density gradient is zero. For sample point x i The probability density kernel function of the x point is estimated as:
Figure BDA0002209918550000052
in the method, in the process of the invention, k (| x|| 2 ) Is a kernel function, let G (x) = -k' (x), kernel function G (x) =g (|) |x|| 2 )。
The mean shift vector for the x point is in the form of:
Figure BDA0002209918550000053
let the initial point be x=y 1 Calculating the mean shift amount y by iteratively executing the following formula j+1 Until the corresponding module value point is obtained after convergence:
Figure BDA0002209918550000061
2) Carrying out smoothing treatment on the original color image according to the modulus points to obtain a smoothed image;
the image segmentation algorithm based on mean shift comprehensively considers the space information and the color information of the image to form a joint domain with 5 dimensions to represent the color image: x= (x s ,x r ),x s Is a feature vector of a coordinate space, x r Is a feature vector of the color space.
The mean shift-based image segmentation algorithm employs a multivariate kernel function to estimate the distribution of x:
Figure BDA0002209918550000062
wherein C is GuiA constant of the first time is normalized,
Figure BDA0002209918550000063
as a function of the coordinate space>
Figure BDA0002209918550000064
As a kernel function of the color space, h s ,h r The kernel bandwidth, x, of the coordinate space and the color space, respectively s ,x r Feature vectors of the coordinate space and the color space, respectively.
Let x= (x) s ,x r ),z=(z s ,z r ) The original image and the smoothed image are respectively represented, and then the image smoothing based on mean shift specifically comprises the following steps:
(1) initializing j=1;
(2) calculating y j+1
(3) Calculating mean shift vector M h,G(x) :M h,G(x) =y j+1 -x;
Given the error ε, when M h,G(x) Let x=m, | > ε h,G(x) J=j+1, and returning to the second step to continue iteration, otherwise ending iteration and pointing to the next pixel point x until each pixel point in the image is traversed.
(4) Let z= (x s ,M h,G(x) (x))。
3) And merging similar areas in the smooth image to obtain a color segmentation map.
(1) Screening pixel points with larger color value difference, calculating the color average value of the neighborhood pixel points, and replacing the color value of the pixel points;
(2) the space distance is smaller than h s The color distance is less than h r Is divided into the same region;
(3) after the initial region merging is completed, calculating the number sum of pixel points in different regions i If sum is i And (3) merging the region into the adjacent region, and limiting the minimum pixel points in different regions by setting a parameter S so as to limit the size of the finally segmented region.
In this embodiment, the binary image is obtained by performing binarization processing on the gray scale division map by using the maximum inter-class variance method. The specific process of obtaining the binary image is as follows:
firstly, a threshold value required by binarization processing is calculated by using a maximum inter-class variance method, and the method comprises the following specific steps:
let the gray scale range of the gray scale division map be {0,1,2,3, & gt, l }, the number of pixels with gray scale i be n i The total pixel number of the image is recorded as
Figure BDA0002209918550000071
The probability of the occurrence of a pixel with gray i is:
Figure BDA0002209918550000072
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure BDA0002209918550000073
selecting a threshold t E [1, l-1 ]]The threshold t divides the gray pixels of the image into C 1 {0,1,2., t } and C 2 { t+1, t+2,.. Two parts, l }, C 1 、C 2 Probability of occurrence P 1 (t)、P 2 (t) is:
Figure BDA0002209918550000074
its corresponding mean value mu 1 (t)、μ 2 (t) is:
Figure BDA0002209918550000075
overall gray average μ of an image T The method comprises the following steps:
Figure BDA0002209918550000076
maximum inter-class variance of two regions divided by threshold
Figure BDA0002209918550000081
The method comprises the following steps:
Figure BDA0002209918550000082
by adopting a traversing method, t is E [1, l-1 ]]Within (1) is calculated such that
Figure BDA0002209918550000083
The maximum threshold t is the required threshold.
Then, the gray-scale division map is binarized by using the obtained threshold value, and a binary image is obtained.
In this embodiment, a mean shift segmentation method is used to obtain a color segmentation map, and a maximum inter-class variance method is used to process a gray segmentation map to obtain a binary image, which has the following advantages: the method can effectively weaken the over-segmentation of the image, can merge the regions of the segmented image again by using the maximum inter-class variance method, reduces the number of the segmented regions, improves the segmentation effectiveness, and can extract the near-complete target image after binarization.
And step 3, performing image processing on the original color image to obtain a contour map and a texture map, and combining the contour map and the texture map to obtain a gray pencil drawing.
In this embodiment, the texture map and the contour map are subjected to dot multiplication operation to generate a gray pencil drawing. The step of obtaining the texture map comprises the following steps:
converting an original color image from an RGB color space to an HSV color space to obtain an HSV color space image, and extracting brightness components on brightness channels of the HSV color space image to obtain a brightness component image;
according to each divided area of the color divided image, each divided area of the brightness component image is correspondingly obtained, white noise is added to the brightness component image according to the areas to obtain a white noise image, and the texture direction of each divided area of the brightness component image is determined;
and carrying out line integral convolution (namely LIC) on the white noise graph and the vector field generated according to the texture direction to obtain the texture graph.
The specific process of adding white noise to the brightness component graph according to the region to obtain the white noise graph is as follows:
1) Calculating the average brightness value of all pixels in each partition area of the brightness component graph, and taking the average brightness value as the area brightness average value of the corresponding area;
2) Comparing the pixel value of each pixel point in the brightness component diagram with the regional brightness average value of the corresponding dividing region, and solving the white noise value corresponding to each pixel point by using a white noise formula; wherein, the pixel value of the pixel point in the brightness component image is the brightness value;
the white noise formula is as follows:
Figure BDA0002209918550000091
wherein T is 1 =k 1 (1-I input_i ),k 1 Is a proportionality coefficient, k 1 ∈[0,1.0],I input-i Is the pixel value of the luminance component image of the ith divided area (namely the pixel value of the pixel point in the ith divided area of the luminance component image), I is a constant, R i For the average luminance value of all pixels in region I (i.e. the regional luminance average of the ith divided region of the luminance component map), I noise Is the output pixel value (i.e. white noise value), I max For maximum luminance value, p is a random number.
The white noise formula is as follows: when the pixel value I of a pixel point in the ith divided area of the brightness component diagram input-i A region brightness average R of less than or equal to the region i And satisfies p.gtoreq.T 1 ,I input-i When I is less than 0, the white noise value corresponding to the pixel point is equal to the maximum brightness value I max The method comprises the steps of carrying out a first treatment on the surface of the Otherwise, the white noise value corresponding to the pixel point is equal to I input-i -I。
The white noise formula is improved, so that the generation condition of the white noise figure is simplified, the drawing requirement of the color pencil drawing can be met, the brightness relationship of the image can be reflected, the information of the image can be reserved, and the generated white noise is finer.
3) And replacing the pixel value of each pixel point in the brightness component graph with a corresponding white noise value to obtain a white noise graph.
The specific procedure for determining the texture direction of each divided region of the luminance component map is as follows:
1) The pixel values of the luminance component map are converted into radian values using a conversion formula as follows:
Figure BDA0002209918550000092
wherein I (I, j) is a pixel value of a pixel point (I, j) in the luminance component map, and radian (I, j) is an radian value corresponding to I (I, j).
2) Determining a primary direction and a secondary direction of the composition, calculating an average radian value of each divided region of the brightness component diagram, comparing the average radian value with a set threshold value, and if the average radian value is larger than the set threshold value, enabling the texture direction of the divided region corresponding to the average radian value to be the primary direction, otherwise, enabling the texture direction of the divided region corresponding to the average radian value to be the secondary direction.
In the actual painting process, the painter will usually choose four possible directions: horizontal, vertical, curved, diagonal, while only one direction dominates during patterning, the other direction is secondary. In this embodiment, a 45 ° diagonal direction is selected as the primary direction, a-30 ° direction is selected as the secondary direction, a threshold value is set to 60 ° (as other embodiments, the size of the set threshold value can be adjusted according to actual needs), the average radian value of each divided region of the luminance component map is compared with the set threshold value, if the average radian value is greater than 60 °, the texture direction of each pixel point in the divided region (also referred to as the texture direction of the divided region) is 45 °, otherwise, the texture direction of each pixel point in the divided region is-30 °. Specifically, the method is shown in the following formula:
Figure BDA0002209918550000101
/>
in the formula, radian i For the average radian value of the ith divided area, I out_θ The texture direction of each pixel point in the ith divided area.
The specific process of carrying out line integral convolution on the white noise image and the vector field generated according to the texture direction to obtain the texture image is as follows:
setting a point P as a pixel point at a (x, y) point in the output image, and outputting a texture value of the point as follows:
Figure BDA0002209918550000102
wherein I (P (0)) is a pixel value in the output image, and P (0) represents a P point; k (w) is a filter convolution kernel, which satisfies
Figure BDA0002209918550000103
L is the integral streamline step length; p (w) is the streamline and T (p (w)) is the corresponding white noise value on the streamline.
Discretized form:
Figure BDA0002209918550000111
in the method, in the process of the invention,
Figure BDA0002209918550000112
l, L' are the number of integration steps in the forward and reverse directions of the streamline, respectively; t (p (w) i ) Is the pixel value of the input texture corresponding to the coordinate point in the input vector field; the numerator in the formula represents the line integral h of the convolution kernel for each point on the flow line i Multiplied by T (p (w) i ) A) accumulation of pixel values; the denominator represents the accumulation of the line integral of the convolution kernel and is used for carrying out normalization processing on the output result; ΔS i The actual distance travelled by the streamline on the ith section; k (w) is a convolution kernel function, and a hanning window function is selected in this embodiment, because it can meet the requirement of low-pass filtering, and the specific form is:
Figure BDA0002209918550000113
where c and d are expansion coefficients of 2 Hanning functions and β is the phase shift of the Hanning function.
In this embodiment, neon processing is performed on the HSV color space image, and then inversion and subsequent graying processing are performed to obtain a contour map, where the neon processing formula is as follows:
Figure BDA0002209918550000114
Figure BDA0002209918550000115
Figure BDA0002209918550000116
wherein the hue, saturation and brightness components of the ith row and jth column pixel points Ig (i, j) in the HSV color space image are h respectively 1 、s 1 、v 1 The hue, saturation and luminance components of the pixel Ig1 (i, j+1) of the same row as the pixel Ig (i, j) are h 2 、s 2 、v 2 The hue, saturation, and luminance components of pixel Ig2 (i+1, j) in the same column as pixel Ig (i, j) are h 3 、s 3 、v 3 The hue, saturation, and luminance components of the pixel point Img (i, j) in the ith row and jth column in the processed image (i.e., outline) are H, S, V, respectively.
And 4, adding color information of the foreground area of the original color image to a corresponding area in the gray pencil drawing to obtain and output a local color pencil drawing.
The partial color pencil drawing mainly highlights the image partial color, i.e. the foreground region color, while the background region is not colored, i.e. it is necessary to achieve color preservation in a specific region of the color image, while the other regions are shown as gray.
The HSV color space color parameters are H (hue), S (saturation), V (brightness), respectively, H is 0 to 360 degrees in the HSV color space, S is the purity of the control color, and when s=0, the value of H is undefined, and when V gradually decreases, gray of different grays appears from this point. Therefore, after the input image is converted from RGB color space to HSV color space to generate the gray pencil, the saturation of the background area of the gray pencil is set to 0, and the saturation of the foreground area of the gray pencil is replaced by the saturation of the foreground area of the input image, so that the color information of the foreground area of the input image can be added to the corresponding area in the gray pencil, and the specific formula is as follows:
Figure BDA0002209918550000121
wherein S is out_I To output the value of the image saturation, S input_i The saturation value of each pixel of the input image is i, i being the i-th pixel of the input image.
In this embodiment, after the foreground area and the background area of the original color image are determined according to the binary image, color information of the foreground area of the original color image is added to a corresponding area in the gray-scale pencil drawing, and converted from the HSV color space to the RGB color space, so as to obtain and output a partial color pencil drawing.
As other embodiments, the methods for obtaining the color segmentation map, the binary image, the luminance component map, the white noise map, the texture direction, and the contour map may be other methods in the prior art, for example, the methods mentioned in the documents cited in the background section.
Device example:
the embodiment provides a device for generating a partial color pencil drawing, which comprises a memory and a processor, wherein the processor is used for running program instructions stored in the memory to realize a method for generating the partial color pencil drawing, and the method is the same as the method for generating the partial color pencil drawing in the embodiment of the method and is not repeated herein.

Claims (4)

1. A method of generating a partial color pencil drawing, the method comprising the steps of:
1) Inputting an original color image;
2) Performing image segmentation on an original color image to obtain a color segmentation image, performing gray scale treatment on the color segmentation image to obtain a gray scale segmentation image, performing binarization treatment on the gray scale segmentation image by using a maximum inter-class variance method to obtain a binary image, and determining a foreground region and a background region of the original color image according to the binary image;
3) Carrying out image processing on the original color image to obtain a contour map and a texture map, and merging the contour map and the texture map to obtain a gray pencil drawing; neon processing is carried out on the HSV color space image by utilizing a neon processing formula to obtain a contour map, wherein the neon processing formula is as follows:
Figure FDA0004086680250000011
Figure FDA0004086680250000012
Figure FDA0004086680250000013
wherein the hue, saturation and brightness components of the pixel points Ig (i, j) in the HSV color space image are respectively h 1 、s 1 、v 1 The hue, saturation and luminance components of the pixel Ig1 (i, j+1) of the same row as the pixel Ig (i, j) are h 2 、s 2 、v 2 The hue, saturation, and luminance components of pixel Ig2 (i+1, j) in the same column as pixel Ig (i, j) are h 3 、s 3 、v 3 The hue, saturation and brightness components of the pixel point Img (i, j) in the processed image are H, S, V respectively;
the step of obtaining the texture map comprises the following steps: converting an original color image from an RGB color space to an HSV color space to obtain an HSV color space image, and extracting brightness components on brightness channels of the HSV color space image to obtain a brightness component image; according to each divided area of the color divided image, each divided area of the brightness component image is correspondingly obtained, white noise is added to the brightness component image according to the areas to obtain a white noise image, and the texture direction of each divided area of the brightness component image is determined; carrying out line integral convolution on the white noise image and a vector field generated according to the texture direction to obtain a texture image;
the step of obtaining the texture direction comprises the following steps:
converting the pixel value of the brightness component image into an radian value by using a conversion formula;
determining a primary direction and a secondary direction of the composition, calculating an average radian value of each divided region of the brightness component diagram, comparing the average radian value with a set threshold value, and if the average radian value is larger than the set threshold value, enabling the texture direction of the divided region corresponding to the average radian value to be the primary direction, otherwise, enabling the texture direction of the divided region corresponding to the average radian value to be the secondary direction;
wherein, the conversion formula is:
Figure FDA0004086680250000021
wherein I (I, j) is a pixel value of a pixel point (I, j) in the brightness component image, and radan (I, j) is an radian value corresponding to I (I, j);
4) And adding color information of the foreground area of the original color image to a corresponding area in the gray pencil drawing to obtain and output a local color pencil drawing.
2. The partial color pencil drawing generation method of claim 1, wherein the step of obtaining the white noise map includes:
calculating the average brightness value of all pixels in each partition area of the brightness component graph, and taking the average brightness value as the area brightness average value of the corresponding area;
comparing the pixel value of each pixel point in the brightness component diagram with the regional brightness average value of the corresponding dividing region, and solving the white noise value corresponding to each pixel point by using a white noise formula;
replacing the pixel value of each pixel point in the brightness component graph with a corresponding white noise value to obtain a white noise graph;
wherein, the white noise formula is:
Figure FDA0004086680250000022
wherein T is 1 =k 1 (1-I input-i ),k 1 Is a proportionality coefficient, k 1 ∈[0,1.0],I input-i Is the luminance component image pixel value of the I-th divided region, I is a constant, R i For the average luminance value of all pixels in region I, I noise Is the output pixel value, I max For maximum luminance value, p is a random number.
3. The partial color pencil drawing generation method of claim 1, wherein the original color image is subjected to image segmentation using a meanshift segmentation method.
4. A partial color pencil drawing generating device comprising a memory and a processor for executing program instructions stored in the memory to implement the partial color pencil drawing generating method of any one of claims 1-3.
CN201910894963.3A 2019-08-23 2019-09-20 Method and device for generating partial color pencil drawing Active CN110675463B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2019107852791 2019-08-23
CN201910785279 2019-08-23

Publications (2)

Publication Number Publication Date
CN110675463A CN110675463A (en) 2020-01-10
CN110675463B true CN110675463B (en) 2023-05-23

Family

ID=69077252

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910894963.3A Active CN110675463B (en) 2019-08-23 2019-09-20 Method and device for generating partial color pencil drawing

Country Status (1)

Country Link
CN (1) CN110675463B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111784562B (en) * 2020-06-12 2024-01-26 齐鲁工业大学 Automatic generation algorithm for winding picture
CN113297723B (en) * 2021-04-22 2022-11-08 哈尔滨理工大学 Mean shift-grey correlation analysis-based optimization method for electric spindle temperature measurement point
CN114612355A (en) * 2022-03-02 2022-06-10 影石创新科技股份有限公司 Oil painting stylization method, device, equipment and medium for image

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010081350A (en) * 2008-09-26 2010-04-08 Osaka Prefecture Univ Method and program for generating oil painting tone image
CN103489204A (en) * 2013-05-15 2014-01-01 许昌学院 Method for automatically drawing two-dimensional color pencil drawings
CN106023276A (en) * 2016-05-13 2016-10-12 云南大学 Pencil drawing making method and pencil drawing making device based on image processing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010081350A (en) * 2008-09-26 2010-04-08 Osaka Prefecture Univ Method and program for generating oil painting tone image
CN103489204A (en) * 2013-05-15 2014-01-01 许昌学院 Method for automatically drawing two-dimensional color pencil drawings
CN106023276A (en) * 2016-05-13 2016-10-12 云南大学 Pencil drawing making method and pencil drawing making device based on image processing

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种改进的二维彩色铅笔画自动绘制算法;谢党恩等;《计算机应用与软件》;20130815(第08期);全文 *
一种改进的铅笔画的生成方法;李龙生等;《中国图象图形学报》;20070815(第08期);全文 *

Also Published As

Publication number Publication date
CN110675463A (en) 2020-01-10

Similar Documents

Publication Publication Date Title
CN110675463B (en) Method and device for generating partial color pencil drawing
US10547871B2 (en) Edge-aware spatio-temporal filtering and optical flow estimation in real time
JP3833153B2 (en) Image processing method and apparatus
US8391594B1 (en) Method and apparatus for generating variable-width border masks
GB2582689A (en) Interactive image matting using neural networks
CN107273608B (en) Oil reservoir geological profile vectorization method
Zeng et al. Region-based bas-relief generation from a single image
KR102010085B1 (en) Method and apparatus for producing labeling image of microstructure using super-pixels
Ko et al. Skelgan: A font image skeletonization method
JP2023087671A (en) System and method for image transformation using distance field procedure
CN110458773B (en) Anisotropic diffusion noise processing method based on edge enhancement operator
US9036938B2 (en) Image processing apparatus, image processing method, and program
JP3716455B2 (en) Region extraction method and region extraction device
JP2018206260A (en) Image processing system, evaluation model construction method, image processing method, and program
CN100403769C (en) Image crisperding method during composing process
JP2023087670A (en) System and method for image transformation
JP2017134596A (en) Image processing method and process simulation device
Kurlin et al. A persistence-based approach to automatic detection of line segments in images
JP4509512B2 (en) Skew detection
Ullah et al. Experimental and numerical research of paved microcrack using histogram equalization for detection and segmentation
CN110264417B (en) Local motion fuzzy area automatic detection and extraction method based on hierarchical model
Palenichka et al. A fast structure-adaptive evaluation of local features in images
Mishra et al. Underwater image restoration using color correction and empirical mode decomposition
Hiraoka Generation of Contour-Like Images Using Euclidean Distance from Edges
Yamane et al. A watercolor painting image generation using stroke-based rendering

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