WO2021139382A1 - 人脸图像的处理方法、装置、可读介质和电子设备 - Google Patents

人脸图像的处理方法、装置、可读介质和电子设备 Download PDF

Info

Publication number
WO2021139382A1
WO2021139382A1 PCT/CN2020/127260 CN2020127260W WO2021139382A1 WO 2021139382 A1 WO2021139382 A1 WO 2021139382A1 CN 2020127260 W CN2020127260 W CN 2020127260W WO 2021139382 A1 WO2021139382 A1 WO 2021139382A1
Authority
WO
WIPO (PCT)
Prior art keywords
line
face image
sight
coordinates
distance
Prior art date
Application number
PCT/CN2020/127260
Other languages
English (en)
French (fr)
Inventor
诸葛晶晶
杨清帅
李璇
Original Assignee
北京字节跳动网络技术有限公司
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 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Priority to GB2117372.9A priority Critical patent/GB2599036B/en
Priority to JP2021571584A priority patent/JP7316387B2/ja
Priority to US17/616,961 priority patent/US11887325B2/en
Publication of WO2021139382A1 publication Critical patent/WO2021139382A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/18Eye characteristics, e.g. of the iris
    • G06V40/193Preprocessing; Feature extraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/011Arrangements for interaction with the human body, e.g. for user immersion in virtual reality
    • G06F3/013Eye tracking input arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • G06V10/225Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition based on a marking or identifier characterising the area
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • G06V40/165Detection; Localisation; Normalisation using facial parts and geometric relationships
    • 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

