WO2021000414A1 - 图像生成方法、装置、计算机设备及存储介质 - Google Patents
图像生成方法、装置、计算机设备及存储介质 Download PDFInfo
- Publication number
- WO2021000414A1 WO2021000414A1 PCT/CN2019/103544 CN2019103544W WO2021000414A1 WO 2021000414 A1 WO2021000414 A1 WO 2021000414A1 CN 2019103544 W CN2019103544 W CN 2019103544W WO 2021000414 A1 WO2021000414 A1 WO 2021000414A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- deformation
- deformed
- cartoon
- image
- preset
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 230000001815 facial effect Effects 0.000 claims abstract description 67
- 230000009466 transformation Effects 0.000 claims description 57
- 238000010422 painting Methods 0.000 claims description 35
- 238000004364 calculation method Methods 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 8
- 230000005855 radiation Effects 0.000 claims description 6
- 238000006243 chemical reaction Methods 0.000 claims description 4
- 238000010606 normalization Methods 0.000 claims description 3
- 210000004709 eyebrow Anatomy 0.000 description 10
- 238000013507 mapping Methods 0.000 description 8
- 210000000056 organ Anatomy 0.000 description 6
- 230000000694 effects Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 241001465754 Metazoa Species 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000002054 transplantation Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/18—Image warping, e.g. rearranging pixels individually
-
- 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/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
-
- 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
-
- 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/30—Subject of image; Context of image processing
- G06T2207/30196—Human being; Person
- G06T2207/30201—Face
Definitions
- This application relates to the computer field, in particular to image generation methods, devices, computer equipment and storage media.
- OpenCV is lightweight and efficient—consisting of a series of C functions and a small number of C++ classes, it also provides interfaces to languages such as Python, Ruby, MATLAB, etc. It implements many common algorithms in image processing and computer vision, plus its open source Features, properly handled, no need to add new external support can also be completely compiled and linked to generate executive programs, so many people use it to do algorithm transplantation.
- the main purpose of this application is to provide an image generation method, which aims to solve the technical problem that the existing OpenCV has an interface to directly obtain a sketch image, but does not have a face deformation function.
- This application proposes an image generation method, including:
- a deformed cartoon painting is generated through deformation within a preset deformation range according to preset rules, where the preset deformation range is a deformation range corresponding to the deformation distance.
- This application also provides an image generation device, including:
- a collection module configured to collect a first number of facial contour points and a second number of facial feature points in a preset facial image, wherein the first number is greater than the second number;
- the receiving module is used to receive the deformation starting point selected by the user from the facial feature points and the deformation ending point selected from the facial contour points corresponding to the deformation starting point one-to-one;
- An obtaining module is used to obtain the deformation distance between each deformation start point and its corresponding deformation end point;
- the generating module is used to generate a deformed cartoon painting through deformation according to preset rules within a preset deformation range, where the preset deformation range is a deformation range corresponding to the deformation distance.
- the present application also provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of the foregoing method when the computer program is executed.
- the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to realize the steps of the above method.
- the feature points corresponding to the corners of the eyes or the corners of the mouth are deformed to a specified position, and then the feature points corresponding to the corners of the eye or the corner of the mouth and other points in the area between the specified positions are deformed according to the corresponding deformation factors to realize the face Image deformation cartoon production.
- This application adjusts according to the gray image corresponding to the deformed cartoon, so as to realize the corresponding adjustment following the original gray gradient of the deformed cartoon, so as to maintain the display effect corresponding to the original gradient of the deformed cartoon, and control through the parameter alpha
- the depth of the strokes of the deformed cartoon the larger the parameter alpha value, the deeper the strokes.
- This application obtains the grayscale image of the deformed cartoon drawing, that is, the sketch image, by directly outputting and saving out.
- a colored deformed cartoon can be obtained.
- the grayscale and color deformed cartoons can be obtained at the same time to satisfy more users. demand.
- FIG. 1 is a schematic flowchart of an image generation method according to an embodiment of the present application
- Fig. 2 is a schematic structural diagram of an image generating device according to an embodiment of the present application.
- Fig. 3 is a schematic diagram of the internal structure of a computer device according to an embodiment of the present application.
- an image generation method includes:
- S1 Collect a first number of facial contour points and a second number of facial feature points in a preset facial image, where the first number is greater than the second number.
- the preset facial image includes images with identification feature points, such as a human face image, an animal face image, and the like, and the above identification feature points are feature points that can distinguish between individuals.
- the first number in this embodiment satisfies the number of all facial contour points that can highlight the entire face contour.
- the first number range in this embodiment is greater than or equal to 68, so as to better determine the facial contour and face
- the deformation boundary and deformation feature points included in the contour are points corresponding to various organs that identify facial features, such as mapping points for organs such as eyes, mouth, nose, and eyebrows.
- S2 Receive the deformation starting point selected by the user from the facial feature points, and the deformation ending point selected from the facial contour points that corresponds to the deformation starting point one-to-one.
- the recognizable organ mapping point is the deformation starting point, that is, the deformation starting point is included in the facial feature points, such as the mapping point corresponding to the corner of the mouth and the corresponding corner of the eye Mapping points, etc.
- This embodiment is to highlight the abstract cartoon effect of the deformed cartoon drawing, and the deformation end point corresponding to the deformation starting point one by one is the face contour point or the point near the face contour point.
- the deformation distance in this embodiment is the distance between the deformation start point and the corresponding deformation end point.
- the face image is mapped on a two-dimensional coordinate system plane so as to pass through points in the two-dimensional coordinate system. Identify each image point in the facial image, including facial contour points and facial feature points.
- S4 Generate a deformed cartoon painting through deformation according to preset rules within a preset deformation range, where the preset deformation range is a deformation range corresponding to the deformation distance.
- the feature point corresponding to the corner of the eye or the mouth is deformed to a designated position, and then the feature point corresponding to the corner of the eye or the corner of the mouth and other points in the area between the designated positions are deformed according to the corresponding deformation factor.
- the aforementioned deformation distance is the distance between the characteristic point corresponding to the corner of the eye or the mouth and the designated position before deformation
- the deformation range corresponding to the aforementioned deformation distance is an area with the deformation starting point as the center and the aforementioned deformation distance as the radius.
- step S4 of generating a deformed cartoon painting through deformation according to a preset rule within a preset deformation range includes:
- the corresponding coordinates of the characteristic point of the deformation start point are changed to the coordinates corresponding to the deformation end point, so that the deformation start point and the deformation end point are overlapped, and then the deformation start point is positioned at the deformation end point.
- the other characteristic points of the deformation area between the starting point and the deformation end point are deformed according to the transformation factor to achieve smooth deformation, instead of simply pulling the deformation start point to the deformation end point, so as to be able to draw from the deformed cartoon.
- the original feature point corresponding to the characteristic contour image of the individual is recognized, that is, the deformed face image can still be recognized as a face image, but the face image cannot be recognized as a face image after the deformation.
- the above transformation factor is related to the coordinates of the two points of the deformation start point and the deformation end point. For a pair of the deformation start point and the deformation end point, there will be a corresponding transformation factor. When the facial feature image contains multiple pairs of transformation starting points and transformation ending points, multiple transformation factors will appear. In the process of realizing the image transformation, the transformation will be carried out according to the respective transformation factors to obtain the final transformation cartoon. .
- the face image includes four pairs of deformation start points and deformation end points.
- the first pair of deformation start points are the feature points corresponding to the corner of the left mouth
- the first pair of deformation end points are the feature points corresponding to the left cheek, and its corresponding transformation
- the transformation factor is the first transformation factor, and the radius of the deformation area affected by the first transformation factor is
- the second pair of deformation starting points are the characteristic points corresponding to the right mouth corner, and the second pair of deformation ends
- the point is the characteristic point corresponding to the right cheek, and its corresponding transformation factor is the second transformation factor.
- the radius of the deformation area affected by the second transformation factor is
- the third pair of deformation starting points Is the characteristic point corresponding to the left eye corner,
- the third pair of deformation termination points are the characteristic points corresponding to the left eyebrow, and the corresponding transformation factor is the third transformation factor.
- the radius of the deformation area affected by the third transformation factor is
- the fourth pair of deformation starting points are the characteristic points corresponding to the right eye corners, and the third pair of deformation ending points are the characteristic points corresponding to the right eyebrows.
- the corresponding transformation factor is the fourth transformation factor, and the fourth transformation
- the radius of the deformation area affected by the factor is
- step S43 of outputting the deformed cartoon image obtained through image deformation the method includes:
- S431 Determine whether the picture brightness of the deformed cartoon painting meets a preset requirement.
- the brightness value of the picture can be automatically adjusted according to the preset picture brightness requirement, so that the picture meets the brightness demand and improves the display clarity of the deformed cartoon.
- step S432 of adjusting the brightness value of the deformed cartoon according to the preset brightness adjustment method includes:
- S4322 Calculate the grayscale gradient in the grayscale image according to the preset calculation method.
- the deformed cartoon painting img_yuv in the YUV format by obtaining the deformed cartoon painting img_yuv in the YUV format, only the dimension of Y is obtained, the grayscale image img_y of img_yuv is obtained, and the sketch map of the deformed cartoon painting is obtained by obtaining the grayscale image and then using the grayscale image to obtain the gradient.
- step S4323 of adjusting the brightness value of the deformed cartoon according to the gray gradient to obtain the deformed cartoon after adjusting the brightness value includes:
- S43231 Obtain the radiation angle el of the light source, the azimuth angle az of the light source, and the normalized gradient value of the gray gradient.
- the gradient value is calculated according to the preset gradient calculation method, for example, the difference obtained by subtracting the previous pixel value from the next pixel value is the gradient, and the next pixel value is adjacent to the previous pixel value, or the next pixel
- the value and the previous pixel value are separated by a specified number of pixel values.
- the x-axis gradient value and the y-axis gradient value of the grayscale image img_y are respectively calculated, and the corresponding values are expressed as grad_x and grad_y, multiplied by the parameter alpha, where the parameter alpha is an experience
- the value ranges from 1 to 10 so as to control the depth of strokes by adjusting the parameter alpha.
- grad_x grad_x ⁇ *alpha
- grad_y grad_y ⁇ *alpha
- set grad_z 1
- grad_x ⁇ and grad_y ⁇ are the gradient values before adjustment.
- the gradient value is normalized to obtain the normalized formula of ux, uy, uz:
- the brightness value of the deformed cartoon is adjusted to obtain the black and white deformed cartoon with the adjusted brightness value after step S43232, including:
- S43233 merge out into the grayscale image to obtain a picture in YUV format.
- S43234 Convert the picture in the YUV format to the RGB format to obtain a colorful deformed cartoon picture.
- the grayscale image of the deformed cartoon drawing that is, the sketch image
- the grayscale image img_yuv By combining out into the y dimension of the grayscale image img_yuv, and then converting the YUV format to the RGB format, a colored deformed cartoon can be obtained.
- the grayscale and color deformed cartoons can be obtained at the same time to satisfy more users. demand.
- step S4321 of obtaining the gray scale image corresponding to the deformed cartoon painting includes:
- S43213 Obtain the corresponding gray-scale dimension in the deformed cartoon picture in YUV format, and obtain the corresponding gray-scale image in the deformed cartoon picture.
- the image generating device includes:
- the collection module 1 is configured to collect a first number of facial contour points and a second number of facial feature points in a preset facial image, wherein the first number is greater than the second number.
- the preset facial image includes images with identification feature points, such as a human face image, an animal face image, and the like, and the above identification feature points are feature points that can distinguish between individuals.
- the first number in this embodiment satisfies the number of all facial contour points that can highlight the entire face contour.
- the first number range in this embodiment is greater than or equal to 68, so as to better determine the facial contour and face
- the deformation boundary and deformation feature points included in the contour are points corresponding to various organs that identify facial features, such as mapping points for organs such as eyes, mouth, nose, and eyebrows.
- the receiving module 2 is used for receiving the deformation starting point selected by the user from the facial feature points and the deformation ending point selected from the facial contour points corresponding to the deformation starting point one-to-one.
- the recognizable organ mapping point is the deformation starting point, that is, the deformation starting point is included in the facial feature points, such as the mapping point corresponding to the corner of the mouth and the corresponding corner of the eye Mapping points, etc.
- This embodiment is to highlight the abstract cartoon effect of the deformed cartoon drawing, and the deformation end point corresponding to the deformation starting point one by one is the face contour point or the point near the face contour point.
- the obtaining module 3 is used to obtain the deformation distance between each deformation starting point and its corresponding deformation end point.
- the deformation distance in this embodiment is the distance between the deformation start point and the corresponding deformation end point.
- the face image is mapped on a two-dimensional coordinate system plane so as to pass through points in the two-dimensional coordinate system. Identify each image point in the facial image, including facial contour points and facial feature points.
- the generating module 4 is configured to generate a deformed cartoon painting through deformation according to preset rules within a preset deformation range, wherein the preset deformation range is a deformation range corresponding to the deformation distance.
- the feature point corresponding to the corner of the eye or the mouth is deformed to a designated position, and then the feature point corresponding to the corner of the eye or the corner of the mouth and other points in the area between the designated positions are deformed according to the corresponding deformation factor.
- the aforementioned deformation distance is the distance between the characteristic point corresponding to the corner of the eye or the mouth and the designated position before deformation
- the deformation range corresponding to the aforementioned deformation distance is an area with the deformation starting point as the center and the aforementioned deformation distance as the radius.
- the generating module 4 includes:
- Calculation sub-module used according to formula: Calculate the transformation factor factor corresponding to the deformation of all points in the preset deformation range, where the coordinates of the deformation starting point are expressed as (cx, cy), and the coordinates of the deformation ending point are expressed as (mx, my).
- the first output sub-module is used to output the deformed cartoon picture obtained through image deformation.
- the corresponding coordinates of the characteristic point of the deformation start point are changed to the coordinates corresponding to the deformation end point, so that the deformation start point and the deformation end point are overlapped, and then the deformation start point is positioned at the deformation end point.
- the other characteristic points of the deformation area between the starting point and the deformation end point are deformed according to the transformation factor to achieve smooth deformation, instead of simply pulling the deformation start point to the deformation end point, so as to be able to draw from the deformed cartoon.
- the original feature point corresponding to the characteristic contour image of the individual is recognized, that is, the deformed face image can still be recognized as a face image, but the face image cannot be recognized as a face image after the deformation.
- the above transformation factor is related to the coordinates of the two points of the deformation start point and the deformation end point. For a pair of the deformation start point and the deformation end point, there will be a corresponding transformation factor. When the facial feature image contains multiple pairs of transformation starting points and transformation ending points, multiple transformation factors will appear. In the process of realizing the image transformation, the transformation will be carried out according to the respective transformation factors to obtain the final transformation cartoon. .
- the face image includes four pairs of deformation start points and deformation end points.
- the first pair of deformation start points are the feature points corresponding to the corner of the left mouth
- the first pair of deformation end points are the feature points corresponding to the left cheek, and its corresponding transformation
- the transformation factor is the first transformation factor, and the radius of the deformation area affected by the first transformation factor is
- the second pair of deformation starting points are the characteristic points corresponding to the right mouth corner, and the second pair of deformation ends
- the point is the characteristic point corresponding to the right cheek, and its corresponding transformation factor is the second transformation factor.
- the radius of the deformation area affected by the second transformation factor is
- the third pair of deformation starting points Is the characteristic point corresponding to the left eye corner,
- the third pair of deformation termination points are the characteristic points corresponding to the left eyebrow, and the corresponding transformation factor is the third transformation factor.
- the radius of the deformation area affected by the third transformation factor is
- the fourth pair of deformation starting points are the characteristic points corresponding to the right eye corners, and the third pair of deformation ending points are the characteristic points corresponding to the right eyebrows.
- the corresponding transformation factor is the fourth transformation factor, and the fourth transformation
- the radius of the deformation area affected by the factor is
- the generating module 4 includes:
- the judging sub-module is used to judge whether the brightness of the deformed cartoon picture meets the preset requirements.
- the adjustment sub-module is used to adjust the brightness value of the deformed cartoon according to the preset brightness adjustment method if the brightness of the picture of the deformed cartoon does not meet the preset requirements.
- the second output sub-module is used to output the deformed cartoon picture after adjusting the brightness value.
- the brightness value of the picture can be automatically adjusted according to the preset picture brightness requirement, so that the picture meets the brightness demand and improves the display clarity of the deformed cartoon.
- the adjustment sub-module includes:
- the acquiring unit is used to acquire the grayscale image corresponding to the deformed cartoon painting.
- the calculation unit is used to calculate the grayscale gradient in the grayscale image according to a preset calculation method.
- the adjustment unit is used to adjust the brightness value of the deformed cartoon according to the grayscale gradient to obtain the deformed cartoon after adjusting the brightness value.
- the brightness of the picture when adjusting the brightness of the picture, it needs to be adjusted according to the grayscale corresponding to the deformed cartoon, so as to achieve the corresponding adjustment following the original gray gradient of the deformed cartoon, so as to maintain the display corresponding to the original gradient of the deformed cartoon. effect.
- the preset facial images acquired by the camera at different shooting angles have different grayscale gradients, and corresponding adjustments are made in equal proportions by following the original grayscale gradient of the deformed cartoon to maintain the visual effect of the original shooting angle.
- the deformed cartoon painting img_yuv in the YUV format by obtaining the deformed cartoon painting img_yuv in the YUV format, only the dimension of Y is obtained, the grayscale image img_y of img_yuv is obtained, and the sketch map of the deformed cartoon painting is obtained by obtaining the grayscale image and then using the grayscale image to obtain the gradient.
- the adjustment unit includes:
- the first acquisition subunit is used to acquire the radiation angle el of the light source, the azimuth angle az of the light source, and the gradient value after the normalization of the gray gradient.
- the gradient value is calculated according to the preset gradient calculation method, for example, the difference obtained by subtracting the previous pixel value from the next pixel value is the gradient, and the next pixel value is adjacent to the previous pixel value, or the next pixel
- the value and the previous pixel value are separated by a specified number of pixel values.
- the x-axis gradient value and the y-axis gradient value of the grayscale image img_y are respectively calculated, and the corresponding values are expressed as grad_x and grad_y, multiplied by the parameter alpha, where the parameter alpha is an experience
- the value ranges from 1 to 10 so as to control the depth of strokes by adjusting the parameter alpha.
- grad_x grad_x ⁇ *alpha
- grad_y grad_y ⁇ *alpha
- set grad_z 1
- grad_x ⁇ and grad_y ⁇ are the gradient values before adjustment.
- the gradient value is normalized to obtain the normalized formula of ux, uy, uz:
- the adjustment unit includes:
- the merge subunit is used to merge out into a grayscale image to obtain a picture in YUV format.
- the first conversion subunit is used to convert the picture in the YUV format into the RGB format to obtain a colorful deformed cartoon picture.
- the grayscale image of the deformed cartoon drawing that is, the sketch image
- the grayscale image img_yuv By combining out into the y dimension of the grayscale image img_yuv, and then converting the YUV format to the RGB format, a colored deformed cartoon can be obtained.
- the grayscale and color deformed cartoons can be obtained at the same time to satisfy more users. demand.
- the acquiring unit includes:
- the judging subunit is used to judge whether the picture format of the deformed cartoon is YUV format
- the second conversion subunit is used to convert the picture format of the deformed cartoon to the YUV format if the picture format of the deformed cartoon is not in the YUV format;
- the second acquiring subunit is used to acquire the corresponding gray-scale dimension in the deformed cartoon picture in YUV format, and obtain the corresponding gray-scale image in the deformed cartoon picture.
- an embodiment of the present application also provides a computer device.
- the computer device may be a server, and its internal structure may be as shown in FIG. 3.
- the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities.
- the memory of the computer device includes a non-volatile storage medium and an internal memory.
- the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
- the memory provides an environment for the operation of the operating system and computer readable instructions in the non-volatile storage medium.
- the computer equipment database is used to store data such as image generation.
- the network interface of the computer device is used to communicate with an external terminal through a network connection.
- FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
- An embodiment of the present application further provides a computer non-volatile readable storage medium, on which computer readable instructions are stored, and when the computer readable instructions are executed, the processes as in the foregoing method embodiments are executed.
- a computer non-volatile readable storage medium on which computer readable instructions are stored, and when the computer readable instructions are executed, the processes as in the foregoing method embodiments are executed.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Geometry (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
一种图像生成方法,包括:(S1)在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点;(S2)接收用户从脸部特征点中选定的变形起始点,以及从脸部轮廓点中选定的与变形起始点一一对应的变形终止点;(S3)分别获取各变形起始点与其对应的变形终止点之间的变形距离;(S4)在预设变形范围内按照预设规则生成变形卡通画。
Description
本申请要求于2019年07月03日提交中国专利局、申请号为201910595932.8,发明名称为“图像生成方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及到计算机领域,特别是涉及到图像生成方法、装置、计算机设备及存储介质。
OpenCV轻量级而且高效——由一系列C函数和少量C++类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法,加上其开源的特性,处理得当,不需要添加新的外部支持也可以完整的编译链接生成执行程序,所以很多人用它来做算法的移植。发明人意识到,目前OpenCV有直接获取素描图像的接口,但是没有人脸变形功能,而且获取的图像暗黑,没有参数可以调整线条深浅。
本申请的主要目的为提供图像生成方法,旨在解决现有OpenCV有直接获取素描图像的接口,但是没有人脸变形功能的技术问题。
本申请提出一种图像生成方法,包括:
在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,第一数量大于所述第二数量;
接收用户从脸部特征点中选定的变形起始点,以及从脸部轮廓点中选定的与变形起始点一一对应的变形终止点;
分别获取各变形起始点与其对应的变形终止点之间的变形距离;
在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,预设变形范围为变形距离对应的变形范围。
本申请还提供了一种图像生成装置,包括:
采集模块,用于在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,第一数量大于第二数量;
接收模块,用于接收用户从脸部特征点中选定的变形起始点,以及从脸部轮廓点中选定的与变形起始点一一对应的变形终止点;
获取模块,用于分别获取各变形起始点与其对应的变形终止点之间的变形距离;
生成模块,用于在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,预设变形范围为变形距离对应的变形范围。
本申请还提供了一种计算机设备,包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现上述方法的步骤。
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述的方法的步骤。
本申请通过将眼角或嘴角对应的特征点,变形拉到指定位置,然后变形前眼角或嘴角对应的特征点以及指定位置之间区域的其他点,根据对应的变形因子进行对应变形,实现人脸图像的变形卡通画制作。本申请根据变形卡通画对应的灰度图进行调节,以便实现跟随变形卡通画的原始灰度梯度进行等比例对应调节,以保持变形卡通画的原始梯度对应的显示效果,并通过参数alpha,控制变形卡通画的笔画深浅,参数alpha值越大,笔画越深。本申请通过将out直接输出保存,获取变形卡通画的灰度图,即素描图。通过将out合入灰度图img_yuv的y维,再将YUV格式转换为RGB格式,则得到彩色的变形卡通画,可以同时获取灰度图和彩色图的变形卡通画,满足更多用户的使用需求。
图1本申请一实施例的图像生成方法流程示意图;
图2本申请一实施例的图像生成装置结构示意图;
图3本申请一实施例的计算机设备内部结构示意图。
参照图1,本申请一实施例的图像生成方法,包括:
S1:在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,第一数量大于第二数量。
本实施例中,预设脸部图像包括人脸图像、动物脸图像等带有辨识特征点的图像,上述辨识特征点为可辨别区分个体的特征点。本实施例的第一数量满足能凸显出整个脸部轮廓的所有脸部轮廓点的数量,比如本实施例的第一数量范围为大于或等于68,以便更好的确定脸部轮廓,以及脸部轮廓中包括的变形边界和变形特征点。上述第二数量的脸部特征点为标识脸部特征的各器官对应 的点,比如包括眼、口、鼻、眉等器官的映射点。
S2:接收用户从脸部特征点中选定的变形起始点,以及从脸部轮廓点中选定的与变形起始点一一对应的变形终止点。
本实施例中,为满足变形卡通画的保真辨识性,优选具有辨识度的器官映射点为变形起始点,即变形起始点包含于脸部特征点中,比如嘴角对应的映射点、眼角对应的映射点等。本实施例为突出变形卡通画的抽象卡通效果,变形起始点一一对应的变形终止点,为脸部轮廓点或脸部轮廓点附近的点。
S3:分别获取各变形起始点与其对应的变形终止点之间的变形距离。
本实施例的变形距离为变形起始点到对应的变形终止点的两点之间的距离,本实施例中脸部图像映射于一个二维坐标系平面中,以便通过二维坐标系中的点标识脸部图像中的各个图像点,包括脸部轮廓点以及脸部特征点。
S4:在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,预设变形范围为变形距离对应的变形范围。
本实施例通过将眼角或嘴角对应的特征点,变形拉到指定位置,然后变形前眼角或嘴角对应的特征点以及指定位置之间区域的其他点,根据对应的变形因子进行对应变形。上述变形距离为变形前眼角或嘴角对应的特征点以及指定位置之间的距离,上述变形距离对应的变形范围,为以变形起始点为圆心,上述变形距离为半径的区域。
进一步地,在预设变形范围内按照预设规则通过变形生成变形卡通画的步骤S4,包括:
S42:根据坐标点(x’,y’)=(x-factor*(mx-cx),y-factor*(my-cy)),实现将点(x,y)的坐标值变换到点(x’,y’)的坐标值,完成图像变形,其中点(x,y)包含于预设变形范围内所有点中。
S43:输出经过图像变形得到的变形卡通画。
本实施例在确定了变形起始点和变形终止点后,将变形起始点的特征点的对应坐标,变为变形终止点对应的坐标,使变形起始点和变形终止点重合,然后将位于变形起始点到变形终止点之间的变形区域的其他特征点,根据变换因 子进行对应变形,以实现平滑变形,而不是简单的将变形起始点拉牵到变形终止点,以便从变形卡通画中也能识别出原特征点对应个体的特征轮廓影像,即变形后的人脸图像还能辨识出是人脸图像,而不至于人脸图像变形后辨识不出是人脸图像。上述变换因子与变形起始点和变形终止点的两点的坐标有关,对于一对变形起始点和变形终止点,会有对应的变换因子。当脸部特征图像中包含了多对变形起始点和变形终止点,会出现多个变换因子,在实现图像变形的过程中,会分别根据各自对应的变换因子进行变形,得到最终的变形卡通画。
举例地,脸部图像中包括四对变形起始点和变形终止点,第一对变形开始点为左嘴角对应的特征点,第一对变形终止点为左脸颊对应的特征点,其对应的变换变换因子为第一变换因子,第一变换因子的影响变形区域的半径为|左嘴角x值-左脸颊x值|;第二对变形开始点为右嘴角对应的特征点,第二对变形终止点为右脸颊对应的特征点,其对应的变换变换因子为第二变换因子,第二变换因子的影响变形区域的半径为|右嘴角x值-右脸颊x值|;第三对变形开始点为左眼角对应的特征点,第三对变形终止点为左眉梢对应的特征点,其对应的变换变换因子为第三变换因子,第三变换因子的影响变形区域的半径为|左眼角y值-左眉梢y值|;第四对变形开始点为右眼角对应的特征点,第三对变形终止点为右眉梢对应的特征点,其对应的变换变换因子为第四变换因子,第四变换因子的影响变形区域的半径为|右眼角y值-右眉梢y值|,变形卡通画经由上述四对变形起始点到对应变形终止点的变形,并在各变换因子对应的变形区域,分别进行变形后,输出对应的变性卡通画。
进一步地,输出经过图像变形得到的变形卡通画的步骤S43之后,包括:
S431:判断变形卡通画的图片亮度是否满足预设要求。
S432:若否,则按照预设亮度调整方式调整变形卡通画的亮度值。
S433:输出调整亮度值后的变形卡通画。
本实施例,在完成图像变形后,输出变形后的变形卡通画时,可根据预设图片亮度要求,自动调节图片的亮度值,以便图片满足亮度需求,提高变形卡通画的展示清晰度。
进一步地,按照预设亮度调整方式调整变形卡通画的亮度值的步骤S432,包括:
S4321:获取变形卡通画对应的灰度图。
S4322:按照预设计算方式计算灰度图中灰度梯度。
S4323:根据灰度梯度调整变形卡通画的亮度值,得到调整亮度值后的变形卡通画。
本实施例在调整图片亮度时,需根据变形卡通画对应的灰度图进行调节,以便实现跟随变形卡通画的原始灰度梯度进行等比例对应调节,以保持变形卡通画的原始梯度对应的显示效果。摄像头不同拍摄角度获取的预设脸部图像的灰度梯度不同,通过跟随变形卡通画的原始灰度梯度进行等比例对应调节,以保持原始拍摄角度的视觉效果。本实施例通过得到YUV格式的变形卡通画img_yuv,只获取Y这个维度,则得到img_yuv的灰度图img_y,通过获取灰度图,再用灰度图获取梯度后得到变形卡通画的素描图。
进一步地,根据灰度梯度调整变形卡通画的亮度值,得到调整亮度值后的变形卡通画的步骤S4323,包括:
S43231:获取光源的辐射角度el、光源的方位角度az,以及灰度梯度归一化处理后的梯度值。
S43232:根据公式:out=(dx*ux+dy*uy+dz*uz),调整变形卡通画的亮度值,得到调整亮度值后的黑白色的变形卡通画,其中,dx=cos(el)*cos(az),dy=cos(el)*sin(az),dz=sin(el),ux、uy和uz均为归一化处理后的灰度梯度值。
本实施例的根据预设的梯度计算方法计算梯度值,比如通过后一像素值减去前一像素值得到的差值为梯度,后一像素值和前一像素值相邻,或者后一像素值和前一像素值中间间隔指定数量的像素值。本实施例通过上述预设的梯度计算方法,分别计算得到灰度图img_y的x轴的梯度值和y轴的梯度值,对应表示为grad_x和grad_y,乘以参数alpha,其中参数alpha为一经验值,取值范围为1至10之间,以便通过调节参数alpha,实现对笔画深浅的控制。以控制梯度变化大小,即grad_x=grad_x`*alpha,grad_y=grad_y`*alpha,设置grad_z=1,grad_x`和grad_y`为调整前的梯度值。然后将梯度值进行归一化处理,获取ux,uy,uz归一化公式为:
获取光源的辐射角度el=1.308,光源的方位角度az=0.785,则dx=cos(el)*cos(az),dy=cos(el)*sin(az),dz=sin(el),然后根据out=(dx*ux +dy*uy+dz*uz),得到调整亮度值后的变形卡通画的素描图。而且本实施例的灰度图中,通过参数alpha,控制变形卡通画的笔画深浅,grad_x=grad_x`*alpha,grad_y=grad_y`*alpha,参数alpha值越大,笔画越深。
进一步地,根据公式:out=(dx*ux+dy*uy+dz*uz),调整变形卡通画的亮度值,得到调整亮度值后的黑白色的变形卡通画的步骤S43232之后,包括:
S43233:将out合并入灰度图,得到YUV格式的图片。
S43234:将YUV格式的图片转变为RGB格式,得到彩色的变形卡通画。
本实施例通过将out直接输出保存,获取变形卡通画的灰度图,即素描图。通过将out合入灰度图img_yuv的y维,再将YUV格式转换为RGB格式,则得到彩色的变形卡通画,可以同时获取灰度图和彩色图的变形卡通画,满足更多用户的使用需求。
进一步地,获取变形卡通画对应的灰度图的步骤S4321,包括:
S43211:判断变形卡通画的图片格式是否为YUV格式;
S43212:若否,则将变形卡通画的图片格式转变为YUV格式;
S43213:获取YUV格式的变形卡通画中对应的灰度维度,得到变形卡通画中对应的灰度图。
本实施例在获取灰度图时,需要将三维的RGB格式转换为三维的YUV格式,得到YUV格式图img_yuv,然后再提取img_yuv的y维,得到灰度图。
参照图2,本申请一实施例的图像生成装置,包括:
采集模块1,用于在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,第一数量大于第二数量。
本实施例中,预设脸部图像包括人脸图像、动物脸图像等带有辨识特征点的图像,上述辨识特征点为可辨别区分个体的特征点。本实施例的第一数量满足能凸显出整个脸部轮廓的所有脸部轮廓点的数量,比如本实施例的第一数量范围为大于或等于68,以便更好的确定脸部轮廓,以及脸部轮廓中包括的变形边界和变形特征点。上述第二数量的脸部特征点为标识脸部特征的各器官对应的点,比如包括眼、口、鼻、眉等器官的映射点。
接收模块2,用于接收用户从脸部特征点中选定的变形起始点,以及从脸部轮廓点中选定的与变形起始点一一对应的变形终止点。
本实施例中,为满足变形卡通画的保真辨识性,优选具有辨识度的器官映 射点为变形起始点,即变形起始点包含于脸部特征点中,比如嘴角对应的映射点、眼角对应的映射点等。本实施例为突出变形卡通画的抽象卡通效果,变形起始点一一对应的变形终止点,为脸部轮廓点或脸部轮廓点附近的点。
获取模块3,用于分别获取各变形起始点与其对应的变形终止点之间的变形距离。
本实施例的变形距离为变形起始点到对应的变形终止点的两点之间的距离,本实施例中脸部图像映射于一个二维坐标系平面中,以便通过二维坐标系中的点标识脸部图像中的各个图像点,包括脸部轮廓点以及脸部特征点。
生成模块4,用于在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,预设变形范围为变形距离对应的变形范围。
本实施例通过将眼角或嘴角对应的特征点,变形拉到指定位置,然后变形前眼角或嘴角对应的特征点以及指定位置之间区域的其他点,根据对应的变形因子进行对应变形。上述变形距离为变形前眼角或嘴角对应的特征点以及指定位置之间的距离,上述变形距离对应的变形范围,为以变形起始点为圆心,上述变形距离为半径的区域。
进一步地,生成模块4,包括:
变形子模块,用于根据坐标点(x’,y’)=(x-factor*(mx-cx),y-factor*(my-cy)),实现将点(x,y)的坐标值变换到点(x’,y’)的坐标值,完成图像变形,其中点(x,y)包含于预设变形范围内所有点中。
第一输出子模块,用于输出经过图像变形得到的变形卡通画。
本实施例在确定了变形起始点和变形终止点后,将变形起始点的特征点的对应坐标,变为变形终止点对应的坐标,使变形起始点和变形终止点重合,然后将位于变形起始点到变形终止点之间的变形区域的其他特征点,根据变换因子进行对应变形,以实现平滑变形,而不是简单的将变形起始点拉牵到变形终止点,以便从变形卡通画中也能识别出原特征点对应个体的特征轮廓影像,即变形后的人脸图像还能辨识出是人脸图像,而不至于人脸图像变形后辨识不出 是人脸图像。上述变换因子与变形起始点和变形终止点的两点的坐标有关,对于一对变形起始点和变形终止点,会有对应的变换因子。当脸部特征图像中包含了多对变形起始点和变形终止点,会出现多个变换因子,在实现图像变形的过程中,会分别根据各自对应的变换因子进行变形,得到最终的变形卡通画。
举例地,脸部图像中包括四对变形起始点和变形终止点,第一对变形开始点为左嘴角对应的特征点,第一对变形终止点为左脸颊对应的特征点,其对应的变换变换因子为第一变换因子,第一变换因子的影响变形区域的半径为|左嘴角x值-左脸颊x值|;第二对变形开始点为右嘴角对应的特征点,第二对变形终止点为右脸颊对应的特征点,其对应的变换变换因子为第二变换因子,第二变换因子的影响变形区域的半径为|右嘴角x值-右脸颊x值|;第三对变形开始点为左眼角对应的特征点,第三对变形终止点为左眉梢对应的特征点,其对应的变换变换因子为第三变换因子,第三变换因子的影响变形区域的半径为|左眼角y值-左眉梢y值|;第四对变形开始点为右眼角对应的特征点,第三对变形终止点为右眉梢对应的特征点,其对应的变换变换因子为第四变换因子,第四变换因子的影响变形区域的半径为|右眼角y值-右眉梢y值|,变形卡通画经由上述四对变形起始点到对应变形终止点的变形,并在各变换因子对应的变形区域,分别进行变形后,输出对应的变性卡通画。
进一步地,生成模块4,包括:
判断子模块,用于判断变形卡通画的图片亮度是否满足预设要求。
调整子模块,用于若变形卡通画的图片亮度不满足预设要求,则按照预设亮度调整方式调整变形卡通画的亮度值。
第二输出子模块,用于输出调整亮度值后的变形卡通画。
本实施例,在完成图像变形后,输出变形后的变形卡通画时,可根据预设图片亮度要求,自动调节图片的亮度值,以便图片满足亮度需求,提高变形卡通画的展示清晰度。
进一步地,调整子模块,包括:
获取单元,用于获取变形卡通画对应的灰度图。
计算单元,用于按照预设计算方式计算灰度图中灰度梯度。
调整单元,用于根据灰度梯度调整变形卡通画的亮度值,得到调整亮度值后的变形卡通画。
本实施例在调整图片亮度时,需根据变形卡通画对应的灰度图进行调节, 以便实现跟随变形卡通画的原始灰度梯度进行等比例对应调节,以保持变形卡通画的原始梯度对应的显示效果。摄像头不同拍摄角度获取的预设脸部图像的灰度梯度不同,通过跟随变形卡通画的原始灰度梯度进行等比例对应调节,以保持原始拍摄角度的视觉效果。本实施例通过得到YUV格式的变形卡通画img_yuv,只获取Y这个维度,则得到img_yuv的灰度图img_y,通过获取灰度图,再用灰度图获取梯度后得到变形卡通画的素描图。
进一步地,调整单元,包括:
第一获取子单元,用于获取光源的辐射角度el、光源的方位角度az,以及灰度梯度归一化处理后的梯度值。
调整子单元,用于根据公式:out=(dx*ux+dy*uy+dz*uz),调整变形卡通画的亮度值,得到调整亮度值后的黑白色的变形卡通画,其中,dx=cos(el)*cos(az),dy=cos(el)*sin(az),dz=sin(el),ux、uy和uz均为归一化处理后的灰度梯度值。
本实施例的根据预设的梯度计算方法计算梯度值,比如通过后一像素值减去前一像素值得到的差值为梯度,后一像素值和前一像素值相邻,或者后一像素值和前一像素值中间间隔指定数量的像素值。本实施例通过上述预设的梯度计算方法,分别计算得到灰度图img_y的x轴的梯度值和y轴的梯度值,对应表示为grad_x和grad_y,乘以参数alpha,其中参数alpha为一经验值,取值范围为1至10之间,以便通过调节参数alpha,实现对笔画深浅的控制。以控制梯度变化大小,即grad_x=grad_x`*alpha,grad_y=grad_y`*alpha,设置grad_z=1,grad_x`和grad_y`为调整前的梯度值。然后将梯度值进行归一化处理,获取ux,uy,uz归一化公式为:
获取光源的辐射角度el=1.308,光源的方位角度az=0.785,则dx=cos(el)*cos(az),dy=cos(el)*sin(az),dz=sin(el),然后根据out=(dx*ux+dy*uy+dz*uz),得到调整亮度值后的变形卡通画的素描图。而且本实施例的灰度图中,通过参数alpha,控制变形卡通画的笔画深浅,grad_x=grad_x`*alpha,grad_y=grad_y`*alpha,参数alpha值越大,笔画越深。
进一步地,调整单元,包括:
合并子单元,用于将out合并入灰度图,得到YUV格式的图片。
第一转变子单元,用于将YUV格式的图片转变为RGB格式,得到彩色的变形卡通画。
本实施例通过将out直接输出保存,获取变形卡通画的灰度图,即素描图。通过将out合入灰度图img_yuv的y维,再将YUV格式转换为RGB格式,则得到彩色的变形卡通画,可以同时获取灰度图和彩色图的变形卡通画,满足更多用户的使用需求。
进一步地,获取单元,包括:
判断子单元,用于判断变形卡通画的图片格式是否为YUV格式;
第二转变子单元,用于若变形卡通画的图片格式不为YUV格式,则将变形卡通画的图片格式转变为YUV格式;
第二获取子单元,用于获取YUV格式的变形卡通画中对应的灰度维度,得到变形卡通画中对应的灰度图。
本实施例在获取灰度图时,需要将三维的RGB格式转换为三维的YUV格式,得到YUV格式图img_yuv,然后再提取img_yuv的y维,得到灰度图。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储图像生成等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令在执行时,执行如上述各方法的实施例的流程。本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。
本申请一实施例还提供一种计算机非易失性可读存储介质,其上存储有计算机可读指令,该计算机可读指令在执行时,执行如上述各方法的实施例的流程。以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。
Claims (20)
- 一种图像生成方法,其特征在于,包括:在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,所述第一数量大于所述第二数量;接收用户从所述脸部特征点中选定的变形起始点,以及从所述脸部轮廓点中选定的与所述变形起始点一一对应的变形终止点;分别获取各所述变形起始点与其对应的所述变形终止点之间的变形距离;在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,所述预设变形范围为所述变形距离对应的变形范围。
- 根据权利要求2所述的图像生成方法,其特征在于,所述输出经过图像变形得到的变形卡通画的步骤之后,包括:判断所述变形卡通画的图片亮度是否满足预设要求;若否,则按照预设亮度调整方式调整所述变形卡通画的亮度值;输出调整亮度值后的所述变形卡通画。
- 根据权利要求3所述的图像生成方法,其特征在于,所述按照预设亮度调整方式调整所述变形卡通画的亮度值的步骤,包括:获取所述变形卡通画对应的灰度图;按照预设计算方式计算所述灰度图中灰度梯度;根据所述灰度梯度调整所述变形卡通画的亮度值,得到调整亮度值后的所述变形卡通画。
- 根据权利要求4所述的图像生成方法,其特征在于,所述根据所述灰度梯度调整所述变形卡通画的亮度值,得到调整亮度值后的所述变形卡通画的步骤,包括:获取光源的辐射角度el、光源的方位角度az,以及所述灰度梯度归一化处理后的梯度值ux和uy;根据公式:out=(dx*ux+dy*uy+dz*uz),调整所述变形卡通画的亮度值,得到调整亮度值后的黑白色的所述变形卡通画,其中,dx=cos(el)*cos(az),dy=cos(el)*sin(az),dz=sin(el),ux、uy和uz均为归一化处理后的灰度梯度值。
- 根据权利要求5所述的图像生成方法,其特征在于,所述根据公式:out=(dx*ux+dy*uy+dz*uz),调整所述变形卡通画的亮度值,得到调整亮度值后的黑白色的所述变形卡通画的步骤之后,包括:将所述out合并入所述灰度图,得到YUV格式的图片;将所述YUV格式的图片转变为RGB格式,得到彩色的所述变形卡通画。
- 根据权利要求4所述的图像生成方法,其特征在于,所述获取所述变形卡通画对应的灰度图的步骤,包括:判断所述变形卡通画的图片格式是否为YUV格式;若否,则将所述变形卡通画的图片格式转变为YUV格式;获取YUV格式的所述变形卡通画中对应的灰度维度,得到所述变形卡通画中对应的灰度图。
- 一种图像生成装置,其特征在于,包括:采集模块,用于在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,所述第一数量大于所述第二数量;接收模块,用于接收用户从所述脸部特征点中选定的变形起始点,以及从所述脸部轮廓点中选定的与所述变形起始点一一对应的变形终止点;获取模块,用于分别获取各所述变形起始点与其对应的所述变形终止点之间的变形距离;生成模块,用于在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,所述预设变形范围为所述变形距离对应的变形范围。
- 根据权利要求9所述的图像生成装置,其特征在于,所述生成模块,包括:判断子模块,用于判断所述变形卡通画的图片亮度是否满足预设要求;调整子模块,用于若否,则按照预设亮度调整方式调整所述变形卡通画的亮度值;第二输出子模块,用于输出调整亮度值后的所述变形卡通画。
- 根据权利要求10所述的图像生成装置,其特征在于,所述调整子模块,包括:获取单元,用于获取所述变形卡通画对应的灰度图;计算单元,用于按照预设计算方式计算所述灰度图中灰度梯度;调整单元,用于根据所述灰度梯度调整所述变形卡通画的亮度值,得到调整亮度值后的所述变形卡通画。
- 根据权利要求11所述的图像生成装置,其特征在于,所述调整单元,包括:第一获取子单元,用于获取光源的辐射角度el、光源的方位角度az,以及所述灰度梯度归一化处理后的梯度值ux和uy;调整子单元,用于根据公式:out=(dx*ux+dy*uy+dz*uz),调整所述变形卡通画的亮度值,得到调整亮度值后的黑白色的所述变形卡通画,其中,dx=cos(el)*cos(az),dy=cos(el)*sin(az),dz=sin(el),ux、uy和uz均为归一化处理后的灰度梯度值。
- 根据权利要求12所述的图像生成装置,其特征在于,所述调整单元,包括:合并子单元,用于将所述out合并入所述灰度图,得到YUV格式的图片;第一转变子单元,用于将所述YUV格式的图片转变为RGB格式,得到彩色的所述变形卡通画。
- 根据权利要求11所述的图像生成装置,其特征在于,所述获取单元,包括:判断子单元,用于判断所述变形卡通画的图片格式是否为YUV格式;第二转变子单元,用于若否,则将所述变形卡通画的图片格式转变为YUV格式;第二获取子单元,用于获取YUV格式的所述变形卡通画中对应的灰度维度,得到所述变形卡通画中对应的灰度图。
- 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时图像生成方法,图像生成方法包括:在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,所述第一数量大于所述第二数量;接收用户从所述脸部特征点中选定的变形起始点,以及从所述脸部轮廓点中选定的与所述变形起始点一一对应的变形终止点;分别获取各所述变形起始点与其对应的所述变形终止点之间的变形距离;在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,所述预设变形范围为所述变形距离对应的变形范围。
- 根据权利要求16所述的计算机设备,其特征在于,所述输出经过图像变形得到的变形卡通画的步骤之后,包括:判断所述变形卡通画的图片亮度是否满足预设要求;若否,则按照预设亮度调整方式调整所述变形卡通画的亮度值;输出调整亮度值后的所述变形卡通画。
- 一种计算机非易失性可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现图像生成方法,图像生成方法包括:在预设脸部图像中采集第一数量的脸部轮廓点以及第二数量的脸部特征点,其中,所述第一数量大于所述第二数量;接收用户从所述脸部特征点中选定的变形起始点,以及从所述脸部轮廓点中选定的与所述变形起始点一一对应的变形终止点;分别获取各所述变形起始点与其对应的所述变形终止点之间的变形距离;在预设变形范围内按照预设规则通过变形生成变形卡通画,其中,所述预设变形范围为所述变形距离对应的变形范围。
- 根据权利要求19所述的计算机非易失性可读存储介质,其特征在于,所述输出经过图像变形得到的变形卡通画的步骤之后,包括:判断所述变形卡通画的图片亮度是否满足预设要求;若否,则按照预设亮度调整方式调整所述变形卡通画的亮度值;输出调整亮度值后的所述变形卡通画。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910595932.8 | 2019-07-03 | ||
CN201910595932.8A CN110443745B (zh) | 2019-07-03 | 2019-07-03 | 图像生成方法、装置、计算机设备及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021000414A1 true WO2021000414A1 (zh) | 2021-01-07 |
Family
ID=68428553
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/103544 WO2021000414A1 (zh) | 2019-07-03 | 2019-08-30 | 图像生成方法、装置、计算机设备及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110443745B (zh) |
WO (1) | WO2021000414A1 (zh) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105719248A (zh) * | 2016-01-14 | 2016-06-29 | 深圳市商汤科技有限公司 | 一种实时的人脸变形方法及其系统 |
CN107203963A (zh) * | 2016-03-17 | 2017-09-26 | 腾讯科技(深圳)有限公司 | 一种图像处理方法及装置、电子设备 |
WO2018096661A1 (ja) * | 2016-11-25 | 2018-05-31 | 日本電気株式会社 | 画像生成装置、顔照合装置、画像生成方法、およびプログラムを記憶した記憶媒体 |
CN108830787A (zh) * | 2018-06-20 | 2018-11-16 | 北京微播视界科技有限公司 | 图像变形的方法、装置及电子设备 |
CN109003224A (zh) * | 2018-07-27 | 2018-12-14 | 北京微播视界科技有限公司 | 基于人脸的形变图像生成方法和装置 |
CN109461117A (zh) * | 2018-10-30 | 2019-03-12 | 维沃移动通信有限公司 | 一种图像处理方法及移动终端 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104574266B (zh) * | 2013-12-19 | 2018-02-16 | 陈鹏飞 | 基于轮廓线的图像变形技术 |
CN105374055B (zh) * | 2014-08-20 | 2018-07-03 | 腾讯科技(深圳)有限公司 | 图像处理方法及装置 |
CN109087238B (zh) * | 2018-07-04 | 2021-04-23 | 北京市商汤科技开发有限公司 | 图像处理方法和装置、电子设备以及计算机可读存储介质 |
-
2019
- 2019-07-03 CN CN201910595932.8A patent/CN110443745B/zh active Active
- 2019-08-30 WO PCT/CN2019/103544 patent/WO2021000414A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105719248A (zh) * | 2016-01-14 | 2016-06-29 | 深圳市商汤科技有限公司 | 一种实时的人脸变形方法及其系统 |
CN107203963A (zh) * | 2016-03-17 | 2017-09-26 | 腾讯科技(深圳)有限公司 | 一种图像处理方法及装置、电子设备 |
WO2018096661A1 (ja) * | 2016-11-25 | 2018-05-31 | 日本電気株式会社 | 画像生成装置、顔照合装置、画像生成方法、およびプログラムを記憶した記憶媒体 |
CN108830787A (zh) * | 2018-06-20 | 2018-11-16 | 北京微播视界科技有限公司 | 图像变形的方法、装置及电子设备 |
CN109003224A (zh) * | 2018-07-27 | 2018-12-14 | 北京微播视界科技有限公司 | 基于人脸的形变图像生成方法和装置 |
CN109461117A (zh) * | 2018-10-30 | 2019-03-12 | 维沃移动通信有限公司 | 一种图像处理方法及移动终端 |
Also Published As
Publication number | Publication date |
---|---|
CN110443745A (zh) | 2019-11-12 |
CN110443745B (zh) | 2024-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3992919B1 (en) | Three-dimensional facial model generation method and apparatus, device, and medium | |
CN108961175B (zh) | 人脸亮度调整方法、装置、计算机设备及存储介质 | |
JP6685827B2 (ja) | 画像処理装置、画像処理方法及びプログラム | |
CN109584168B (zh) | 图像处理方法和装置、电子设备和计算机存储介质 | |
CN106952221B (zh) | 一种三维京剧脸谱自动化妆方法 | |
WO2024007478A1 (zh) | 基于单手机的人体三维建模数据采集与重建方法及系统 | |
WO2015186519A1 (ja) | 画像処理装置及び画像表示装置 | |
WO2018082389A1 (zh) | 一种肤色检测方法、装置及终端 | |
CN105096353B (zh) | 一种图像处理方法及装置 | |
WO2022267653A1 (zh) | 图像处理方法、电子设备及计算机可读存储介质 | |
CN107452049A (zh) | 一种三维头部建模方法及装置 | |
WO2023066120A1 (zh) | 图像处理方法、装置、电子设备及存储介质 | |
JP2018163648A (ja) | 画像処理装置、画像処理方法、及びプログラム | |
WO2023010796A1 (zh) | 图像处理方法及相关装置 | |
WO2022135574A1 (zh) | 肤色检测方法、装置、移动终端和存储介质 | |
WO2023273247A1 (zh) | 人脸图像处理方法及装置、计算机可读存储介质、终端 | |
CN109242760B (zh) | 人脸图像的处理方法、装置和电子设备 | |
CN109064431B (zh) | 一种图片亮度调节方法、设备及其存储介质 | |
WO2021184931A1 (zh) | 适用于光学穿透式头戴显示器的颜色对比增强绘制方法、装置以及系统 | |
CN115482359A (zh) | 目标的尺寸测量方法、电子设备及其介质 | |
WO2021000414A1 (zh) | 图像生成方法、装置、计算机设备及存储介质 | |
WO2020119518A1 (zh) | 一种基于人工视网膜空间感知的控制方法及装置 | |
CN109345470B (zh) | 人脸图像融合方法和系统 | |
CN113837020B (zh) | 一种化妆进度检测方法、装置、设备及存储介质 | |
US10354125B2 (en) | Photograph processing method and system |
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: 19936317 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19936317 Country of ref document: EP Kind code of ref document: A1 |