WO2018153264A1 - 一种图像处理的方法及装置 - Google Patents
一种图像处理的方法及装置 Download PDFInfo
- Publication number
- WO2018153264A1 WO2018153264A1 PCT/CN2018/075676 CN2018075676W WO2018153264A1 WO 2018153264 A1 WO2018153264 A1 WO 2018153264A1 CN 2018075676 W CN2018075676 W CN 2018075676W WO 2018153264 A1 WO2018153264 A1 WO 2018153264A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- stroke
- pixel
- texture
- determining
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/10004—Still image; Photographic image
Definitions
- the present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for image processing.
- the stylization of the pencil drawing of the picture is an important direction of non-realistic drawing.
- the purpose is to process the pictures in the real world and get a pencil drawing effect similar to artificial hand-painting.
- a pencil drawing style picture of an original picture is mainly generated by an edge extraction method. Specifically, edge extraction is performed on the original image, and the image edge of the original image is output as a result.
- the pencil drawing style picture obtained in the prior art lacks the brush stroke texture of the pencil drawing, and cannot reflect the characteristics of the original picture, such as light and dark contrast, and the pencil drawing effect is poor.
- the embodiment of the invention provides a method and a device for image processing, which can improve the pencil drawing effect of a pencil drawing style picture.
- an embodiment of the present invention provides a method for image processing, including: presetting at least one stroke texture;
- the method further includes: presetting a correspondence between the gray level and the stroke texture;
- the determining the stroke texture corresponding to each of the at least one image region comprises:
- the determining the stroke texture corresponding to each of the at least one image region comprises:
- the determining a stroke direction of the pixel in the contour image includes:
- the first convolution result of the current pixel is convoluted by a predetermined number of directions, and a second convolution result of each direction of the current pixel in the preset number of directions is obtained.
- a direction corresponding to a maximum value of the second convolution results of the preset number of directions is used as a stroke direction of the current pixel.
- the method further includes:
- the pencil drawing style image is colored according to the color information.
- an apparatus for image processing including:
- a saving unit for saving at least one stroke texture
- a graying unit for performing grayscale processing on the original image to generate a grayscale image corresponding to the original image
- An extracting unit configured to extract an edge of the grayscale image, and generate a contour image corresponding to the grayscale image
- a dividing unit configured to divide the contour image into at least one image region according to a gray value of each pixel in the grayscale image
- a determining unit configured to determine a stroke texture corresponding to each image region in the at least one image region
- a generating unit configured to fill the stroke texture corresponding to the image region into the corresponding image region, and generate an image of a pencil drawing style corresponding to the original image.
- the apparatus further includes: a setting unit, configured to set a correspondence relationship between the gray level and the stroke texture;
- the determining unit is configured to determine a gray level of the image region according to a gray value of each pixel in the image region, and determine the image according to the correspondence relationship and a gray level of the image region The stroke texture corresponding to the region.
- the determining unit is configured to determine a stroke direction of each pixel in the contour image, and determine a stroke direction of the stroke texture corresponding to the image region according to a stroke direction of the pixel, according to the image region The stroke direction of the stroke of the texture determines the stroke texture corresponding to the image area.
- the determining unit includes:
- a convolution subunit configured to perform full-picture convolution on the grayscale image to obtain a first convolution result of each pixel
- Determining a subunit configured to convolve a first number of directions of the current convolution result of the current pixel for each pixel, and obtain a second of each direction of the current pixel in the preset number of directions As a result of the convolution, a direction corresponding to a maximum value of the second convolution results of the preset number of directions is taken as a stroke direction of the current pixel.
- the apparatus further includes: a coloring unit configured to acquire color information of the original image, and color the image of the pencil drawing style according to the color information.
- an embodiment of the present invention provides a storage controller, including a processor and a memory.
- the memory is configured to store an execution instruction of the method of image processing described above;
- the processor is configured to execute the execution instruction stored by the memory.
- the gray image of the original image is extracted, and the corresponding contour image is generated according to the gray image to form a basic outline of the last generated pencil drawing style image, and the contour image is divided according to the gray level of each pixel.
- Each image area is filled with a corresponding stroke texture in the image area, so that the finally generated pencil-painted image is more full on the basis of the basic contour, closer to the real pencil drawing, and provides the pencil-style picture corresponding to the original image. Pencil drawing effect.
- FIG. 1 is a flowchart of a method for image processing according to an embodiment of the present invention
- FIG. 2 is a flowchart of another method for image processing according to an embodiment of the present invention.
- FIG. 3 is a schematic diagram of an apparatus for image processing according to an embodiment of the present invention.
- FIG. 4 is a schematic diagram of another apparatus for image processing according to an embodiment of the present invention.
- FIG. 5 is a schematic diagram of still another apparatus for image processing according to an embodiment of the present invention.
- FIG. 6 is a schematic diagram of still another apparatus for image processing according to an embodiment of the present invention.
- an embodiment of the present invention provides a method for image processing, which may include the following steps:
- Step 101 preset at least one stroke texture
- Step 102 Perform grayscale processing on the original image to generate a grayscale image corresponding to the original image.
- Step 103 Extract an edge of the grayscale image, and generate a contour image corresponding to the grayscale image.
- Step 104 Dividing the contour image into at least one image region according to a gray value of each pixel in the grayscale image
- Step 105 Determine a stroke texture corresponding to each of the image regions
- Step 106 Fill the corresponding brush stroke texture corresponding to each of the image regions into the corresponding image region, and generate an image of a pencil drawing style corresponding to the original image.
- the gray image of the original image is extracted, and the corresponding contour image is generated according to the gray image to form a basic outline of the last generated pencil drawing style image, and the contour image is divided according to the gray level of each pixel.
- Each image area is filled with a corresponding stroke texture in the image area, so that the finally generated pencil-painted image is more full on the basis of the basic contour, closer to the real pencil drawing, and provides the pencil-style picture corresponding to the original image. Pencil drawing effect.
- the method further includes: presetting a correspondence between the gray level and the brush texture in order to further improve the pencil drawing effect of the pencil drawing style image corresponding to the original image;
- Determining a stroke texture corresponding to each of the image regions including:
- each stroke texture may be preset according to the line density.
- the line density of the first stroke texture is within a preset first range
- the line density of the second stroke texture is at a preset second.
- the line density of the third stroke texture is within a preset third range.
- the image region may be divided into gradation levels according to the gradation value of each pixel in the image region.
- the gray value range corresponding to the gray level 1 is [0, 70]
- the gray value range corresponding to the gray level 2 is (70, 150)
- the gray value range corresponding to the gray level 3 is ( 150, 255], wherein, when determining the gradation value of the image region, the average value of the gradation values of the respective pixels of the image region may be used as the gradation value of the image region.
- each pixel of the image region A The average value of the gray value is 90
- the gray level of the image area A is gray level 2.
- the stroke texture corresponding to the gray level 2 is the second stroke texture.
- the gray value range is The smaller the maximum value, the higher the line density of the corresponding stroke texture.
- the stroke texture of each image region is determined by the magnitude of the gray value of each image region, so that the darker region is filled with the stroke texture with a larger line density, so that the stroke texture of each image region is more
- the style close to the real pencil drawing further enhances the pencil drawing effect of the pencil-style image corresponding to the original image.
- the lines that can be set in each stroke texture have a certain stroke direction, for example: from bottom left to top right, from top left to bottom right, from top right to bottom left, from bottom right to top left.
- the starting end color of the line is deeper than the end point.
- the stroke direction is from the bottom left to the upper right line, the lower left color is darker, and the upper right color is lighter.
- the determining the stroke texture corresponding to each of the image regions comprises:
- a stroke texture corresponding to each of the image regions is determined according to a stroke direction of a stroke texture corresponding to each of the image regions.
- the stroke direction of the stroke texture corresponding to each image region when determining the stroke direction of the stroke texture corresponding to each image region, it may be determined according to the number of pixels corresponding to each stroke direction in the current image region, specifically, the stroke with the largest number of corresponding pixels
- the direction is the stroke direction of the current image area.
- the stroke direction of 10 pixels is the stroke direction 1
- the stroke direction of 20 pixels is the stroke direction 2
- the stroke direction of 300 pixels is the stroke direction 3
- the target stroke texture with the same stroke direction of the stroke texture corresponding to the current image region may be found from the preset at least one stroke texture, and the target stroke texture is As the stroke texture corresponding to the current image area.
- the stroke direction of each pixel in the image area is embodied by the filled stroke texture, so that the pencil drawing effect of the generated pencil drawing style image is better.
- the determining a stroke direction of each of the pixels in the contour image comprises: performing a full-image convolution on the grayscale image to obtain a first convolution result of each pixel;
- the first convolution result of the current pixel is convoluted by a predetermined number of directions, and a second convolution result of each direction of the current pixel in the preset number of directions is obtained.
- a direction corresponding to a maximum value of the second convolution results of the preset number of directions is used as a stroke direction of the current pixel.
- each stroke texture carries information of a stroke direction, that is, a line in each stroke texture has a certain direction, for example, the stroke direction of the stroke texture 1 is from the lower left to the upper right.
- the gray image of the image to be processed is subjected to full-image convolution to obtain a light-dark relationship between each pixel.
- the mean direction of the stroke direction can also be hashed to ensure that the image does not change repeatedly.
- the stroke direction of the pixel A when determining the stroke direction of the pixel A, it can be realized by setting three stroke textures in advance, wherein the stroke direction of the stroke texture 1 is the stroke direction 1, and the stroke direction of the stroke texture 2 For the stroke direction 2, the stroke direction of the stroke texture 3 is the stroke direction 3. Determining a second convolution result 1 of pixel A in direction 1, determining a second convolution result 2 of pixel A in direction 2, determining a second convolution result 3 of pixel A in direction 3, if these three responses Among the values, the second convolution result 2 is the largest, then the direction 2 corresponding to the second convolution result 2 is the stroke direction of the pixel A.
- the method may further include: determining a convolution kernel of each pixel, determining a gradient value of each pixel in the contour image; for each pixel, according to a stroke direction of the current pixel, the current pixel.
- the convolution kernel in the stroke direction and the gradient values of the surrounding pixels of the current pixel enhance the response of the current pixel in the corresponding stroke direction, and also reduce the noise caused by the gradient calculation.
- the method further includes:
- the pencil drawing style image is colored according to the color information.
- the color information of the original image may be RGB information of each pixel in the original image.
- an embodiment of the present invention provides a method for image processing, which may include the following steps:
- Step 201 At least one stroke texture is preset, and each stroke texture is set with a corresponding stroke direction.
- each stroke texture may include two features: line density and stroke direction.
- Stroke textures can be implemented by texture mapping.
- the stroke texture may include pure black, pure white, and slash, wherein the line density of the lines in the pure black stroke texture is greater than the line density of the lines in the stroke texture of the slash, and the stroke texture in the slash The line density of the lines is greater than the line density of the lines in the pure white brush texture.
- each line density can be combined with each stroke direction to form a stroke texture
- the line density of the stroke texture 1 is the line density A
- the stroke direction is the direction A
- the line density of the stroke texture 2 is the line density A
- the stroke direction is the direction B
- the line density of the stroke texture 3 is the line density A
- the stroke direction is the direction C, and the like.
- various line densities can be combined with various brush stroke directions to form a plurality of brush stroke textures to satisfy various original images.
- one implementation manner is: six stroke textures in advance, wherein the line density of the stroke texture 1 is the line density A, the stroke direction is the direction A; the line density of the stroke texture 2 is the line density A, and the stroke direction is the direction. B; stroke density 3 line density is line density B, stroke direction is direction A; stroke texture 4 line density is line density B, stroke direction is direction B; stroke texture 5 line density is line density C, stroke direction is Direction A; the line density of the stroke texture 6 is the line density C, and the stroke direction is the direction B.
- Step 202 Pre-set the correspondence between the gray level and the stroke texture.
- the gray level of the image is reflected by the line density on the stroke texture.
- the gray level can be divided by the range of gray values.
- the tone curve of the photo is matched with the gray histogram of the pencil drawing to conform to the gray distribution rule of the pencil drawing, and then the gray value range of the image area is combined to be classified.
- the gray level can be divided into three levels, namely gray level 1, gray level 2, and gray level 3.
- the line density A corresponds to the gray level 1
- the line density B corresponds to the gray level 2
- the line density C corresponds to the gray level 3, that is, the stroke texture 1 corresponds to the gray level 1, the stroke texture 2 and the gray level
- the stroke texture 3 corresponds to the gray level 2
- the stroke texture 4 corresponds to the gray level 2
- the stroke texture 5 corresponds to the gray level 3
- the stroke texture 6 corresponds to the gray level 3.
- Step 203 Perform grayscale processing on the original image to generate a grayscale image corresponding to the original image.
- Step 204 Extract an edge of the grayscale image to generate a contour image corresponding to the grayscale image.
- the contour image can be obtained by extracting the edge of the grayscale image by the Laplacian. Then, a reasonable threshold can be set by which the process of profile picking is achieved. The area with a relatively large area is determined by the threshold, and the area with a small area may not participate in the subsequent processing.
- Step 205 Divide the contour image into at least one image region according to the gray value of each pixel in the grayscale image.
- the region can be divided according to the severity of the change in the gray value, and the place where the gray value is abrupt is the edge of several regions.
- Step 206 Determine the gray level of each image area according to the gray value of each pixel in each image area.
- the average value of the gray values of the respective pixels in the current image region may be used as the gray value of the current image region, thereby determining which gray level the current image region belongs to.
- the gradation level of the image area A is gradation level 1.
- Step 207 Determine the stroke direction of each pixel in the contour image.
- the first convolution result of the current pixel is convoluted by a predetermined number of directions, and a second convolution result of each direction of the current pixel in the preset number of directions is obtained.
- a direction corresponding to a maximum value of the second convolution results of the preset number of directions is used as a stroke direction of the current pixel.
- Step 208 Determine the stroke direction of the stroke texture corresponding to each image region according to the stroke direction of each pixel.
- the brush point direction is the most pixel point of the direction A, and it can be determined that the stroke direction of the stroke texture corresponding to the image area A is the direction A.
- direction A is from bottom left to top right.
- Step 209 Determine a stroke texture corresponding to each image region according to the correspondence relationship, the gray level of each image region, and the stroke direction of the stroke texture corresponding to each of the image regions.
- the stroke texture corresponding to each image region is determined by two parameters of gray scale and stroke direction.
- the stroke texture corresponding to the image area A can be the stroke texture 1 and the stroke texture 2.
- the direction A is determined. From the stroke texture 1 and the stroke texture 2, it can be determined that the stroke texture corresponding to the image area A is the stroke texture 1.
- Step 210 Fill the corresponding touch image texture into the corresponding image area to generate an image of the pencil drawing style corresponding to the original image.
- the stroke texture 1 corresponding to the image area A is filled into the image area A.
- the other image areas are also filled with corresponding stroke textures, thereby obtaining a pencil-drawn style image corresponding to the original image.
- the method may further include: acquiring color information of the original image; and coloring the image of the pencil drawing style corresponding to the original image according to the color information.
- the color of each pixel in the original image may be acquired, and for each pixel on the pencil drawing style image corresponding to the original image, the current pixel is colored according to the color information of the pixel on the original image corresponding to the current pixel.
- the pixel A on the original image corresponds to the pixel C on the pencil-drawn image corresponding to the original image, and the RGB of the pixel A on the original image is acquired, and the pixel C is colored according to the RGB of the pixel A.
- the stroke texture is preset, and the preset stroke texture is filled into the corresponding image region to generate an image of the pencil drawing style corresponding to the original image, and the calculation amount is small, and the processing speed is fast.
- each frame in the video is separately subjected to pencil drawing processing as an original image to obtain an image of a pencil drawing style corresponding to each frame.
- the generated brush stroke style image can have the pencil stroke style and the highlight shadow effect of the generated pencil stroke style, which is closer to the real pencil drawing, and the pencil drawing effect is better.
- the calculation amount can be greatly reduced, the required computing resources are less, and can be implemented on a mobile terminal such as a mobile phone, which can achieve real-time effects and can obtain a better pencil drawing. effect.
- an embodiment of the present invention provides an apparatus for image processing.
- the device embodiment may be implemented by software, or may be implemented by hardware or a combination of hardware and software.
- FIG. 3 a hardware structure diagram of a device for processing an image processing apparatus according to an embodiment of the present invention, except for the processor, the memory, the network interface, and the non-
- the device in which the device is located in the embodiment may also typically include other hardware, such as a forwarding chip responsible for processing the message, and the like.
- the CPU of the device in which it is located reads the corresponding computer program instructions in the non-volatile memory into the memory.
- An apparatus for image processing provided by this embodiment includes:
- a saving unit 401 configured to save at least one stroke texture
- the gradation unit 402 is configured to perform gradation processing on the original image to generate a grayscale image corresponding to the original image;
- An extracting unit 403 configured to extract an edge of the grayscale image, and generate a contour image corresponding to the grayscale image
- a dividing unit 404 configured to divide the contour image into at least one image region according to a gray value of each pixel in the grayscale image
- a determining unit 405, configured to determine a stroke texture corresponding to each of the image regions
- the generating unit 406 is configured to fill the stroke texture corresponding to each of the image regions into the corresponding image region, and generate an image of a pencil drawing style corresponding to the original image.
- the apparatus further includes: a setting unit 501, configured to set a correspondence between the gray level and the stroke texture ;
- the determining unit is configured to determine a gray level of each of the image regions according to a gray value of each of the pixels in each of the image regions, according to the correspondence relationship and each of the image regions Gray scale, determining the stroke texture corresponding to each of the image regions.
- the determining unit is configured to determine a stroke direction of each of the pixels in the contour image, and determine a stroke corresponding to each of the image regions according to a stroke direction of each of the pixels
- the stroke direction of the texture determines the stroke texture corresponding to each of the image regions according to the stroke direction of the stroke texture corresponding to each of the image regions.
- the determining unit includes:
- a convolution subunit configured to perform full-picture convolution on the grayscale image to obtain a first convolution result of each pixel
- Determining a subunit configured to convolve a first number of directions of the current convolution result of the current pixel for each pixel, and obtain a second of each direction of the current pixel in the preset number of directions As a result of the convolution, a direction corresponding to a maximum value of the second convolution results of the preset number of directions is taken as a stroke direction of the current pixel.
- the apparatus further includes: a coloring unit 601, configured to acquire color information of the original image, according to The color information colors the image of the pencil drawing style.
- An apparatus for image processing provided by an embodiment of the present invention can be implemented on a mobile terminal such as a mobile phone.
- the embodiment of the present invention provides a readable medium, including an execution instruction, when the processor of the storage controller executes the execution instruction, the storage controller performs an image processing according to any one of the embodiments of the present invention. Methods.
- An embodiment of the present invention provides a storage controller, including: a processor, a memory, and a bus;
- the memory is configured to store an execution instruction
- the processor is connected to the memory through the bus, and when the storage controller is running, the processor executes the execution instruction stored in the memory to make
- the storage controller performs a method of image processing according to any one of the embodiments of the present invention.
- the gray image of the original image is extracted, and the corresponding contour image is generated according to the gray image to form a basic outline of the last generated pencil drawing style image, and the contour is formed according to the gray level of each pixel.
- the image is divided into individual image regions, and the corresponding brush stroke texture is filled in the image region, so that the finally generated pencil-painted image is more full on the basis of the basic contour, and is closer to the real pencil drawing, and provides the pencil drawing style corresponding to the original image.
- the pencil drawing effect of the picture is applied to the picture.
- the stroke texture of each image region is determined by the magnitude of the gray value of each image region, so that the darker region is filled with the stroke texture with a larger line density, so that the strokes of the respective image regions are made.
- the texture is closer to the style of the real pencil drawing, which further enhances the pencil drawing effect of the pencil-style image corresponding to the original image.
- the stroke direction is set in the stroke texture, and the stroke texture is filled into the corresponding image area according to the stroke direction, so that the generated pencil style image is closer to the hand drawn pencil drawing, and the pencil drawing effect is better.
- the stroke texture is preset, and the preset stroke texture is filled into the corresponding image region to generate a pencil-drawn image corresponding to the original image, and the calculation amount is small, and the processing speed is fast.
- the generated pencil stroke style image can have the pencil stroke and the highlight shadow effect of the generated pencil stroke style, which is closer to the real pencil drawing, and the pencil drawing effect is better.
- the calculation amount can be greatly reduced, the required computing resources are less, and can be implemented on a mobile terminal such as a mobile phone, which can achieve real-time effects and can achieve better results. Pencil drawing effect.
- the disclosed systems, devices, and methods may be implemented in other manners.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
- the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the image processing method and apparatus of the embodiment of the present invention avoids processing of a large number of redundant image signals, and simplifies the calculation amount of image processing. It can be widely applied to smart mobile terminal devices to improve the efficiency of human-computer interaction process.
Landscapes
- Image Generation (AREA)
- Image Processing (AREA)
- Processing Or Creating Images (AREA)
Abstract
一种图像处理的方法及装置,该方法,包括:预先设置至少一个笔触纹理;对原始图像进行灰度化处理,生成所述原始图像对应的灰度图像;提取所述灰度图像的边缘,生成所述灰度图像对应的轮廓图像;根据所述灰度图像中每个像素的灰度值,将所述轮廓图像分成至少一个图像区域;确定每个所述图像区域对应的笔触纹理;将每个所述图像区域对应的所述笔触纹理填充到对应的所述图像区域中,生成所述原始图像对应的铅笔画风格的图像。能够提高铅笔画风格的图片的铅笔画效果。
Description
本发明是要求由申请人提出的,申请日为2017年02月27日,申请号为CN201710109287.5,名称为“一种图像处理的方法及装置”的申请的优先权。以上申请的全部内容通过整体引用结合于此。
本发明涉及图像处理技术领域,特别涉及一种图像处理的方法及装置。
图片的铅笔画风格化是非真实绘制的一个重要方向,目的是对现实世界的图片进行处理,得到类似于人工手绘的铅笔画效果。
现有技术中,主要通过边缘提取的方法来生成原始图片的铅笔画风格的图片。具体地,对原始图片进行边缘提取,将原始图片的图像边缘作为结果输出。
通过上述描述可见,现有技术得到的铅笔画风格的图片缺少铅笔画的笔触纹理,无法体现原始图片的明暗对比等特征,铅笔画效果较差。
发明内容
本发明实施例提供了一种图像处理的方法及装置,能够提高铅笔画风格的图片的铅笔画效果。
一方面,本发明实施例提供了一种图像处理的方法,包括:预先设置至少一个笔触纹理;
对原始图像进行灰度化处理,生成所述原始图像对应的灰度图像;
提取所述灰度图像的边缘,生成所述灰度图像对应的轮廓图像;
根据所述灰度图像中每个像素的灰度值,将所述轮廓图像分成至少一个图像区域;
确定所述至少一个图像区域中的每个图像区域对应的笔触纹理;
将所述图像区域对应的所述笔触纹理填充到对应的所述图像区域中,生成所述原始图像对应的铅笔画风格的图像。
进一步地,该方法进一步包括:预先设置灰度等级与所述笔触纹理的对应关系;
所述确定所述至少一个图像区域中的每个图像区域对应的笔触纹理,包括:
根据所述图像区域中每个像素的灰度值,确定所述图像区域的灰度等级;
根据所述对应关系和所述图像区域的灰度等级,确定所述图像区域对应的所述笔触纹理。
所述确定所述至少一个图像区域中的每个图像区域对应的笔触纹理,包括:
确定所述轮廓图像中每个像素的笔触方向;
根据所述轮廓图像中每个像素的笔触方向,确定所述图像区域对应的笔触纹理的笔触方向;
根据所述图像区域对应的笔触纹理的笔触方向,确定所述图像区域对应的笔触纹理。
进一步地,所述确定所述轮廓图像中所述像素的笔触方向包括:
对所述灰度图像进行全图卷积,获得每个像素的第一卷积结果;
针对每个像素,对当前像素的第一卷积结果取预设数量个方向进行卷积,获取所述当前像 素在所述预设数量个方向中每个方向的第二卷积结果,将所述预设数量个方向的第二卷积结果中的最大值对应的方向作为所述当前像素的笔触方向。
进一步地,在所述生成所述原始图像对应的铅笔画风格的图像之后,进一步包括:
获取所述原始图像的颜色信息;
根据所述颜色信息对所述铅笔画风格的图像上色。
另一方面,本发明实施例提供了一种图像处理的装置,包括:
保存单元,用于保存至少一个笔触纹理;
灰度化单元,用于对原始图像进行灰度化处理,生成所述原始图像对应的灰度图像;
提取单元,用于提取所述灰度图像的边缘,生成所述灰度图像对应的轮廓图像;
划分单元,用于根据所述灰度图像中每个像素的灰度值,将所述轮廓图像分成至少一个图像区域;
确定单元,用于确定所述至少一个图像区域中的每个图像区域对应的笔触纹理;
生成单元,用于将所述图像区域对应的所述笔触纹理填充到对应的所述图像区域中,生成所述原始图像对应的铅笔画风格的图像。
进一步地,该装置进一步包括:设置单元,用于设置灰度等级与所述笔触纹理的对应关系;
所述确定单元,用于根据所述图像区域中每个像素的灰度值,确定所述图像区域的灰度等级,根据所述对应关系和所述图像区域的灰度等级,确定所述图像区域对应的所述笔触纹理。
进一步地,所述确定单元,用于确定所述轮廓图像中每个像素的笔触方向,根据所述像素的笔触方向,确定所述图像区域对应的笔触纹理的笔触方向,根据所述图像区域对应的笔触纹理的笔触方向,确定所述图像区域对应的笔触纹理。
进一步地,所述确定单元,包括:
卷积子单元,用于对所述灰度图像进行全图卷积,获得每个像素的第一卷积结果;
确定子单元,用于针对每个像素,对当前像素的第一卷积结果取预设数量个方向进行卷积,获取所述当前像素在所述预设数量个方向中每个方向的第二卷积结果,将所述预设数量个方向的第二卷积结果中的最大值对应的方向作为所述当前像素的笔触方向。
进一步地,该装置进一步包括:上色单元,用于获取所述原始图像的颜色信息,根据所述颜色信息对所述铅笔画风格的图像上色。
另一方面,本发明实施例提供了一种存储控制器,包括处理器和存储器,
所述存储器用于存储上述的图像处理的方法的执行指令;
所述处理器用于执行所述存储器存储的所述执行指令。
在本发明实施例中,提取出原始图像的灰度图像,根据灰度图像生成对应的轮廓图像,形成最后生成的铅笔画风格的图像的基础轮廓,按照每个像素的灰度,将轮廓图像分成各个图像区域,在图像区域中填充上对应的笔触纹理,使得最后生成的铅笔画风格的图像在基础轮廓的基础上内容更加丰满,更加接近真实的铅笔画,提供了原始图像对应的铅笔画风格的图片的铅笔画效果。
附图简要说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明一实施例提供的一种图像处理的方法的流程图;
图2是本发明一实施例提供的另一种图像处理的方法的流程图;
图3是本发明一实施例提供的一种图像处理的装置的示意图;
图4是本发明一实施例提供的另一种图像处理的装置的示意图;
图5是本发明一实施例提供的又一种图像处理的装置的示意图;
图6是本发明一实施例提供的再一种图像处理的装置的示意图。
实施本发明的方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例,基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。
如图1所示,本发明实施例提供了一种图像处理的方法,该方法可以包括以下步骤:
步骤101:预先设置至少一个笔触纹理;
步骤102:对原始图像进行灰度化处理,生成所述原始图像对应的灰度图像;
步骤103:提取所述灰度图像的边缘,生成所述灰度图像对应的轮廓图像;
步骤104:根据所述灰度图像中每个像素的灰度值,将所述轮廓图像分成至少一个图像区域;
步骤105:确定每个所述图像区域对应的笔触纹理;
步骤106:将每个所述图像区域对应的所述笔触纹理填充到对应的所述图像区域中,生成所述原始图像对应的铅笔画风格的图像。
在本发明实施例中,提取出原始图像的灰度图像,根据灰度图像生成对应的轮廓图像,形成最后生成的铅笔画风格的图像的基础轮廓,按照每个像素的灰度,将轮廓图像分成各个图像区域,在图像区域中填充上对应的笔触纹理,使得最后生成的铅笔画风格的图像在基础轮廓的基础上内容更加丰满,更加接近真实的铅笔画,提供了原始图像对应的铅笔画风格的图片的铅笔画效果。
为了能够进一步提高原始图像对应的铅笔画风格的图像的铅笔画效果,在本发明一实施例中,该方法进一步包括:预先设置灰度等级与所述笔触纹理的对应关系;
所述确定每个所述图像区域对应的笔触纹理,包括:
根据每个所述图像区域中每个所述像素的灰度值,确定每个所述图像区域的灰度等级;
根据所述对应关系和每个所述图像区域的灰度等级,确定每个所述图像区域对应的所述笔触纹理。
在本发明实施例中,可以按照线条密度预先设置各个笔触纹理,举例来说,第一笔触纹理的线条密度在预设的第一范围内,第二笔触纹理的线条密度在预设的第二范围内,第三笔触纹理的线条密度在预设的第三范围内。另外,可以根据图像区域中的每个像素的灰度值,对图像区域划分灰度等级。举例来说,灰度等级1对应的灰度值范围是[0,70],灰度等级2对应的灰度值范围是(70,150],灰度等级3对应的灰度值范围是(150,255],其中,在确定图像区域的灰度值时,可以将该图像区域的各个像素的灰度值的平均值作为该图像区域的灰度值。例如:图像区域A的各个像素的灰度值的平均值为90,则图像区域A的灰度等级为灰度等级2。假设灰度等级2对应的笔触纹理为第二笔触纹理。在设置对应关系是,灰度值范围中的最大值越小,对应的笔触纹理的线条密度越高。
在本发明实施例中,通过各个图像区域的灰度值的大小来确定各个图像区域的笔触纹理,能够使得颜色较深的区域填充线条密度较大的笔触纹理,使得各个图像区域的笔触纹理更加接近真实的铅笔画的风格,进一步提高了原始图像对应的铅笔画风格的图像的铅笔画效果。
为了更加接近真实的铅笔画,可以设置在每个笔触纹理中的线条就有某个笔触方向,例如:从左下到右上、从左上到右下、从右上到左下、从右下到左上等。其中,线条的起始端颜色较终点端深。例如:笔触方向为从左下到右上的线条,左下的颜色较深,右上的颜色较浅。
为了进一步提高原始图像对应的铅笔画风格的图像的铅笔画效果,在本发明一实施例中,所述确定每个所述图像区域对应的笔触纹理,包括:
确定所述轮廓图像中每个所述像素的笔触方向;
根据每个所述像素的笔触方向,确定每个所述图像区域对应的笔触纹理的笔触方向;
根据每个所述图像区域对应的笔触纹理的笔触方向,确定每个所述图像区域对应的笔触纹理。
在本发明实施例中,在确定每个图像区域对应的笔触纹理的笔触方向时,可以根据当前图像区域中每个笔触方向对应的像素数来确定,具体地,将对应的像素数最多的笔触方向作为当前图像区域的笔触方向。举例来说,在图像区域A中,有10个像素的笔触方向为笔触方向1,有20个像素的笔触方向为笔触方向2,有300个像素的笔触方向为笔触方向3,那么,笔触方向为图像区域A的笔触方向。在确定出当前图像区域对应的笔触纹理的笔触方向后,可以从预先设置的至少一个笔触纹理中,找出与当前图像区域对应的笔触纹理的笔触方向相同的目标笔触纹理,将该目标笔触纹理作为当前图像区域对应的笔触纹理。
在本发明实施例中,将图像区域中的每个像素的笔触方向,通过填充的笔触纹理来体现,使得生成的铅笔画风格的图像的铅笔画效果更好。
在本发明一实施例中,所述确定所述轮廓图像中每个所述像素的笔触方向,包括:对所述灰度图像进行全图卷积,获得每个像素的第一卷积结果;
针对每个像素,对当前像素的第一卷积结果取预设数量个方向进行卷积,获取所述当前像素在所述预设数量个方向中每个方向的第二卷积结果,将所述预设数量个方向的第二卷积结果中的最大值对应的方向作为所述当前像素的笔触方向。
在本发明实施例中,每个笔触纹理携带有笔触方向的信息,也就是说,每个笔触纹理中的线条具有一定的方向,例如:笔触纹理1的笔触方向为从左下到右上。
在本发明实施例中,对待处理图像的灰度图像进行全图卷积,得到每个像素之间的明暗关系。在确定出笔触方向后,还可以对笔触方向做均值抽希,从而保证图像不出现反复变化的情况。
举例来说,针对像素A,在确定像素A的笔触方向时,可以通过以下方式来实现:预先设置三个笔触纹理,其中,笔触纹理1的笔触方向为笔触方向1,笔触纹理2的笔触方向为笔触方向2,笔触纹理3的笔触方向为笔触方向3。确定像素A在方向1上的第二卷积结果1,确定像素A在方向2上的第二卷积结果2,确定像素A在方向3上的第二卷积结果3,如果这三个响应值中,第二卷积结果2最大,那么,第二卷积结果2对应的方向2为像素A的笔触方向。
在本发明一实施例中,该方法还可以包括:确定出每个像素的卷积核,确定轮廓图像中每个像素的梯度值;针对每个像素,根据当前像素的笔触方向、当前像素的笔触方向上的卷积核以及当前像素的周边像素的梯度值,强化当前像素的在对应的笔触方向上的响应,同时也降低了梯度计算带来的噪声。
为了使得原始图像对应的铅笔画风格的图像的效果更好,在本发明一实施例中,在所述生成所述原始图像对应的铅笔画风格的图像之后,进一步包括:
获取所述原始图像的颜色信息;
根据所述颜色信息对所述铅笔画风格的图像上色。
在本发明实施例中,原始图像的颜色信息可以是原始图像中每个像素的RGB信息。通过对原始图像对应的铅笔画风格的图像上色,可以使得该铅笔画风格的图像更加美观,也能够携带更多原始图像的信息。
如图2所示,本发明实施例提供了一种图像处理的方法,该方法可以包括以下步骤:
步骤201:预先设置至少一个笔触纹理,每个笔触纹理设置有对应的笔触方向。
在本实施例中,每个笔触纹理可以包括两种特征:线条密度和笔触方向。
笔触纹理可以通过纹理贴图的方式来实现。
基于线条密度,笔触纹理可以包括纯黑、纯白、斜线,其中,纯黑的笔触纹理中的线条的线条密度大于斜线的笔触纹理中的线条的线条密度,斜线的笔触纹理中的线条的线条密度大于纯白的笔触纹理中的线条的线条密度。
其中,每种线条密度可以与各个笔触方向结合构成笔触纹理,例如:笔触纹理1的线条密度为线条密度A,笔触方向为方向A;笔触纹理2的线条密度为线条密度A,笔触方向为方向B;笔触纹理3的线条密度为线条密度A,笔触方向为方向C等。
为了使得各种原始图像对应的铅笔画风格的图像的铅笔画效果更好,可以将各种线条密度与各种笔触方向结合,构成多种笔触纹理,以满足各种原始图像。
举例来说,一种实现方式为:预先六个笔触纹理,其中,笔触纹理1的线条密度为线条密度A,笔触方向为方向A;笔触纹理2的线条密度为线条密度A,笔触方向为方向B;笔触纹理3的线条密度为线条密度B,笔触方向为方向A;笔触纹理4的线条密度为线条密度B,笔触方向为方向B;笔触纹理5的线条密度为线条密度C,笔触方向为方向A;笔触纹理6的线条密度为线条密度C,笔触方向为方向B。
步骤202:预先设置灰度等级与笔触纹理的对应关系。
图像的灰度等级在笔触纹理上通过线条密度来反应。灰度等级可以通过灰度值范围来划分。
另外,在划分灰度等级时,将照片的色调曲线与铅笔画的灰度直方图匹配,使其符合铅笔画的灰度分布规律,然后结合图像区域的灰度值范围进行分级。
举例来说,可以将灰度等级分为三级,分别是灰度等级1、灰度等级2、灰度等级3。线条密度A与灰度等级1对应、线条密度B与灰度等级2对应、线条密度C与灰度等级3对应,也就是,笔触纹理1与灰度等级1对应,笔触纹理2与灰度等级1对应,笔触纹理3与灰度等级2对应,笔触纹理4与灰度等级2对应,笔触纹理5与灰度等级3对应,笔触纹理6与灰度等级3对应。
步骤203:对原始图像进行灰度化处理,生成原始图像对应的灰度图像。
步骤204:提取灰度图像的边缘,生成灰度图像对应的轮廓图像。
具体地,可以通过拉普拉斯算子提取灰度图像的边缘获得轮廓图像。然后,可以设置合理的阈值,通过该阈值实现廓线拾取的过程。通过该阈值确定出面积比较大的区域,对于面积很小的区域,可以不参与后续处理。
步骤205:根据灰度图像中每个像素的灰度值,将轮廓图像分成至少一个图像区域。
具体地,可以根据灰度值的变化的剧烈程度来划分区域,灰度值突变的地方就是几个区域的边缘。
步骤206:根据每个图像区域中每个像素的灰度值,确定每个图像区域的灰度等级。
具体地,可以将当前图像区域中各个像素的灰度值的平均值作为当前图像区域的灰度值,进而确定当前图像区域属于哪个灰度等级。
举例来说,图像区域A的灰度等级为灰度等级1。
步骤207:确定轮廓图像中每个像素的笔触方向。
具体地,可以通过以下步骤实现:
对所述灰度图像进行全图卷积,获得每个像素的第一卷积结果;
针对每个像素,对当前像素的第一卷积结果取预设数量个方向进行卷积,获取所述当前像素在所述预设数量个方向中每个方向的第二卷积结果,将所述预设数量个方向的第二卷积结果中的最大值对应的方向作为所述当前像素的笔触方向。
步骤208:根据每个像素的笔触方向,确定每个图像区域对应的笔触纹理的笔触方向。
举例来说,图像区域A中笔触方向为方向A的像素点最多,则可以确定图像区域A对应的笔触纹理的笔触方向为方向A。例如:方向A为从左下到右上。
步骤209:根据对应关系、每个图像区域的灰度等级以及每个所述图像区域对应的笔触纹理的笔触方向,确定每个图像区域对应的笔触纹理。
具体地,通过灰度等级和笔触方向两个参数来确定出每个图像区域对应的笔触纹理。
举例来说,对于图像区域A,根据对应关系和图像区域A对应的灰度等级1,可以确定出图像区域A对应的笔触纹理可以是笔触纹理1和笔触纹理2。根据图像区域A对应的笔触纹理的笔触方向为方向A,从笔触纹理1和笔触纹理2中,可以确定出图像区域A对应的笔触纹理为笔触纹理1。
步骤210:将每个图像区域对应的笔触纹理填充到对应的图像区域中,生成原始图像对应的铅笔画风格的图像。
举例来说,针对图像区域A,将图像区域A对应的笔触纹理1填充到图像区域A中。其他的图像区域也填充上对应的笔触纹理,进而得到原始图像对应的铅笔画风格的图像。
另外,该方法还可以包括:获取原始图像的颜色信息;根据颜色信息对原始图像对应的铅笔画风格的图像上色。
具体地,可以获取原始图像中每个像素的颜色,针对原始图像对应的铅笔画风格的图像上的每个像素,根据当前像素对应的原始图像上的像素的颜色信息,为当前像素上色。
举例来说,原始图像上的像素A与原始图像对应的铅笔画风格的图像上的像素C对应,获取原始图像上的像素A的RGB,根据像素A的RGB为像素C上色。
在本发明实施例中,预先设置笔触纹理,将预先设置的笔触纹理填充到对应的图像区域中即可生成原始图像对应的铅笔画风格的图像,计算量较小,处理速度较快。
在本发明实施例中,由于生成原始图像对应的铅笔画风格的图像的计算量较小,处理速度较快,可以实现视频的实时铅笔画处理。具体地,分别将视频中的每一帧作为一个原始图像进行铅笔画处理,得到每一帧对应的铅笔画风格的图像。
在本发明实施例中,通过预先设置的笔触纹理可以使得生成的铅笔画风格的图像具有铅笔画的笔触和高光阴影效果,更接近真实的铅笔画,铅笔画效果更好。
在本发明实施例中,通过对笔触纹理的预先设置,可以大大减少计算量,需要的计算资源较少,能够在手机等移动终端上实现,能够达到实时的效果,并能够取得较好的铅笔画效果。
如图3、图4所示,本发明实施例提供了一种图像处理的装置。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。从硬件层面而言,如图3所示,为本发明实施例提供的一种图像处理的装置所在设备的一种硬件结构图,除了图3所示的处理器、内存、网络接口、以及非易失性存储器之外,实施例中装置所在的设备通常还可以包括其他硬件,如负责处理报文的转发芯片等等。以软件实现为例,如图4所示,作为一个逻辑意义上的装置,是通过其所在设备的CPU将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。本实施例提供的一种图像处理的装置,包括:
保存单元401,用于保存至少一个笔触纹理;
灰度化单元402,用于对原始图像进行灰度化处理,生成所述原始图像对应的灰度图像;
提取单元403,用于提取所述灰度图像的边缘,生成所述灰度图像对应的轮廓图像;
划分单元404,用于根据所述灰度图像中每个像素的灰度值,将所述轮廓图像分成至少一个图像区域;
确定单元405,用于确定每个所述图像区域对应的笔触纹理;
生成单元406,用于将每个所述图像区域对应的所述笔触纹理填充到对应的所述图像区域中,生成所述原始图像对应的铅笔画风格的图像。
基于图4所示的一种图像处理的装置,在本发明一实施例中,如图5所示,该装置进一步包括:设置单元501,用于设置灰度等级与所述笔触纹理的对应关系;
所述确定单元,用于根据每个所述图像区域中每个所述像素的灰度值,确定每个所述图像区域的灰度等级,根据所述对应关系和每个所述图像区域的灰度等级,确定每个所述图像区域对应的所述笔触纹理。
在本发明一实施例中,所述确定单元,用于确定所述轮廓图像中每个所述像素的笔触方向,根据每个所述像素的笔触方向,确定每个所述图像区域对应的笔触纹理的笔触方向,根据每个所述图像区域对应的笔触纹理的笔触方向,确定每个所述图像区域对应的笔触纹理。
在本发明一实施例中,所述确定单元,包括:
卷积子单元,用于对所述灰度图像进行全图卷积,获得每个像素的第一卷积结果;
确定子单元,用于针对每个像素,对当前像素的第一卷积结果取预设数量个方向进行卷积,获取所述当前像素在所述预设数量个方向中每个方向的第二卷积结果,将所述预设数量个方向的第二卷积结果中的最大值对应的方向作为所述当前像素的笔触方向。
基于图4所示的一种图像处理的装置,在本发明一实施例中,如图6所示,该装置进一步包括:上色单元601,用于获取所述原始图像的颜色信息,根据所述颜色信息对所述铅笔画风格的图像上色。
本发明实施例提供的一种图像处理的装置,可以在手机等移动终端上实现。
上述装置内的各单元之间的信息交互、执行过程等内容,由于与本发明方法实施例基于同一构思,具体内容可参见本发明方法实施例中的叙述,此处不再赘述。
本发明实施例提供了一种可读介质,包括执行指令,当存储控制器的处理器执行所述执行指令时,所述存储控制器执行本发明实施例中任一所述的一种图像处理的方法。
本发明实施例提供了一种存储控制器,包括:处理器、存储器和总线;
所述存储器用于存储执行指令,所述处理器与所述存储器通过所述总线连接,当所述存储控制器运行时,所述处理器执行所述存储器存储的所述执行指令,以使所述存储控制器执行本发明实施例中任一所述的一种图像处理的方法。
本发明各个实施例至少具有如下有益效果:
1、在本发明实施例中,提取出原始图像的灰度图像,根据灰度图像生成对应的轮廓图像,形成最后生成的铅笔画风格的图像的基础轮廓,按照每个像素的灰度,将轮廓图像分成各个图像区域,在图像区域中填充上对应的笔触纹理,使得最后生成的铅笔画风格的图像在基础轮廓的基础上内容更加丰满,更加接近真实的铅笔画,提供了原始图像对应的铅笔画风格的图片的铅笔画效果。
2、在本发明实施例中,通过各个图像区域的灰度值的大小来确定各个图像区域的笔触纹理,能够使得颜色较深的区域填充线条密度较大的笔触纹理,使得各个图像区域的笔触纹理更加接近真实的铅笔画的风格,进一步提高了原始图像对应的铅笔画风格的图像的铅笔画效果。
3、在本发明实施例中,在笔触纹理中设置笔触方向,将笔触纹理按照笔触方向填充到对应的图像区域中,使得生成的铅笔画风格的图像更加接近手工绘制的铅笔画,铅笔画效果更好。
4、在本发明实施例中,预先设置笔触纹理,将预先设置的笔触纹理填充到对应的图像区域中即可生成原始图像对应的铅笔画风格的图像,计算量较小,处理速度较快。
5、在本发明实施例中,通过预先设置的笔触纹理可以使得生成的铅笔画风格的图像具有铅笔画的笔触和高光阴影效果,更接近真实的铅笔画,铅笔画效果更好。
6、在本发明实施例中,通过对笔触纹理的预先设置,可以大大减少计算量,需要的计算资源较少,能够在手机等移动终端上实现,能够达到实时的效果,并能够取得较好的铅笔画效果。
需要说明的是,在本文中,诸如第一和第二之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个······”限定的要 素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同因素。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序校验码的介质。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。
本发明实施例的图像处理的方法和装置,避免了大量冗余图像信号的处理,精简了图像处理的运算量。可以普遍应用于智能移动终端设备,改善人机交互过程的效率。
Claims (11)
- 一种图像处理的方法,其特征在于,预先设置至少一个笔触纹理,包括:对原始图像进行灰度化处理,生成所述原始图像对应的灰度图像;提取所述灰度图像的边缘,生成所述灰度图像对应的轮廓图像;根据所述灰度图像中每个像素的灰度值,将所述轮廓图像分成至少一个图像区域;确定所述至少一个图像区域中的每个图像区域对应的笔触纹理;将所述图像区域对应的所述笔触纹理填充到对应的所述图像区域中,生成所述原始图像对应的铅笔画风格的图像。
- 根据权利要求1所述图像处理的方法,其特征在于,进一步包括:预先设置灰度等级与所述笔触纹理的对应关系;所述确定所述至少一个图像区域中的每个图像区域对应的笔触纹理,包括:根据所述图像区域中每个像素的灰度值,确定所述图像区域的灰度等级;根据所述对应关系和所述图像区域的灰度等级,确定所述图像区域对应的所述笔触纹理。
- 根据权利要求1所述图像处理的方法,其特征在于,所述确定所述至少一个图像区域中的每个图像区域对应的笔触纹理,包括:确定所述轮廓图像中每个像素的笔触方向;根据所述轮廓图像中每个像素的笔触方向,确定所述图像区域对应的笔触纹理的笔触方向;根据所述图像区域对应的笔触纹理的笔触方向,确定所述图像区域对应的笔触纹理。
- 根据权利要求3所述图像处理的方法,其特征在于,所述确定所述轮廓图像中每个像素的笔触方向,包括:对所述灰度图像进行全图卷积,获得每个像素的第一卷积结果;针对每个像素,对当前像素的第一卷积结果取预设数量个方向进行卷积,获取所述当前像素在所述预设数量个方向中每个方向的第二卷积结果,将所述预设数量个方向的第二卷积结果中的最大值对应的方向作为所述当前像素的笔触方向。
- 根据权利要求1-4中任一所述图像处理的方法,其特征在于,在所述生成所述原始图像对应的铅笔画风格的图像之后,进一步包括:获取所述原始图像的颜色信息;根据所述颜色信息对所述铅笔画风格的图像上色。
- 一种图像处理的装置,其特征在于,包括:保存单元,用于保存至少一个笔触纹理;灰度化单元,用于对原始图像进行灰度化处理,生成所述原始图像对应的灰度图像;提取单元,用于提取所述灰度图像的边缘,生成所述灰度图像对应的轮廓图像;划分单元,用于根据所述灰度图像中每个像素的灰度值,将所述轮廓图像分成至少一个图像区域;确定单元,用于确定所述至少一个图像区域中的每个图像区域对应的笔触纹理;生成单元,用于将所述图像区域对应的所述笔触纹理填充到对应的所述图像区域中,生成所述原始图像对应的铅笔画风格的图像。
- 根据权利要求6所述图像处理的装置,其特征在于,进一步包括:设置单元,用于设置灰度等级与所述笔触纹理的对应关系;所述确定单元,用于根据所述图像区域中每个像素的灰度值,确定所述图像区域的灰度等级,根据所述对应关系和所述图像区域的灰度等级,确定所述图像区域对应的所 述笔触纹理。
- 根据权利要求6所述图像处理的装置,其特征在于,所述确定单元,用于确定所述轮廓图像中每个像素的笔触方向,根据所述像素的笔触方向,确定所述图像区域对应的笔触纹理的笔触方向,根据所述图像区域对应的笔触纹理的笔触方向,确定所述图像区域对应的笔触纹理。
- 根据权利要求8所述图像处理的装置,其特征在于,所述确定单元,包括:卷积子单元,用于对所述灰度图像进行全图卷积,获得每个像素的第一卷积结果;确定子单元,用于针对每个像素,对当前像素的第一卷积结果取预设数量个方向进行卷积,获取所述当前像素在所述预设数量个方向中每个方向的第二卷积结果,将所述预设数量个方向的第二卷积结果中的最大值对应的方向作为所述当前像素的笔触方向。
- 根据权利要求6-9中任一所述图像处理的装置,其特征在于,进一步包括:上色单元,用于获取所述原始图像的颜色信息,根据所述颜色信息对所述铅笔画风格的图像上色。
- 一种存储控制器,包括处理器和存储器,其特征在于,所述存储器用于存储如权利要求1至5任一所述图像处理的方法的执行指令;所述处理器用于执行所述存储器存储的所述执行指令。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710109287.5 | 2017-02-27 | ||
CN201710109287.5A CN106846390B (zh) | 2017-02-27 | 2017-02-27 | 一种图像处理的方法及装置 |
Publications (2)
Publication Number | Publication Date |
---|---|
WO2018153264A1 true WO2018153264A1 (zh) | 2018-08-30 |
WO2018153264A9 WO2018153264A9 (zh) | 2018-10-11 |
Family
ID=59133622
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/075676 WO2018153264A1 (zh) | 2017-02-27 | 2018-02-07 | 一种图像处理的方法及装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106846390B (zh) |
WO (1) | WO2018153264A1 (zh) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106846390B (zh) * | 2017-02-27 | 2020-10-13 | 迈吉客科技(北京)有限公司 | 一种图像处理的方法及装置 |
CN109087371B (zh) * | 2018-07-16 | 2023-06-30 | 深圳市智能机器人研究院 | 一种控制机器人画像的方法及系统 |
CN109523603B (zh) * | 2018-10-24 | 2022-12-02 | 广东智媒云图科技股份有限公司 | 一种基于皴法风格的绘画方法、装置、终端设备及存储介质 |
WO2020124603A1 (zh) * | 2018-12-21 | 2020-06-25 | 深圳市柔宇科技有限公司 | 一种绘图方法、绘图装置及电子设备 |
CN110070495B (zh) * | 2019-02-20 | 2021-09-17 | 北京字节跳动网络技术有限公司 | 图像的处理方法、装置和电子设备 |
CN110751703B (zh) * | 2019-10-22 | 2023-05-16 | 广东智媒云图科技股份有限公司 | 一种绕线画生成方法、装置、设备及存储介质 |
CN110738712B (zh) * | 2019-10-24 | 2023-07-25 | 广东智媒云图科技股份有限公司 | 一种几何图案重构方法、装置、设备及存储介质 |
CN111784562B (zh) * | 2020-06-12 | 2024-01-26 | 齐鲁工业大学 | 一种绕线画自动生成算法 |
CN112070854B (zh) * | 2020-09-02 | 2023-08-08 | 北京字节跳动网络技术有限公司 | 一种图像生成方法、装置、设备及存储介质 |
CN113470138B (zh) * | 2021-06-30 | 2024-05-24 | 维沃移动通信有限公司 | 图像的生成方法、装置、电子设备及可读存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7567715B1 (en) * | 2004-05-12 | 2009-07-28 | The Regents Of The University Of California | System and method for representing and encoding images |
US20130121613A1 (en) * | 2009-09-04 | 2013-05-16 | Holger Winnemoeller | Methods and Apparatus for Directional Texture Generation Using Image Warping |
CN104915976A (zh) * | 2015-06-03 | 2015-09-16 | 厦门美图之家科技有限公司 | 一种模拟铅笔素描的图像处理方法和系统 |
CN105374007A (zh) * | 2015-12-02 | 2016-03-02 | 华侨大学 | 融合骨架笔画和纹理特征的铅笔画生成方法和装置 |
CN106023276A (zh) * | 2016-05-13 | 2016-10-12 | 云南大学 | 基于图像处理的铅笔画绘制方法及装置 |
CN106846390A (zh) * | 2017-02-27 | 2017-06-13 | 迈吉客科技(北京)有限公司 | 一种图像处理的方法及装置 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6657642B1 (en) * | 1997-07-03 | 2003-12-02 | International Business Machines Corporation | User interactive display interfaces with means for interactive formation of combination display objects representative of combined interactive functions |
CN102572219B (zh) * | 2012-01-19 | 2014-12-24 | 西安联客信息技术有限公司 | 移动终端及其图像处理方法 |
CN103793930A (zh) * | 2014-01-27 | 2014-05-14 | 汉王科技股份有限公司 | 铅笔画图像生成方法及装置 |
-
2017
- 2017-02-27 CN CN201710109287.5A patent/CN106846390B/zh active Active
-
2018
- 2018-02-07 WO PCT/CN2018/075676 patent/WO2018153264A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7567715B1 (en) * | 2004-05-12 | 2009-07-28 | The Regents Of The University Of California | System and method for representing and encoding images |
US20130121613A1 (en) * | 2009-09-04 | 2013-05-16 | Holger Winnemoeller | Methods and Apparatus for Directional Texture Generation Using Image Warping |
CN104915976A (zh) * | 2015-06-03 | 2015-09-16 | 厦门美图之家科技有限公司 | 一种模拟铅笔素描的图像处理方法和系统 |
CN105374007A (zh) * | 2015-12-02 | 2016-03-02 | 华侨大学 | 融合骨架笔画和纹理特征的铅笔画生成方法和装置 |
CN106023276A (zh) * | 2016-05-13 | 2016-10-12 | 云南大学 | 基于图像处理的铅笔画绘制方法及装置 |
CN106846390A (zh) * | 2017-02-27 | 2017-06-13 | 迈吉客科技(北京)有限公司 | 一种图像处理的方法及装置 |
Also Published As
Publication number | Publication date |
---|---|
WO2018153264A9 (zh) | 2018-10-11 |
CN106846390A (zh) | 2017-06-13 |
CN106846390B (zh) | 2020-10-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018153264A1 (zh) | 一种图像处理的方法及装置 | |
CN110956654B (zh) | 图像处理方法、装置、设备及存储介质 | |
JP7175197B2 (ja) | 画像処理方法および装置、記憶媒体、コンピュータ装置 | |
Du et al. | Saliency-guided color-to-gray conversion using region-based optimization | |
US11138695B2 (en) | Method and device for video processing, electronic device, and storage medium | |
CN108431751B (zh) | 背景去除 | |
CN101155248B (zh) | 图像处理设备及产生轮廓图像数据的方法 | |
JPH11250267A (ja) | 目の位置検出方法、目の位置検出装置および目の位置検出プログラムを記録した記録媒体 | |
CN110110829B (zh) | 一种二维码处理方法及装置 | |
WO2017173578A1 (zh) | 一种图像增强方法及装置 | |
CN113052923A (zh) | 色调映射方法、装置、电子设备和存储介质 | |
WO2019128459A1 (zh) | 图像阴影消除方法和装置 | |
WO2019209751A1 (en) | Superpixel merging | |
CN114862694A (zh) | 一种保证图像质量的高动态范围图像重建方法及装置 | |
WO2021197230A1 (zh) | 三维头部模型的构建方法、装置、系统及存储介质 | |
CN111160240A (zh) | 图像对象的识别处理方法、装置及智能设备、存储介质 | |
Liu et al. | Shadow removal of text document images using background estimation and adaptive text enhancement | |
CN107564085B (zh) | 图像扭曲处理方法、装置、计算设备及计算机存储介质 | |
CN109448093B (zh) | 一种风格图像生成方法及装置 | |
CN111462294B (zh) | 一种图像处理方法、电子设备及计算机可读存储介质 | |
CN111259744B (zh) | 一种基于皮肤模型和svm分类器的人脸检测方法及其装置 | |
CN115661322B (zh) | 人脸纹理图像的生成方法、装置 | |
CN114820349B (zh) | 图像处理方法、装置、电子设备及存储介质 | |
CN112435173A (zh) | 一种图像处理和直播方法、装置、设备和存储介质 | |
CN111583163B (zh) | 基于ar的人脸图像处理方法、装置、设备及存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18756932 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 10.12.2019) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18756932 Country of ref document: EP Kind code of ref document: A1 |