CN109146769A - Image processing method and device, image processing equipment and storage medium - Google Patents

Image processing method and device, image processing equipment and storage medium Download PDF

Info

Publication number
CN109146769A
CN109146769A CN201810819327.XA CN201810819327A CN109146769A CN 109146769 A CN109146769 A CN 109146769A CN 201810819327 A CN201810819327 A CN 201810819327A CN 109146769 A CN109146769 A CN 109146769A
Authority
CN
China
Prior art keywords
coordinate
dimensional coordinate
dimensional
point
image
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.)
Pending
Application number
CN201810819327.XA
Other languages
Chinese (zh)
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.)
Beijing Sensetime Technology Development Co Ltd
Original Assignee
Beijing Sensetime Technology Development 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 Beijing Sensetime Technology Development Co Ltd filed Critical Beijing Sensetime Technology Development Co Ltd
Priority to CN201810819327.XA priority Critical patent/CN109146769A/en
Publication of CN109146769A publication Critical patent/CN109146769A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/06Topological mapping of higher dimensional structures onto lower dimensional surfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/403Edge-driven scaling; Edge-based scaling
    • 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
    • G06T2207/30201Face

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the invention provides a kind of image processing method and devices, image processing equipment and storage medium.Image processing method provided by the invention includes: to obtain the three-dimensional coordinate of the first object of two-dimensional first image in three-dimensional space;The three-dimensional coordinate is mapped in two-dimensional space, two-dimensional coordinate is obtained;The deformation process for carrying out first object to the first image based on the two-dimensional coordinate, obtains the second image.

Description

