CN105389835A - Image processing method, device and terminal - Google Patents

Image processing method, device and terminal Download PDF

Info

Publication number
CN105389835A
CN105389835A CN201410446966.8A CN201410446966A CN105389835A CN 105389835 A CN105389835 A CN 105389835A CN 201410446966 A CN201410446966 A CN 201410446966A CN 105389835 A CN105389835 A CN 105389835A
Authority
CN
China
Prior art keywords
pixel
distance
central point
conditioned
mouth
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
CN201410446966.8A
Other languages
Chinese (zh)
Other versions
CN105389835B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201410446966.8A priority Critical patent/CN105389835B/en
Publication of CN105389835A publication Critical patent/CN105389835A/en
Application granted granted Critical
Publication of CN105389835B publication Critical patent/CN105389835B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)

Abstract

The invention discloses an image processing method, device and terminal, so as to carry out the processing of a human face in an image, and achieve an effect of thinning the face or fattening the face. The method comprises the steps: obtaining a first distance and a second distance of the human face in the image; and carrying out the processing of the image when the first and second distances meet a preset condition: taking a mouth central point as the central point, and adjusting pixel values of first pixels in preset regions at two sides of the mouth central point as pixel values of second pixels, wherein the second pixels are located at a preset side of the first pixels, and the distance from the second pixels to the first pixels in a direction parallel to a connection line between the central points of two eyes is a preset distance. The preset side is corresponding to the preset condition, and is one of the outer and inner sides of the first pixel.

Description