Definitions

  • This application relates to the field of image processing technology, and more specifically, to a method, device, readable medium, and electronic equipment for processing a human face image.
  • the terminal device can add various effects to the image containing the human face, for example, the effects of laser, light, and tears can be rendered on the human eyes in the image.
  • the rendering effect for the human eye is usually fixed and displayed near the position of the human eye, and cannot reflect the real state of the human eye.
  • the purpose of this application is to provide a face image processing method, device, readable medium, and electronic equipment, which are used to solve the problem that the existing face image processing method can only be fixedly displayed where the human eye is when performing human eye rendering.
  • the proximity of the location does not reflect the technical problem of the real state of the human eye.
  • the present disclosure provides a method for processing a face image, the method including:
  • the line of sight information in the face image to be processed is obtained.
  • the line of sight information includes: the first coordinates and edge coordinates of the human eye.
  • the edge coordinates are used to indicate the line of sight and the position of the human eye. State the intersection of the edges of the face image;
  • the target area includes a line of sight segment with the first coordinates and the edge coordinates as endpoints;
  • the preset effect material is rendered to the target area to obtain a target image.
  • the present disclosure provides a face image processing device, the device includes:
  • the obtaining module is used to obtain the line of sight information in the face image to be processed according to a preset recognition algorithm.
  • the line of sight information includes: the first coordinate of the human eye and the edge coordinate, and the edge coordinate is used to indicate the person The intersection of the line of sight of the eye and the edge of the face image;
  • a first determining module configured to determine a target area in the face image according to the line of sight information, the target area including a line of sight segment with the first coordinates and the edge coordinates as endpoints;
  • the rendering module is used to render the preset effect material to the target area to obtain the target image.
  • the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the method described in the first aspect of the present disclosure are implemented.
  • an electronic device including:
  • a storage device on which a computer program is stored
  • the processing device is configured to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.
  • the present disclosure first recognizes the face image to be processed according to a preset recognition algorithm to obtain line of sight information including the first coordinates of the human eye and the edge coordinates, wherein the edge coordinates are used to indicate the human eye’s The intersection of the line of sight and the edge of the face image, and then determine the face image according to the line of sight information, including the target area of the line of sight segment with the first coordinate and the edge coordinate as the endpoint, and finally render the preset effect material to the target area, To get the target image.
  • the present disclosure recognizes the line of sight information included in the face image, determines the target area that needs to be rendered, and then renders the effect material to the target area, so that the rendering effect can follow the line of sight of the human eye.
  • Fig. 1 is a flowchart showing a method for processing a face image according to an exemplary embodiment
  • Fig. 2 is an effect material according to an exemplary embodiment
  • Fig. 3 is a face image according to an exemplary embodiment
  • Fig. 4 is a target image according to an exemplary embodiment
  • Fig. 5 is a flowchart showing another method for processing a face image according to an exemplary embodiment
  • Fig. 6 is a face image according to an exemplary embodiment
  • Fig. 7 is a flowchart showing another method for processing a face image according to an exemplary embodiment
  • Fig. 8 is a flowchart showing another method for processing a face image according to an exemplary embodiment
  • Fig. 9 is an additional effect material according to an exemplary embodiment
  • Fig. 10a shows a face image according to an exemplary embodiment
  • Fig. 10b shows a target image according to an exemplary embodiment
  • Fig. 11 is a block diagram showing a device for processing a face image according to an exemplary embodiment
  • Fig. 12 is a block diagram showing another device for processing a face image according to an exemplary embodiment
  • Fig. 13 is a block diagram showing another device for processing a face image according to an exemplary embodiment
  • Fig. 14 is a block diagram showing another device for processing a face image according to an exemplary embodiment
  • Fig. 15 is a schematic structural diagram of an electronic device used according to an exemplary embodiment.
  • Fig. 1 is a flowchart showing a method for processing a face image according to an exemplary embodiment. As shown in Fig. 1, the method includes:
  • Step 101 Obtain the line of sight information in the face image to be processed according to a preset recognition algorithm.
  • the line of sight information includes: the first coordinate and edge coordinates of the human eye.
  • the edge coordinates are used to indicate the line of sight of the human eye and the face image. The intersection of the edges.
  • the face image to be processed may be, for example, a photo containing a face taken by a user through a terminal device, or a frame containing a face image in a video shot through a terminal device, or it may be a picture taken by the user on the terminal.
  • the line of sight information contained in the face image is recognized.
  • the recognition algorithm can first recognize the face in the face image, and then further determine the position of the eye in the face, and finally obtain the line of sight information.
  • the line of sight information can describe the line of sight of the human eye, for example, it may include the first coordinate of the human eye on the face image, and the edge coordinate of the intersection of the line of sight of the human eye and the edge of the face image on the face image. Through the first coordinate and the edge coordinate, the direction of the line of sight (that is, which direction the human eye looks in) can be described.
  • the line of sight contained in the face image takes the first coordinate as the starting point and the edge coordinate as the end point.
  • the human face image may include one or more human faces, and each human face may include two human eyes, so each human eye corresponds to a line of sight.
  • each line of sight corresponds to a set of first coordinates and edge coordinates. It can be understood that when the face image includes N eyes, N pieces of line of sight information are acquired in step 101, and each line of sight information includes a set of first coordinates and edge coordinates, which are used to describe the line of sight of a human eye.
  • Step 102 Determine a target area in the face image according to the line of sight information, where the target area includes a line of sight segment with the first coordinates and edge coordinates as endpoints.
  • the user can select a specified effect through the terminal device (for example, it can be laser, light, tears, etc.), then to render the specified effect to the human eye, it is necessary to determine a target area in the face image based on the line of sight information. That is, the position where the specified effect needs to be displayed in the face image.
  • the target area includes a line of sight segment with the first coordinates and edge coordinates as endpoints.
  • the target area may be a rectangle or other shapes including the line of sight segment.
  • the target area can be a certain rectangle with the midpoint of the line of sight as the center, the length of the line of sight as the length, and the length of the human eye as the width.
  • the target area is centered on the midpoint of the extended line segment and the length of the extended line segment is set as the length. As the width of the width, the rectangle will be obtained.
  • the target area corresponds to the line of sight one-to-one.
  • the face image includes multiple eyes (for example, two eyes of a single face in a face image, or multiple faces in a face image) Personal eye)
  • each human eye corresponds to a set of first coordinates and edge coordinates
  • each set of first coordinates and edge coordinates determine a line of sight segment
  • each corresponding line of sight segment determines a target area, that is, it is determined in the face image Multiple target areas.
  • Step 103 Render the preset effect material to the target area to obtain the target image.
  • the effect material corresponding to the specified effect can also be found in the pre-stored material library according to the effect specified by the user.
  • the material library includes the effect material corresponding to each of the various effects.
  • the material library can be pre-stored on the terminal device or stored in a server that the terminal device can access. When the terminal device needs to use a certain effect corresponding When the effect material is selected, search for and obtain the effect material from the server. After determining the effect material, use openGL (English: Open Graphics Library, Chinese: Open Graphics Library) to use the effect material as a texture map and render it into the target area to obtain the target image. Since the target area is determined based on the line of sight information, the effect material is rendered in the target area, so that the rendering effect can follow the line of sight of the human eye and reflect the real state of the human eye.
  • openGL English: Open Graphics Library, Chinese: Open Graphics Library
  • the effect material may be set to material with inconsistent widths at both ends.
  • rendering the target area render the smaller end of the effect material to the end of the target area close to the first coordinate (that is, the end close to the human eye), and render the wider end of the effect material to the target area The end of the middle near the edge coordinates.
  • the effect material as a laser as an example, the target image obtained in this way has a thinner laser beam at one end of the human eye, and a thicker laser beam at the edge of the image, thereby producing a visual 3D effect.
  • the target image can be displayed on the display interface of the terminal device, or the target image can be stored in a designated storage.
  • the target image can also be sent to a designated server for sharing, etc., which is not specifically limited in the present disclosure.
  • the present disclosure first recognizes the face image to be processed according to a preset recognition algorithm to obtain line-of-sight information including the first coordinates and edge coordinates of the human eye.
  • the edge coordinates are used to indicate the human eye’s The intersection of the line of sight and the edge of the face image, and then determine the face image according to the line of sight information, including the target area of the line of sight segment with the first coordinate and the edge coordinate as the endpoint, and finally render the preset effect material to the target area, To get the target image.
  • the present disclosure recognizes the line of sight information included in the face image, determines the target area that needs to be rendered, and then renders the effect material to the target area, so that the rendering effect can follow the line of sight of the human eye.
  • Fig. 5 is a flowchart showing another method for processing a face image according to an exemplary embodiment.
  • the line of sight information also includes a depth of field distance, which is the distance between the human eye and the lens that takes the face image .
  • the implementation of step 102 may include:
  • Step 1021 Determine the first distance according to the depth of field distance, and determine the second distance according to the image size of the face image, the first distance is negatively correlated with the depth of field distance, and the second distance is positively correlated with the image size.
  • step 1022 a rectangular area including the line of sight segment, the width being the first distance, and the length being the second distance is taken as the target area.
  • the target area may also be determined in combination with the depth of field distance included in the line of sight information.
  • the depth of field distance can be understood as the human eye in the face image, the distance between the lens that took the face image, the closer the human eye is to the lens, the smaller the depth of field distance, the farther the human eye is from the lens, the greater the depth of field distance .
  • the first distance is determined according to the depth of field distance
  • the second distance is determined according to the image size of the face image, wherein the first distance is negatively correlated with the depth of field distance, and the second distance is positively correlated with the image size.
  • a rectangle including the line of sight segment is determined as the target area.
  • the first distance can be determined according to Formula 1:
  • W represents the first distance
  • Z represents the depth of field distance
  • ⁇ and ⁇ are preset adjustment parameters used to adjust the sensitivity of W with Z. Use the arctangent function To limit W to be too large or too small.
  • the target area can be extended beyond the range of the face image.
  • the second distance can be set to the length of the diagonal of the face image, or the length of the diagonal can be used as the minimum value of the second distance to ensure that the effect material will not be disconnected on the face image.
  • step 103 may be:
  • Adjust the size of the effect material according to the first distance and the second distance and render the adjusted effect material to the target area to obtain the target image.
  • the effect material is resized according to the first distance and the second distance, the width of the adjusted effect material is the first distance and the length is the second distance, and then the adjusted effect material is used as a texture map through openGL and rendered to The target area to get the target image.
  • the adjusted effect material is used as a texture map through openGL and rendered to The target area to get the target image.
  • determining the target area in step 1022 may include the following steps:
  • Step 1) Determine the first side, the side length of the first side is the first distance, the midpoint of the first side is the first coordinate, and the first side is perpendicular to the line of sight segment.
  • Step 2) determine the second side, the side length of the second side is the second distance, and the second side is perpendicular to the first side.
  • Step 3 taking a rectangle composed of the first side and the second side and including the line of sight segment as the target area.
  • the first side is the normal line of the line of sight segment, and the first side is the line segment whose side length is the first distance and the midpoint is the first coordinate.
  • the second side of the target area is determined.
  • the second side is a line segment perpendicular to the first side and the length is the second length, and the intersection of the second side and the first side is located at an end point of the first side.
  • the rectangle formed by the first side and the second side is used as the target area, and the line of sight is included in the target area.
  • the first coordinate and edge coordinates of the left eye: (P0, P1), the first side determined by step 1) to step 3) is MN, the second side is MO, and the left eye
  • the target area is A1, as shown in Figure 6.
  • the method of determining the target area of the right eye is the same as that of the left eye, and will not be repeated here.
  • the coordinates of the four vertices of A1 can be determined according to formula 2:
  • Vertex LeftTop represents the coordinates of the upper left corner of A1
  • Vertex RightTop represents the coordinates of the upper right corner of A1
  • Vertex LeftBottom represents the coordinates of the lower left corner of A1
  • Vertex RightBottom represents the coordinates of the lower right corner of A1
  • W represents the first distance (ie the side length of MN)
  • H represents the second distance (that is, the side length of MO)
  • dy represents sin ⁇
  • dx represents cos ⁇
  • is the angle between the line of sight and the lower edge of the face image.
  • step 101 may be:
  • the face image is input to the pre-trained line-of-sight recognition model to obtain the first coordinates, edge coordinates, and depth of field distance output by the line-of-sight recognition model.
  • the recognition algorithm may input a face image to a pre-trained line of sight recognition model, and the line of sight recognition model can output the first coordinates, edge coordinates, and depth of field distance in the face image.
  • the sight recognition model may be a neural network trained according to a preset sample input set and sample output set, for example, it may be a convolutional neural network (English: Convolutional Neural Networks, abbreviation: CNN).
  • the convolutional neural network is only an example of the neural network of the embodiment of the present disclosure, and the present disclosure is not limited to this, and may also include other various neural networks.
  • the sight recognition model may include, for example, an input layer, a convolutional layer, a feedback layer, a fully connected layer, and an output layer.
  • the face image is input to the input layer, and the convolution layer features are extracted from the face image through the convolution layer.
  • the feedback layer combine the features of the previous feedback layer and the features of the next feedback layer, extract the current feedback layer features from the convolutional layer, and then abstract the feedback layer features through the fully connected layer to generate a face
  • the first coordinates, edge coordinates, and depth of field distance of the image, and finally the first coordinates, edge coordinates, and depth of field distance are output through the output layer.
  • Fig. 7 is a flowchart showing another method for processing a face image according to an exemplary embodiment. As shown in Fig. 7, in a scene where there are multiple line of sight segments in the face image, after step 102, the Methods also include:
  • Step 104 Determine the coordinates of the intersection of multiple line-of-sight line segments according to the line-of-sight information.
  • Step 105 Use edge coordinates and/or intersection coordinates as additional effect coordinates.
  • Step 106 Determine an additional area centered on the additional effect coordinates.
  • step 103 includes:
  • the eyes of a single face in a face image may correspond to two line-of-sight segments, and the two line-of-sight segments may intersect.
  • the face image may include multiple faces.
  • the line of sight corresponding to the face may intersect.
  • the line of sight of the human eye may also intersect the edge of the face image (that is, the point indicated by the edge coordinates).
  • additional effects for example, collisions, sparks, etc.
  • the coordinates of the intersection point can be zero (that is, multiple line-of-sight segments are parallel to each other, or there is no intersection point in the face image), one or more.
  • the coordinates of the intersection point of ab and cd can be determined by the following steps:
  • the coordinates of the four endpoints in ab and cd are: the abscissa of a is ax, the ordinate of a is ay, the abscissa of a is bx, the ordinate of b is by, the abscissa of c is cx, the ordinate of c Is cy, the abscissa of d is dx, and the ordinate of d is dy.
  • area_abd (a.x-d.x)*(b.y-d.y)-(a.y-d.y)*(b.x-d.x)
  • t can be understood as the ratio of the area of the triangle cda to the area of the quadrilateral abcd, and can also be understood as the ratio of the length from the point a to the intersection to the length of ab.
  • the edge coordinates and the intersection point coordinates can be used as the additional effect coordinates, and if the intersection point coordinates are zero, then only the edge coordinates are used as the additional effect coordinates. Then determine the additional area centered on the additional effect coordinates.
  • the additional area can be a rectangle centered on the additional effect coordinates, or other shapes.
  • the additional effect material can be rendered to the additional area to obtain the target image.
  • the additional effect can also be selected by the user, and then according to the additional effect selected by the user, additional effect materials corresponding to the additional effect are found in the pre-stored additional material library.
  • Fig. 8 is a flow chart showing another method for processing a face image according to an exemplary embodiment.
  • the line of sight information also includes a depth of field distance.
  • the depth of field distance is between the human eye and the lens that takes the face image.
  • the implementation of step 106 may include:
  • Step 1061 according to the depth of field distance and the additional effect coordinates, determine the additional depth of field distance corresponding to the additional effect coordinates.
  • Step 1062 Determine an additional area centered on the additional effect coordinates, and the size of the additional area is determined according to the additional depth of field distance.
  • the additional area may also be determined in combination with the depth of field distance included in the line of sight information.
  • the additional depth of field distance corresponding to the additional effect coordinates can be determined according to the depth of field distance and the additional effect coordinates.
  • the additional depth of field distance can be determined by formula 4:
  • Z f represents the additional depth-of-field distance
  • Z represents the depth-of-field distance
  • t is the ratio of the area of the triangle cda to the area of the quadrilateral abcd, as determined in formula 3.
  • the size of the additional area is determined, and the size of the additional area is negatively related to the additional depth of field distance. That is, the larger the additional depth of field distance, the farther the additional effect coordinates are from the lens, the smaller the additional area, and the smaller the additional depth of field distance, the closer the additional effect coordinates are to the lens, the larger the additional area.
  • the side length of the additional area can be determined according to formula 5:
  • W f represents the side length of the additional area
  • ⁇ and ⁇ are preset adjustment parameters for adjusting the sensitivity of W f with Z f.
  • Use the arctangent function To restrict W f from being too large or too small.
  • the GL_MAX_EXT mixing equation in openGL can be used to place the effect material on the layer and the additional effect material.
  • the layer is merged with the layer where the face image is located, and then the effect material, additional effect material and the face image are mixed using the filter blending mode to achieve rendering.
  • the result color is displayed in the target image
  • the color of the face image is the basic color
  • the color of the effect material and the additional effect material are the mixed colors
  • the present disclosure first recognizes the face image to be processed according to a preset recognition algorithm to obtain line of sight information including the first coordinate of the human eye and the edge coordinate, where the edge coordinate is used to indicate the human eye’s
  • the intersection of the line of sight and the edge of the face image is then determined according to the line of sight information.
  • the face image includes the target area of the line of sight segment with the first coordinate and the edge coordinate as the endpoint, and finally the preset effect material is rendered to the target area To get the target image.
  • the present disclosure recognizes the line of sight information included in the face image, determines the target area that needs to be rendered, and then renders the effect material to the target area, so that the rendering effect can follow the line of sight of the human eye.
  • Fig. 11 is a block diagram showing an apparatus for processing a face image according to an exemplary embodiment. As shown in Fig. 11, the apparatus 200 includes:
  • the obtaining module 201 is used to obtain the line of sight information in the face image to be processed according to a preset recognition algorithm.
  • the line of sight information includes: the first coordinates and edge coordinates of the human eye.
  • the edge coordinates are used to indicate the line of sight of the human eye and the human eye. The intersection of the edges of the face image.
  • the first determining module 202 is configured to determine a target area in the face image according to the line of sight information, and the target area includes a line of sight segment with the first coordinates and edge coordinates as endpoints.
  • the rendering module 203 is configured to render the preset effect material to the target area to obtain the target image.
  • Fig. 12 is a block diagram of another face image processing device according to an exemplary embodiment.
  • the line of sight information also includes a depth of field distance, which is the distance between the human eye and the lens that takes the face image.
  • the first determining module 202 includes:
  • the first determining sub-module 2021 is configured to determine the first distance according to the depth of field distance, and determine the second distance according to the image size of the face image, the first distance is negatively correlated with the depth of field distance, and the second distance is positively correlated with the image size.
  • the second determining sub-module 2022 is configured to use a rectangular area that includes the line of sight segment, the width is the first distance, and the length is the second distance as the target area.
  • the rendering module 203 is used to:
  • Adjust the size of the effect material according to the first distance and the second distance and render the adjusted effect material to the target area to obtain the target image.
  • the second determining submodule 2022 is configured to perform the following steps:
  • Step 1) Determine the first side, the side length of the first side is the first distance, the midpoint of the first side is the first coordinate, and the first side is perpendicular to the line of sight segment.
  • Step 2) determine the second side, the side length of the second side is the second distance, and the second side is perpendicular to the first side.
  • Step 3 taking a rectangle composed of the first side and the second side and including the line of sight segment as the target area.
  • the obtaining module 201 is used to:
  • the face image is input to the pre-trained line-of-sight recognition model to obtain the first coordinates, edge coordinates, and depth-of-field distance output by the line-of-sight recognition model.
  • Fig. 13 is a block diagram showing another apparatus for processing a face image according to an exemplary embodiment. As shown in Fig. 13, there are multiple line-of-sight segments in the face image, and the apparatus 200 further includes:
  • the second determining module 204 is configured to determine the coordinates of the intersection of multiple line-of-sight line segments according to the line-of-sight information after determining the target area in the face image according to the line-of-sight information.
  • the second determining module 204 is further configured to use edge coordinates and/or intersection coordinates as additional effect coordinates.
  • the second determining module 204 is also used to determine the additional area centered on the additional effect coordinates.
  • the rendering module 203 is configured to render the effect material to the target area, and render the preset additional effect material to the additional area to obtain the target image.
  • Fig. 14 is a block diagram showing another face image processing apparatus according to an exemplary embodiment.
  • the second determining module 204 includes:
  • the third determining sub-module 2041 is configured to determine the additional depth of field distance corresponding to the additional effect coordinate according to the depth of field distance and the additional effect coordinate.
  • the fourth determining sub-module 2042 is used to determine the additional area centered on the additional effect coordinates, and the size of the additional area is determined according to the additional depth of field distance.
  • the present disclosure first recognizes the face image to be processed according to a preset recognition algorithm to obtain line of sight information including the first coordinate of the human eye and the edge coordinate, where the edge coordinate is used to indicate the human eye’s
  • the intersection of the line of sight and the edge of the face image is then determined according to the line of sight information.
  • the face image includes the target area of the line of sight segment with the first coordinate and the edge coordinate as the endpoint, and finally the preset effect material is rendered to the target area To get the target image.
  • the present disclosure recognizes the line of sight information included in the face image, determines the target area that needs to be rendered, and then renders the effect material to the target area, so that the rendering effect can follow the line of sight of the human eye.
  • the electronic device in the embodiment of the present disclosure may be a server, which may be a local server or a cloud server, or a terminal device, and the terminal device may include, but is not limited to, mobile Phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), mobile terminals such as car navigation terminals, and mobile terminals such as digital TVs, desktops Fixed terminals for computers, etc.
  • the user can upload the face image by logging in to the server, or directly upload the face image through the terminal device, or collect the face image through the terminal device.
  • the electronic device shown in FIG. 15 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the electronic device 300 may include a processing device (such as a central processing unit, a graphics processor, etc.) 301, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 302 or from a storage device 308
  • the program in the memory (RAM) 303 executes various appropriate actions and processing.
  • various programs and data required for the operation of the electronic device 300 are also stored.
  • the processing device 301, the ROM 302, and the RAM 303 are connected to each other through a bus 304.
  • An input/output (I/O) interface 305 is also connected to the bus 304.
  • the following devices can be connected to the I/O interface 305: including input devices 306 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, vibrations
  • input devices 306 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.
  • LCD liquid crystal displays
  • An output device 307 such as a device
  • a storage device 308 such as a magnetic tape, a hard disk, etc.
  • the communication device 309 may allow the electronic device 300 to perform wireless or wired communication with other devices to exchange data.
  • FIG. 15 shows an electronic device 300 having various devices, it should be understood that it is not required to implement or have all of the illustrated devices. It may be implemented alternatively or provided with more or fewer devices.
  • an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer readable medium, and the computer program contains program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302.
  • the processing device 301 When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above.
  • Computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable removable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein.
  • This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
  • the terminal device and the server can communicate with any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium.
  • Communication e.g., communication network
  • Examples of communication networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (for example, the Internet), and end-to-end networks (for example, ad hoc end-to-end networks), as well as any currently known or future research and development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains the line of sight information in the face image to be processed according to a preset recognition algorithm
  • the line of sight information includes: first coordinates of the human eye and edge coordinates, and the edge coordinates are used to indicate the intersection of the line of sight of the human eye and the edge of the face image.
  • a target area in the face image is determined according to the line of sight information, where the target area includes a line of sight segment with the first coordinates and the edge coordinates as endpoints.
  • the preset effect material is rendered to the target area to obtain a target image.
  • the computer program code used to perform the operations of the present disclosure can be written in one or more programming languages or a combination thereof.
  • the above-mentioned programming languages include but are not limited to object-oriented programming languages such as Java, Smalltalk, C++, and Including conventional procedural programming languages-such as "C" language or similar programming languages.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user’s computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to Connect via the Internet).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logic function.
  • Executable instructions can also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the modules involved in the embodiments described in the present disclosure can be implemented in software or hardware. Among them, the name of the module does not constitute a limitation on the module itself under certain circumstances.
  • the first determining module can also be described as a "module for determining the target area”.
  • exemplary types of hardware logic components include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logical device (CPLD) and so on.
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • ASSP Application Specific Standard Product
  • SOC System on Chip
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium, which may contain or store a program for use by the instruction execution system, apparatus, or device or in combination with the instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • the machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing.
  • machine-readable storage media would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read-only memory
  • EPROM or flash memory erasable programmable read-only memory
  • CD-ROM compact disk read only memory
  • magnetic storage device or any suitable combination of the foregoing.
  • Example 1 provides a method for processing a face image, including: obtaining line of sight information in a face image to be processed according to a preset recognition algorithm, where the line of sight information includes : The first coordinates and edge coordinates of the human eye, the edge coordinates are used to indicate the intersection of the line of sight of the human eye and the edge of the face image; determine the target area in the face image according to the line of sight information The target area includes a line of sight segment with the first coordinates and the edge coordinates as endpoints; and a preset effect material is rendered to the target area to obtain a target image.
  • Example 2 provides the method of Example 1.
  • the line of sight information further includes a depth-of-field distance, and the depth-of-field distance is the distance between the human eye and the lens that took the face image.
  • Distance; the determining the target area in the face image according to the line of sight information includes: determining a first distance according to the depth of field distance, and determining a second distance according to the image size of the face image, the first A distance is negatively correlated with the depth of field distance, and the second distance is positively correlated with the image size; a rectangle that includes the line of sight segment, the width is the first distance, and the length is the second distance
  • the area serves as the target area.
  • Example 3 provides the method of Example 2.
  • the rendering the preset effect material to the target area to obtain the target image includes: according to the first distance and the The second distance adjusts the size of the effect material, and renders the adjusted effect material to the target area to obtain the target image.
  • Example 4 provides the method of Example 2.
  • a rectangle that includes the line of sight segment and has a width of the first distance and a length of the second distance is used as the The target area includes: determining a first side, the side length of the first side being the first distance, the midpoint of the first side being the first coordinate, and the first side and the line of sight
  • the line segment is vertical; the second side is determined, the side length of the second side is the second distance, and the second side is perpendicular to the first side; it will be composed of the first side and the second side ,
  • the rectangle including the line of sight segment is used as the target area.
  • Example 5 provides the method of any one of Examples 2 to 4.
  • obtaining line of sight information in a face image to be processed includes: The face image is input to a pre-trained line of sight recognition model to obtain the first coordinates, the edge coordinates, and the depth distance output by the line of sight recognition model.
  • Example 6 provides the method of any one of Examples 1 to 4, there are a plurality of the line of sight segments in the face image, and the line of sight is determined according to the line of sight information.
  • the method further includes: determining intersection coordinates of a plurality of the line of sight line segments according to the line of sight information; using the edge coordinates and/or the coordinates of the intersection point as additional effect coordinates Determining the additional area centered on the additional effect coordinates; the rendering the preset effect material to the target area to obtain the target image includes: rendering the effect material to the target area, and The preset additional effect material is rendered to the additional area to obtain the target image.
  • Example 7 provides the method of Example 6, the line of sight information further includes a depth-of-field distance, and the depth-of-field distance is the distance between the human eye and the lens that took the face image Distance; the determining the additional area centered on the additional effect coordinates includes: determining the additional depth distance corresponding to the additional effect coordinates according to the depth of field distance and the additional effect coordinates; determining the additional effect coordinates The additional area is the center, and the size of the additional area is determined according to the additional depth of field distance.
  • Example 8 provides an apparatus for processing a face image
  • the apparatus includes: an acquisition module for acquiring the face image in the face image to be processed according to a preset recognition algorithm
  • Line of sight information includes: first coordinates of the human eye and edge coordinates, the edge coordinates are used to indicate the intersection of the line of sight of the human eye and the edge of the face image
  • a first determining module for Determine a target area in the face image according to the line of sight information, where the target area includes a line of sight segment with the first coordinates and the edge coordinates as endpoints
  • a rendering module for rendering preset effect materials To the target area to obtain a target image.
  • Example 9 provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the methods described in Examples 1 to 7 are implemented.
  • Example 10 provides an electronic device, including: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to Implement the steps of the methods described in Example 1 to Example 7.
  • Example 11 provides a computer program, including: a storage device on which the computer program is stored; and a processing device for executing the computer program in the storage device to Implement the steps of the methods described in Example 1 to Example 7.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • General Health & Medical Sciences (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Ophthalmology & Optometry (AREA)
  • Processing Or Creating Images (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)
  • Image Generation (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

一种人脸图像的处理方法、装置、可读介质和电子设备,涉及图像处理技术领域,该方法包括:按照预设的识别算法,获取待处理的人脸图像中的视线信息(101),视线信息包括:人眼的第一坐标和边缘坐标,边缘坐标用于指示人眼的视线与人脸图像的边缘的交点,根据视线信息确定人脸图像中的目标区域(102),目标区域包括以第一坐标和边缘坐标为端点的视线线段,将预设的效果素材渲染至目标区域,以得到目标图像(103)。通过识别人脸图像中包括的视线信息,确定需要渲染的目标区域,再将效果素材渲染至目标区域,使得渲染效果能够跟随人眼的视线。

Description

人脸图像的处理方法、装置、可读介质和电子设备
本申请要求于2020年1月6日提交中国专利局、申请号为202010010716.5、申请名称为“人脸图像的处理方法、装置、可读介质和电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,更为具体地,涉及一种人脸图像的处理方法、装置、可读介质和电子设备。
背景技术
随着终端技术和图像处理技术的不断发展,终端设备上所能提供的图像处理操作越来越丰富。为了满足用户的不同需求,终端设备可以在包含人脸的图像上增加各种效果,例如可以在图像中的人眼处渲染出镭射、发光、流泪等效果。然而,针对人眼的渲染效果,通常是固定显示在人眼所在位置的附近,不能反映人眼的真实状态。
发明内容
本申请的目的在于提供一种人脸图像的处理方法、装置、可读介质和电子设备,用于解决现有的人脸图像处理方法在进行人眼渲染时,只能固定显示在人眼所在位置的附近,不能反映人眼的真实状态的技术问题。
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。第一方面,本公开提供一种人脸图像的处理方法,所述方法包括:
按照预设的识别算法,获取待处理的人脸图像中的视线信息,所述视线信息包括:人眼的第一坐标和边缘坐标,所述边缘坐标用于指示所述人眼的视线与所述人脸图像的边缘的交点;
根据所述视线信息确定所述人脸图像中的目标区域,所述目标区域包括以所述第一坐标和所述边缘坐标为端点的视线线段;
将预设的效果素材渲染至所述目标区域,以得到目标图像。
第二方面,本公开提供一种人脸图像的处理装置,所述装置包括:
获取模块,用于按照预设的识别算法,获取待处理的人脸图像中的视线信息,所述视线信息包括:人眼的第一坐标和边缘坐标,所述边缘坐标用于指示所述人眼的视线与所述人脸图像的边缘的交点;
第一确定模块,用于根据所述视线信息确定所述人脸图像中的目标区域,所述目标区域包括以所述第一坐标和所述边缘坐标为端点的视线线段;
渲染模块,用于将预设的效果素材渲染至所述目标区域,以得到目标图像。
第三方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现本公开第一方面所述方法的步骤。
第四方面,本公开提供一种电子设备,包括:
存储装置,其上存储有计算机程序;
处理装置,用于执行所述存储装置中的所述计算机程序,以实现本公开第一方面所述方法的步骤。
通过上述技术方案,本公开首先按照预设的识别算法对待处理的人脸图像进行识别,以获取包括了人眼的第一坐标和边缘坐标的视线信息,其中,边缘坐标用于指示人眼的视线与人脸图像的边缘的交点,之后根据视线信息确定人脸图像中,包括了以第一坐标和边缘坐标为端点的视线线段的目标区域,最后将预设的效果素材渲染至目标区域,以得到目标图像。本公开通过识别人脸图像中包括的视线信息,确定需要渲染的目标区域,再将效果素材渲染至目标区域,使得渲染效果能够跟随人眼的视线。
本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:
图1是根据一示例性实施例示出的一种人脸图像的处理方法的流程图;
图2是根据一示例性实施例示出的一种效果素材;
图3是根据一示例性实施例示出的一种人脸图像;
图4是根据一示例性实施例示出的一种目标图像;
图5是根据一示例性实施例示出的另一种人脸图像的处理方法的流程图;
图6是根据一示例性实施例示出的一种人脸图像;
图7是根据一示例性实施例示出的另一种人脸图像的处理方法的流程图;
图8是根据一示例性实施例示出的另一种人脸图像的处理方法的流程图;
图9是根据一示例性实施例示出的一种附加效果素材;
图10a是根据一示例性实施例示出的一种人脸图像;
图10b是根据一示例性实施例示出的一种目标图像;
图11是根据一示例性实施例示出的一种人脸图像的处理装置的框图;
图12是根据一示例性实施例示出的另一种人脸图像的处理装置的框图;
图13是根据一示例性实施例示出的另一种人脸图像的处理装置的框图;
图14是根据一示例性实施例示出的另一种人脸图像的处理装置的框图;
图15是根据一示例性实施例使出的电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施 例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
图1是根据一示例性实施例示出的一种人脸图像的处理方法的流程图,如图1所示,该方法包括:
步骤101,按照预设的识别算法,获取待处理的人脸图像中的视线信息,视线信息包括:人眼的第一坐标和边缘坐标,边缘坐标用于指示人眼的视线与人脸图像的边缘的交点。
举例来说,待处理的人脸图像,例如可以是用户通过终端设备拍摄的一幅包含人脸的照片,或者通过终端设备拍摄的视频中一帧包含人脸的图像,也可以是用户在终端设备显示界面上选择的一副包含人脸的图像。首先,按照预设的识别算法,识别出人脸图像中包含的视线信息。识别算法可以先识别出人脸图像中的人脸,再进一步确定人脸中人眼的位置,最后获得视线信息。其中,视线信息能够描述人眼的视线,例如可以包括人眼在人脸图像上的第一坐标,和人眼的视线与人脸图像的边缘的交点在人脸图像上的边缘坐标。通过第一坐标和边缘坐标,能够描述视线的方向(即人眼看向哪个方向)。人脸图像中所包含的视线,是以第一坐标为起点,边缘坐标为终点。需要说明的是,人脸图像中可以包括一个或多个人脸,每个人脸上可以包括两个人眼,那么每个人眼对应一道视线。相应的,每道视线都对应一组第一坐标和边缘坐标。可以理解为,当人脸图像中包括N个人眼时,步骤101中获取的是N个视线信息,每个视线信息中包括一组第一坐标和边缘坐标,用于 描述一个人眼的视线。
步骤102,根据视线信息确定人脸图像中的目标区域,目标区域包括以第一坐标和边缘坐标为端点的视线线段。
示例的,用户可以通过终端设备选择指定的效果(例如可以是镭射、发光、流泪等),那么要对人眼渲染出指定的效果,需要在人脸图像中,根据视线信息确定一个目标区域,即指定的效果在人脸图像中需要显示的位置。目标区域包括了以第一坐标和边缘坐标为端点的视线线段。目标区域可以是包括了视线线段的矩形或者其他形状。例如目标区域可以是以视线线段的中点作为中心,视线线段的长度作为长,人眼的长度作为宽,确定的矩形。还可以将视线线段向边缘坐标的方向进行延伸,得到长度与人脸图像的对角线长度相同的延伸线段,目标区域为以延伸线段的中点作为中心,延伸线段的长度作为长,预设的宽度作为宽,将得到的矩形。
其中,目标区域是与视线线段一一对应的,若人脸图像中包括了多个人眼(例如:人脸图像中的单个人脸的两个人眼,或者人脸图像中的多个人脸的多个人眼),每个人眼对应一组第一坐标和边缘坐标,那么每一组第一坐标和边缘坐标确定一个视线线段,相应的每个视线线段确定一个目标区域,即在人脸图像中确定多个目标区域。
步骤103,将预设的效果素材渲染至目标区域,以得到目标图像。
示例的,在对目标区域进行渲染之前,还可以根据用户指定的效果,在预先存储的素材库中找到指定的效果对应的效果素材。其中,素材库中包括有多种效果中每种效果对应的效果素材,素材库可以预先存储在终端设备上,也可以存储在终端设备能够访问的服务器中,当终端设备需要使用某个效果对应的效果素材时,再从服务器中查找并获取该效果素材。在确定效果素材之后,通过openGL(英文:Open Graphics Library,中文:开放式图形库)将效果素材作为纹理贴图,渲染到目标区域内,以得到目标图像。由于目标区域是根据视线信息确定的,因此在目标区域内渲染效果素材,使得渲染效果能够跟随人眼的视线,能够反映人眼的真实状态。
进一步的,为了使渲染效果能够具有视觉上的3D(英文:3 Dimensions,中文:三维)效果,可以将效果素材设置为两端宽度不一致的素材。在对目标区域进行渲染时,将效果素材中宽度较小的一端渲染至目标区域中靠近第一坐标的一端(即靠近人眼的一端),将效果素材中宽度较大的一端渲染至目标区域中靠近边缘坐标的一端。以效果素材是镭射为例,这样得到的目标图像位于人眼一端的镭射线较细,位于图像边缘一端的镭射线较粗,从而产生视觉上的3D效果。
需要说明的是,在得到目标图像后,可以根据用户的不同需求,对目标图像进行不同 的操作,例如可以将目标图像显示在终端设备的显示界面上,也可以将目标图像存储在指定的存储路径内,还可以将目标图像发送至指定的服务器进行共享等,本公开对此不作具体限定。
以效果素材为图2,人脸图像为图3来举例,先通过识别算法得到图3中左眼的第一坐标和边缘坐标:(P0,P1),右眼的第一坐标和边缘坐标:(P2,P3),再根据(P0,P1)和(P2,P3)确定左眼对应的目标区域A,和右眼对应的目标区域B,最后将图2分别渲染至A和B处,得到目标图像如图4所示。
综上所述,本公开首先按照预设的识别算法对待处理的人脸图像进行识别,以获取包括了人眼的第一坐标和边缘坐标的视线信息,其中,边缘坐标用于指示人眼的视线与人脸图像的边缘的交点,之后根据视线信息确定人脸图像中,包括了以第一坐标和边缘坐标为端点的视线线段的目标区域,最后将预设的效果素材渲染至目标区域,以得到目标图像。本公开通过识别人脸图像中包括的视线信息,确定需要渲染的目标区域,再将效果素材渲染至目标区域,使得渲染效果能够跟随人眼的视线。
图5是根据一示例性实施例示出的另一种人脸图像的处理方法的流程图,如图5所示,视线信息还包括景深距离,景深距离为人眼到拍摄人脸图像的镜头之间的距离,步骤102的实现方式可以包括:
步骤1021,根据景深距离确定第一距离,并根据人脸图像的图像尺寸确定第二距离,第一距离与景深距离为负相关,第二距离与图像尺寸为正相关。
步骤1022,将包括视线线段,且宽度为第一距离,长度为第二距离的矩形区域作为目标区域。
举例来说,为了使渲染效果能够具有视觉上的3D效果,还可以结合视线信息中包括的景深距离来确定目标区域。其中,景深距离可以理解为人脸图像中的人眼,距离拍摄该人脸图像的镜头之间的距离,人眼距离镜头越近,景深距离越小,人眼距离镜头越远,景深距离越大。首先,根据景深距离确定第一距离,根据人脸图像的图像尺寸确定第二距离,其中,第一距离与景深距离为负相关,第二距离与图像尺寸为正相关。之后,按照第一距离为宽,第二距离为长确定一个包括视线线段的矩形,作为目标区域。这样,景深距离越小,目标区域的宽度越宽,景深距离越大,目标区域的宽度越窄。
具体的,第一距离可以根据公式1来确定:
Figure PCTCN2020127260-appb-000001
其中,W表示第一距离,Z表示景深距离,α和β为预设的调节参数,用于调节W随 Z变化的敏感度。利用反正切函数
Figure PCTCN2020127260-appb-000002
来限制W过大或者过小。
为了避免目标区域选择的过小,导致效果素材在人脸图像上出现断开的问题,可以将目标区域延伸出人脸图像的范围之外。那么可以将第二距离设置为人脸图像的对角线的长度,也可以将对角线的长度作为第二距离的最小值,以保证效果素材在人脸图像上不会出现断开的问题。
相应的,步骤103的实现方式可以为:
按照第一距离和第二距离调整效果素材的大小,并将调整后的效果素材渲染至目标区域,以得到目标图像。
示例的,将效果素材按照第一距离和第二距离调整大小,调整后的效果素材的宽为第一距离,长为第二距离,然后通过openGL将调整后的效果素材作为纹理贴图,渲染至目标区域,以得到目标图像。以效果素材是镭射为例,景深距离越小,目标区域的宽度越宽,调整后的效果素材就越宽,目标图像中的镭射线就越宽,景深距离越大,目标区域的宽度越窄,调整后的效果素材就越窄,目标图像中的镭射线就越窄,从而产生视觉上的3D效果。
具体的,步骤1022中确定目标区域可以包括以下步骤:
步骤1),确定第一边,第一边的边长为第一距离,第一边的中点为第一坐标,且第一边与视线线段垂直。
步骤2),确定第二边,第二边的边长为第二距离,且第二边与第一边垂直。
步骤3),将由第一边和第二边组成的,且包括视线线段的矩形作为目标区域。
示例的,先确定目标区域的第一边,第一边是视线线段的法线,并且,第一边是边长为第一距离且中点为第一坐标的线段。之后,再确定目标区域的第二边,第二边是与第一边垂直,长度为第二长度的线段,且第二边与第一边的交点位于第一边的一个端点处。最后,将由第一边和第二边组成的矩形作为目标区域,目标区域内包括视线线段。以图3中的左眼来举例,左眼的第一坐标和边缘坐标:(P0,P1),通过步骤1)至步骤3)确定的第一边为MN,第二边为MO,左眼的目标区域为A1,如图6所示。确定右眼的目标区域的方式与左眼相同,此处不再赘述。A1的四个顶点的坐标可以根据公式2来确定:
Figure PCTCN2020127260-appb-000003
Figure PCTCN2020127260-appb-000004
Figure PCTCN2020127260-appb-000005
Figure PCTCN2020127260-appb-000006
其中,Vertex LeftTop表示A1的左上角坐标,Vertex RightTop表示A1的右上角坐标,Vertex LeftBottom表示A1的左下角坐标,Vertex RightBottom表示A1的右下角坐标,W表示第一距离(即MN的边长),H表示第二距离(即MO的边长),dy表示sinθ,dx表示cosθ,θ为视线线段与人脸图像的下边缘的夹角。
可选地,步骤101的实现方式可以为:
将人脸图像输入至预先训练的视线识别模型,以得到视线识别模型输出的第一坐标、边缘坐标和景深距离。
举例来说,识别算法可以是将人脸图像输入至预先训练的视线识别模型,视线识别模型能够输出人脸图像中的第一坐标、边缘坐标和景深距离。其中,视线识别模型可以是根据预先设置的样本输入集和样本输出集训练得到的神经网络,例如可以是卷积神经网络(英文:Convolutional Neural Networks,缩写:CNN)。卷积神经网络仅是本公开实施例的神经网络的一个示例,本公开不限于此,还可以包括其他各种神经网络。视线识别模型例如可以包括输入层、卷积层、反馈层、全连接层和输出层。首先将人脸图像输入到输入层,通过卷积层,从人脸图像中提取卷积层特征。再通过反馈层,结合上一次的反馈层特征和后一次的反馈层特征,从卷积层中提取当前的反馈层特征,之后通过全连接层,对反馈层特征进行抽象处理,以生成人脸图像的第一坐标、边缘坐标和景深距离,最后通过输出层输出第一坐标、边缘坐标和景深距离。
图7是根据一示例性实施例示出的另一种人脸图像的处理方法的流程图,如图7所示,在人脸图像中存在多个视线线段的场景中,在步骤102之后,该方法还包括:
步骤104,根据视线信息确定多个视线线段的交点坐标。
步骤105,将边缘坐标,和/或交点坐标作为附加效果坐标。
步骤106,确定以附加效果坐标为中心的附加区域。
相应的,步骤103包括:
将效果素材渲染至目标区域,并将预设的附加效果素材渲染至附加区域,以得到目标图像。
在具体的实现场景中,例如人脸图像中的单个人脸的双眼可以分别对应两个视线线段,所述两个视线线段可能相交,例如人脸图像中可能包括多个人脸,所述多个人脸所对应的视线线段可能相交,还例如人眼的视线也会和人脸图像的边缘相交(即边缘坐标所指示的点)。此时可以在相交的位置处渲染附加的效果(例如可以是碰撞、火花等)。首先确定多个视线线段的交点坐标,交点坐标可以为零个(即多个视线线段互相平行,或者在人脸图像内不存在交点),一个或多个。
以人脸图像中存在两个视线线段ab和cd来举例,确定ab和cd的交点坐标可以通过以下步骤来获得:
ab和cd中四个端点的坐标为:a的横坐标为a.x,a的纵坐标为a.y,a的横坐标为b.x,b的纵坐标为b.y,c的横坐标为c.x,c的纵坐标为c.y,d的横坐标为d.x,d的纵坐标为d.y。先计算ac和bc的叉乘:
area_abc=(a.x-c.x)*(b.y-c.y)-(a.y-c.y)*(b.x-c.x)
ab和bd的叉乘:
area_abd=(a.x-d.x)*(b.y-d.y)-(a.y-d.y)*(b.x-d.x)
ca和da的叉乘:
area_cda=(c.x-a.x)*(d.y-a.y)-(c.y-a.y)*(d.x-a.x)
cb和db的叉乘:
area_cdb=area_cda+area_abc-area_abd
若area_abc==area_abd表示ab和cd平行,即ab和cd之间没有交点。若area_abc*area_abd>=0或者area_cda*area_cdb>=0,表示ab和cd不平行,但在人脸图像内不存在交点。
若不满足上述条件,表示ab和cd之间存在交点,那么交点坐标的横坐标X和纵坐标Y可以通过公式3来获得:
X=(a.x+dx)
Y=(a.y+dy)
dx=t*(b.x-a.x)
dy=t*(b.y-a.y)
t=area_cda/(area_abd-area_abc)   公式3
其中,t可以理解为三角形cda的面积与四边形abcd的面积的比值,也可以理解为点a到交点的长度与ab的长度的比值。
以上仅以两个视线线段之间的交点坐标来进行举例说明,当存在两个以上的视线线段时,交点坐标的确定方式是相同的,此处不再赘述。
进一步的,若交点坐标不为零个,那么可以将边缘坐标和交点坐标作为附加效果坐标,若交点坐标为零个,那么仅将边缘坐标作为附加效果坐标。然后确定以附加效果坐标为中心的附加区域。附加区域可以是以附加效果坐标为中心的矩形,也可以是其他形状。确定附加区域之后,在通过openGL将效果素材渲染至目标区域的同时,可以将附加效果素材渲染至附加区域,以得到目标图像。其中,附加的效果同样也可以由用户来选择,然后根据用户选择的附加的效果,在预先存储的附加素材库中找到附加的效果对应的附加效果素材。
图8是根据一示例性实施例示出的另一种人脸图像的处理方法的流程图,如图8所示,视线信息还包括景深距离,景深距离为人眼到拍摄人脸图像的镜头之间的距离,步骤106的实现方式可以包括:
步骤1061,根据景深距离和附加效果坐标,确定附加效果坐标对应的附加景深距离。
步骤1062,确定以附加效果坐标为中心的附加区域,附加区域的大小为根据附加景深距离确定的。
示例的,为了使附加效果也能够具有视觉上的3D效果,同样可以结合视线信息中包括的景深距离来确定附加区域。首先可以根据景深距离和附加效果坐标,来确定附加效果坐标对应的附加景深距离。附加景深距离可以通过公式4来确定:
Z f=Z*(1-t)   公式4
其中,Z f表示附加景深距离,Z表示景深距离,t为公式3中确定的,三角形cda的面积与四边形abcd的面积的比值。
然后再根据附加景深距离,确定附加区域的大小,附加区域的大小与附加景深距离负相关。即附加景深距离越大,表示附加效果坐标距离镜头越远,那么附加区域越小,附加景深距离越小,表示附加效果坐标距离镜头越近,那么附加区域越大。以附加区域为正方形来举例,那么附加区域的边长可以根据公式5来确定:
Figure PCTCN2020127260-appb-000007
其中,W f表示附加区域的边长,α和β为预设的调节参数,用于调节W f随Z f变化的敏感度。利用反正切函数
Figure PCTCN2020127260-appb-000008
来限制W f过大或者过小。
以效果素材为图2,附加效果素材为图9,人脸图像为图3来举例,确定的附加区域为C、D、E,如图10a所示,将图2渲染至目标区域,并将图9素材渲染至附加区域,得到的目标图像如图10b所示。
需要说明的是,上述实施例中,将效果素材(或者附加效果素材)渲染至目标区域(或者附加区域)时,可以采用openGL中的GL_MAX_EXT混合方程,将效果素材所在图层、附加效果素材所在图层与人脸图像所在图层进行合并,之后采用滤色混合模式将效果素材、附加效果素材与人脸图像进行混合,来实现渲染。其中,目标图像中显示的是结果色,人脸图像的颜色为基础色,效果素材和附加效果素材的颜色为混合色,滤色混合模式中的滤色混合公式可以为:结果色=255-[(255-基础色)*(255-混合色)]/255。
综上所述,本公开首先按照预设的识别算法对待处理的人脸图像进行识别,以获取包括了人眼的第一坐标和边缘坐标的视线信息,其中,边缘坐标用于指示人眼的视线与人脸图像的边缘的交点,之后根据视线信息确定人脸图像中,包括了以第一坐标和边缘坐标为端点的视线线段的目标区域,最后将预设的效果素材渲染至目标区域,以得到目标图像。本公开通过识别人脸图像中包括的视线信息,确定需要渲染的目标区域,再将效果素材渲染至目标区域,使得渲染效果能够跟随人眼的视线。
图11是根据一示例性实施例示出的一种人脸图像的处理装置的框图,如图11所示,该装置200包括:
获取模块201,用于按照预设的识别算法,获取待处理的人脸图像中的视线信息,视线信息包括:人眼的第一坐标和边缘坐标,边缘坐标用于指示人眼的视线与人脸图像的边缘的交点。
第一确定模块202,用于根据视线信息确定人脸图像中的目标区域,目标区域包括以第一坐标和边缘坐标为端点的视线线段。
渲染模块203,用于将预设的效果素材渲染至目标区域,以得到目标图像。
图12是根据一示例性实施例示出的另一种人脸图像的处理装置的框图,如图12所示,视线信息还包括景深距离,景深距离为人眼到拍摄人脸图像的镜头之间的距离,第一确定模块202包括:
第一确定子模块2021,用于根据景深距离确定第一距离,并根据人脸图像的图像尺寸确定第二距离,第一距离与景深距离为负相关,第二距离与图像尺寸为正相关。
第二确定子模块2022,用于将包括视线线段,且宽度为第一距离,长度为第二距离的矩形区域作为目标区域。
可选地,渲染模块203用于:
按照第一距离和第二距离调整效果素材的大小,并将调整后的效果素材渲染至目标区域,以得到目标图像。
可选地,第二确定子模块2022用于执行以下步骤:
步骤1),确定第一边,第一边的边长为第一距离,第一边的中点为第一坐标,且第一边与视线线段垂直。
步骤2),确定第二边,第二边的边长为第二距离,且第二边与第一边垂直。
步骤3),将由第一边和第二边组成的,且包括视线线段的矩形作为目标区域。
可选地,获取模块201用于:
将人脸图像输入至预先训练的视线识别模型,以得到视线识别模型输出的第一坐标、边缘坐标和景深距离。
图13是根据一示例性实施例示出的另一种人脸图像的处理装置的框图,如图13所示,人脸图像中存在多个视线线段,该装置200还包括:
第二确定模块204,用于在根据视线信息确定人脸图像中的目标区域之后,根据视线信息确定多个视线线段的交点坐标。
第二确定模块204,还用于将边缘坐标,和/或交点坐标作为附加效果坐标。
第二确定模块204,还用于确定以附加效果坐标为中心的附加区域。
渲染模块203,用于将效果素材渲染至目标区域,并将预设的附加效果素材渲染至附加区域,以得到目标图像。
图14是根据一示例性实施例示出的另一种人脸图像的处理装置的框图,如图14所示,第二确定模块204包括:
第三确定子模块2041,用于根据景深距离和附加效果坐标,确定附加效果坐标对应的附加景深距离。
第四确定子模块2042,用于确定以附加效果坐标为中心的附加区域,附加区域的大小为根据附加景深距离确定的。
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。
综上所述,本公开首先按照预设的识别算法对待处理的人脸图像进行识别,以获取包括了人眼的第一坐标和边缘坐标的视线信息,其中,边缘坐标用于指示人眼的视线与人脸图像的边缘的交点,之后根据视线信息确定人脸图像中,包括了以第一坐标和边缘坐标为端点的视线线段的目标区域,最后将预设的效果素材渲染至目标区域,以得到目标图像。本公开通过识别人脸图像中包括的视线信息,确定需要渲染的目标区域,再将效果素材渲染至目标区域,使得渲染效果能够跟随人眼的视线。
下面参考图15,其示出了适于用来实现本公开实施例的电子设备300的结构示意图。本公开实施例中的电子设备(即上述图像的处理方法的执行主体),可以是服务器,该服 务器例如可以是本地服务器或者云服务器,也可以是终端设备,终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。用户可以通过登录服务器以上传人脸图像,也可以直接通过终端设备上传人脸图像,或者通过终端设备采集人脸图像。图15示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图15所示,电子设备300可以包括处理装置(例如中央处理器、图形处理器等)301,其可以根据存储在只读存储器(ROM)302中的程序或者从存储装置308加载到随机访问存储器(RAM)303中的程序而执行各种适当的动作和处理。在RAM 303中,还存储有电子设备300操作所需的各种程序和数据。处理装置301、ROM 302以及RAM 303通过总线304彼此相连。输入/输出(I/O)接口305也连接至总线304。
通常,以下装置可以连接至I/O接口305:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置306;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置307;包括例如磁带、硬盘等的存储装置308;以及通信装置309。通信装置309可以允许电子设备300与其他设备进行无线或有线通信以交换数据。虽然图15示出了具有各种装置的电子设备300,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置309从网络上被下载和安装,或者从存储装置308被安装,或者从ROM 302被安装。在该计算机程序被处理装置301执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使 用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,终端设备、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:按照预设的识别算法,获取待处理的人脸图像中的视线信息,所述视线信息包括:人眼的第一坐标和边缘坐标,所述边缘坐标用于指示所述人眼的视线与所述人脸图像的边缘的交点。根据所述视线信息确定所述人脸图像中的目标区域,所述目标区域包括以所述第一坐标和所述边缘坐标为端点的视线线段。将预设的效果素材渲染至所述目标区域,以得到目标图像。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个 用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定,例如,第一确定模块还可以被描述为“确定目标区域的模块”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,示例1提供了一种人脸图像的处理方法,包括:按照预设的识别算法,获取待处理的人脸图像中的视线信息,所述视线信息包括:人眼的第一坐标和边缘坐标,所述边缘坐标用于指示所述人眼的视线与所述人脸图像的边缘的交点;根据所述视线信息确定所述人脸图像中的目标区域,所述目标区域包括以所述第一坐标和所述边缘坐标为端点的视线线段;将预设的效果素材渲染至所述目标区域,以得到目标图像。
根据本公开的一个或多个实施例,示例2提供了示例1的方法,所述视线信息还包括景深距离,所述景深距离为所述人眼到拍摄所述人脸图像的镜头之间的距离;所述根据所述视线信息确定所述人脸图像中的目标区域,包括:根据所述景深距离确定第一距离,并根据所述人脸图像的图像尺寸确定第二距离,所述第一距离与所述景深距离为负相关,所 述第二距离与所述图像尺寸为正相关;将包括所述视线线段,且宽度为所述第一距离,长度为所述第二距离的矩形区域作为所述目标区域。
根据本公开的一个或多个实施例,示例3提供了示例2的方法,所述将预设的效果素材渲染至所述目标区域,以得到目标图像,包括:按照所述第一距离和所述第二距离调整所述效果素材的大小,并将调整后的所述效果素材渲染至所述目标区域,以得到所述目标图像。
根据本公开的一个或多个实施例,示例4提供了示例2的方法,所述将包括所述视线线段,且宽度为所述第一距离,长度为所述第二距离的矩形作为所述目标区域,包括:确定第一边,所述第一边的边长为所述第一距离,所述第一边的中点为所述第一坐标,且所述第一边与所述视线线段垂直;确定第二边,所述第二边的边长为所述第二距离,且所述第二边与所述第一边垂直;将由所述第一边和所述第二边组成的,且包括所述视线线段的矩形作为所述目标区域。
根据本公开的一个或多个实施例,示例5提供了示例2至示例4中任一项的方法,所述按照预设的识别算法,获取待处理的人脸图像中的视线信息,包括:将所述人脸图像输入至预先训练的视线识别模型,以得到所述视线识别模型输出的所述第一坐标、所述边缘坐标和所述景深距离。
根据本公开的一个或多个实施例,示例6提供了示例1至示例4中任一项的方法,所述人脸图像中存在多个所述视线线段,在所述根据所述视线信息确定所述人脸图像中的目标区域之后,所述方法还包括:根据所述视线信息确定多个所述视线线段的交点坐标;将所述边缘坐标,和/或所述交点坐标作为附加效果坐标;确定以所述附加效果坐标为中心的附加区域;所述将预设的效果素材渲染至所述目标区域,以得到目标图像,包括:将所述效果素材渲染至所述目标区域,并将预设的附加效果素材渲染至所述附加区域,以得到所述目标图像。
根据本公开的一个或多个实施例,示例7提供了示例6的方法,所述视线信息还包括景深距离,所述景深距离为所述人眼到拍摄所述人脸图像的镜头之间的距离;所述确定以所述附加效果坐标为中心的附加区域,包括:根据所述景深距离和所述附加效果坐标,确定所述附加效果坐标对应的附加景深距离;确定以所述附加效果坐标为中心的所述附加区域,所述附加区域的大小为根据所述附加景深距离确定的。
根据本公开的一个或多个实施例,示例8提供了一种人脸图像的处理装置,所述装置包括:获取模块,用于按照预设的识别算法,获取待处理的人脸图像中的视线信息,所述视线信息包括:人眼的第一坐标和边缘坐标,所述边缘坐标用于指示所述人眼的视线与所 述人脸图像的边缘的交点;第一确定模块,用于根据所述视线信息确定所述人脸图像中的目标区域,所述目标区域包括以所述第一坐标和所述边缘坐标为端点的视线线段;渲染模块,用于将预设的效果素材渲染至所述目标区域,以得到目标图像。
根据本公开的一个或多个实施例,示例9提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现示例1至示例7中所述方法的步骤。
根据本公开的一个或多个实施例,示例10提供了一种电子设备,包括:存储装置,其上存储有计算机程序;处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1至示例7中所述方法的步骤。
根据本公开的一个或多个实施例,示例11提供了一种计算机程序,包括:存储装置,其上存储有计算机程序;处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1至示例7中所述方法的步骤。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。