Image processing method and device, image processing equipment and storage medium
Technical field
The present invention relates to information technology field more particularly to a kind of image processing method and device, image processing equipment and Storage medium.
Background technique
Existing many electronic equipments, which are equipped with the image capture devices such as camera, can acquire image;But acquisition Image usually has certain distortion or the ideal effect that user wants is not achieved.If directly transformation image capture device is certainly Body, first aspect technical difficulty is big, and second aspect is at high cost, even if the third aspect, which develops, can reduce distortion or can adopt The image capture device for the ideal effect that collection user wants, general structure is complicated and quality is big and/or volume is big;Be inconvenient to integrate In the mobile device that user is convenient for carrying.
In this way, being all in the related art to reduce distortion or image is made to reach the ideal effect that user wants By the image procossing in later period, so that the distortion of image reduces or reaches the ideal effect that user wants.But presently relevant skill Image processing effect in art, although making up the undesirable problem of image effect caused by hardware limitations to a certain extent, It is that there are also a distances for the ideal effect wanted from user, therefore how to promote image effect and be still and needed in the prior art into one Step solves the problems, such as.
Summary of the invention
In view of this, an embodiment of the present invention is intended to provide a kind of image processing method and device, image processing equipment and depositing Storage media.
The technical scheme of the present invention is realized as follows:
In a first aspect, the embodiment of the present invention provides a kind of image processing method, comprising:
Obtain the three-dimensional coordinate of the first object of two-dimensional first image in three-dimensional space;
The three-dimensional coordinate is mapped in two-dimensional space, two-dimensional coordinate is obtained;
The deformation process for carrying out first object to the first image based on the two-dimensional coordinate, obtains the second figure Picture.
Based on above scheme, the three-dimensional coordinate of first object for obtaining two-dimensional first image in three-dimensional space, Include:
The three-dimensional coordinate of the second object based on the first image positions the three-dimensional coordinate of first object, wherein Second object includes first object.
Based on above scheme, the three-dimensional coordinate of second object based on the first image positions described first pair The three-dimensional coordinate of elephant, comprising:
According to the three-dimensional coordinate of second object, the first coordinate of the core point of first object is positioned;
According to the default deformation parameter of first object and first coordinate, the boundary point of first object is obtained The second coordinate.
Based on above scheme, the default deformation parameter and first coordinate according to first object obtains institute State the second coordinate of the boundary point of the first object, comprising:
Determine the difference of the deformation values of the core point and the deformation values of the boundary point;
According to the incidence relation of the spacing between the difference and the core point and the boundary point, the side is determined Second coordinate of boundary's point.
Based on above scheme, second coordinate is obtained using following function;
x*For first coordinate the first reference axis of the three-dimensional space value;y*It is first coordinate in institute State the value of the second reference axis of three-dimensional space;I is the deformation values determined according to the default deformation parameter;IgFor given value, For the corresponding deformation values of the boundary point, x is value of second coordinate in first reference axis of the three-dimensional space; Y is value of second coordinate in the second reference axis of the three-dimensional space;A is known first parameter;B is known the Two parameters;
According to x*And y*Determine z*, wherein z*Third reference axis for first coordinate in the three-dimensional space takes Value;
Z is determined according to x and y, wherein z is value of second coordinate in the third reference axis of the three-dimensional space;
First reference axis is perpendicular to second reference axis;
First reference axis vertically with the third reference axis;
Second reference axis is perpendicular to the third reference axis.
Based on above scheme, the method also includes:
According to the orientation information of first object, the first plane where first object is determined;
According to the default deformation parameter, the deformation values I on the normal of first plane is determined.
Based on above scheme, the three-dimensional coordinate according to second object positions the core point of first object The first coordinate, comprising:
According to the three-dimensional coordinate of second object, the initial coordinate of the core point of first object is determined;
According to the three-dimensional coordinate of the mesh point grid vertex nearest apart from the initial coordinate, first coordinate is determined.
Based on above scheme, second object is face;
First object is apple flesh.
It is described that the three-dimensional coordinate is mapped in two-dimensional space based on above scheme, obtain two-dimensional coordinate, comprising:
According to camera internal reference matrix parameter, the three-dimensional coordinate is mapped to the two-dimensional space, the two dimension is obtained and sits Mark.
It is described according to camera internal reference matrix parameter based on above scheme, it is empty that the three-dimensional coordinate is mapped to the two dimension Between, obtain the two-dimensional coordinate, comprising:
According to camera focal length on a two-dimensional coordinate axis, the coordinate value and three-dimensional coordinate of principal point for camera, the two dimension is determined Coordinate.
The two-dimensional coordinate is obtained using following functional relation based on above scheme;
x2dFor the two-dimensional coordinate the 4-coordinate axis of the two-dimensional space value;y2dExist for the two-dimensional coordinate The value of the Five Axis axis of the two-dimensional space;The 4-coordinate axis is perpendicular to the Five Axis value;x3dIt is described three Coordinate is tieed up in the value of the first reference axis of the three-dimensional space;y3dIt is sat for the three-dimensional coordinate the second of the three-dimensional space The value of parameter;z3dFor the three-dimensional coordinate the third reference axis of the three-dimensional space value;fxIt is camera described Focal length on 4-coordinate axis;fyFor focal length of the camera on the Five Axis axis;cxFor camera the first image pixel planes The interior coordinate value corresponding to the principal point for camera of reference axis where the 4-coordinate;cyFor camera the first image pixel planes The coordinate value of the interior principal point for camera corresponding to the Five Axis.
Based on above scheme, which comprises
According to default deformation parameter and the three-dimensional coordinate, deformed three-dimensional coordinate is obtained;
It is described that the three-dimensional coordinate is mapped in two-dimensional space, obtain two-dimensional coordinate, comprising:
The three-dimensional coordinate before deformation is mapped in the two-dimensional space, source two-dimensional coordinate is obtained;
The deformed three-dimensional coordinate is mapped in the two-dimensional space, target two-dimensional coordinate is obtained;
The method also includes:
Based on the source two-dimensional coordinate and target two-dimensional coordinate, transformation parameter is obtained;
The deformation process for carrying out first object to the first image based on the two-dimensional coordinate, obtains second Image, comprising:
Coordinate conversion is carried out according to two-dimensional coordinate of the transformation parameter to first object in the first image, Obtain second image.
It is described to be based on the source two-dimensional coordinate and target two-dimensional coordinate based on above scheme, obtain transformation parameter, comprising:
Using the source two-dimensional coordinate and predetermined constant, the first matrix of 3*N is constructed, wherein N is positive integer;
Using the target two-dimensional coordinate and the predetermined constant, the second matrix of dimension 3*N is constructed;
Determine second matrixing to first matrix transformation parameter.
Based on above scheme, the transformation parameter T is obtained based on following functional relation:
xsrcFor the value that the source two-dimensional coordinate is in 4-coordinate axis;ysrcIt is to be sat the 5th for the source two-dimensional coordinate The value of parameter;xdstFor the value that the target two-dimensional coordinate is in 4-coordinate axis;ydstIt is for the target two-dimensional coordinate In the value of Five Axis axis.
Based on above scheme, the deformation for carrying out first object to the first image based on the two-dimensional coordinate Processing, obtains the second image, comprising:
Based on the two-dimensional coordinate construct convex polygon, wherein the convex polygon by first object boundary point Two-dimensional coordinate be formed by connecting;
The convex polygon is converted into several triangles, the triangle, by the two neighboring of first object The two-dimensional coordinate of the central point of the two-dimensional coordinate of boundary point and first object is formed by connecting;
Using triangle fractal transform, the source two-dimensional coordinate of first object is converted into target two-dimensional coordinate, is obtained described Second image.
It is described that the convex polygon is constructed based on the two-dimensional coordinate based on above scheme, comprising:
According to the two-dimensional coordinate of the boundary point of first object, the first starting point coordinate is determined;
After determining first starting point coordinate, according to the neighbouring relations between the two-dimensional coordinate of the boundary point, really Next first starting point coordinate is made, until the two dimension for orienting all boundary points of outermost in the boundary point is sat Mark;
All boundary points for connecting the outermost, form the convex polygon.
Based on above scheme, the two-dimensional coordinate of the boundary point according to first object determines that the first starting point is sat Mark, comprising:
Determine the two-dimensional coordinate in the boundary point of first object in the smallest boundary point of the coordinate of the first reference axis As first starting point coordinate;
If in the smallest boundary point more than one of coordinate of first reference axis, choosing in the boundary point of first object The boundary point for selecting out first object is minimum in the coordinate of first reference axis and the smallest in the coordinate of the second reference axis The two-dimensional coordinate of boundary point is as first starting point coordinate.
Second aspect, the embodiment of the present invention provide a kind of image processing apparatus, comprising:
First obtains module, for obtaining the three-dimensional coordinate of the first object of two-dimensional first image in three-dimensional space;
Mapping block obtains two-dimensional coordinate for the three-dimensional coordinate to be mapped in two-dimensional space;
Deformation module, at the deformation for carrying out first object to the first image based on the two-dimensional coordinate Reason, obtains the second image.
Based on above scheme, described first obtains module, specifically for three of the second object based on the first image Coordinate is tieed up, the three-dimensional coordinate of first object is positioned, wherein second object includes first object.
Based on above scheme, described first obtains module, specifically for the three-dimensional coordinate according to second object, positioning First coordinate of the core point of first object;According to the default deformation parameter of first object and first coordinate, Obtain the second coordinate of the boundary point of first object.
Based on above scheme, described first obtains module, deformation values and the side specifically for the determination core point The difference of the deformation values of boundary's point;According to the incidence relation of the spacing between the difference and the core point and the boundary point, Determine second coordinate of the boundary point.
Based on above scheme, second coordinate is obtained using following function;
x*For first coordinate the first reference axis of the three-dimensional space value;y*It is first coordinate in institute State the value of the second reference axis of three-dimensional space;I is the deformation values determined according to the default deformation parameter;IgFor given value, For the corresponding deformation values of the boundary point, x is value of second coordinate in first reference axis of the three-dimensional space; Y is value of second coordinate in the second reference axis of the three-dimensional space;A is known first parameter;B is known the Two parameters;
According to x*And y*Determine z*, wherein z*Third reference axis for first coordinate in the three-dimensional space takes Value;
Z is determined according to x and y, wherein z is value of second coordinate in the third reference axis of the three-dimensional space;
First reference axis is perpendicular to second reference axis;
First reference axis vertically with the third reference axis;
Second reference axis is perpendicular to the third reference axis.
Based on above scheme, described device further include:
First determining module determines where first object for the orientation information according to first object One plane;
Second determining module, for determining the change on the normal of first plane according to the default deformation parameter Shape value I.
Based on above scheme, described first obtains module, specifically for the three-dimensional coordinate according to second object, determines The initial coordinate of the core point of first object;According to the three-dimensional of the mesh point grid vertex nearest apart from the initial coordinate Coordinate determines first coordinate.
Based on above scheme, second object is face;
First object is apple flesh.
Based on above scheme, the mapping block, for according to camera internal reference matrix parameter, the three-dimensional coordinate to be mapped To the two-dimensional space, the two-dimensional coordinate is obtained.
Based on above scheme, the mapping block, specifically for according to camera focal length on a two-dimensional coordinate axis, phase owner The coordinate value and three-dimensional coordinate of point, determine the two-dimensional coordinate.
The two-dimensional coordinate is obtained using following functional relation based on above scheme;
x2dFor the two-dimensional coordinate the 4-coordinate axis of the two-dimensional space value;y2dExist for the two-dimensional coordinate The value of the Five Axis axis of the two-dimensional space;The 4-coordinate axis is perpendicular to the Five Axis value;x3dIt is described three Coordinate is tieed up in the value of the first reference axis of the three-dimensional space;y3dIt is sat for the three-dimensional coordinate the second of the three-dimensional space The value of parameter;z3dFor the three-dimensional coordinate the third reference axis of the three-dimensional space value;fxIt is camera described Focal length on 4-coordinate axis;fyFor focal length of the camera on the Five Axis axis;cxFor camera the first image pixel planes The interior coordinate value corresponding to the principal point for camera of reference axis where the 4-coordinate;cyFor camera the first image pixel planes The coordinate value of the interior principal point for camera corresponding to the Five Axis.
Based on above scheme, described device includes:
Second obtains module, for obtaining deformed three-dimensional coordinate according to deformation parameter and the three-dimensional coordinate is preset;
The mapping block obtains source two for the three-dimensional coordinate before deformation to be mapped in the two-dimensional space Tie up coordinate;The deformed three-dimensional coordinate is mapped in the two-dimensional space, target two-dimensional coordinate is obtained;
Described device further include:
Third obtains module, for being based on the source two-dimensional coordinate and target two-dimensional coordinate, obtains transformation parameter;
The deformation module, for the two dimension according to the transformation parameter to first object in the first image Coordinate carries out coordinate conversion, obtains second image.
Based on above scheme, the third obtains module, is specifically used for utilizing the source two-dimensional coordinate and predetermined constant, structure Build the first matrix of 3*N, wherein N is positive integer;Using the target two-dimensional coordinate and the predetermined constant, dimension 3*N is constructed The second matrix;Determine second matrixing to first matrix transformation parameter.
Based on above scheme, the transformation parameter T is obtained based on following functional relation:
xsrcFor the value that the source two-dimensional coordinate is in 4-coordinate axis;ysrcIt is to be sat the 5th for the source two-dimensional coordinate The value of parameter;xdstFor the value that the target two-dimensional coordinate is in 4-coordinate axis;ydstIt is for the target two-dimensional coordinate In the value of Five Axis axis.
Based on above scheme, described device further include:
Module is constructed, for constructing convex polygon based on the two-dimensional coordinate, wherein the convex polygon is by described first The two-dimensional coordinate of the boundary point of object is formed by connecting;
The deformation module, for the convex polygon to be converted to several triangles, wherein the triangle, by The two-dimensional coordinate of the central point of the two-dimensional coordinate and first object of the two neighboring boundary point of first object connect and At;Using triangle fractal transform, the source two-dimensional coordinate of first object is converted into target two-dimensional coordinate, obtains second figure Picture.
Based on above scheme, the building module, specifically for the two-dimensional coordinate according to the boundary point of first object, Determine the first starting point coordinate;After determining first starting point coordinate, according between the two-dimensional coordinate of the boundary point Neighbouring relations determine next first starting point coordinate, until orienting all sides of outermost in the boundary point The two-dimensional coordinate of boundary's point;All boundary points for connecting the outermost, form the convex polygon.
Based on above scheme, the building module, first in the boundary point specifically for determining first object The two-dimensional coordinate of the smallest boundary point of the coordinate of reference axis is as first starting point coordinate;If the boundary of first object In the smallest boundary point more than one of coordinate of first reference axis in point, the boundary point of first object is selected in institute State the coordinate minimum of the first reference axis and in the two-dimensional coordinate of the smallest boundary point of the coordinate of the second reference axis as described first Starting point coordinate.
The third aspect, the embodiment of the invention provides a kind of computer storage medium, the computer storage medium storage There is computer-executable code;After the computer-executable code is performed, it can be realized first aspect any embodiment and mention The image processing method of confession.
Fourth aspect, a kind of computer program product provided in an embodiment of the present invention, described program product includes computer Executable instruction;After the computer executable instructions are performed, the image procossing that first aspect any embodiment provides is realized Method.
Fourth aspect, the embodiment of the present invention provide a kind of image processing equipment, comprising:
Memory, for storing information;
Processor is connect with the memory, for executable by executing the computer being stored on the memory Instruction can be realized the image processing method of first aspect any embodiment offer.
Image processing method and device provided in an embodiment of the present invention, image processing equipment and storage medium are carrying out two It is not directly general to two-dimensional first image rough to determine first when the deformation of the first object in the first image of dimension Region of the object in the first image, but the first object is reverted into three-dimensional space, two-dimensional space is arrived based on three-dimensional space Mapping, is accurately positioned out the region at the place of the first object in the first image, then carries out deformation, so as to promote deformation Accuracy avoids the problem of deformation region is not to the strange image of caused generation to promote the effect of deformation.
Detailed description of the invention
Fig. 1 is the flow diagram of the first image processing method provided in an embodiment of the present invention;
Fig. 2 is the flow diagram of second of image processing method provided in an embodiment of the present invention;
Fig. 3 A is a kind of schematic diagram of core point and boundary point provided in an embodiment of the present invention;
Fig. 3 B is that the comparison in the apple flesh region of a kind of practical apple flesh region provided in an embodiment of the present invention and detection is shown It is intended to;
Fig. 4 is the comparison schematic diagram of apple flesh provided in an embodiment of the present invention filling front and back;
Fig. 5 is that a kind of triangle provided in an embodiment of the present invention changes schematic diagram;
Fig. 6 is a kind of structural schematic diagram of image processing apparatus provided in an embodiment of the present invention;
Fig. 7 is the flow diagram of the third image processing method provided in an embodiment of the present invention;
Fig. 8 is a kind of structural schematic diagram of image processing equipment provided in an embodiment of the present invention.
Specific embodiment
Technical solution of the present invention is further described in detail with reference to the accompanying drawings and specific embodiments of the specification.
As shown in Figure 1, the present embodiment provides a kind of image processing methods, comprising:
Step S110: the three-dimensional coordinate of the first object of two-dimensional first image in three-dimensional space is obtained;
Step S120: the three-dimensional coordinate is mapped in two-dimensional space, two-dimensional coordinate is obtained;
Step S130: the deformation process of first object is carried out to the first image based on the two-dimensional coordinate, is obtained To the second image.
The present embodiment can be applied in image processing equipment, and described image processing equipment can set for various types of electronics It is standby, for example, mobile device or fixed equipment.The mobile device can include: mobile phone, wearable device, virtually shows tablet computer Real equipment or augmented reality equipment etc..The fixed equipment can include: PC (Personal Computer, PC) or clothes Business device etc..
First object can be any one Drawing Object in two-dimensional first image, for example, two dimensional image is to more A acquisition target is acquired, and multiple Drawing Objects are formd, and first object can be one in this multiple Drawing Object It is a or multiple.For another example two-dimensional first image is the imaging of some acquisition target, first object can be this The imaging of acquisition target part.In short, first object can be one or more in two-dimensional graphics object in the present embodiment A Drawing Object, the topography being also possible in two-dimensional first image.
For example, two-dimensional first image can be the portrait taking human as acquisition target;It can be in the portrait Using the portrait of a certain individual as first object, the imaging in a certain personal part can be as described first pair As.For example, some part is as first object using on face or face.
Accuracy when in the present embodiment, in order to ensure to the first object deformation, by the first of two-dimensional first image The three-dimensional coordinate of object in three-dimensional space is determined.Under normal conditions, acquisition target is to be located at during Image Acquisition It is a three dimensional object in three-dimensional space;On acquisition target partially or fully can be first object;First determine first The three-dimensional coordinate of object in three-dimensional space, then then be mapped to the two-dimensional coordinate in two-dimensional space, so as to obtain two dimension The first image on the first object accurate two-dimensional coordinate, relative to the institute for directly substantially positioning the first object on the first image Region, the first object positioning accuracy can be promoted, thus solve in the related technology since first can not be accurately located at The problem of deformed region mistake caused by first object of image is inaccurate, and caused deformation effect falls flat.
In some embodiments, the method also includes: based on the partial pixel point of the first object in three-dimensional space Three-dimensional coordinate carries out the deformation in three-dimensional space;The ginseng of the transformation in two-dimensional space is derived based on the deformation dynamic in three-dimensional space Number is the change derived according to the 3 D deformation effect in three-dimensional space when executing the deformation of two-dimensional coordinate in step s 130 Parameter progress is changed, in this way, relative to being changed in two-dimensional space according to preset transforming function transformation function in the related technology, deformation Effect is more preferable, can dynamically meet the Deformation Demands of different user, avoids deforming strange problem in two-dimensional space.
For example, being connect after determining the three-dimensional coordinate of the boundary point of the first object in three-dimensional space based on human-computer interaction The user's operation of mouth acquisition, the three-dimensional coordinate of the first object part pixel such as adjustment boundary point, until user's operation stopping, such as This, can be then based on according to the coordinate value of adjustment front and back in three-dimensional space, the transformation parameter being dynamically determined out in three-dimensional space Transformation parameter in three-dimensional space is converted to the ginseng of the transformation in two-dimensional space to the mapping relations of three-dimensional space by two-dimensional space Number can carry out two of all first objects on the first image based on the transformation parameter in aforementioned two-dimensional space in step s 130 Dimension transformation of coordinates obtains second image.It can certainly be after user's operation stopping, before being adjusted in three-dimensional space Coordinate value afterwards maps back two-dimensional space, is then based on the pass being mapped to afterwards between the two-dimensional coordinate in two-dimensional space before adjustment System, direct derivation goes out the transformation parameter in the two-dimensional space, then the pixel of all first objects is carried out in two-dimensional space Transformation obtain second image, the transformation parameter in the two-dimensional space can be preset in a word, be also possible to It is dynamically determined, and is dynamically determined the transformation parameter in two-dimensional space in addition to determining two-dimensional space based on the deformation in three-dimensional space Transformation parameter mode other than also there are many kinds of, just different one schematically illustrate herein.
In some embodiments, the step S110 can include:
The three-dimensional coordinate of the second object based on the first image positions the three-dimensional coordinate of first object, wherein Second object includes first object.
Second object can be the object for including first object in the present embodiment, and first object can be A subobject in second object.
For example, second object can be face, first object can be the apple flesh on the face.
For another example second object can be face, first object can be nose, eyes or the eyebrow of people on the face Hair, brow ridge etc..
For another example second object can be the person, first object can be face etc..
In short, in the present embodiment, second object includes first object.
Second object include with the first object, and the second object include many key feature points, these key features The three-dimensional coordinate of point can be known.
For example, first object is apple flesh, second object is face;There is the pass of predetermined number on the face Key characteristic point, for example, the key feature points of the face such as eyes, nose, mouth, ear, according to these key feature points, in conjunction with face Model can determine the approximate location of apple flesh.
For example, pass through the depth information of the first image, the key feature of the second object in available the first image The three-dimensional coordinate of point can calculate or estimate out the three-dimensional coordinate of first object according to the three-dimensional coordinate of the second object. Even if in this way, the three-dimensional coordinate of the first object is unknowable the three-dimensional coordinate can also be obtained in conjunction with the second object.
In some embodiments, the depth information can be the information of depth camera acquisition, can be used for characterizing the The three-dimensional feature for the object being collected in one image.For example, the depth information can be the grid (Mesh) for utilizing grid representation Information.
In some embodiments, as shown in Fig. 2, the step S110 can include:
Step S111: according to the three-dimensional coordinate of second object, position the core point of first object first is sat Mark;
Step S112: according to the default deformation parameter of first object and first coordinate, described first pair is obtained Second coordinate of the boundary point of elephant.
First object can include: core point and boundary point.In some embodiments, the core point can be first pair The central point of elephant, or the highest point of the first object.For example, the core point can if first object is apple flesh For the central point of apple flesh, if first object is nose, the core point can be the highest point of nose.If described first pair As for apple flesh;Referring to shown in Fig. 3 A, solid black circle is expressed as the position where the core point, the equal position of boundary point in Fig. 3 A In core point periphery.Middle dashed circle shown in Fig. 3 B indicates to be the region where actual apple flesh;Filled with black region To utilize the region where the determining apple flesh of method provided in an embodiment of the present invention, it is clear that difference is small between two regions, therefore Have the characteristics that determine accuracy is high.
The core point is relevant to first object in the present embodiment, the determination of the core point and described the An object itself and deformation are related, such as, it is generally the case that default deformation parameter includes a deformation values, and deformation values are maximum Point may be the first object highest point or minimum point.For example, drawing high apple flesh, it is clear that maximum deformation quantity should be in apple flesh Highest point, for example, during beautifying its image, need to force down the height of its mouth for the user that certain mouths protrude a little, At this point, if default deformation parameter defines maximum deformation value, the core point can be the minimum point of mouth, if predetermined deformation parameter limits Minimal deformation value is determined, then the core point can be the highest point of mouth.It, can be in order to simplify processing in short, in some embodiments The unified central point by the whole central point of the first object or part is considered as the core point, for example, by the nose of nose Central point is considered as the core point.
The boundary point is normally at the periphery of core point, and the boundary point defines boundary or the foreign steamer of the first object It is wide.
In the present embodiment, the center of first object is oriented according to the three-dimensional coordinate of second object first First coordinate of point;Go out the second coordinate of the boundary point of first object then in conjunction with the first coordinate setting.
In the present embodiment, first coordinate and second coordinate can be three-dimensional coordinate.
In some embodiments, the default deformation parameter and first coordinate according to first object, obtains Second coordinate of the boundary point of first object, comprising: determine the deformation values of the core point and the deformation of the boundary point The difference of value;According to the incidence relation of the spacing between the difference and the core point and the boundary point, determine described Second coordinate of boundary point.
The deformation values of the core point can be the maximum value of this deformation;The deformation values of the boundary point can be default deformation Value, may be close to zero.In this way, the difference between the deformation values of the core point and the deformation values of the boundary point can are as follows: described Maximum deformation values in default deformation parameter.The deformation values of the boundary point can be preset known quantity.
The incidence relation of spacing between the difference and the core point and the boundary point may include it is following at least it One:
The difference and the spacing are positively correlated;
Square positive correlation of the difference and the spacing.
For example, the incidence relation can be indicated by following functional relation:
x*For first coordinate the first reference axis of the three-dimensional space value;y*It is first coordinate in institute State the value of the second reference axis of three-dimensional space;I is the deformation values determined according to the default deformation parameter;IgFor given value, For the corresponding deformation values of the boundary point, x is value of second coordinate in first reference axis of the three-dimensional space; Y is value of second coordinate in the second reference axis of the three-dimensional space;A is known first parameter;B is known the Two parameters;
According to x*And y*Determine z*, wherein z*Third reference axis for first coordinate in the three-dimensional space takes Value;
Z is determined according to x and y, wherein z is value of second coordinate in the third reference axis of the three-dimensional space;
In some embodiments, the depth information of the first image can be obtained, three can be obtained according to depth information Tie up coordinate;But it can not know which point is the three-dimensional coordinate for belonging to the first object.In the present embodiment, pass through above-mentioned letter first Two coordinate values in the three-dimensional coordinate of the boundary point that the first object has been calculated of number relationship, in this way, inquiry can be passed through The depth information, alternatively, obtaining the three of the boundary point of first object by the modes combination depth information such as interpolation calculation Tie up three coordinate values of coordinate.
In some embodiments, the IgCan be for 0 between k, the k is less than I.In some embodiments, if IgIt is directly fixed Justice is 0, then the number that may cause the boundary point determined is less, it has not been convenient to the subsequent source two-dimensional coordinate obtained in two-dimensional space To the solution of the transformation parameter of target two-dimensional coordinate.In the present embodiment, by IgK can be arrived for 0, k can be much smaller than I, for example, k can Value is 0.05,0.1 or 0.15 equivalent, in this way, can the number appropriate that boundary point be increased, to facilitate subsequent success and accurate Solve the transformation parameter.
A in some embodiments, the value of k may depend on I, for example, the s times of I.S may be less than 1 positive number.
The a and b can be predetermined known quantity, be also possible to before this function calculates, that dynamically seeks is known Amount, for example, the first object is apple flesh if the second object is face, then a and b can be for according to the seat of the key feature points of face What mark was sought.
For example, for being drawn high with nose, apple flesh and the eyebrow in the first image, the core of nose, apple flesh or eyebrow Heart point (for example, central point).The boundary point can be the point of the nasion position of nose, the point in the outside of apple flesh, eyebrow Edge point.
In some embodiments, for z*The coordinate that can be based on determining the first reference axis and the second reference axis with z, leads to The depth information determination for inquiring two-dimensional first image is crossed, for example, respectively with determining x*And y*And x and y, inquire three dimensional network Lattice information determines corresponding z*And z.
In further embodiments, for z*It can be based on the seat of determining the first reference axis and the second reference axis with z Mark, can be based on determining x*And y*And x and y and three-dimensional modeling, estimate corresponding z*And z.
The default deformation parameter can be some parameters of the first object deformation, for example, nose, apple flesh or eyebrow are drawn high Height value etc..
In some embodiments, the default deformation parameter may include at least one of:
Dynamics parameter, for example, apple flesh draw high draw high dynamics;
Directioin parameter for example, the inaesthetic point of the apple flesh of different user is different, therefore draws high apple flesh, from different sides It can be only achieved optimal effect to drawing high, which may also include directioin parameter.
In some embodiments, the default deformation parameter may also include that
Form parameter etc., for example, nose deformation can by some shape distortion to another beauty standard shape, , can be by the shape distortion of a standard to some shape for making laughs alternatively, in image interest and appeal treatment process, this When, the shape for needing to deform can be characterized by form parameter.
In some embodiments, the method also includes:
According to the orientation information of first object, the first plane where first object is determined;
According to the default deformation parameter, the deformation values I on the normal of first plane is determined.
It is illustrated so that face is the second object as an example, people, may be towards different, the first image having when shooting photo It is direct picture;The first image be side image;In order to avoid not distinguishing direct picture and side image all to same Image draws high the second strange image obtained caused by apple flesh.In this application, can also be believed according to the direction of the first image Breath, determines direction corresponding to deformation values;It avoids not distinguishing direct picture and side image is unified deformation in one direction and caused Strange image, to promote the obtained image effect of the second image.
In some embodiments, the three-dimensional coordinate according to second object positions the core of first object First coordinate of point, comprising:
According to the three-dimensional coordinate of second object, the initial coordinate of the core point of first object is determined;
According to the three-dimensional coordinate of the mesh point grid vertex nearest apart from the initial coordinate, first coordinate is determined.
For example, if the second object is that face can be positioned substantially according to the three-dimensional coordinate of nose and eyes in the second object First coordinate of the central point of apple flesh out, obtains the initial coordinate of the central point of apple flesh.
The depth information of first image is gridding information, and gridding information is characterized by three-dimensional grid, is believed in grid The coordinate of each grid vertex in the three-dimensional grid recorded in breath can will be with positioning in the present embodiment by approximate processing Final seat of the three-dimensional coordinate of the hithermost grid vertex of the initial coordinate of core point out as the central point of the apple flesh Mark, i.e., described first coordinate.Just it is not related to calculating in this way, has the characteristics that realize easy.
In further embodiments, the two grid tops nearest with initial coordinate can also be selected by interpolation algorithm The coordinate of the central point of grid where point is as first coordinate, alternatively, selecting two nets nearest with initial coordinate The coordinate of the central point of the line on lattice vertex is used as the first coordinate certainly.
In some embodiments, the step S120 can include:
According to camera internal reference matrix parameter, the three-dimensional coordinate is mapped to the two-dimensional space, the two dimension is obtained and sits Mark.
The camera internal reference matrix parameter can in the present embodiment are as follows: what camera used in acquisition the first image Various acquisition parameters, for example, acquisition focal length;The information such as principal point of image pixel in the image of camera acquisition.In the present embodiment The camera internal reference matrix parameter can be used for reacting the posture of acquisition target in three-dimensional space in collected first image And/or form.
In the present embodiment, according to camera internal reference matrix parameter, three-dimensional coordinate is mapped in two-dimensional space, two will be obtained Two-dimensional coordinate in dimension space.Two-dimensional space includes a plane;Three-dimensional space be include three planes, and these three are flat Face is orthogonal two-by-two.
In some embodiments, described according to camera internal reference matrix parameter, the three-dimensional coordinate is mapped to the two dimension Space obtains the two-dimensional coordinate, comprising: according to camera focal length on a two-dimensional coordinate axis, the coordinate value and three of principal point for camera Coordinate is tieed up, determines the two-dimensional coordinate.
In the present embodiment, the camera internal reference matrix parameter can include: the focal length of the camera on a two-dimensional coordinate axis, With the coordinate value of principal point for camera.In conjunction with above-mentioned camera focal length on a two-dimensional coordinate axis, principal point for camera coordinate value and three-dimensional sit Mark, calculates the two-dimensional coordinate value.
For example, obtaining the two-dimensional coordinate using following functional relation;
x2dFor the two-dimensional coordinate the 4-coordinate axis of the two-dimensional space value;y2dExist for the two-dimensional coordinate The value of the Five Axis axis of the two-dimensional space;The 4-coordinate axis is perpendicular to the Five Axis value;x3dIt is described three Coordinate is tieed up in the value of the first reference axis of the three-dimensional space;y3dIt is sat for the three-dimensional coordinate the second of the three-dimensional space The value of parameter;z3dFor the three-dimensional coordinate the third reference axis of the three-dimensional space value;fxIt is camera described Focal length on 4-coordinate axis;fyFor focal length of the camera on the Five Axis axis;cxFor camera the first image pixel planes The interior coordinate value corresponding to the principal point for camera of reference axis where the 4-coordinate;cyFor camera the first image pixel planes The coordinate value of the interior principal point for camera corresponding to the Five Axis.
Herein, 4-coordinate axis and Five Axis axis constitutes the reference axis of the two-dimensional surface, the 4-coordinate Axis is perpendicular to the Five Axis axis.Two two-phase of the first reference axis, the second reference axis and third reference axis in three-dimensional space It is mutually vertical.
In the present embodiment, the plane that two reference axis of two-dimensional space are constituted can are as follows: with the first image The plane of delineation;The plane that the reference axis of the three-dimensional space is constituted can are as follows: described image plane.
In the present embodiment, the fxAnd fyFor focal length, the cxFor and cyIt can be principal point for camera.
In some embodiments, which comprises
According to default deformation parameter and the three-dimensional coordinate, deformed three-dimensional coordinate is obtained;
The step S120 can include:
The three-dimensional coordinate before deformation is mapped in the two-dimensional space, source two-dimensional coordinate is obtained;
The deformed three-dimensional coordinate is mapped in the two-dimensional space, target two-dimensional coordinate is obtained;
The method may also include that
Based on the source two-dimensional coordinate and target two-dimensional coordinate, transformation parameter is obtained.
In embodiments of the present invention, the partial 3-D coordinate of first object before deformation can be mapped to two-dimensional space Obtain source two-dimensional coordinate, at the same by deformed described first to partial 3-D coordinate be mapped to two-dimensional space and obtain target two Tie up coordinate.For example, the three-dimensional coordinate before and after the deformation of the core point of the first object and boundary point is respectively mapped to two-dimensional space It is interior.In this way, just obtained the first object core point and boundary point before being deformed after three-dimensional space to two-dimensional space mapping. In this way, being equivalent to the core point of the first object and the source two-dimensional coordinate of boundary point and target two-dimensional coordinate there is known part, it is based on Source two-dimensional coordinate and target two-dimensional coordinate is proud obtains, transformation parameter.It is all that the transformation parameter can be used for first object Pixel changes in coordinates, thus realize the first object deformation.
In this application in order to accurately realize deformation, deformation is first carried out in three-dimensional space, in the portion for passing through the first object Relationship after the deformation of branch in three-dimensional space, is mapped to after two-dimensional space, obtains the transformation parameter in two-dimensional space, So, it is possible to reduce deformation directly is carried out to two dimensional image, because being not bound with deformation caused by the three dimensional characteristic of the first object It is strange or the problem of default effect cannot be presented, to promote the effect of deformation.
The transformation parameter embodies the source two-dimensional coordinate in two-dimensional space before the first object deformation to target two-dimensional coordinate Mapping relations.The transformation parameter can are as follows: transformation array and/or transformation matrix.
In this embodiment, before executing step S130, by the first object in three-dimensional space at least partly as The determination of the three-dimensional coordinate of vegetarian refreshments carries out three dimensional change in conjunction with the default deformation parameter, the source three-dimensional coordinate before being deformed With deformed target three-dimensional coordinate;Then the three-dimensional coordinate of deformation front and back is respectively mapped in two-dimensional space, is obtained and source The corresponding source two-dimensional coordinate of three-dimensional coordinate and the corresponding target two-dimensional coordinate of target three-dimensional coordinate;Based on source two-dimensional coordinate and target Two-dimensional coordinate dynamic and combination preset deformation parameter and obtain the transformation parameter in the two-dimensional space of accurate Characterization Deformation Demands, right The pixel that first object is constituted in two-dimensional space is based on the transformation parameter and is converted, relative to sharp in the related technology It is changed with preset functional relation, has the characteristics that deformation effect is good and meets certain variations demand.
Assuming that first object is apple flesh, the center of apple flesh in three-dimensional space can be obtained by step S110 The source three-dimensional coordinate of point and boundary point, and become based on default deformation parameter (for example, apple flesh draws high ratio or draws high value) Target three-dimensional coordinate after shape;Then source three-dimensional coordinate and target three-dimensional coordinate are respectively mapped to two-dimensional space respectively, then led to Variation Features between the source two-dimensional coordinate in two-dimensional space and target two-dimensional coordinate are crossed, transformation parameter is obtained.The transformation parameter can With the coordinate transform for all the points in apple flesh, in this way, it is accurate to draw high progress to apple flesh based on the transformation relation Transformation.
Fig. 4 show showing for the front and back being filled using image processing method provided in an embodiment of the present invention to apple flesh It is intended to.
The step S130 can include:
Coordinate conversion is carried out according to two-dimensional coordinate of the transformation parameter to first object in the first image, Obtain second image.
In some embodiments, described to be based on the source two-dimensional coordinate and target two-dimensional coordinate, transformation parameter is obtained, is wrapped It includes:
Using the source two-dimensional coordinate and predetermined constant, the first matrix of 3*N is constructed, wherein N is positive integer;
Using the target two-dimensional coordinate and the predetermined constant, the second matrix of dimension 3*N is constructed;
Determine second matrixing to first matrix transformation parameter.
First matrix and the second matrix are all the matrix of 3 row N column, wherein the N is chosen as 1, in this way, the first matrix arrives Transformation parameter calculation amount between second matrix is small.
In this way, obtained transformation parameter can be the matrix of 3 rows 1 column, the coordinate value for including just for one with three-dimensional coordinate Number is corresponding.
For example, obtaining the transformation parameter T based on following functional relation:
xsrcFor the value that the source two-dimensional coordinate is in 4-coordinate axis;ysrcIt is to be sat the 5th for the source two-dimensional coordinate The value of parameter;xdstFor the value that the target two-dimensional coordinate is in 4-coordinate axis;ydstIt is for the target two-dimensional coordinate In the value of Five Axis axis.
Further, at the deformation for carrying out first object to the first image based on the two-dimensional coordinate Reason, obtains the second image, comprising:
The corresponding convex polygon of the two-dimensional coordinate is converted into several triangles, wherein the convex polygon is by institute The two-dimensional coordinate for stating the boundary point of the first object is formed by connecting;The triangle, by the two neighboring boundary of first object The two-dimensional coordinate of the central point of the two-dimensional coordinate and first object of point is formed by connecting;
Using triangle fractal transform, the source two-dimensional coordinate of first object is converted into target two-dimensional coordinate, is obtained described Second image.
Changed using triangle, relative to the direct transformation of polygon, reduces and need needing to be traversed in conversion process Change and processing calculation amount, it is complicated to reduce calculating, so as to promote the computation rate of single calculating, and then mentions on the whole The processing speed that the second image is transformed to from the first image is risen.
Triangle number after conversion is decided by the number of edges of the convex shape changeable, several triangles will cover convex more comprehensively Each side of deformation is primary, in this way, on the one hand realizing comprehensive covering, while reducing redundancy meter caused by repetition covers It calculates.
Fig. 5 show a kind of schematic diagram of triangle variation, for example, triangle ABP conversion layer triangle ABO, then triangle Point M in shape ABP is mapped to the N point of triangle ABO based on transformation parameter T.
For example, filtering out the boundary for constituting the convex polygon of the first object using convexHull.If obtained boundary point, So that foring recessed shape changeable between boundary point, then the point that can result in recessed shape changeable is considered as abnormal point removal.
In some embodiments, the method also includes: the convex polygon is constructed based on the two-dimensional coordinate.
In the present embodiment, each boundary point to form convex polygon how is traversed.
It is described that the convex polygon is constructed based on the two-dimensional coordinate, comprising:
According to the two-dimensional coordinate of the boundary point of first object, the first starting point coordinate is determined;
After determining first starting point coordinate, according to the neighbouring relations between the two-dimensional coordinate of the boundary point, really Next first starting point coordinate is made, until the two dimension for orienting all boundary points of outermost in the boundary point is sat Mark;
All boundary points for connecting the outermost, form the convex polygon.
Further, the two-dimensional coordinate of the boundary point according to first object, determines the first starting point coordinate, packet It includes:
Determine the two-dimensional coordinate in the boundary point of first object in the smallest boundary point of the coordinate of the first reference axis As first starting point coordinate;
If in the smallest boundary point more than one of coordinate of first reference axis, choosing in the boundary point of first object The boundary point for selecting out first object is minimum in the coordinate of first reference axis and the smallest in the coordinate of the second reference axis The two-dimensional coordinate of boundary point is as first starting point coordinate.
As shown in fig. 6, the present embodiment provides a kind of image processing apparatus, comprising:
First obtains module 110, for obtaining the three-dimensional seat of the first object of two-dimensional first image in three-dimensional space Mark;
Mapping block 120 obtains two-dimensional coordinate for the three-dimensional coordinate to be mapped in two-dimensional space;
Deformation module 130, for carrying out the deformation of first object to the first image based on the two-dimensional coordinate Processing, obtains the second image.
Image processing apparatus provided in this embodiment can be applied in various image processing equipments.
The first acquisition module 110, mapping block 120 and deformation module 130 can be program module, be held by processor After row, the determination of above-mentioned three-dimensional coordinate, the mapping of two-dimensional coordinate and deformed second image can be realized.
In some embodiments, described first module 110 is obtained, specifically for the second object based on the first image Three-dimensional coordinate, position the three-dimensional coordinate of first object, wherein second object includes first object.
In further embodiments, described first module 110 is obtained, specifically for sitting according to the three-dimensional of second object Mark positions the first coordinate of the core point of first object;According to the default deformation parameter of first object and described One coordinate obtains the second coordinate of the boundary point of first object.
In further embodiments, described first obtains module 110, specifically for the deformation values of the determination core point With the difference of the deformation values of the boundary point;According to the pass of the spacing between the difference and the core point and the boundary point Connection relationship determines second coordinate of the boundary point.
For example, described first obtains module 110, can be specifically used for obtaining second coordinate using following function;
x*For first coordinate the first reference axis of the three-dimensional space value;y*It is first coordinate in institute State the value of the second reference axis of three-dimensional space;I is the deformation values determined according to the default deformation parameter;IgIt is consistent with I Given value, be the corresponding deformation parameter of the boundary point, x be second coordinate the three-dimensional space it is described first sit The value of parameter;Y is value of second coordinate in the second reference axis of the three-dimensional space;A is known first parameter; B is known second parameter;
According to the x*And y*Determine z*, wherein z*For first coordinate the three-dimensional space third reference axis Value;
Z is determined according to x and y, wherein z is value of second coordinate in the third reference axis of the three-dimensional space;
First reference axis is perpendicular to second reference axis;
First reference axis vertically with the third reference axis;
Second reference axis is perpendicular to the third reference axis.
In addition, described device further include:
First determining module determines where first object for the orientation information according to first object One plane;
Second determining module, for determining the change on the normal of first plane according to the default deformation parameter Shape value I.
In some embodiments, described first module 110 is obtained, specifically for sitting according to the three-dimensional of second object Mark, determines the initial coordinate of the core point of first object;It is selected in three-dimensional grid with the initial coordinate distance most The three-dimensional coordinate of close grid vertex is as first coordinate.
For example, second object is face;First object is apple flesh.
In some embodiments, the mapping block 120, for according to camera internal reference matrix parameter, the three-dimensional to be sat Mark is mapped to the two-dimensional space, obtains the two-dimensional coordinate.
In further embodiments, the mapping block 120, specifically for the coke according to camera on a two-dimensional coordinate axis Coordinate value and three-dimensional coordinate away from, principal point for camera, determine the two-dimensional coordinate.
For example, the mapping block 120 can be specifically used for using following functional relation, the two-dimensional coordinate is obtained;
x2dFor the two-dimensional coordinate the 4-coordinate axis of the two-dimensional space value;y2dExist for the two-dimensional coordinate The value of the Five Axis axis of the two-dimensional space;The 4-coordinate axis is perpendicular to the Five Axis value;x3dIt is described three Coordinate is tieed up in the value of the first reference axis of the three-dimensional space;y3dIt is sat for the three-dimensional coordinate the second of the three-dimensional space The value of parameter;z3dFor the three-dimensional coordinate the third reference axis of the three-dimensional space value;fxIt is camera described Focal length on 4-coordinate axis;fyFor focal length of the camera on the Five Axis axis;cxFor camera the first image pixel planes The interior coordinate value corresponding to the principal point for camera of reference axis where the 4-coordinate;cyFor camera the first image pixel planes The coordinate value of the interior principal point for camera corresponding to the Five Axis.
Further, described device includes: the second acquisition module, for according to default deformation parameter and the three-dimensional seat Mark, obtains deformed three-dimensional coordinate;
The mapping block 120 obtains source for the three-dimensional coordinate before deformation to be mapped in the two-dimensional space Two-dimensional coordinate;The deformed three-dimensional coordinate is mapped in the two-dimensional space, target two-dimensional coordinate is obtained;
Described device further include: third obtains module, for being based on the source two-dimensional coordinate and target two-dimensional coordinate, obtains Transformation parameter;
The deformation module 130, for according to the transformation parameter to first object in the first image Two-dimensional coordinate carries out coordinate conversion, obtains second image.
In addition, the third obtains module, it can be specifically used for utilizing the source two-dimensional coordinate and predetermined constant, construct 3*N The first matrix, wherein N is positive integer;Using the target two-dimensional coordinate and the predetermined constant, the of dimension 3*N is constructed Two matrixes;Determine second matrixing to first matrix transformation parameter.
For example, the third obtains module, can be specifically used for obtaining the transformation parameter T based on following functional relation:
xsrcFor the value that the source two-dimensional coordinate is in 4-coordinate axis;ysrcIt is to be sat the 5th for the source two-dimensional coordinate The value of parameter;xdstFor the value that the target two-dimensional coordinate is in 4-coordinate axis;ydstIt is for the target two-dimensional coordinate In the value of Five Axis axis.
In some embodiments, the deformation module 130, for being converted to the corresponding convex polygon of the two-dimensional coordinate Several triangles, wherein the convex polygon is formed by connecting by the two-dimensional coordinate of the boundary point of first object;Described three It is angular, by the two-dimensional coordinate of the central point of the two-dimensional coordinate and first object of the two neighboring boundary point of first object It is formed by connecting;Using triangle fractal transform, the source two-dimensional coordinate of first object is converted into target two-dimensional coordinate, is obtained described Second image.
In some embodiments, described device further include:
Module is constructed, for constructing the convex polygon based on the two-dimensional coordinate.
In further embodiments, the building module, specifically for according to the two of the boundary point of first object Coordinate is tieed up, determines the first starting point coordinate;After determining first starting point coordinate, according to the two-dimensional coordinate of the boundary point Between neighbouring relations, next first starting point coordinate is determined, until orient outermost in the boundary point The two-dimensional coordinate of all boundary points;All boundary points for connecting the outermost, form the convex polygon.
In addition, the building module, in the first reference axis in the boundary point specifically for determining first object The two-dimensional coordinate of the smallest boundary point of coordinate is as first starting point coordinate;If in institute in the boundary point of first object The smallest boundary point more than one of coordinate for stating the first reference axis, the boundary point for selecting first object are sat described first The coordinate of parameter is minimum and sits in the two-dimensional coordinate of the smallest boundary point of the coordinate of the second reference axis as first starting point Mark.
Several specific examples are provided below in conjunction with above-mentioned any embodiment:
Example 1:
This example provides a kind of 3D grid (Mesh) information based on face, passes through human face five-sense-organ 3D key point and face Orientation information is accurately positioned the 3D point for being located at apple flesh zone boundary in Mesh and 3D point is mapped as 2D point, and accuracy in detection is more It is high.
After detecting to obtain accurate apple flesh zone boundary point using 3D Mesh point, used by comprehensive Apple flesh Convex Polygon Domain boundary that convexHull algorithm determines 2D face and triangle fractal transform algorithm are to convex polygon area Domain is deformed, and the full effect of apple flesh can be well realized, and plays the role of prominent apple flesh contour line.
Based entirely on 3D characteristic information, algorithm can be accurately detected apple flesh region and realize more natural U.S. face algorithm Filling effect.
3D Mesh information of the algorithm based on face, the orientation information by human face five-sense-organ 3D key point and face are accurate Belong to the 3D point of apple flesh zone boundary in positioning Mesh and mapped back 2D face, the accurate positioning for apple flesh provides Effective solution scheme.
The algorithm determines the apple flesh Convex Polygon Domain boundary of 2D face using convexHull algorithm, can be preferably Approximate apple flesh region.The algorithm deforms apple flesh Convex Polygon Domain using triangle fractal transform algorithm, can be fine The full effect of apple flesh is realized on ground, provides effective thinking for the filling of apple flesh.Triangle fractal transform algorithm is by image procossing The inspiration of affine transformation is realized.
Example 2:
Referring to shown in Fig. 7, the technical solution that this example provides may include following three main technical flows, be to utilize respectively The 3D Mesh information and facial orientation information of face are accurately positioned the 3D point for belonging to apple flesh zone boundary in Mesh and then obtain The apple flesh zone boundary point of 2D face obtains the convex polygon in apple flesh region using convexHull algorithm screening boundary point Boundary realizes convex polygon apple flesh region deformation using triangle fractal transform algorithm and promotes apple flesh effect.One, face is utilized 3D Mesh information and facial orientation information be accurately positioned apple flesh central point and zone boundary point.
Input: 2D image, for example, facial image, face 3D Mesh information (including the vertex Mesh, key point), in camera Join the camera parameters such as matrix parameter, the face characters such as facial orientation information, the default deformation parameter such as apple flesh filling dynamics.
Output: apple flesh zone boundary point, the position of former apple flesh central point, the position of new apple flesh central point.
Using the key point information in 3D Mesh information, i.e. eyes key point and nose key point primarily determines apple flesh Then the approximate center point P in region selects the grid vertex nearest from P as former apple by the vertex in traversal 3D Mesh Flesh central point P*
Given original apple flesh center P*And apple flesh fills dynamics I, the filling of apple flesh is i.e. to the click-through in apple flesh region Row is raised.The operation at apple flesh center is raised in definition are as follows: along point P*Normal vector direction moving distance I, thus raise apple Fruit flesh region needs to move corresponding distance, mobile distance and the point to center along its normal vector direction to the point in region Position it is related.Specifically, for arbitrary point (x, y, z) and central point (x*,y*,z*) define its distance for needing movement are as follows:Here a and b is the parameter calculated according to 3D face key point information.Based on above-mentioned It analyzes, point, that is, I in apple flesh regiongThe corresponding point of > 0.Here setting regions boundary point is to meet 0 < IgThe 3D point of < K, K It is different under different facial orientation angles for the threshold value of setting, 0.1 can be set as.
For arbitrary point, the distance and x, y of movement are related unrelated with z.Main reason is that when side face, in apple flesh The z value of the point of heart point two sides, also referred to as depth, are different.Our target is that the amplitude of variation of two side points is consistent, thus Ig Only with the 2D distance dependent on x/y plane.
By to former apple flesh central point P*(x*,y*,z*) along its normal vector (nx,ny,nz) the mobile I in direction, it obtains New apple flesh center Pnew(xnew,ynew,znew):
According to the mapping relations of 3D point and 2D point, pass through camera internal reference matrix parameter matrixing:Apple flesh zone boundary 2D point, former apple flesh central point and new apple flesh center can finally be obtained Point.Apple flesh region convex polygon boundary is obtained using convexHull algorithm screening areas boundary point.
It is plane where 2D image that x/y plane is corresponding in 3D Mesh information, and the direction z is vertical with the 2D plane of delineation Direction.Such as: when facial orientation is positive face, face plane and the 2D plane of delineation are overlapped, the direction z perpendicular to face plane, namely Perpendicular to the 2D plane of delineation;When facial orientation is side face, face plane is not overlapped with the 2D plane of delineation, the direction z perpendicular to face, Namely with 2D plane of delineation out of plumb.
Input: the coordinate set for the apple flesh zone boundary point that step 1 obtains.
Output: the convex polygon boundary point set obtained after convexHull algorithm process.
The smallest point of abscissa is looked in the apple flesh zone boundary point set that step 1 obtains, if more than one is horizontal The smallest point of coordinate takes the smaller point of ordinate as starting point.
It since starting point, finds opposite starting point near the point (judging according to cross product) in outside, then will find Point saves and as new starting point.
Iterative step 2 traverses all boundary points, and until finding initial starting point, algorithm terminates.
Final result is obtained to convex polygon apple flesh region deformation using triangle fractal transform algorithm.
Input: facial image, the former apple flesh central point and new apple flesh central point that step 1 obtains, what step 2 obtained Convex polygon boundary point.
Output: apple flesh filling effect figure.
Convex polygon is divided into several triangles, and then can be approximate to polygon well to the transformation of delta-shaped region The transformation in shape region.The core of triangle fractal transform is to ensure that the point in the triangle of source can be properly mapped to target triangle In suitable position.
Construct several source triangles: with former apple flesh central point for a vertex, two adjacent Polygonal Boundary points are Other two vertex constructs triangle, can construct to obtain N number of triangle if having N number of Polygonal Boundary point.
Corresponding several target triangles: the construction of analogy source triangle are constructed, change former apple flesh central point into new apple Fruit flesh central point, remaining is constant.Source triangle and target triangle in this way can correspond.
At (i, j) coordinate in target triangle k, pixel value is by the pixel at (m, n) coordinate in the triangle k of source Value determines.Specifically, when three vertex of source triangle and target triangle one-to-one correspondence, source triangle to target triangle Affine transformation T can be now uniquely determined, it may be assumed that
Wherein T is the invertible matrix of a 3*3, (xsrc, ysrc) and (xdst, ydst) respectively indicate source triangle and target three Corresponding points in angular.Thus to the coordinate (i, j) in the triangle that sets the goal, one surely finds corresponding coordinate in the triangle of source (m, n).Here (m, n) is not necessarily integer, and the pixel value at this carries out bilinear interpolation by surrounding four pixels and obtains. For the process schematic as shown in Fig. 4 in Detailed description of the invention, the pixel value of the point M in target triangle PAB is right in source triangle OAB Should point N pixel value, their coordinate can mutually be converted by T-phase.
3D Mesh (grid) information of this algorithm based on face is believed by the direction of human face five-sense-organ 3D key point and face Breath is accurately positioned the 3D point for being located at apple flesh zone boundary in Mesh and is mapped back 2D face, and accuracy in detection is higher.
This algorithm is used after detecting to obtain accurate apple flesh zone boundary point using 3D Mesh point by comprehensive Apple flesh Convex Polygon Domain boundary that convexHull algorithm determines 2D face and triangle fractal transform algorithm are to convex polygon area Domain is deformed, and the full effect of apple flesh can be well realized, and plays the role of prominent apple flesh contour line.
This algorithm is more bonded face, is able to achieve more based entirely on 3D characteristic information, the apple flesh region point of algorithm positioning Natural filling effect.
As shown in figure 8, the embodiment of the invention provides a kind of image processing equipments, comprising:
Memory, for storing information;
Processor is connect with the memory, for executable by executing the computer being stored on the memory Instruction can be realized the image processing method that aforementioned one or more technical solutions provide, for example, as shown in Figure 1, Figure 2 and/or Fig. 7 Shown in method.
The memory can be various types of memories, can be random access memory, read-only memory, flash memory etc..It is described to deposit Reservoir can be used for information storage, for example, storage computer executable instructions etc..The computer executable instructions can be various journeys Sequence instruction, for example, objective program instruction and/or source program instruction etc..
The processor can be various types of processors, for example, central processing unit, microprocessor, Digital Signal Processing Device, programmable array, digital signal processor, specific integrated circuit or image processor etc..
The processor can be connect by bus with the memory.The bus can be IC bus etc..
In some embodiments, the terminal device may also include that communication interface, the communication interface can include: network connects Mouthful, for example, lan interfaces, dual-mode antenna etc..The communication interface is equally connected to the processor, and can be used in information receipts Hair.
In some embodiments, the terminal device further includes man-machine interactive interface, for example, the man-machine interactive interface can Including various input-output equipment, for example, keyboard, touch screen etc..
The embodiment of the invention provides a kind of computer storage medium, the computer storage medium is stored with computer can Execute code;After the computer-executable code is performed, the figure that aforementioned one or more technical solutions provide can be realized As processing method, for example, one or more of method shown in executable Fig. 1, Fig. 2 and Fig. 7.
The storage medium includes: movable storage device, read-only memory (ROM, Read-Only Memory), deposits at random The various media that can store program code such as access to memory (RAM, Random Access Memory), magnetic or disk. The storage medium can be non-moment storage medium.
The embodiment of the present invention provides a kind of computer program product, and described program product includes computer executable instructions; After the computer executable instructions are performed, it can be realized what first aspect or any one technical solution of second aspect provided Method.
The computer executable instructions that computer program product described in the present embodiment includes, it may include: it is application program, soft Part development kit, plug-in unit or patch etc..
In several embodiments provided herein, it should be understood that disclosed device and method can pass through it Its mode is realized.Apparatus embodiments described above are merely indicative, for example, the division of the unit, only A kind of logical function partition, there may be another division manner in actual implementation, such as: multiple units or components can combine, or It is desirably integrated into another system, or some features can be ignored or not executed.In addition, shown or discussed each composition portion Mutual coupling or direct-coupling or communication connection is divided to can be through some interfaces, the INDIRECT COUPLING of equipment or unit Or communication connection, it can be electrical, mechanical or other forms.
Above-mentioned unit as illustrated by the separation member, which can be or may not be, to be physically separated, aobvious as unit The component shown can be or may not be physical unit, it can and it is in one place, it may be distributed over multiple network lists In member;Some or all of units can be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
In addition, each functional unit in various embodiments of the present invention can be fully integrated into a processing module, it can also To be each unit individually as a unit, can also be integrated in one unit with two or more units;It is above-mentioned Integrated unit both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above method embodiment can pass through The relevant hardware of program instruction is completed, and program above-mentioned can be stored in a computer readable storage medium, the program When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned include: movable storage device, it is read-only Memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or The various media that can store program code such as person's CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.