A kind of image processing method, device and terminal
Technical field
The present invention relates to technical field of image processing, more specifically, relate to a kind of image processing method, device and terminal.
Background technology
Along with the picture pick-up device of the specialty such as digital camera, micro-list and the widely using of the mobile terminal such as mobile phone, panel computer with camera, increasing user can optionally take.But due to light, apparatus for making a video recording, individual appearance, shooting angle, shooting posture, lens distortion etc. reason, picture effect after some shootings, particularly face position, often not fully up to expectations, particularly some schoolgirls, always think that face gets fat, shape of face is not taken, and can affect the whole structure of photograph.
In order to obtain desirable photo, user can use the image processing softwares such as such as AdobePhotoshop (image processing software developed by AdobeSystems and issue) manually to process picture, by face's slight of stature.But this disposal route learning cost is high, and operates cumbersome, general user is difficult to grasp, thus cannot obtain good treatment effect.
Therefore, a kind of method that just can process the face in image without the need to user operation is needed badly.
Summary of the invention
In view of this, the object of the embodiment of the present invention is to provide a kind of image processing method, device and terminal, in order to process the face in image, reaches the effect of thin face or fat face.
In order to achieve the above object, on the one hand, the embodiment of the present invention proposes a kind of image processing method, comprises the following steps:
Obtain the first Distance geometry second distance in the face in image, wherein, described first distance is the distance between the eyes central point of described face, described second distance is the distance between the mouth central point of described face and reference point, and described reference point is through described mouth central point and is parallel to the straight line of eyes central point line and the intersection point of facial contour;
Judge whether described first Distance geometry second distance meets pre-conditioned;
When described first Distance geometry second distance meets pre-conditioned, described image is processed, wherein:
Centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel default side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction;
Wherein, described default side is: the side in the outside of described first pixel of described pre-conditioned correspondence or inner side.
In one embodiment of this invention, when described pre-conditioned be thin face task corresponding pre-conditioned time, described described image to be processed, comprising:
Centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel outside, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
In one embodiment of this invention, when described pre-conditioned be fat face task corresponding pre-conditioned time, described described image to be processed, comprising:
Centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel inner side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
In one embodiment of this invention, described predeterminable range can be f (r):
θ ( r ) = π r d
λ ( r ) = 1 - 0.8 sin ( rπ d )
f ( r ) = λ ( r ) cos ( θ ( r ) ) + 1 2
Wherein, described r is that described first pixel is being parallel to the distance of side upward to mouth central point of eyes central point line, and described d is described first distance.
In one embodiment of this invention, when described f (r) is for non-integer, described method also can comprise:
The pixel value of described second pixel is obtained by bilinear interpolation.
In one embodiment of this invention, described described image to be processed, can comprise:
Calculate the f (r) that described r is corresponding, generate the corresponding relation of described r and f (r);
According to described first pixel being parallel to the square distance r upward to mouth central point of eyes central point line and described corresponding relation, obtain the f (r) that described first pixel is corresponding;
The f (r) corresponding according to described first pixel determines described second pixel;
The pixel value of described first pixel is adjusted to the pixel value of described second pixel.
In one embodiment of this invention, described predeterminable area can comprise: the pixel region being less than the twice of described first distance in the square distance upward to mouth central point being parallel to eyes central point line.
In one embodiment of this invention, the first Distance geometry second distance in the face in described acquisition image can comprise:
Facial contour location is carried out to described image, obtains the left eye center position of the face in described image, right eye center position, mouth center position and facial contour;
Described first Distance geometry second distance is calculated according to described left eye center position, right eye center position, mouth center position and facial contour.
In one embodiment of this invention, describedly pre-conditionedly to comprise: corresponding pre-conditioned of pre-conditioned and fat face task corresponding to thin face task; Wherein,
Corresponding pre-conditioned of described thin face task, comprising:
The ratio of described second distance and the first distance is more than or equal to the first preset value; Or,
Described first distance is less than or equal to described second distance;
Corresponding pre-conditioned of described fat face task, comprising:
The ratio of described second distance and the first distance is less than the second preset value; Or,
Described first distance is greater than described second distance.
In one embodiment of this invention, described first preset value can be 1.
On the other hand, the embodiment of the present invention proposes a kind of image processing apparatus, comprising:
Acquisition module, for obtaining the first Distance geometry second distance in the face in image, wherein, described first distance is the distance between the eyes central point of described face, described second distance is the distance between the mouth central point of described face and reference point, and described reference point is through described mouth central point and is parallel to the straight line of eyes central point line and the intersection point of facial contour;
Judge module, for judging whether described first Distance geometry second distance meets pre-conditioned;
Processing module, for when described first Distance geometry second distance meets pre-conditioned, described image is processed, wherein: centered by described mouth central point, by described mouth central point both sides predeterminable area in the pixel value of the first pixel be adjusted to the pixel value of the second pixel, described second pixel be positioned at the default side of described first pixel, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction;
Wherein, described default side is: the side in the outside of described first pixel of described pre-conditioned correspondence or inner side.
In one embodiment of this invention, when described pre-conditioned be thin face task corresponding pre-conditioned time, described processing module is used for: centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel outside, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
In one embodiment of this invention, when described pre-conditioned be fat face task corresponding pre-conditioned time, described processing module is used for: centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel inner side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
In one embodiment of this invention, described predeterminable range can be f (r):
θ ( r ) = π r d
λ ( r ) = 1 - 0.8 sin ( rπ d )
f ( r ) = λ ( r ) cos ( θ ( r ) ) + 1 2
Wherein, described r is that described first pixel is being parallel to the distance of side upward to mouth central point of eyes central point line, and described d is described first distance.
In one embodiment of this invention, described processing module, also can be used for, when described f (r) is for non-integer, being obtained the pixel value of described second pixel by bilinear interpolation.
In one embodiment of this invention, described processing module can comprise:
Generation unit, for calculating f (r) corresponding to described r, generates the corresponding relation of described r and f (r);
Search unit, for according to described first pixel being parallel to the side of eyes central point line upward to the distance r of mouth central point and described corresponding relation, obtain the f (r) that described first pixel is corresponding;
Determining unit, determines described second pixel for the f (r) corresponding according to described first pixel;
Adjustment unit, for being adjusted to the pixel value of described second pixel by the pixel value of described first pixel.
In one embodiment of this invention, described predeterminable area can comprise: the pixel region being less than the twice of described first distance in the square distance upward to mouth central point being parallel to eyes central point line.
In one embodiment of this invention, described acquisition module can comprise:
Positioning unit, for carrying out facial contour location to described image, obtains the left eye center position of the face in described image, right eye center position, mouth center position and facial contour;
Computing unit, for calculating described first Distance geometry second distance according to described left eye center position, right eye center position, mouth center position and facial contour.
In one embodiment of this invention, describedly pre-conditionedly to comprise: corresponding pre-conditioned of pre-conditioned and fat face task corresponding to thin face task; Wherein,
Corresponding pre-conditioned of described thin face task, comprising:
The ratio of described second distance and the first distance is more than or equal to the first preset value; Or,
Described first distance is less than or equal to described second distance;
Corresponding pre-conditioned of described fat face task, comprising:
The ratio of described second distance and the first distance is less than the second preset value; Or,
Described first distance is greater than described second distance.
In one embodiment of this invention, described first preset value can be 1.
On the other hand, the embodiment of the present invention also proposes a kind of terminal, and described terminal comprises arbitrary image processing apparatus as above.
The technical scheme that the embodiment of the present invention provides can comprise following beneficial effect:
The embodiment of the present invention can distance between the eyes of face in the picture and mouth when meeting pre-conditioned to the distance of the profile of face, image is processed, image after process can realize the effect of thin face or fat face, meets the demand of user, improves the experience of user.
The further feature of the embodiment of the present invention and advantage will be set forth in the following description, and, partly become apparent from instructions, or understand by implementing the present invention.Object of the present invention and other advantage realize by structure specifically noted in write instructions, claims and accompanying drawing and obtain.
Below by drawings and Examples, the technical scheme of the embodiment of the present invention is described in further detail.
Accompanying drawing explanation
Accompanying drawing is used to provide the further understanding to the embodiment of the present invention, and forms a part for instructions, together with embodiments of the present invention for explaining the present invention, does not form the restriction to the embodiment of the present invention.In the accompanying drawings:
Fig. 1 is the process flow diagram of the image processing method that one embodiment of the invention provides;
Fig. 2 is the face schematic diagram that one embodiment of the invention provides;
Fig. 3 is the rectangular coordinate system schematic diagram for face foundation that one embodiment of the invention provides;
Fig. 4 is the rectangular coordinate system schematic diagram for face foundation that one embodiment of the invention provides;
Fig. 5 is the process flow diagram of the image processing method that another embodiment of the present invention provides;
Fig. 6 is the structural representation of the image processing apparatus that one embodiment of the invention provides;
Fig. 7 is the structural representation of the processing module in the image processing apparatus that provides of one embodiment of the invention;
Fig. 8 is the structural representation of the acquisition module in the image processing apparatus that provides of one embodiment of the invention.
Embodiment
Below in conjunction with accompanying drawing, the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein is only for instruction and explanation of the embodiment of the present invention, is not intended to limit the present invention embodiment.
Be illustrated in figure 1 the main flow of the image processing method in one embodiment of the invention, the method comprises the following steps:
Step S101: obtain the first Distance geometry second distance in the face in image.
Wherein, the first distance is the distance between the eyes central point of face, and second distance is the distance between the mouth central point of face and reference point, and reference point is through mouth central point and is parallel to the straight line of eyes central point line and the intersection point of facial contour.
As shown in Figure 2, in face, eyes central point is respectively EL and ER, and mouth central point is M, and the first distance is d, and second distance is f.
Step S102: judge whether the first Distance geometry second distance meets pre-conditioned.
In one embodiment of this invention, pre-conditioned can be such as corresponding pre-conditioned of thin face task, or corresponding pre-conditioned of fat face task.
Corresponding pre-conditioned of thin face task, can comprise:
The ratio of second distance and the first distance is more than or equal to the first preset value; Or the first distance is less than or equal to second distance; Such as, or can also be that other can indicate relation pre-conditioned between second distance and the first distance, the difference between second distance and the first distance be greater than preset value etc.
Wherein, the first preset value can be set to 1, and namely second distance is more than or equal to the first distance.Now, what reflect in the picture is that the cheek of mouth both sides is more fertile, thus needs to carry out thin face process.Certainly, in other embodiments of the invention, the value of the first preset value also can be adjusted by user, thus determines the condition of image procossing, meets the actual demand of user.
Corresponding pre-conditioned of fat face task, can comprise:
The ratio of second distance and the first distance is less than the second preset value; Or the first distance is greater than second distance; Such as, or can also be that other can indicate relation pre-conditioned between second distance and the first distance, the difference between second distance and the first distance be less than preset value etc.
Wherein, the second preset value such as can be set to 0.8, and now, what reflect in the picture is that the cheek of mouth both sides is thinner, thus needs to carry out fat face process.Certainly, in other embodiments of the invention, the value of the second preset value also can be adjusted by user, thus determines the condition of image procossing, meets the actual demand of user.
Step S103: when the first Distance geometry second distance meets pre-conditioned, image is processed, wherein:
Centered by mouth central point, the pixel value of the first pixel in the predeterminable area of mouth central point both sides is adjusted to the pixel value of the second pixel, the second pixel be positioned at the first pixel default side, with the first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction; Wherein, default side is: the side in the outside of the first pixel of pre-conditioned correspondence or inner side.
The operation of step S103, is equivalent to mouth central point both sides pixel inwardly or to external-adjuster, thus can reach and the face mask of mouth central point both sides to be reduced or to become large effect, thus achieves the effect of thin face or fat face.
The image processing method that the present invention proposes can when the spacing of the eyes of face and mouth central point meet pre-conditioned to the distance of facial contour in the picture, image is processed, image after process can realize the effect of thin face or fat face, meet the demand of user, improve the experience of user.
Predeterminable range in above-described embodiment can be arranged by smoothness as required.Propose a kind of computing method of predeterminable range in the embodiment of the present invention, smoother image procossing can be realized.Particularly, if predeterminable range is f (r):
θ ( r ) = π r d
λ ( r ) = 1 - 0.8 sin ( rπ d )
f ( r ) = λ ( r ) cos ( θ ( r ) ) + 1 2
Wherein, r is that the first pixel is being parallel to the distance of side upward to mouth central point of eyes central point line, and d is the distance between the eyes central point of the first distance and face.
Below illustrate when pre-conditioned be thin face task corresponding pre-conditioned time, image processing method of the present invention.In one embodiment, as shown in Figure 3, for the face in image sets up rectangular coordinate system, the first pixel being positioned at the predeterminable area on the left of mouth central point M is L [x, y], L and M distance on the direction being parallel to eyes central point line is r, so, by the pixel value of the pixel value of the left pixel [x-f (r), y] of the L in image as the first pixel L in the image after process; The 3rd pixel being positioned at the predeterminable area on the right side of mouth central point M is R [p, q], R and M distance on the direction being parallel to eyes central point line is r, so, by the pixel value of the pixel value of the right pixel [p+f (r), q] of the R in image as the 3rd pixel R in the image after process.That is, the solution of the present invention is centered by mouth central point M, the pixel value of the pixel in the predeterminable area of mouth central point both sides is adjusted to be positioned at this pixel outside, with this pixel be parallel to the pixel value that the distance on eyes central point line direction is another pixel of predeterminable range, after the image procossing of this programme, the effect of thin face can be realized.
Below illustrate when pre-conditioned be fat face task corresponding pre-conditioned time, image processing method of the present invention.In one embodiment, as shown in Figure 4, for the face in image sets up rectangular coordinate system, the first pixel being positioned at the predeterminable area on the left of mouth central point M is L [x, y], L and M distance on the direction being parallel to eyes central point line is r, so, by the pixel value of the pixel value of the right pixel [x+f (r), y] of the L in image as the first pixel L in the image after process; The 3rd pixel being positioned at the predeterminable area on the right side of mouth central point M is R [p, q], R and M distance on the direction being parallel to eyes central point line is r, so, by the pixel value of the pixel value of the left pixel [p-f (r), q] of the R in image as the 3rd pixel R in the image after process.That is, the solution of the present invention is centered by mouth central point M, the pixel value of the pixel in the predeterminable area of mouth central point both sides is adjusted to be positioned at this pixel inner side, with this pixel be parallel to the pixel value that the distance on eyes central point line direction is another pixel of predeterminable range, after the image procossing of this programme, the effect of fat face can be realized.
In addition, when predeterminable range f (r) is for non-integer, above-mentioned pixel [x-f (r) can be obtained by bilinear interpolation, y], [p+f (r), q], [x+f (r), y] or the pixel value of [p-f (r), q].
In the above-described embodiments, predeterminable area can be set to the pixel region being less than the twice of the first distance in the square distance upward to mouth central point being parallel to eyes central point line.The object arranging this predeterminable area is only the region that face is all included to be processed in image, and does not need to process whole image, therefore can avoid unnecessary process.
In another embodiment of the invention, can be first the image of RGB (RedGreenBlue, RGB) color mode by image decoding, then under this color mode, carry out image procossing.In other embodiments of the invention, also can be carry out image procossing after the image of other color modes by image decoding, such as CMYK (CyanMagentaYellowBlack, cyan, carmetta, yellow, black) pattern, pattern bitmap, grayscale mode, duotone mode, Indexed Color mode and multi-channel mode.
In another embodiment of the invention, after image is processed, the image after process can also be carried out histogram equalization, to improve the contrast of image.
In another embodiment of the invention, after image is processed, the image after process can also be shown.
Be illustrated in figure 5 another embodiment of the present invention, in this embodiment, the image processing method that the present invention proposes comprises the following steps:
Step S501: the image by image decoding being rgb color pattern.
Step S502: judge whether to carry out facial contour location to image, if so, performs step S503; If not, then failure is shown.
Step S503: obtain the left eye center position of the face in image, right eye center position, mouth center position and facial contour.
Step S504: calculate the first Distance geometry second distance according to left eye center position, right eye center position, mouth center position and facial contour.
In other embodiments of the invention, the first Distance geometry second distance also can be inputted by user, and such as, user's finger or mouse illustrate the first Distance geometry second distance in the picture.
Step S505: judge whether the first Distance geometry second distance meets pre-conditioned; If so, step step S506 is performed; If not, step S510 is performed.
Step S506: calculate the f (r) that r is corresponding, generates the corresponding relation of r and f (r).
This step precalculates f (r) corresponding to r all in predeterminable area, therefore only needs to search this corresponding relation when follow-up process and just can obtain f (r), improve treatment effeciency.
Step S507: according to the corresponding relation of the first pixel in the predeterminable area of mouth central point both sides in the square distance r upward to mouth central point being parallel to eyes central point line and step S506, obtain the f (r) that the first pixel is corresponding.
Step S508: the f (r) corresponding according to the first pixel determines the second pixel.
Step S509: the pixel value pixel value of the first pixel being adjusted to the second pixel.
Step S510: image is carried out histogram equalization.
Step S511: the image after histogram equalization is carried out in display.
In the present embodiment, precompute the f (r) that r is corresponding, utilize the corresponding relation generated to obtain the second pixel corresponding to the first pixel, improve counting yield.Corresponding relation can be embodied as a mapping table or look-up table.
The image processing method that the present embodiment proposes is a kind of method of beautifying portrait photo of automatic thin face or fat face, can the shape of Intelligent Measurement face and profile, identification face is fat or thin, the face of overfertilization is naturally reduced weight, natural getting fat is carried out to excessively thin face, make the personage's shape of face in picture, seem more active, lovely, therefore personage also becomes beautiful beautiful, can not introduce abnormal result simultaneously.
The structural representation of the image processing apparatus that Fig. 6 provides for one embodiment of the invention, as shown in Figure 6, this image processing apparatus comprises:
Acquisition module 601, for obtaining the first Distance geometry second distance in the face in image, wherein, first distance is the distance between the eyes central point of face, second distance is the distance between the mouth central point of face and reference point, and reference point is through mouth central point and is parallel to the straight line of eyes central point line and the intersection point of facial contour;
Judge module 602, for judging whether the first Distance geometry second distance meets pre-conditioned;
Processing module 603, for when the first Distance geometry second distance meets pre-conditioned, image is processed, wherein: centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel default side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction; Wherein, described default side is the side in the outside of described pre-conditioned correspondence, described first pixel or inner side.
In an embodiment of the present invention, when described pre-conditioned be thin face task corresponding pre-conditioned time, described module 603 for: centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel outside, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
In an embodiment of the present invention, when described pre-conditioned be fat face task corresponding pre-conditioned time, processing module 603 for: centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel inner side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
In one embodiment of this invention, predeterminable range can be f (r):
θ ( r ) = π r d
λ ( r ) = 1 - 0.8 sin ( rπ d )
f ( r ) = λ ( r ) cos ( θ ( r ) ) + 1 2
Wherein, r states the first pixel and is being parallel to the distance of side upward to mouth central point of eyes central point line, and d is the first distance.
In one embodiment of this invention, processing module 603, also for when f (r) is for non-integer, obtains the pixel value of the second pixel by bilinear interpolation.
As shown in Figure 7, in one embodiment of this invention, processing module 603 can comprise:
Generation unit 6031, for calculating f (r) corresponding to r, sets up the corresponding relation of r and f (r);
Search unit 6032, for according to the first pixel being parallel to the side of eyes central point line upward to the distance r of mouth central point and corresponding relation, obtain the f (r) that the first pixel is corresponding;
Determining unit 6033, determines the second pixel for the f (r) corresponding according to the first pixel;
Adjustment unit 6034, for being adjusted to the pixel value of the second pixel by the pixel value of the first pixel.
In one embodiment of this invention, predeterminable area is the pixel region being less than the twice of the first distance in the square distance upward to mouth central point being parallel to eyes central point line.
As shown in Figure 8, acquisition module 601 can comprise:
Positioning unit 6011, for carrying out facial contour location to image, obtains the left eye center position of the face in image, right eye center position, mouth center position and facial contour;
Computing unit 6012, for calculating the first Distance geometry second distance according to left eye center position, right eye center position, mouth center position and facial contour.
In one embodiment of this invention, pre-conditionedly can to comprise: corresponding pre-conditioned of pre-conditioned and fat face task corresponding to thin face task; Wherein:
Corresponding pre-conditioned can comprise thin face task: the ratio of second distance and the first distance is more than or equal to the first preset value; Or the first distance is less than or equal to second distance;
Corresponding pre-conditioned can comprise fat face task: the ratio of second distance and the first distance is less than the second preset value; Or the first distance is greater than second distance.
In one embodiment of this invention, the first preset value can be 1.
The above-mentioned image processing apparatus that the embodiment of the present invention provides, can distance between the eyes of face in the picture and mouth when meeting pre-conditioned to the distance of the profile of face, image is processed, image after process can realize the effect of thin face or fat face, meet the demand of user, improve the experience of user.
It should be noted that: the image processing apparatus that above-described embodiment provides is when carrying out image procossing, only be illustrated with the division of above-mentioned each functional module, in practical application, can distribute as required and by above-mentioned functions and be completed by different functional modules, inner structure by device is divided into different functional modules, to complete all or part of function described above.In addition, the image processing apparatus that above-described embodiment provides and image processing method embodiment belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (21)