Claims (11)

  1. 一种人脸图像的处理方法,其特征在于,所述方法包括:
    按照预设的识别算法,获取待处理的人脸图像中的视线信息,所述视线信息包括:人眼的第一坐标和边缘坐标,所述边缘坐标用于指示所述人眼的视线与所述人脸图像的边缘的交点;
    根据所述视线信息确定所述人脸图像中的目标区域,所述目标区域包括以所述第一坐标和所述边缘坐标为端点的视线线段;
    将预设的效果素材渲染至所述目标区域,以得到目标图像。
  2. 根据权利要求1所述的方法,其特征在于,所述视线信息还包括景深距离,所述景深距离为所述人眼到拍摄所述人脸图像的镜头之间的距离;
    所述根据所述视线信息确定所述人脸图像中的目标区域,包括:
    根据所述景深距离确定第一距离,并根据所述人脸图像的图像尺寸确定第二距离,所述第一距离与所述景深距离为负相关,所述第二距离与所述图像尺寸为正相关;
    将包括所述视线线段,且宽度为所述第一距离,长度为所述第二距离的矩形区域作为所述目标区域。
  3. 根据权利要求2所述的方法,其特征在于,所述将预设的效果素材渲染至所述目标区域,以得到目标图像,包括:
    按照所述第一距离和所述第二距离调整所述效果素材的大小,并将调整后的所述效果素材渲染至所述目标区域,以得到所述目标图像。
  4. 根据权利要求2或3所述的方法,其特征在于,所述将包括所述视线线段,且宽度为所述第一距离,长度为所述第二距离的矩形作为所述目标区域,包括:
    确定第一边,所述第一边的边长为所述第一距离,所述第一边的中点为所述第一坐标,且所述第一边与所述视线线段垂直;
    确定第二边,所述第二边的边长为所述第二距离,且所述第二边与所述第一边垂直;
    将由所述第一边和所述第二边组成的,且包括所述视线线段的矩形作为所述目标区域。
  5. 根据权利要求2-4中任一项所述的方法,其特征在于,所述按照预设的识别算法,获取待处理的人脸图像中的视线信息,包括:
    将所述人脸图像输入至预先训练的视线识别模型,以得到所述视线识别模型输出的所述第一坐标、所述边缘坐标和所述景深距离。
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述人脸图像中存在多个所述视线线段,在所述根据所述视线信息确定所述人脸图像中的目标区域之后,所述方法还包括:
    根据所述视线信息确定多个所述视线线段的交点坐标;
    将所述边缘坐标,和/或所述交点坐标作为附加效果坐标;
    确定以所述附加效果坐标为中心的附加区域;
    所述将预设的效果素材渲染至所述目标区域,以得到目标图像,包括:
    将所述效果素材渲染至所述目标区域,并将预设的附加效果素材渲染至所述附加区域,以得到所述目标图像。
  7. 根据权利要求6所述的方法,其特征在于,所述视线信息还包括景深距离,所述景深距离为所述人眼到拍摄所述人脸图像的镜头之间的距离;
    所述确定以所述附加效果坐标为中心的附加区域,包括:
    根据所述景深距离和所述附加效果坐标,确定所述附加效果坐标对应的附加景深距离;
    确定以所述附加效果坐标为中心的所述附加区域,所述附加区域的大小为根据所述附加景深距离确定的。
  8. 一种人脸图像的处理装置,其特征在于,所述装置包括:
    获取模块,用于按照预设的识别算法,获取待处理的人脸图像中的视线信息,所述视线信息包括:人眼的第一坐标和边缘坐标,所述边缘坐标用于指示所述人眼的视线与所述人脸图像的边缘的交点;
    第一确定模块,用于根据所述视线信息确定所述人脸图像中的目标区域,所述目标区域包括以所述第一坐标和所述边缘坐标为端点的视线线段;
    渲染模块,用于将预设的效果素材渲染至所述目标区域,以得到目标图像。
  9. 一种计算机可读介质,其上存储有计算机程序,其特征在于,该程序被处理装置执行时实现权利要求1-7中任一项所述方法的步骤。
  10. 一种电子设备,其特征在于,包括:
    存储装置,其上存储有计算机程序;
    处理装置,用于执行所述存储装置中的所述计算机程序,以实现权利要求1-7中任一项所述方法的步骤。
  11. 一种计算机程序,其特征在于,包括程序代码,当计算机运行所述计算机程序时,所述程序代码执行如权利要求1-7中任一项所述方法的步骤。