Claims (10)

1. a kind of image processing method characterized by comprising
Obtain the three-dimensional coordinate of the first object of two-dimensional first image in three-dimensional space;
The three-dimensional coordinate is mapped in two-dimensional space, two-dimensional coordinate is obtained;
The deformation process for carrying out first object to the first image based on the two-dimensional coordinate, obtains the second image.
2. the method according to claim 1, wherein
The three-dimensional coordinate of first object for obtaining two-dimensional first image in three-dimensional space, comprising:
The three-dimensional coordinate of the second object based on the first image positions the three-dimensional coordinate of first object, wherein described Second object includes first object.
3. according to the method described in claim 2, it is characterized in that,
The three-dimensional coordinate of second object based on the first image positions the three-dimensional coordinate of first object, comprising:
According to the three-dimensional coordinate of second object, the first coordinate of the core point of first object is positioned;
According to the default deformation parameter of first object and first coordinate, the of the boundary point of first object is obtained Two coordinates.
4. according to the method described in claim 3, it is characterized in that,
The default deformation parameter and first coordinate according to first object, obtains the boundary point of first object The second coordinate, comprising:
Determine the difference of the deformation values of the core point and the deformation values of the boundary point;
According to the incidence relation of the spacing between the difference and the core point and the boundary point, the boundary point is determined Second coordinate.
5. method according to any one of claims 1 to 4, which is characterized in that
It is described that the three-dimensional coordinate is mapped in two-dimensional space, obtain two-dimensional coordinate, comprising:
According to camera internal reference matrix parameter, the three-dimensional coordinate is mapped to the two-dimensional space, obtains the two-dimensional coordinate.
6. method according to any one of claims 1 to 5, which is characterized in that
The described method includes:
According to default deformation parameter and the three-dimensional coordinate, deformed three-dimensional coordinate is obtained;
It is described that the three-dimensional coordinate is mapped in two-dimensional space, obtain two-dimensional coordinate, comprising:
The three-dimensional coordinate before deformation is mapped in the two-dimensional space, source two-dimensional coordinate is obtained;
The deformed three-dimensional coordinate is mapped in the two-dimensional space, target two-dimensional coordinate is obtained;
The method also includes:
Based on the source two-dimensional coordinate and target two-dimensional coordinate, transformation parameter is obtained;
The deformation process for carrying out first object to the first image based on the two-dimensional coordinate, obtains the second figure Picture, comprising:
Coordinate conversion is carried out according to two-dimensional coordinate of the transformation parameter to first object in the first image, is obtained Second image.
7. method according to any one of claims 1 to 6, which is characterized in that
The deformation process for carrying out first object to the first image based on the two-dimensional coordinate, obtains the second figure Picture, comprising:
Based on the two-dimensional coordinate construct convex polygon, wherein the convex polygon by first object boundary point two Dimension coordinate is formed by connecting;
The convex polygon is converted into several triangles, the triangle, by the two neighboring boundary of first object The two-dimensional coordinate of the central point of the two-dimensional coordinate and first object of point is formed by connecting;
Using triangle fractal transform, the source two-dimensional coordinate of first object is converted into target two-dimensional coordinate, obtains described second Image.
8. a kind of image processing apparatus characterized by comprising
First obtains module, for obtaining the three-dimensional coordinate of the first object of two-dimensional first image in three-dimensional space;
Mapping block obtains two-dimensional coordinate for the three-dimensional coordinate to be mapped in two-dimensional space;
Deformation module is obtained for being carried out the deformation process of first object to the first image based on the two-dimensional coordinate To the second image.
9. a kind of computer storage medium, the computer storage medium is stored with computer-executable code;The computer After executable code is performed, the method that any one of claim 1 to 7 provides can be realized.
10. a kind of image processing equipment characterized by comprising
Memory, for storing information;
Processor is connect with the memory, the computer executable instructions for being stored on the memory by execution, It can be realized the method that any one of claim 1 to 7 provides.
CN201810819327.XA 2018-07-24 2018-07-24 Image processing method and device, image processing equipment and storage medium Pending CN109146769A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810819327.XA CN109146769A (en) 2018-07-24 2018-07-24 Image processing method and device, image processing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810819327.XA CN109146769A (en) 2018-07-24 2018-07-24 Image processing method and device, image processing equipment and storage medium