1. an image processing method, is characterized in that, comprises the following steps:
Obtain the first Distance geometry second distance in the face in image, wherein, described first distance is the distance between the eyes central point of described face, described second distance is the distance between the mouth central point of described face and reference point, and described reference point is through described mouth central point and is parallel to the straight line of eyes central point line and the intersection point of facial contour;
Judge whether described first Distance geometry second distance meets pre-conditioned;
When described first Distance geometry second distance meets pre-conditioned, described image is processed, wherein:
Centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel default side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction; Wherein, described default side is the side in the outside of described pre-conditioned correspondence, described first pixel or inner side.
2. method according to claim 1, is characterized in that, when described pre-conditioned be thin face task corresponding pre-conditioned time, described described image to be processed, comprising:
Centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel outside, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
3. method according to claim 1, is characterized in that, when described pre-conditioned be fat face task corresponding pre-conditioned time, described described image to be processed, comprising:
Centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel inner side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
4. method according to claim 1, is characterized in that, described predeterminable range is f (r):
θ ( r ) = π r d
λ ( r ) = 1 - 0.8 sin ( rπ d )
f ( r ) = λ ( r ) cos ( θ ( r ) ) + 1 2
Wherein, described r is that described first pixel is being parallel to the distance of side upward to mouth central point of eyes central point line, and described d is described first distance.
5. method according to claim 4, is characterized in that, when described f (r) is for non-integer, described method also comprises:
The pixel value of described second pixel is obtained by bilinear interpolation.
6. method according to claim 4, is characterized in that, describedly processes described image, comprising:
Calculate the f (r) that described r is corresponding, generate the corresponding relation of described r and f (r);
According to described first pixel being parallel to the square distance r upward to mouth central point of eyes central point line and described corresponding relation, obtain the f (r) that described first pixel is corresponding;
The f (r) corresponding according to described first pixel determines described second pixel;
The pixel value of described first pixel is adjusted to the pixel value of described second pixel.
7. method according to claim 1, is characterized in that,
Described predeterminable area comprises: the pixel region being less than the twice of described first distance in the square distance upward to mouth central point being parallel to eyes central point line.
8. method according to claim 1, is characterized in that, the first Distance geometry second distance in the face in described acquisition image, comprising:
Facial contour location is carried out to described image, obtains the left eye center position of the face in described image, right eye center position, mouth center position and facial contour;
Described first Distance geometry second distance is calculated according to described left eye center position, right eye center position, mouth center position and facial contour.
9. method according to claim 1, is characterized in that, describedly pre-conditionedly to comprise: corresponding pre-conditioned of pre-conditioned and fat face task corresponding to thin face task; Wherein,
Corresponding pre-conditioned of described thin face task, comprising:
The ratio of described second distance and the first distance is more than or equal to the first preset value; Or,
Described first distance is less than or equal to described second distance;
Corresponding pre-conditioned of described fat face task, comprising:
The ratio of described second distance and the first distance is less than the second preset value; Or,
Described first distance is greater than described second distance.
10. method according to claim 9, is characterized in that, described first preset value is 1.
11. 1 kinds of image processing apparatus, is characterized in that, comprising:
Acquisition module, for obtaining the first Distance geometry second distance in the face in image, wherein, described first distance is the distance between the eyes central point of described face, described second distance is the distance between the mouth central point of described face and reference point, and described reference point is through described mouth central point and is parallel to the straight line of eyes central point line and the intersection point of facial contour;
Judge module, for judging whether described first Distance geometry second distance meets pre-conditioned;
Processing module, for when described first Distance geometry second distance meets pre-conditioned, described image is processed, wherein: centered by described mouth central point, by described mouth central point both sides predeterminable area in the pixel value of the first pixel be adjusted to the pixel value of the second pixel, described second pixel be positioned at the default side of described first pixel, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction;
Wherein, described default side is the side in the outside of described pre-conditioned correspondence, described first pixel or inner side.
12. devices according to claim 11, it is characterized in that, when described pre-conditioned be thin face task corresponding pre-conditioned time, described processing module is used for: centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel outside, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
13. devices according to claim 11, it is characterized in that, when described pre-conditioned be fat face task corresponding pre-conditioned time, described processing module is used for: centered by described mouth central point, the pixel value of the first pixel in the predeterminable area of described mouth central point both sides is adjusted to the pixel value of the second pixel, described second pixel be positioned at described first pixel inner side, with described first pixel be the pixel of predeterminable range being parallel to the distance on eyes central point line direction.
14. devices according to claim 11, is characterized in that, described predeterminable range is f (r):
θ ( r ) = π r d
λ ( r ) = 1 - 0.8 sin ( rπ d )
f ( r ) = λ ( r ) cos ( θ ( r ) ) + 1 2
Wherein, described r is that described first pixel is being parallel to the distance of side upward to mouth central point of eyes central point line, and described d is described first distance.
15. devices according to claim 14, is characterized in that,
Described processing module, also for when described f (r) is for non-integer, obtains the pixel value of described second pixel by bilinear interpolation.
16. devices according to claim 14, is characterized in that, described processing module comprises:
Generation unit, for calculating f (r) corresponding to described r, generates the corresponding relation of described r and f (r);
Search unit, for according to described first pixel being parallel to the side of eyes central point line upward to the distance r of mouth central point and described corresponding relation, obtain the f (r) that described first pixel is corresponding;
Determining unit, determines described second pixel for the f (r) corresponding according to described first pixel;
Adjustment unit, for being adjusted to the pixel value of described second pixel by the pixel value of described first pixel.
17. devices according to claim 11, is characterized in that, described predeterminable area comprises: the pixel region being less than the twice of described first distance in the square distance upward to mouth central point being parallel to eyes central point line.
18. devices according to claim 11, is characterized in that, described acquisition module comprises:
Positioning unit, for carrying out facial contour location to described image, obtains the left eye center position of the face in described image, right eye center position, mouth center position and facial contour;
Computing unit, for calculating described first Distance geometry second distance according to described left eye center position, right eye center position, mouth center position and facial contour.
19. devices according to claim 11, is characterized in that, describedly pre-conditionedly to comprise: corresponding pre-conditioned of pre-conditioned and fat face task corresponding to thin face task; Wherein,
Corresponding pre-conditioned of described thin face task, comprising:
The ratio of described second distance and the first distance is more than or equal to the first preset value; Or,
Described first distance is less than or equal to described second distance;
Corresponding pre-conditioned of described fat face task, comprising:
The ratio of described second distance and the first distance is less than the second preset value; Or,
Described first distance is greater than described second distance.
20. devices according to claim 19, is characterized in that, described first preset value is 1.
21. 1 kinds of terminals, is characterized in that, described terminal comprises the image processing apparatus as described in any one of claim 11-20.
CN201410446966.8A 2014-09-03 2014-09-03 A kind of image processing method, device and terminal Active CN105389835B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410446966.8A CN105389835B (en) 2014-09-03 2014-09-03 A kind of image processing method, device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410446966.8A CN105389835B (en) 2014-09-03 2014-09-03 A kind of image processing method, device and terminal

