CN110675463B - Method and device for generating partial color pencil drawing - Google Patents
Method and device for generating partial color pencil drawing Download PDFInfo
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 69
- 238000010421 pencil drawing Methods 0.000 title claims abstract description 53
- 230000011218 segmentation Effects 0.000 claims abstract description 31
- 238000003709 image segmentation Methods 0.000 claims abstract description 9
- 239000013598 vector Substances 0.000 claims description 12
- 229910052754 neon Inorganic materials 0.000 claims description 8
- GKAOGPIIYCISHV-UHFFFAOYSA-N neon atom Chemical compound [Ne] GKAOGPIIYCISHV-UHFFFAOYSA-N 0.000 claims description 8
- 238000010586 diagram Methods 0.000 claims description 7
- 238000006243 chemical reaction Methods 0.000 claims description 5
- 239000000203 mixture Substances 0.000 claims description 3
- 238000005192 partition Methods 0.000 claims description 3
- 230000006870 function Effects 0.000 description 10
- 239000003086 colorant Substances 0.000 description 3
- 238000009825 accumulation Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004883 computer application Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000005315 distribution function Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 238000003706 image smoothing Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 238000007591 painting process Methods 0.000 description 1
- 238000000059 patterning Methods 0.000 description 1
- 230000010363 phase shift Effects 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/001—Texturing; Colouring; Generation of texture or colour
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/28—Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
- Facsimile Image Signal Circuits (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
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:
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:
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:
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:
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:
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:
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:
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:
wherein C is GuiA constant of the first time is normalized,as a function of the coordinate space>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 asThe probability of the occurrence of a pixel with gray i is:
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:
its corresponding mean value mu 1 (t)、μ 2 (t) is:
overall gray average μ of an image T The method comprises the following steps:
maximum inter-class variance of two regions divided by thresholdThe method comprises the following steps:
by adopting a traversing method, t is E [1, l-1 ]]Within (1) is calculated such thatThe 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:
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:
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:
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:
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 satisfiesL 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:
in the method, in the process of the invention,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:
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:
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:
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:
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:
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:
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.
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)
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)
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 |
-
2019
- 2019-09-20 CN CN201910894963.3A patent/CN110675463B/en active Active
Patent Citations (3)
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)
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 | |
JP3833153B2 (en) | Image processing method and apparatus | |
CN107273608B (en) | Oil reservoir geological profile vectorization method | |
US8391594B1 (en) | Method and apparatus for generating variable-width border masks | |
US8406566B1 (en) | Methods and apparatus for soft edge masking | |
KR102010085B1 (en) | Method and apparatus for producing labeling image of microstructure using super-pixels | |
Ko et al. | Skelgan: A font image skeletonization method | |
CN110458773B (en) | Anisotropic diffusion noise processing method based on edge enhancement operator | |
JP2023087671A (en) | System and method for image transformation using distance field procedure | |
CN107194402B (en) | Parallel refined skeleton extraction method | |
CN115239594A (en) | Document image denoising method based on total variation model | |
US9036938B2 (en) | Image processing apparatus, image processing method, and program | |
Soille | Advances in the analysis of topographic features on discrete images | |
CN108710881B (en) | Neural network model, candidate target area generation method and model training method | |
JP3706755B2 (en) | Image processing apparatus and method, and storage medium | |
JP2003162718A (en) | Image processing method and its program | |
JP3716455B2 (en) | Region extraction method and region extraction device | |
CN100403769C (en) | Image crisperding method during composing process | |
JP2017134596A (en) | Image processing method and process simulation device | |
JP2023087670A (en) | System and method for image transformation | |
CN113409344B (en) | Template information acquisition method, equipment and computer readable storage medium | |
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 | |
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 |