Publications (1)

Publication Number Publication Date
CN109146769A true CN109146769A (en) 2019-01-04

Family

ID=64797828

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810819327.XA Pending CN109146769A (en) 2018-07-24 2018-07-24 Image processing method and device, image processing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109146769A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110555815A (en) * 2019-08-30 2019-12-10 维沃移动通信有限公司 Image processing method and electronic equipment
CN111031305A (en) * 2019-11-21 2020-04-17 北京市商汤科技开发有限公司 Image processing method and apparatus, image device, and storage medium
CN111274943A (en) * 2020-01-19 2020-06-12 深圳市商汤科技有限公司 Detection method, detection device, electronic equipment and storage medium
WO2020181900A1 (en) * 2019-01-18 2020-09-17 北京市商汤科技开发有限公司 Image processing method and apparatus, image device and storage medium
CN113362231A (en) * 2021-07-23 2021-09-07 百果园技术(新加坡)有限公司 Interpolation method and device for key points of human face, computer equipment and storage medium
US11450068B2 (en) 2019-11-21 2022-09-20 Beijing Sensetime Technology Development Co., Ltd. Method and device for processing image, and storage medium using 3D model, 2D coordinates, and morphing parameter

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2189945A1 (en) * 2008-11-21 2010-05-26 A&P ip B.V. Method of and arrangement for linking image coordinates to coordinates of reference model
CN106503684A (en) * 2016-10-28 2017-03-15 厦门中控生物识别信息技术有限公司 A kind of face image processing process and device
CN107154030A (en) * 2017-05-17 2017-09-12 腾讯科技(上海)有限公司 Image processing method and device, electronic equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2189945A1 (en) * 2008-11-21 2010-05-26 A&P ip B.V. Method of and arrangement for linking image coordinates to coordinates of reference model
CN106503684A (en) * 2016-10-28 2017-03-15 厦门中控生物识别信息技术有限公司 A kind of face image processing process and device
CN107154030A (en) * 2017-05-17 2017-09-12 腾讯科技(上海)有限公司 Image processing method and device, electronic equipment and storage medium

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020181900A1 (en) * 2019-01-18 2020-09-17 北京市商汤科技开发有限公司 Image processing method and apparatus, image device and storage medium
US11538207B2 (en) 2019-01-18 2022-12-27 Beijing Sensetime Technology Development Co., Ltd. Image processing method and apparatus, image device, and storage medium
CN110555815A (en) * 2019-08-30 2019-12-10 维沃移动通信有限公司 Image processing method and electronic equipment
CN110555815B (en) * 2019-08-30 2022-05-20 维沃移动通信有限公司 Image processing method and electronic equipment
CN111031305A (en) * 2019-11-21 2020-04-17 北京市商汤科技开发有限公司 Image processing method and apparatus, image device, and storage medium
WO2021098143A1 (en) * 2019-11-21 2021-05-27 北京市商汤科技开发有限公司 Image processing method and device, image processing apparatus, and storage medium
US11450068B2 (en) 2019-11-21 2022-09-20 Beijing Sensetime Technology Development Co., Ltd. Method and device for processing image, and storage medium using 3D model, 2D coordinates, and morphing parameter
CN111274943A (en) * 2020-01-19 2020-06-12 深圳市商汤科技有限公司 Detection method, detection device, electronic equipment and storage medium
CN111274943B (en) * 2020-01-19 2023-06-23 深圳市商汤科技有限公司 Detection method, detection device, electronic equipment and storage medium
CN113362231A (en) * 2021-07-23 2021-09-07 百果园技术(新加坡)有限公司 Interpolation method and device for key points of human face, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109146769A (en) Image processing method and device, image processing equipment and storage medium
CN110348330B (en) Face pose virtual view generation method based on VAE-ACGAN
CN111243093B (en) Three-dimensional face grid generation method, device, equipment and storage medium
CN105144247B (en) The generation of the three dimensional representation of user
CN108319901B (en) Biopsy method, device, computer equipment and the readable medium of face
CN103971408B (en) Three-dimensional facial model generating system and method
CN112819947A (en) Three-dimensional face reconstruction method and device, electronic equipment and storage medium
CN106023303B (en) A method of Three-dimensional Gravity is improved based on profile validity and is laid foundations the dense degree of cloud
CN111460871A (en) Image processing method and device, and storage medium
CN110199296A (en) Face identification method, processing chip and electronic equipment
CN109829437A (en) Image processing method, text recognition method, device and electronic system
CN109242961A (en) A kind of face modeling method, apparatus, electronic equipment and computer-readable medium
CN110223370B (en) Method for generating complete human texture map from single-view picture
CN106021550B (en) Hair style design method and system
US9117138B2 (en) Method and apparatus for object positioning by using depth images
CN104346612B (en) Information processing unit and display methods
JP7387202B2 (en) 3D face model generation method, apparatus, computer device and computer program
WO2022205762A1 (en) Three-dimensional human body reconstruction method and apparatus, device, and storage medium
CN110148217A (en) A kind of real-time three-dimensional method for reconstructing, device and equipment
KR20170008638A (en) Three dimensional content producing apparatus and three dimensional content producing method thereof
CN105303616B (en) Embossment modeling method based on single photo
CN110751730B (en) Dressing human body shape estimation method based on deep neural network
CN106023230B (en) A kind of dense matching method of suitable deformation pattern
CN102289803A (en) Image Processing Apparatus, Image Processing Method, and Program
CN106778660B (en) A kind of human face posture bearing calibration and 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190104

RJ01 Rejection of invention patent application after publication