Publications (2)

Publication Number Publication Date
CN105389835A true CN105389835A (en) 2016-03-09
CN105389835B CN105389835B (en) 2019-07-12

Family

ID=55422084

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410446966.8A Active CN105389835B (en) 2014-09-03 2014-09-03 A kind of image processing method, device and terminal

Country Status (1)

Country Link
CN (1) CN105389835B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107180453A (en) * 2016-03-10 2017-09-19 腾讯科技(深圳)有限公司 The edit methods and device of character face's model
CN107203963A (en) * 2016-03-17 2017-09-26 腾讯科技(深圳)有限公司 A kind of image processing method and device, electronic equipment
CN109509140A (en) * 2017-09-15 2019-03-22 阿里巴巴集团控股有限公司 Display methods and device
CN111105348A (en) * 2019-12-25 2020-05-05 北京市商汤科技开发有限公司 Image processing method and apparatus, image processing device, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7155036B2 (en) * 2000-12-04 2006-12-26 Sony Corporation Face detection under varying rotation
US20080212828A1 (en) * 2007-02-16 2008-09-04 Denso Corporation Device, program, and method for determining sleepiness
CN101777195A (en) * 2010-01-29 2010-07-14 浙江大学 Three-dimensional face model adjusting method
CN102142154A (en) * 2011-05-10 2011-08-03 中国科学院半导体研究所 Method and device for generating virtual face image
CN103605975A (en) * 2013-11-28 2014-02-26 小米科技有限责任公司 Image processing method and device and terminal device
CN103793693A (en) * 2014-02-08 2014-05-14 厦门美图网科技有限公司 Method for detecting face turning and facial form optimizing method with method for detecting face turning

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7155036B2 (en) * 2000-12-04 2006-12-26 Sony Corporation Face detection under varying rotation
US20080212828A1 (en) * 2007-02-16 2008-09-04 Denso Corporation Device, program, and method for determining sleepiness
CN101777195A (en) * 2010-01-29 2010-07-14 浙江大学 Three-dimensional face model adjusting method
CN102142154A (en) * 2011-05-10 2011-08-03 中国科学院半导体研究所 Method and device for generating virtual face image
CN103605975A (en) * 2013-11-28 2014-02-26 小米科技有限责任公司 Image processing method and device and terminal device
CN103793693A (en) * 2014-02-08 2014-05-14 厦门美图网科技有限公司 Method for detecting face turning and facial form optimizing method with method for detecting face turning

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107180453A (en) * 2016-03-10 2017-09-19 腾讯科技(深圳)有限公司 The edit methods and device of character face's model
CN107180453B (en) * 2016-03-10 2019-08-16 腾讯科技(深圳)有限公司 The edit methods and device of character face's model
US10628984B2 (en) 2016-03-10 2020-04-21 Tencent Technology (Shenzhen) Company Limited Facial model editing method and apparatus
CN107203963A (en) * 2016-03-17 2017-09-26 腾讯科技(深圳)有限公司 A kind of image processing method and device, electronic equipment
CN107203963B (en) * 2016-03-17 2019-03-15 腾讯科技(深圳)有限公司 A kind of image processing method and device, electronic equipment
CN109509140A (en) * 2017-09-15 2019-03-22 阿里巴巴集团控股有限公司 Display methods and device
CN111105348A (en) * 2019-12-25 2020-05-05 北京市商汤科技开发有限公司 Image processing method and apparatus, image processing device, and storage medium
TWI743843B (en) * 2019-12-25 2021-10-21 中國商北京市商湯科技開發有限公司 Image processing method, image processing device and storage medium thereof
US11734829B2 (en) 2019-12-25 2023-08-22 Beijing Sensetime Technology Development Co., Ltd. Method and device for processing image, and storage medium

