CN111861869A - Image processing method and device for beautifying portrait and preventing background distortion - Google Patents

Image processing method and device for beautifying portrait and preventing background distortion Download PDF

Info

Publication number
CN111861869A
CN111861869A CN202010681810.3A CN202010681810A CN111861869A CN 111861869 A CN111861869 A CN 111861869A CN 202010681810 A CN202010681810 A CN 202010681810A CN 111861869 A CN111861869 A CN 111861869A
Authority
CN
China
Prior art keywords
image
processed
vertex
processing
mask
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010681810.3A
Other languages
Chinese (zh)
Other versions
CN111861869B (en
Inventor
林青山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Guangzhuiyuan Information Technology Co ltd
Original Assignee
Guangzhou Guangzhuiyuan Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Guangzhuiyuan Information Technology Co ltd filed Critical Guangzhou Guangzhuiyuan Information Technology Co ltd
Priority to CN202010681810.3A priority Critical patent/CN111861869B/en
Publication of CN111861869A publication Critical patent/CN111861869A/en
Application granted granted Critical
Publication of CN111861869B publication Critical patent/CN111861869B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/18Image warping, e.g. rearranging pixels individually
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to an image processing method and device for beautifying portrait and preventing background distortion, comprising the steps of processing an original image to generate a mask image; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at the position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed; and according to the image to be processed and the mask image, carrying out slimming processing and/or breast enhancement processing and/or fine adjustment processing on the image to be processed. The invention introduces the locking area, realizes the weight-reducing and breast-enlarging and body-figure fine-tuning method with the area distortion prevention and beautiful and natural body-figure optimization effect by combining the design of the mask map of the locking area, and solves the problems that the portrait repair effect is poor, the portrait background distortion is serious and the user can not carry out local fine tuning according to the requirement in the prior art.

Description

Image processing method and device for beautifying portrait and preventing background distortion
Technical Field
The invention belongs to the technical field of image processing, and particularly relates to an image processing method and device for beautifying portrait and preventing background distortion.
Background
With the more extensive use of mobile terminal application, the more convenient and fast the way of obtaining portrait images, the more and more high the beautification requirement of users for portrait images. People hope that the people can present beautiful and unique images on the social network, always hope that own photos are more beautiful than the real ones, and portrait beautification is already the standard configuration of the application of the decoration class.
In the existing beauty application, a user can perform figure optimization processing on a human image so as to improve the aesthetic feeling of the image. However, in the existing beauty application, no matter the figure optimization result is automatically given through a preset algorithm, or the figure optimization is manually performed through user screen touch, the problems of poor figure repairing effect and serious figure background distortion often exist, meanwhile, the user cannot perform local fine adjustment according to needs, and finally, time and labor are consumed, and the figure optimization effect image with natural appearance cannot be obtained.
Disclosure of Invention
In view of the above, the present invention is directed to overcome the deficiencies of the prior art, and provides an image processing method and apparatus for beautifying a portrait and preventing background distortion, so as to solve the problems of poor portrait repairing effect and serious distortion of portrait background distortion in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme: an image processing method for portrait beautification and prevention of background distortion, comprising:
acquiring an original image by using a mobile client, and processing the original image to acquire an image to be processed;
processing the original image to generate a mask image; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at a position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed;
and performing slimming processing and/or breast enhancement processing and/or fine adjustment processing on the image to be processed according to the image to be processed and the mask image to output an image.
Further, the processing the original image to obtain the image to be processed includes:
and adjusting the pixels of the original image to preset pixels, and determining the image adjusted to the preset pixels as an image to be processed.
Further, the processing the original image to generate a mask map includes:
And setting a locking protection area on the original image, and generating a mask image of the locking area.
Further, the slimming the image to be processed to output an image includes:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
receiving a slimming instruction of a preset adjustor, traversing each vertex in the 3 x 2 x m n vertexes, and if the vertex meets a first preset condition or a pixel value in a mask image corresponding to the vertex is 1, not processing the vertex; otherwise, processing the vertex to obtain a new vertex, and circularly judging until the value in the locking area mask image corresponding to the position of the vertex is 1;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the slimming image is output.
Further, the performing breast enhancement processing on the image to be processed to output an image includes:
Standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
receiving a breast enhancement instruction of a preset adjustor, traversing each vertex in the 3 x 2 x m n vertexes, and if the vertex meets a second preset condition or the value of a pixel in the mask image corresponding to the vertex is 1, not processing the vertex; otherwise, processing the vertex to obtain a new vertex, and circularly judging until the value in the locking area mask image corresponding to the position of the vertex is 1;
after all the vertexes are determined, redefining preset conditions and traversing the 3 x 2 x m n vertexes again;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the breast enhancement image is output.
Further, the fine-tuning the image to be processed to output an image includes:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
Receiving a fine adjustment instruction, performing distortion operation on the image to be processed, acquiring a vertex after the distortion operation, traversing each vertex in the 3 x 2 x m x n vertices, and if the vertex meets a third preset condition or the pixel value in the mask image corresponding to the position of the vertex is 1, not performing processing; if the vertex after the warping operation is located in the unlocked area, updating the vertex into the vertex after the warping operation;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the fine-tuning image is output.
Further, the original image is a portrait image of a half body or a whole body.
Furthermore, the locking area setting mode adopts a touch coating mode.
An embodiment of the present application provides an image processing apparatus for beautifying a portrait and preventing background distortion, including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an original image by using a mobile client and processing the original image to acquire an image to be processed;
the processing module is used for processing the original image to generate a mask image; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at a position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed;
And the output module is used for carrying out slimming processing and/or breast enhancement processing and/or fine adjustment processing on the image to be processed according to the image to be processed and the mask map so as to output the image.
Further, the processing the original image to obtain the image to be processed includes:
and adjusting the pixels of the original image to preset pixels, and determining the image adjusted to the preset pixels as an image to be processed.
By adopting the technical scheme, the invention can achieve the following beneficial effects:
the invention provides an image processing method and device for beautifying portrait and preventing background distortion, comprising the steps of obtaining an original image by utilizing a mobile client, processing the original image to obtain an image to be processed; the method comprises the steps of processing an original image to generate a mask image, and performing slimming and/or breast enlarging processing and/or fine adjustment processing on the image to be processed according to the image to be processed and the mask image to output the image.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram illustrating steps of an image processing method for human image beautification and background distortion prevention according to the present invention;
FIG. 2 is a schematic diagram of smearing of an image processing method for human image beautification and background distortion prevention according to the present invention;
FIG. 3 is a schematic diagram of the slimming operation of the image processing method for beautifying portrait and preventing background distortion according to the present invention;
FIG. 4 is a schematic diagram of a breast enhancement operation of the image processing method for enhancing human image and preventing background distortion according to the present invention;
FIG. 5 is a schematic diagram illustrating a fine-tuning operation of the image processing method for human image beautification and background distortion prevention according to the present invention;
FIG. 6 is a schematic diagram of an image processing apparatus for beautifying human images and preventing background distortion according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
A specific image processing method for enhancing human image and preventing background distortion provided in the embodiments of the present application is described below with reference to the accompanying drawings.
As shown in fig. 1, an image processing method for beautifying a portrait and preventing background distortion provided in an embodiment of the present application includes:
s101, acquiring an original image by using a mobile client, and processing the original image to acquire an image to be processed;
the user takes a picture through the mobile client, or obtains the picture from a picture library stored in the mobile client as an original image, namely, the original image is a picture with a portrait or a half-body portrait obtained through photographing software or an image product.
Wherein, mobile client is the terminal that is equipped with the camera, for example: the mobile client can be a mobile phone, a tablet computer and the like.
S102, processing the original image to generate a mask image; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at a position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed;
In the present application, a locked region mask map with the same size as the to-be-processed image is defined, a pixel point at a certain position of the locked region mask map takes a value of 0 or 1, 0 represents that the pixel point at the same position on the to-be-processed image is not locked, and 1 represents that the pixel point at the same position on the to-be-processed image is locked, preferably, as shown in fig. 2, the locked region mask map may be generated by a user in a smearing manner.
S103, according to the image to be processed and the mask image, performing slimming processing and/or breast enhancement processing and/or fine adjustment processing on the image to be processed to output an image.
According to the pixel value of a certain position in the mask image, whether the pixel point of the position in the image to be processed is locked or not can be judged, and therefore the image to be processed is operated. In the application, one or more of a slimming effect, a breast enlarging effect and a fine adjustment effect can be selected to process the image.
The working principle of the image processing method for beautifying the portrait and preventing the background distortion is as follows: acquiring an original image by using a mobile client, and processing the original image to acquire an image to be processed; and selecting a mask image with the same size as the image to be processed, and performing slimming, breast enlarging and fine adjustment on the image to be processed through pixel points corresponding to the image to be processed and the mask image.
In some embodiments, the processing the original image to obtain the image to be processed includes:
and adjusting the pixels of the original image to preset pixels, and determining the image adjusted to the preset pixels as an image to be processed.
Specifically, the preset pixels in the application are to-be-processed images with widths of w pixels and heights of h pixels, and a user can set the pixels according to actual needs, which is not limited herein.
In some embodiments, the processing the original image to generate a mask map includes:
and setting a locking protection area on the original image, and generating a mask image of the locking area.
Specifically, a user can set an area needing locking protection through the locking area setting module according to aesthetic requirements, and a locking area mask map is generated. For example: the leg lines are considered to be good by the user, the leg can be locked, the leg is a locking area, and the user does not modify the leg when processing the image.
In some embodiments, the slimming the to-be-processed image to output an image includes:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
Receiving a slimming instruction of a preset adjustor, traversing each vertex in the 3 x 2 x m n vertexes, and if the vertex meets a first preset condition or a pixel value in a mask image corresponding to the vertex is 1, not processing the vertex; otherwise, processing the vertex to obtain a new vertex, and circularly judging until the value in the locking area mask image corresponding to the position of the vertex is 1;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the slimming image is output.
Specifically, as shown in fig. 3, the width and height of the image to be processed are normalized to 1, and the image to be processed is divided into m rows and n columns, and m × n rectangles in total; each rectangle is divided into two triangles along the diagonal line, and the triangles are 2 × m × n in total; all vertices of each triangle were recorded, for a total of 3 x 2 m n vertices.
Four auxiliary icons of 'upper', 'lower', 'left' and 'right' are defined on the screen, the four auxiliary icons are not overlapped, the x coordinate of 'upper' is equal to the x coordinate of 'lower', the y coordinate of 'left' is equal to the y coordinate of 'right', the x coordinate of 'left' is smaller than the x coordinate of 'right', and the y coordinate of 'upper' is smaller than the y coordinate of 'lower'.
The preset adjustor sets four parameters of left, right, top and bottom, wherein left is an x value of a coordinate point of the left icon on the screen, right is an x value of a coordinate point of the right icon on the screen, top is a y value of a coordinate point of the up icon on the screen, and bottom is a y value of a coordinate point of the down icon on the screen. Define a center, the x coordinate of center is (left + right)/2, the y coordinate of center is (top + bottom)/2.
The weight degree value weight can be changed by dragging the preset regulator. Preferably, the greater the weight, the more pronounced the slimming effect.
Traversing each vertex p (x, y) of the 3 x 2 x m n vertices; when the first preset condition is met: (x < left | | x > right | | y < top | | | y > bottom) or when the value of the locking region mask image corresponding to the position of the vertex p is 1, the point is not processed, p (x, y) ═ p (x, y), otherwise, a new numerical value p (x1, y1) of the vertex p is calculated in the following calculation mode;
x1=x+dx*pull;
y1=y+dy*pull;
where dx is the difference between center.x and p.x, dx-center.x-x;
where dy is the difference between center.y and p.y, dy being center.y-y;
wherein pull is the intensity value, (float) ((1-math.cos (math.abs (dx)/(math.abs (left-right) × 2);
Math.PI))*(Math.cos(Math.abs(dy)/Math.abs(top-bottom)*Math.PI)+1))*0.05f*weight;
Judging whether the value of a lock area mask map corresponding to the position of p (x1, y1) is 1 or not, and if not, setting p (x, y) as p (x1, y 1);
and when all the 3 x 2 x m n vertexes are traversed, inputting all the vertexes as texture coordinates of a vertex shader, converting the texture coordinates through a coordinate system, inputting the vertex coordinates as the vertex coordinates of the vertex shader, and finally rendering to obtain the slimming effect image.
In some embodiments, the breast enhancement processing the image to be processed to output an image includes:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
receiving a breast enhancement instruction of a preset adjustor, traversing each vertex in the 3 x 2 x m n vertexes, and if the vertex meets a second preset condition or the value of a pixel in the mask image corresponding to the vertex is 1, not processing the vertex; otherwise, processing the vertex to obtain a new vertex, and circularly judging until the value in the locking area mask image corresponding to the position of the vertex is 1;
After all the vertexes are determined, redefining preset conditions and traversing the 3 x 2 x m n vertexes again;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the breast enhancement image is output.
Specifically, as shown in fig. 4, the width and height of the image to be processed are normalized to 1, and the image to be processed is divided into m rows and n columns, which are m × n rectangles; each rectangle is divided into two triangles along the diagonal line, and the triangles are 2 × m × n in total; all vertices of each triangle were recorded, for a total of 3 x 2 m n vertices.
The adjuster defines a parameter r as the radius of the left thoracic adjustment, a center point c (x, y) as the center point of the left thoracic adjustment, and a variable dd for the distance of each vertex p from the center point c, i.e.:
dx=c.x–p.x
dy=c.y–p.y;
dd=Math.sqrt(dx*dx+dy*dy);
the dragging adjuster can change the breast enlargement degree value weight. Preferably, the greater the weight, the more obvious the breast enhancement effect.
Traversing each vertex p (x, y) of the 3 x 2 x m n vertices, when a second predetermined condition is met: if the distance between the vertex p and the central point c is larger than r, namely dd/r is larger than 1, or the value of the locking area mask image corresponding to the position of the vertex p is 1, the point is not processed, namely p (x, y) is p (x, y), otherwise, a new value p (x1, y1) of the vertex p is calculated in the following calculation mode
x1=x+dx*pull;
y1=y+dy*pull;
Where dx is the difference between cr.x and p.x, dx is c.x-x,
where dy is the difference between c.y and p.y, dy being c.y-y;
where pull is the intensity value: pull ═ - (float) (math.cos (d × math.pi) +1) × 0.4f weight;
judging that the value of the lock area mask map corresponding to the position of p (x1, y1) is 1, if not, p (x, y) is p (x1, y1)
And when all the 3 x 2 x m n vertexes are traversed, redefining the parameter r as the right chest adjusting radius and redefining the central point c (x, y) as the right chest adjusting central point.
Traversal of the vertices is performed again.
And when all the 3 x 2 x m n vertexes are traversed, inputting all the vertexes as texture coordinates of a vertex shader, converting the texture coordinates through a coordinate system, inputting the vertex coordinates as the vertex coordinates of the vertex shader, and finally rendering to obtain the breast enhancement effect image.
In some embodiments, the fine-tuning the image to be processed to output an image includes:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
Receiving a fine adjustment instruction, performing distortion operation on the image to be processed, acquiring a vertex after the distortion operation, traversing each vertex in the 3 x 2 x m x n vertices, and if the vertex meets a third preset condition or the pixel value in the mask image corresponding to the position of the vertex is 1, not performing processing; if the vertex after the warping operation is located in the unlocked area, updating the vertex into the vertex after the warping operation;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the fine-tuning image is output.
Specifically, as shown in fig. 5, the width and height of the image to be processed are normalized to 1, and the image to be processed is divided into m rows and n columns, and m × n rectangles; each rectangle is divided into two triangles along the diagonal line, and the triangles are 2 × m × n in total; all vertices of each triangle were recorded, for a total of 3 x 2 m n vertices.
Defining a picture warping operation
Figure BDA0002586121840000101
Where o is the origin of the twist,
Figure BDA0002586121840000102
for the warp vector, k is the constant warp strength factor and r is the warp radius. Wherein r is>0. Preferably, the warping operation may be generated by a user through a screen touch manner.
For each warp operation, the 3 x 2 x m n vertices are traversed. When the condition is met, the distance d between the distortion origin o and the vertex p is larger than r, and the traversal is ignored and continued.
The distortion origin o is at a distance from the vertex p of
Figure BDA0002586121840000111
Figure BDA0002586121840000112
If the vertex p is located in the locking region, the traversal continues for the next vertex.
Judging whether the vertex p is located in the locking region by taking the value of a pixel point at the position on the mask map as 0 or 1, and when the value of the pixel point at the position on the mask map is 0, unlocking the pixel point at the same position on the image to be processed; and when the value of the pixel point at the position on the mask image is 1, locking the pixel point at the same position on the image to be processed, and taking the pixel point (x, y) in the mask image in the locking area, wherein the value of x is p.x times w and the value of y is p.y times h, and if (x, y) exceeds the range of the image, processing according to unlocking.
Let the vertex p being processed be p (x, y), and calculate the distorted point p' ═ f (p).
Distortion transformation
Figure BDA0002586121840000113
Wherein, t ═ k ═ ((d/r)2-2*(d/r)+1)。
If p 'is not located in the lock area, the coordinate of the vertex p is modified to the value of p'.
And then continuously traversing the next vertex until all the points are traversed.
And when all the 3 x 2 x m n vertexes are traversed, all the vertexes are used as texture coordinates of the vertex shader to be input, and the vertex coordinates are input as the vertex coordinates of the vertex shader through coordinate system transformation, and finally the fine adjustment effect image is obtained through rendering.
Preferably, the original image is a portrait image of a half body or a whole body.
Preferably, the locking area setting mode adopts a touch coating mode.
The application provides an image processing apparatus for human image beautification and background distortion prevention, including:
an obtaining module 601, configured to obtain an original image by using a mobile client, and process the original image to obtain an image to be processed;
a processing module 602, configured to process the original image to generate a mask map; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at a position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed;
and an output module 603, configured to perform slimming and/or breast enhancement and/or fine adjustment on the to-be-processed image according to the to-be-processed image and the mask map, and output an image.
The application provides an image processing device for beautifying portrait and preventing background distortion, which has the working principle that an acquisition module 601 acquires an original image by using a mobile client, and processes the original image to acquire an image to be processed; the processing module 602 processes the original image to generate a mask map; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at a position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed; the output module 603 performs a slimming process and/or a breast enhancement process and/or a fine adjustment process on the image to be processed according to the image to be processed and the mask map, and outputs the image.
Preferably, the processing the original image to obtain the image to be processed includes:
and adjusting the pixels of the original image to preset pixels, and determining the image adjusted to the preset pixels as an image to be processed.
The embodiment of the application provides computer equipment, which comprises a processor and a memory connected with the processor;
the memory is used for storing a computer program, and the computer program is used for executing the image processing method for beautifying the portrait and preventing the background from being distorted, which is provided by any embodiment;
the processor is used to call and execute the computer program in the memory.
In summary, the present invention provides an image processing method and apparatus for human image beautification and background distortion prevention, including processing an original image to generate a mask image; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at the position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed; and according to the image to be processed and the mask image, carrying out slimming processing and/or breast enhancement processing and/or fine adjustment processing on the image to be processed. The invention introduces the locking area, realizes the weight-reducing and breast-enlarging and body-figure fine-tuning method with the area distortion prevention and beautiful and natural body-figure optimization effect by combining the design of the mask map of the locking area, and solves the problems that the portrait repair effect is poor, the portrait background distortion is serious and the user can not carry out local fine tuning according to the requirement in the prior art.
It is to be understood that the embodiments of the method provided above correspond to the embodiments of the apparatus described above, and the corresponding specific contents may be referred to each other, which is not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. An image processing method for human image beautification and background distortion prevention, comprising:
acquiring an original image by using a mobile client, and processing the original image to acquire an image to be processed;
processing the original image to generate a mask image; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at a position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed;
and performing slimming processing and/or breast enhancement processing and/or fine adjustment processing on the image to be processed according to the image to be processed and the mask image to output an image.
2. The method according to claim 1, wherein the processing the original image to obtain a to-be-processed image comprises:
and adjusting the pixels of the original image to preset pixels, and determining the image adjusted to the preset pixels as an image to be processed.
3. The method of claim 1, wherein the processing the raw image to generate a mask map comprises:
And setting a locking protection area on the original image, and generating a mask image of the locking area.
4. The method according to claim 2, wherein the slimming the image to be processed to output an image comprises:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
receiving a slimming instruction of a preset adjustor, traversing each vertex in the 3 x 2 x m n vertexes, and if the vertex meets a first preset condition or a pixel value in a mask image corresponding to the vertex is 1, not processing the vertex; otherwise, processing the vertex to obtain a new vertex, and circularly judging until the value in the locking area mask image corresponding to the position of the vertex is 1;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the slimming image is output.
5. The method of claim 2, wherein the breast enhancement processing the image to be processed to output an image comprises:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
receiving a breast enhancement instruction of a preset adjustor, traversing each vertex in the 3 x 2 x m n vertexes, and if the vertex meets a second preset condition or the value of a pixel in the mask image corresponding to the vertex is 1, not processing the vertex; otherwise, processing the vertex to obtain a new vertex, and circularly judging until the value in the locking area mask image corresponding to the position of the vertex is 1;
after all the vertexes are determined, redefining preset conditions and traversing the 3 x 2 x m n vertexes again;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the breast enhancement image is output.
6. The method according to claim 2, wherein the fine-tuning the image to be processed to output an image comprises:
standardizing the width and the height of the image to be processed, dividing the image to be processed into m rows and n columns to obtain m × n rectangles, dividing each rectangle into two triangles along a diagonal line to obtain 2 × m × n triangles, and recording all vertexes of each triangle, wherein the total number of vertexes is 3 × 2 × m; wherein m and n are integers;
receiving a fine adjustment instruction, performing distortion operation on the image to be processed, acquiring a vertex after the distortion operation, traversing each vertex in the 3 x 2 x m x n vertices, and if the vertex meets a third preset condition or the pixel value in the mask image corresponding to the position of the vertex is 1, not performing processing; if the vertex after the warping operation is located in the unlocked area, updating the vertex into the vertex after the warping operation;
and after all the vertexes are determined, all the vertexes are used as texture coordinates of the vertex shader to be input, the vertex coordinates of the vertex shader are obtained through coordinate system transformation, and the fine-tuning image is output.
7. The method according to any one of claims 1 to 6,
The original image is a portrait image of a half body or a whole body.
8. The method of claim 7,
the locking area setting mode adopts a touch coating mode.
9. An image processing apparatus for human image beautification and prevention of background distortion, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an original image by using a mobile client and processing the original image to acquire an image to be processed;
the processing module is used for processing the original image to generate a mask image; the size of the image to be processed is the same as that of the mask image, the value of a pixel point at a position on the mask image is 0 or 1, and when the value of the pixel point at the position on the mask image is 0, the pixel point at the same position on the image to be processed is not locked; when the value of the pixel point at the position on the mask map is 1, locking the pixel point at the same position on the image to be processed;
and the output module is used for carrying out slimming processing and/or breast enhancement processing and/or fine adjustment processing on the image to be processed according to the image to be processed and the mask map so as to output the image.
10. The apparatus according to claim 9, wherein the processing the raw image to obtain the image to be processed comprises:
And adjusting the pixels of the original image to preset pixels, and determining the image adjusted to the preset pixels as an image to be processed.
CN202010681810.3A 2020-07-15 2020-07-15 Image processing method and device for beautifying human images and preventing background distortion Active CN111861869B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010681810.3A CN111861869B (en) 2020-07-15 2020-07-15 Image processing method and device for beautifying human images and preventing background distortion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010681810.3A CN111861869B (en) 2020-07-15 2020-07-15 Image processing method and device for beautifying human images and preventing background distortion

Publications (2)

Publication Number Publication Date
CN111861869A true CN111861869A (en) 2020-10-30
CN111861869B CN111861869B (en) 2024-02-02

Family

ID=72983072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010681810.3A Active CN111861869B (en) 2020-07-15 2020-07-15 Image processing method and device for beautifying human images and preventing background distortion

Country Status (1)

Country Link
CN (1) CN111861869B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112598580A (en) * 2020-12-29 2021-04-02 广州光锥元信息科技有限公司 Method and device for improving definition of portrait photo
CN113435445A (en) * 2021-07-05 2021-09-24 深圳市鹰硕技术有限公司 Image over-optimization automatic correction method and device
CN113822815A (en) * 2021-09-24 2021-12-21 广州光锥元信息科技有限公司 Method and device for eliminating high-performance picture sundries by using GPU rendering

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110199536A1 (en) * 2007-04-23 2011-08-18 Lior Wolf System, method and a computer readable medium for providing an output image
CN106447638A (en) * 2016-09-30 2017-02-22 北京奇虎科技有限公司 Beauty treatment method and device thereof
CN108875759A (en) * 2017-05-10 2018-11-23 华为技术有限公司 A kind of image processing method, device and server
CN109741277A (en) * 2018-12-29 2019-05-10 广州华多网络科技有限公司 Image processing method, device, storage medium and server
CN111028145A (en) * 2019-12-10 2020-04-17 成都品果科技有限公司 Figure image processing method for preventing background deformation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110199536A1 (en) * 2007-04-23 2011-08-18 Lior Wolf System, method and a computer readable medium for providing an output image
CN106447638A (en) * 2016-09-30 2017-02-22 北京奇虎科技有限公司 Beauty treatment method and device thereof
CN108875759A (en) * 2017-05-10 2018-11-23 华为技术有限公司 A kind of image processing method, device and server
CN109741277A (en) * 2018-12-29 2019-05-10 广州华多网络科技有限公司 Image processing method, device, storage medium and server
CN111028145A (en) * 2019-12-10 2020-04-17 成都品果科技有限公司 Figure image processing method for preventing background deformation

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LI, Q等: "General stereoscopic distortion rectification due to arbitrary viewer motion in binocular stereoscopic display", 《PROCEEDINGS OF SPIE》, vol. 9011, pages 1 - 12 *
张吉福: "文本扫描图像折痕检测与扭曲去除", 《CNKI中国优秀硕士毕业论文全文库(信息科技辑)》, no. 7, pages 138 - 1666 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112598580A (en) * 2020-12-29 2021-04-02 广州光锥元信息科技有限公司 Method and device for improving definition of portrait photo
CN112598580B (en) * 2020-12-29 2023-07-25 广州光锥元信息科技有限公司 Method and device for improving definition of portrait photo
CN113435445A (en) * 2021-07-05 2021-09-24 深圳市鹰硕技术有限公司 Image over-optimization automatic correction method and device
CN113822815A (en) * 2021-09-24 2021-12-21 广州光锥元信息科技有限公司 Method and device for eliminating high-performance picture sundries by using GPU rendering
CN113822815B (en) * 2021-09-24 2024-02-06 广州光锥元信息科技有限公司 Method and apparatus for high performance picture clutter removal using GPU rendering

Also Published As

Publication number Publication date
CN111861869B (en) 2024-02-02

Similar Documents

Publication Publication Date Title
CN111861869B (en) Image processing method and device for beautifying human images and preventing background distortion
CN109584151B (en) Face beautifying method, device, terminal and storage medium
JP6864449B2 (en) Methods and devices for adjusting the brightness of the image
Bhat et al. Gradientshop: A gradient-domain optimization framework for image and video filtering
CN106971165B (en) A kind of implementation method and device of filter
Jung et al. Sketching folds: Developable surfaces from non-planar silhouettes
CN110111247A (en) Facial metamorphosis processing method, device and equipment
CN107452049B (en) Three-dimensional head modeling method and device
CN106228516B (en) A kind of real-time U.S. face method, apparatus of high naturalness
JP2013055472A (en) Image processor, image processing method and program
US20110050685A1 (en) Image processing apparatus, image processing method, and program
CN109859299B (en) Portrait picture processing method and device, computer readable storage medium and computer equipment
CN109461213A (en) Image processing method, device, equipment and storage medium based on virtual reality
CN107909553A (en) A kind of image processing method and equipment
JP3467725B2 (en) Image shadow removal method, image processing apparatus, and recording medium
WO2023093291A1 (en) Image processing method and apparatus, computer device, and computer program product
CN113822981B (en) Image rendering method and device, electronic equipment and storage medium
CN108596992B (en) Rapid real-time lip gloss makeup method
CN103702116A (en) Wide dynamic compressing method and device for image
Sethapakdi et al. Painting with CATS: Camera-aided texture synthesis
CN112150387B (en) Method and device for enhancing stereoscopic impression of five sense organs on human images in photo
CN110211214A (en) Texture stacking method, device and the storage medium of three-dimensional map
CN113763525B (en) Hair highlight rendering method, device, equipment and storage medium
CN114882562A (en) Image processing method and device for preventing head from distortion
JPH03154979A (en) Graphic shaping device

Legal Events

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