PCT/CN2020/127260 2020-01-06 2020-11-06 人脸图像的处理方法、装置、可读介质和电子设备 WO2021139382A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
GB2117372.9A GB2599036B (en) 2020-01-06 2020-11-06 Face image processing method and apparatus, readable medium, and electronic device
JP2021571584A JP7316387B2 (ja) 2020-01-06 2020-11-06 顔画像の処理方法、デバイス、可読媒体及び電子装置
US17/616,961 US11887325B2 (en) 2020-01-06 2020-11-06 Face image processing method and apparatus, readable medium, and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010010716.5 2020-01-06
CN202010010716.5A CN111243049B (zh) 2020-01-06 2020-01-06 人脸图像的处理方法、装置、可读介质和电子设备

Publications (1)

Publication Number Publication Date
WO2021139382A1 true WO2021139382A1 (zh) 2021-07-15

Family

ID=70865325

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/127260 WO2021139382A1 (zh) 2020-01-06 2020-11-06 人脸图像的处理方法、装置、可读介质和电子设备

Country Status (5)

Country Link
US (1) US11887325B2 (zh)
JP (1) JP7316387B2 (zh)
CN (1) CN111243049B (zh)
GB (1) GB2599036B (zh)
WO (1) WO2021139382A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113838189A (zh) * 2021-09-13 2021-12-24 厦门美图之家科技有限公司 一种睫毛渲染方法及装置

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111243049B (zh) 2020-01-06 2021-04-02 北京字节跳动网络技术有限公司 人脸图像的处理方法、装置、可读介质和电子设备
CN111754613A (zh) * 2020-06-24 2020-10-09 北京字节跳动网络技术有限公司 图像装饰方法、装置、计算机可读介质和电子设备
CN112257598B (zh) * 2020-10-22 2024-06-18 北京字跳网络技术有限公司 图像中四边形的识别方法、装置、可读介质和电子设备
CN114202617A (zh) * 2021-12-13 2022-03-18 北京字跳网络技术有限公司 视频图像处理方法、装置、电子设备及存储介质
CN116934577A (zh) * 2022-04-01 2023-10-24 北京字跳网络技术有限公司 一种风格图像生成方法、装置、设备及介质
CN117095108B (zh) * 2023-10-17 2024-01-23 海马云(天津)信息技术有限公司 虚拟数字人的纹理渲染方法及装置、云服务器和存储介质

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170262970A1 (en) * 2015-09-11 2017-09-14 Ke Chen Real-time face beautification features for video images
CN107563353A (zh) * 2017-09-26 2018-01-09 维沃移动通信有限公司 一种图像处理方法、装置及移动终端
CN107909058A (zh) * 2017-11-30 2018-04-13 广东欧珀移动通信有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN107909057A (zh) * 2017-11-30 2018-04-13 广东欧珀移动通信有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN108958610A (zh) * 2018-07-27 2018-12-07 北京微播视界科技有限公司 基于人脸的特效生成方法、装置和电子设备
CN109584152A (zh) * 2018-11-30 2019-04-05 深圳市脸萌科技有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
US20190385290A1 (en) * 2018-06-15 2019-12-19 Beijing Xiaomi Mobile Software Co., Ltd. Face image processing method, device and apparatus, and computer-readable storage medium
CN111243049A (zh) * 2020-01-06 2020-06-05 北京字节跳动网络技术有限公司 人脸图像的处理方法、装置、可读介质和电子设备

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4809869B2 (ja) * 2008-05-26 2011-11-09 株式会社ソニー・コンピュータエンタテインメント 画像処理装置、画像処理方法及びプログラム
JP2011049988A (ja) 2009-08-28 2011-03-10 Nikon Corp 画像処理装置およびカメラ
CN106249413B (zh) * 2016-08-16 2019-04-23 杭州映墨科技有限公司 一种模拟人眼对焦的虚拟动态景深变化处理方法
DK179867B1 (en) * 2017-05-16 2019-08-06 Apple Inc. RECORDING AND SENDING EMOJI
CN107818305B (zh) 2017-10-31 2020-09-22 Oppo广东移动通信有限公司 图像处理方法、装置、电子设备和计算机可读存储介质
JP7146585B2 (ja) * 2018-11-13 2022-10-04 本田技研工業株式会社 視線検出装置、プログラム、及び、視線検出方法
CN110378847A (zh) * 2019-06-28 2019-10-25 北京字节跳动网络技术有限公司 人脸图像处理方法、装置、介质及电子设备
CN110378839A (zh) * 2019-06-28 2019-10-25 北京字节跳动网络技术有限公司 人脸图像处理方法、装置、介质及电子设备
CN110555798B (zh) * 2019-08-26 2023-10-17 北京字节跳动网络技术有限公司 图像变形方法、装置、电子设备及计算机可读存储介质

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170262970A1 (en) * 2015-09-11 2017-09-14 Ke Chen Real-time face beautification features for video images
CN107563353A (zh) * 2017-09-26 2018-01-09 维沃移动通信有限公司 一种图像处理方法、装置及移动终端
CN107909058A (zh) * 2017-11-30 2018-04-13 广东欧珀移动通信有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN107909057A (zh) * 2017-11-30 2018-04-13 广东欧珀移动通信有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
US20190385290A1 (en) * 2018-06-15 2019-12-19 Beijing Xiaomi Mobile Software Co., Ltd. Face image processing method, device and apparatus, and computer-readable storage medium
CN108958610A (zh) * 2018-07-27 2018-12-07 北京微播视界科技有限公司 基于人脸的特效生成方法、装置和电子设备
CN109584152A (zh) * 2018-11-30 2019-04-05 深圳市脸萌科技有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN111243049A (zh) * 2020-01-06 2020-06-05 北京字节跳动网络技术有限公司 人脸图像的处理方法、装置、可读介质和电子设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113838189A (zh) * 2021-09-13 2021-12-24 厦门美图之家科技有限公司 一种睫毛渲染方法及装置
CN113838189B (zh) * 2021-09-13 2024-02-02 厦门美图之家科技有限公司 一种睫毛渲染方法及装置

