Summary of the invention
The purpose of the present invention is to provide a kind of image optimization system and method with automatic thin face function, realize face
Automatic detection, face needs the automatic detection in skinny region, and adds curve matching by edge detection, quasi- to thin face region
It determines position, while the pixel filling in thin face rear region is naturally reasonable, meets with region continuous pixels criterion, algorithm complexity
Lower, thin face is high-efficient.
In order to achieve the above object, the present invention provides a kind of image optimization system with automatic thin face function, includes: people
Face detection module determines the face rectangular area in image comprising face using Face recognition technology, extracts face square
Data in shape region determine eyes regional location;Module is established in face Delta Region, with the face detection module phase
Connection, on the basis of face rectangular area, determines face Delta Region according to eyes regional location;Face boundary curve is established
Module establishes module with the face Delta Region and is connected, and on the basis of face Delta Region, takes turns to face periphery
Exterior feature is determined, and obtains face both sides of the edge curve;Thin face area pixel fills module, true with the face boundary curve
Formwork erection block is connected, and according to face both sides of the edge curve and the side of left and right two of face Delta Region, determines face two sides
Skinny region is needed, and pixel in the region is refilled.
Module is established in the face Delta Region: module is established on Delta Region bottom edge, is examined with the face
It surveys module to be connected, is based on face rectangular area, the center of left and right two-eye area is calculated, the eye of the left and right two
The extended line of the line of the center in eyeball region is face three with the intersection point that two sides of face rectangular area are intersected respectively
Two vertex of angular zone, and the line of the two intersection points is the bottom edge of face Delta Region;Module is established in Delta Region side,
It is established module with the Delta Region bottom edge and is connected, and based on the center of left and right two-eye area, is calculated
Midpoint between two forms the vertical line on face Delta Region bottom edge by the midpoint between this two, with face rectangle region
The intersection point of the bottom edge intersection in domain is the third vertex of face Delta Region, thereby determines that face Delta Region and face triangle
The side of left and right two in region.
The face boundary curve establishes module: face edge detection module is pushed up with the Delta Region
Point establishes module and is connected, using edge detection algorithm to image in the lower-left triangle of face rectangular area and right bottom triangle region
Edge detection is carried out, face edge contour pixel is obtained;Face boundary curve fitting module, with the face edge detection
Module is connected, and is believed according to the coordinate information of face edge contour pixel and the coordinate on three vertex of face Delta Region
Breath, using curve-fitting method, carries out curve fitting to face edge contour, obtains face left and right sides edge contour curve.
The thin face area pixel filling module includes: thin face rear profile curve establishes module, with the face
Boundary curve fitting module is connected, according to face both sides of the edge curve and the side of left and right two of face Delta Region, really
Surely skinny two sides human face region is needed;By each point on the right side side of face Delta Region to face right side edge curve away from
From the curve that is constituted of midpoint be determined as right side face mask curve after thin face, by face Delta Region right side side with it is thin
Right side face mask curve constitutes the new right side face area of formation after thin face after face;By the left side of face Delta Region
The curve that is constituted of midpoint of distance of each point to face left side edge curve is determined as left side of the face contouring after thin face on side
Curve, by a new left side for formation after constituting thin face by left side of the face contouring curve behind the left side side of face Delta Region and thin face
Side face area;Face area pixel filling module after thin face establishes module with the thin face rear profile curve and is connected,
The two are calculated in the new right side face area of formation after skinny right side human face region and thin face as needed
The supplementary set of the intersection in region is right side peripheral region, is by right side face mask curve after face right side edge curve and thin face
It is constituted;After thin face by the new color value of each pixel in the new right side face area of formation by its original color value with
The color value of corresponding pixel points in the peripheral region of right side is calculated and is refilled;Skinny people from left side as needed
By the new left side face area of formation behind face region and thin face, the supplementary set of the intersection in the two regions is calculated as a left side
Side peripheral region is made of face left side edge curve and left side of the face contouring curve after thin face;It will be formed after thin face
New left side face area in each pixel new color value by pair in its original color value and left side peripheral region
It answers the color value of pixel to be calculated and is refilled;New background area pixels fill module after thin face, and described
Thin face after face area pixel filling module be connected, right side peripheral region and left side peripheral region are expanded outward respectively
One equidistant adjacent area is filled using the color value combination mirror image of each pixel in each adjacent area or duplication is filled
Background pixel filling is carried out to right side peripheral region and left side peripheral region respectively.
The image optimization system with automatic thin face function of the present invention, also includes image pre-processing module, with
The face detection module is connected, to original image transmit it to after preparatory data processing face detection module into
Row Face recognition.
The image pre-processing module includes: image denoising module, is carried out using smooth algorithm to image flat
Sliding denoising;Image enhancement module is connected with the image denoising module, to the color of image after smoothing denoising,
Contrast, brightness and histogram are adjusted processing, enhance image definition;Image gray processing and normalization module, difference
It is connected with the image enhancement module and face detection module, gray processing processing is carried out to the image after enhancing clarity
And normalized.
The image optimization system with automatic thin face function of the present invention, also includes post processing of image module, with
The thin face area pixel filling module is connected, to the skinny region in face two sides of filler pixels again and new background area
It is smoothed.
The present invention also provides a kind of image optimization methods with automatic thin face function comprising the steps of:
S1, face detection module determine the face rectangular area in image comprising face using Face recognition technology,
The data in face rectangular area are extracted, determine eyes regional location;
S2, face Delta Region establish module on the basis of face rectangular area, determine people according to eyes regional location
Face Delta Region;
S3, face boundary curve establish module on the basis of face Delta Region, are determined to face circumference,
Obtain face both sides of the edge curve;
S4, thin face area pixel fill mould root tuber are according to face both sides of the edge curve and the left and right two of face Delta Region
Side determines that face two sides need skinny region, and refills to pixel in the region.
In the S2, comprising the following steps:
S21, Delta Region bottom edge establish module and are based on face rectangular area, are calculated in the two-eye area of left and right
Heart position, the extended line of the line of the center of the left and right two-eye area and two sides of face rectangular area are distinguished
The intersection point of intersection is two vertex of face Delta Region, and the line of the two intersection points is the bottom edge of face Delta Region;
S22, Delta Region side establish center of the module based on left and right two-eye area, be calculated two it
Between midpoint, the vertical line on face Delta Region bottom edge, the bottom with face rectangular area are formed by midpoint between this two
The intersection point of side intersection is the third vertex of face Delta Region, thereby determines that face Delta Region and face Delta Region
Two sides in left and right.
In the S3, comprising the following steps:
S31, face edge detection module utilize lower-left triangle and bottom right three of the edge detection algorithm to face rectangular area
Image carries out edge detection in angular zone, obtains face edge contour pixel;
The coordinate information and face trigonum of S32, face boundary curve fitting module according to face edge contour pixel
The coordinate information on three vertex in domain carries out curve fitting to face edge contour using curve-fitting method, and it is left to obtain face
Right both sides of the edge contour curve.
In the S4, comprising the following steps:
S41, thin face rear profile curve establish module according to face both sides of the edge curve and the left and right of face Delta Region
Two sides determine and need skinny two sides human face region;On the right side of each point on the right side side of face Delta Region to face
The curve that the midpoint of the distance of boundary curve is constituted is determined as right side face mask curve after thin face, by face Delta Region
Right side face mask curve constitutes the new right side face area of formation after thin face after right side side and thin face;By face three
On the left side side of angular zone each point to face left side edge curve distance the curve that is constituted of midpoint be determined as thin face after
Left side face mask curve, will after constituting thin face by left side of the face contouring curve behind the left side side of face Delta Region and thin face
The new left side face area formed;
It will after face area pixel filling module skinny right side human face region and thin face as needed after S42, thin face
The new right side face area formed, it is by people that the supplementary set that the intersection in the two regions is calculated, which is right side peripheral region,
Face right side edge curve is constituted with right side face mask curve after thin face;It will be in the new right side face area of formation after thin face
The new color value of each pixel is calculated by the color value of the corresponding pixel points in its original color value and right side peripheral region
It obtains and is refilled;As needed by the new left side face of formation after skinny left side human face region and thin face
Region, be calculated the intersection in the two regions supplementary set be left side peripheral region, be by face left side edge curve with it is thin
Left side of the face contouring curve is constituted after face;By the new color of each pixel in the new left side face area of formation after thin face
Value is calculated and is refilled by the color value of its original color value and the corresponding pixel points in the peripheral region of left side;
New background area pixels filling module is outside to right side peripheral region and left side peripheral region difference after S43, thin face
An equidistant adjacent area is expanded in side, is filled using the color value combination mirror image of each pixel in each adjacent area or multiple
System filling carries out background pixel filling to right side peripheral region and left side peripheral region respectively.
The image optimization method with automatic thin face function of the present invention also includes before the S1: S0,
Image pre-processing module carries out preparatory data processing to original image, and is transmitted to face detection module progress face and knows automatically
Not.
In the S0, comprising the following steps:
S01, image denoising module carry out smoothing denoising processing to image using smooth algorithm;
S02, image enhancement module are adjusted place to the color of image, contrast, brightness and histogram after smoothing denoising
Reason enhances image definition;
S03, image gray processing and normalization module carry out gray processing and normalized to the image after enhancing clarity.
The image optimization method with automatic thin face function of the present invention also includes after the S4: S5,
Post processing of image module is smoothed the skinny region in face two sides of filler pixels again and new background area.
The image optimization system and method with automatic thin face function provided by the present invention, are able to achieve the automatic inspection of face
It surveys, face needs the automatic detection in skinny region, and adds curve matching by edge detection, thin face region is accurately positioned,
Pixel filling simultaneously in thin face rear region is naturally reasonable, meets with region continuous pixels criterion, algorithm complexity is lower, thin
Face is high-efficient.
Specific embodiment
The present invention is done and is further explained by the way that a preferable specific embodiment is described in detail below in conjunction with FIG. 1 to FIG. 4
It states.
As shown in Figure 1, including for the image optimization system with automatic thin face function provided by the present invention: face inspection
Module 2 is surveyed, utilizing have been relatively mature at present and determine in the Face recognition technology of a large amount of different fields application
Comprising the face rectangular area F of face in image, specifically as shown in Fig. 2, extracting the data in the F of face rectangular area, eye is determined
The position of eyeball, nose and mouth, especially eyes regional location;Module 3 is established in face Delta Region, examines with the face
It surveys module 2 to be connected, in face rectangular area on the basis of F, face Delta Region is determined according to eyes regional location;Face side
Edge curve establishes module 4, establishes module 3 with the face Delta Region and is connected, on the basis of face Delta Region,
Face circumference is determined, face both sides of the edge curve is obtained;Thin face area pixel fills module 5, and described
Face boundary curve establishes module 4 and is connected, according to face both sides of the edge curve and the side of left and right two of face Delta Region
Side determines that face two sides need skinny region, and refills to pixel in the region, reaches thin face effect.
As shown in Fig. 2, the face Delta Region establishment module 3 includes: module 31 is established on Delta Region bottom edge, with
The face detection module 2 is connected, and is based on face rectangular area F, the centre bit of left and right two-eye area is calculated
Set ElAnd Er, the line of the center of the left and right two-eye areaExtended line and face rectangular area F two sides
Side intersects at point L and point R respectively, therefore the two intersection points L and R are two vertex of face Delta Region, and lineFor
The bottom edge of face Delta Region;Module 32 is established in Delta Region side, establishes 31 phase of module with the Delta Region bottom edge
Connection, the center E based on left and right two-eye arealAnd Er, the midpoint C between two, that is, left and right two is calculated
The line of the center of a eye areasMidpoint C, by C dot at face Delta Region bottom edgeVertical line, and
Point B is intersected at the bottom edge of face rectangular area F, which is the third vertex of face Delta Region, thereby determines that face
Delta Region is, the side of left and right two of face Delta Region is respectivelyWith, and this two sides be even more after
The continuous reference line for carrying out thin face processing.
As shown in Fig. 2, the face boundary curve establishes module 4 includes: face edge detection module 41, and it is described
Delta Region vertex establish module 32 and be connected, according to low frequency between pixel in human face region, human face region edge pixel and back
The characteristic of high frequency between scene element, lower-left triangle and right bottom triangle region using edge detection algorithm to face rectangular area F
Interior image carries out edge detection, rough to obtain face edge contour pixel;Face boundary curve fitting module 42, and it is described
Face edge detection module 41 is connected, according to the three of the coordinate information of face edge contour pixel and face Delta Region
The coordinate information of a vertex L, R, B carry out curve fitting to face edge contour using curve-fitting method, and it is left to obtain face
Right both sides of the edge contour curveWith, and then in subsequent thin face processing, face is indicated with this two matched curves
Edge contour.
The thin face area pixel filling module 5 includes: thin face rear profile curve establishes module 51, with the people
Face boundary curve fitting module 42 is connected, as shown in fig. 2 and fig. 3 a, according to face both sides of the edge curve、And
The side of left and right two of face Delta Region、, determine that the skinny human face region of needs is、;As shown in Figure 3B,
By the right side side of face Delta RegionUpper each point is to face right side edge curveDistance the song that is constituted of midpoint
LineIt is determined as right side face mask curve after thin face, therefore, by the right side side of face Delta RegionAfter thin face
Right side face mask curveIt constitutes the new right side face area of formation after thin face;And for left side after thin face
Identical mode can be used in the new left side face area of formation after face mask curve and thin face to obtain, i.e., by face three
The left side side of angular zoneUpper each point is to face left side edge curveDistance the curve that is constituted of midpoint (in figure
Do not show) it is determined as left side of the face contouring curve after thin face, by the left side side of face Delta RegionWith left side of the face portion after thin face
Contour curve is constituted the new left side face area of formation after thin face;Face area pixel filling module 52 after thin face, with
The thin face rear profile curve establishes module 51 and is connected, in order to keep after thin face the continuity of face color with naturally, thin
The color value (gray value) of the pixel of the new left and right sides face area formed after face must be by the pixel face of its peripheral region
Color value (gray value) is calculated and is filled;Skinny right side human face region as neededAnd by the new of formation after thin face
Right side face area, the supplementary set of the intersection in the two regions is calculated, in Fig. 3 C it can be seen fromIt is by face right side edge curveWith right side face mask curve after thin faceThe peripheral region constituted;Thin face
Afterwards by the new right side face area of formationIn each pixel new color value (gray value) by its original color value
(gray value) and peripheral regionThe color value (gray value) of interior corresponding pixel points is calculated and is refilled;Together
Sample, skinny left side human face region as neededAnd the new left side face area of formation is calculated after thin face
Supplementary set to the intersection in the two regions is left side peripheral region, is by face left side edge curveWith left side after thin face
Face mask curve is constituted;By the new color value of each pixel in the new left side face area of formation by its original after thin face
Some color values and the color value of the corresponding pixel points in the peripheral region of left side are calculated and are refilled;It is new after thin face
Background area pixels fill module 53, are connected with face area pixel filling module 52 after the thin face, thin when completing
After face when the pixel filling of face area, left side peripheral region and right side peripheral regionThe new back of picture after referred to as thin face
Scene area, wherein color value (gray value) needs of each pixel are filled by the pixel of its adjacent area;As described in Fig. 3 D,
To right side peripheral regionExpand an equidistant adjacent area outward, utilize adjacent areaIn each pixel
Color value combines common filling algorithm (such as mirror image filling or duplication filling) to right side peripheral regionBackground pixel is carried out to fill out
It fills;Likewise, also carry out the filling of background pixel to left side peripheral region, thus the face after obtaining as shown in FIGURE 3 E skinny
Region.
The image optimization system with automatic thin face function of the present invention, also includes image pre-processing module 1, with
The face detection module 2 is connected, and transmits it to face detection module 2 after carrying out preparatory data processing to original image
Carry out Face recognition.
The image pre-processing module 1 includes: image denoising module 11, is carried out using smooth algorithm to image
Smoothing denoising processing reduces noise present in image to the subsequent interference for carrying out thin face processing;Image enhancement module 12, with
The image denoising module 11 is connected, and is adjusted to the color of image, contrast, brightness and histogram after smoothing denoising
Processing enhances image definition;Image gray processing and normalization module 13, respectively with the image enhancement module 12 and
Face detection module 2 is connected, and carries out gray processing to the image after enhancing clarity and handles to provide image border data, after being
Continuous face edge detection is ready, and is normalized to avoid picture size and image grayscale range to data
The influence of reason.
The image optimization system with automatic thin face function of the present invention, also includes post processing of image module 6, with
The thin face area pixel filling module 5 is connected, to the skinny region in face two sides of filler pixels again and new background area
Domain is smoothed, and keeps the continuity between the area pixel, so that the colouring information in the region seems more natural.
As shown in figure 4, including following step the present invention also provides a kind of image optimization method with automatic thin face function
It is rapid:
S1, face detection module 2 determine the face rectangular area in image comprising face using Face recognition technology
F determines the position of eyes, nose and mouth specifically as shown in Fig. 2, extracting the data in the F of face rectangular area, especially double
Eye regional location;
S2, face Delta Region establish module 3 on the basis of the F of face rectangular area, are determined according to eyes regional location
Face Delta Region;
S3, face boundary curve establish module 4 on the basis of face Delta Region, carry out to face circumference true
It is fixed, obtain face both sides of the edge curve;
S4, thin face area pixel filling module 5 are according to face both sides of the edge curve and the left and right two of face Delta Region
Side, determines that face two sides need skinny region, and refill to pixel in the region, reaches thin face effect.
In the S2, comprising the following steps:
S21, Delta Region bottom edge establish module 31 and are based on face rectangular area F, and left and right two-eye area is calculated
Center ElAnd Er, the line of the center of the left and right two-eye areaExtended line and face rectangular area F
Two sides intersect at point L and point R respectively, the two intersection points L and R are two vertex of face Delta Region, and lineFor the bottom edge of face Delta Region;
Center E of the module 32 based on left and right two-eye area is established in S22, Delta Region sidelAnd Er, calculate
Midpoint C between to two, that is, left and right two-eye area center lineMidpoint C, pass through C dot
At face Delta Region bottom edgeVertical line, intersect at point B with the bottom edge of face rectangular area F, which is face three
The third vertex of angular zone thereby determines that face Delta Region is, the side of left and right two point of face Delta Region
It is notWith。
In the S3, comprising the following steps:
S31, face edge detection module 41 are according to low frequency between pixel in human face region, human face region edge pixel and background
The characteristic of high frequency between pixel, using edge detection algorithm in the lower-left triangle of face rectangular area F and right bottom triangle region
Image carries out edge detection, rough to obtain face edge contour pixel;
S32, face boundary curve fitting module 42 are according to the coordinate information and face triangle of face edge contour pixel
The coordinate information of three vertex L, R, the B in region carry out curve fitting to face edge contour, are obtained using curve-fitting method
Obtain face left and right sides edge contour curveWith。
In the S4, comprising the following steps:
S41, as shown in fig. 2 and fig. 3 a, thin face rear profile curve establish module 51 according to face both sides of the edge curve、And the side of the left and right of face Delta Region two、, determine that the skinny human face region of needs is、;Such as
Shown in Fig. 3 B, by the right side side of face Delta RegionUpper each point is to face right side edge curveDistance midpoint
The curve constitutedIt is determined as right side face mask curve after thin face, by the right side side of face Delta RegionWith it is thin
Right side face mask curve after faceIt constitutes the new right side face area of formation after thin face;By face trigonum
The left side side in domainUpper each point is to face left side edge curveThe curve that is constituted of midpoint of distance be determined as thin face
Left side of the face contouring curve afterwards, by the left side side of face Delta RegionIt is constituted with left side of the face contouring curve after thin face thin
By the new left side face area of formation after face;
The skinny right side human face region as needed of face area pixel filling module 52 after S42, thin faceAnd it is thin
By the new right side face area of formation after face, the supplementary set of the intersection in the two regions is calculated, by
It can be seen that in Fig. 3 CIt is by face right side edge curveWith right side face mask curve after thin faceIt is constituted
Peripheral region;By the new right side face area of formation after thin faceIn each pixel new color value (gray value) by
Its original color value (gray value) and peripheral regionThe color value (gray value) of interior corresponding pixel points, which is calculated, goes forward side by side
Row refills;Likewise, skinny left side human face region as neededAnd by the new left side of the face of formation after thin face
Portion region, it is by face left side edge curve that the supplementary set that the intersection in the two regions is calculated, which is left side peripheral region,It is constituted with left side of the face contouring curve after thin face;By each pixel in the new left side face area of formation after thin face
New color value is calculated and is carried out by the color value of its original color value and the corresponding pixel points in the peripheral region of left side
It refills;
S43, as described in Fig. 3 D, 53 pairs of right sides of new background area pixels filling module peripheral region after thin faceOutward
Expand an equidistant adjacent area, utilize adjacent areaIn the color value of each pixel combine common filling algorithm
(such as mirror image filling or duplication filling) is to right side peripheral regionCarry out background pixel filling;Likewise, to left side peripheral region
Domain also carries out the filling of background pixel, thus the human face region after obtaining as shown in FIGURE 3 E skinny.
It is specific each for after thin face by the new right side face area of formation in the S42 in the present embodiment
Following methods realization can be used in the calculation method of the new color value of pixel: the right side side for being located at face Delta Region
On wherein certain point O, pass through O point formed with right side sidePerpendicular vertical line and respectively with face right side edge curveAnd right side face mask curve after thin faceIntersect at point T and point T ', it is assumed that lineThe picture at upper any point
Plain color value (gray value) is, lineAbove the pixel color value of corresponding equidistant point is, then line
Above the new color value (gray value) of the pixel is, wherein、It is a constant, and。
The image optimization method with automatic thin face function of the present invention also includes before the S1: S0,
Image pre-processing module 1 carries out preparatory data processing to original image, and is transmitted to the progress face of face detection module 2 and knows automatically
Not, carrying out pretreatment to image is to improve the efficiency and success rate of face-slimming method to provide better resource to subsequent step.
In the S0, comprising the following steps:
S01, image denoising module 11 carry out smoothing denoising processing to image using smooth algorithm;
S02, image enhancement module 12 are adjusted the color of image, contrast, brightness and histogram after smoothing denoising
Processing enhances image definition;
Image after 13 pairs of module S03, image gray processing and normalization enhancing clarity carries out at gray processing and normalization
Reason.
The image optimization method with automatic thin face function of the present invention also includes after the S4: S5,
Post processing of image module 6 is smoothed the skinny region in face two sides of filler pixels again and new background area.
The image optimization system and method with automatic thin face function provided by the present invention, are able to achieve the automatic inspection of face
It surveys, face needs the automatic detection in skinny region, and adds curve matching by edge detection, thin face region is accurately positioned,
Pixel filling simultaneously in thin face rear region is naturally reasonable, meets with region continuous pixels criterion, algorithm complexity is lower, thin
Face is high-efficient.
It is discussed in detail although the contents of the present invention have passed through above preferred embodiment, but it should be appreciated that above-mentioned
Description is not considered as limitation of the present invention.After those skilled in the art have read above content, for of the invention
A variety of modifications and substitutions all will be apparent.Therefore, protection scope of the present invention should be limited to the appended claims.