Also Published As

Publication number Publication date
CN105389835B (en) 2019-07-12

Similar Documents

Publication Publication Date Title
US20230224179A1 (en) Mobile information terminal
US9189889B2 (en) Method for building a three-dimensional model and apparatus thereof
EP3674967A1 (en) Image signal processing method, apparatus and device
CN105389835A (en) Image processing method, device and terminal
CN102479379B (en) Image rectification method and relevant image rectification system
CN109190522B (en) Living body detection method based on infrared camera
CN101072289A (en) Automatic generating method and device for image special effect
CN107948544A (en) A kind of multi-channel video splicing system and method based on FPGA
CN108053373A (en) One kind is based on deep learning model fisheye image correcting method
US20080278516A1 (en) System and method for adjusting perceived eye rotation in image of face
CN101938605A (en) Method for generating panoramic video
CN104574289A (en) Fish-eye image distortion correction algorithm based on ellipsoidal model
CN104869372B (en) Projection method and electronic equipment
CN103745429B (en) Method for rapidly realizing eye image processing
CN102915525A (en) Method for correcting barrel distortion of images for full-frame fish-eye lenses
CN103679166A (en) Method and system for quickly acquiring center offset of fisheye lens in equipment
CN103247020A (en) Fisheye image spread method based on radial characteristics
CN107167924A (en) A kind of lens adjusting method of virtual reality device and virtual reality device
CN105488807A (en) Method for calibrating and rectifying telecentric lens
CN107436681A (en) Automatically adjust the mobile terminal and its method of the display size of word
CN104469161B (en) Image processing method and electronic equipment
CN109785225B (en) Method and device for correcting image
CN106067167A (en) Image processing method and device
CN104103057A (en) Method for fast generating panorama by fish eye image
CN109255761B (en) Image processing method and device and electronic equipment

Legal Events

Date Code Title Description
C06 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