Also Published As

Publication number Publication date
US11887325B2 (en) 2024-01-30
JP7316387B2 (ja) 2023-07-27
GB2599036A9 (en) 2023-06-07
GB2599036B (en) 2024-09-18
GB202117372D0 (en) 2022-01-12
CN111243049B (zh) 2021-04-02
JP2022535524A (ja) 2022-08-09
GB2599036A (en) 2022-03-23
US20220327726A1 (en) 2022-10-13
CN111243049A (zh) 2020-06-05

Similar Documents

Publication Publication Date Title
WO2021139382A1 (zh) 人脸图像的处理方法、装置、可读介质和电子设备
WO2021139408A1 (zh) 显示特效的方法、装置、存储介质及电子设备
US11849211B2 (en) Video processing method, terminal device and storage medium
WO2020248900A1 (zh) 全景视频的处理方法、装置及存储介质
WO2022042290A1 (zh) 一种虚拟模型处理方法、装置、电子设备和存储介质
WO2023207379A1 (zh) 图像处理方法、装置、设备及存储介质
WO2023207963A1 (zh) 图像处理方法、装置、电子设备及存储介质
US12019669B2 (en) Method, apparatus, device, readable storage medium and product for media content processing
US20220139016A1 (en) Sticker generating method and apparatus, and medium and electronic device
CN114900625A (zh) 虚拟现实空间的字幕渲染方法、装置、设备及介质
WO2021244651A1 (zh) 信息显示方法、装置、终端及存储介质
CN111862342B (zh) 增强现实的纹理处理方法、装置、电子设备及存储介质
WO2023246302A1 (zh) 字幕的显示方法、装置、设备及介质
WO2023138467A1 (zh) 虚拟物体的生成方法、装置、设备及存储介质
CN110047126B (zh) 渲染图像的方法、装置、电子设备和计算机可读存储介质
WO2023098649A1 (zh) 视频生成方法、装置、设备及存储介质
US20230284768A1 (en) Beauty makeup special effect generation method, device, and storage medium
US11651529B2 (en) Image processing method, apparatus, electronic device and computer readable storage medium
US20240177409A1 (en) Image processing method and apparatus, electronic device, and readable storage medium
CN112465692A (zh) 图像处理方法、装置、设备及存储介质
JP2023550970A (ja) 画面の中の背景を変更する方法、機器、記憶媒体、及びプログラム製品
CN111223105B (zh) 图像处理方法和装置
RU2802724C1 (ru) Способ и устройство обработки изображений, электронное устройство и машиночитаемый носитель информации
WO2021004171A1 (zh) 水波纹图像实现方法及装置
CN118840467A (zh) 图像处理方法、装置、终端和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20912963

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021571584

Country of ref document: JP

Kind code of ref document: A

Ref document number: 202117372

Country of ref document: GB

Kind code of ref document: A

Free format text: PCT FILING DATE = 20201106

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20912963

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 09.02.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20912963

Country of ref document: EP

Kind code of ref document: A1