Search

CN-115905748-B - Face centering display method and device, electronic equipment and computer storage medium

CN115905748BCN 115905748 BCN115905748 BCN 115905748BCN-115905748-B

Abstract

The application provides a face centering display method, a face centering display device, electronic equipment and a computer storage medium, wherein the method comprises the steps of obtaining parameters of a target picture; the method comprises the steps of determining a default centering display rectangular parameter according to the parameters of a target picture, then carrying out face recognition on a person image in the target picture to obtain a face rectangular array, determining a face center point coordinate according to the face rectangular array, determining a face rectangular parameter according to the face center point coordinate, the center point coordinate of the target picture and the default centering display rectangular parameter, and finally completing face centering display according to a predetermined display area, the parameters of the target picture and the face rectangular parameter. Therefore, the problem of centered display of the picture faces of the social platform is solved, and bad user experience such as slow network loading and loading failure caused by secondary request interaction of clicking pictures to view original pictures is avoided.

Inventors

  • ZHANG ZHIGUANG

Assignees

  • 湖南快乐阳光互动娱乐传媒有限公司

Dates

Publication Date
20260508
Application Date
20221108

Claims (8)

  1. 1. The face centering display method is characterized by comprising the following steps of: acquiring parameters of a target picture, wherein the parameters of the target picture comprise the height and the width of the target picture; determining default centered display rectangular parameters according to the parameters of the target picture, wherein the default centered display rectangular parameters are used for performing default centered clipping when no face exists in the target picture; carrying out face recognition on the portrait in the target picture to obtain a face rectangle array, wherein the face rectangle array consists of a left upper corner ordinate, a left upper corner abscissa, a face frame width and a face frame height of a face frame; according to the face rectangle array, determining the coordinates of a face center point; comparing the face center point coordinate with the center point coordinate of the target picture to determine the azimuth of the face center point coordinate in the target picture; according to the azimuth of the face center point coordinate in the target picture, calculating to obtain a face rectangle parameter by utilizing the face center point coordinate, the parameter of the target picture and a default centering display rectangle parameter; paving a predetermined display area according to the aspect ratio of the target picture; Determining a rectangle proportion according to the face rectangle parameters and the parameters of the target picture; and moving the picture to a predetermined display area according to the rectangle proportion to finish the face centering display, wherein the predetermined display area is selected by a user.
  2. 2. The face centering display method according to claim 1, wherein the determining a default centering display rectangle parameter according to the parameter of the target picture includes: Taking the minimum value of the height and the width of the target picture as a target side length; and determining default centered display rectangular parameters according to the height and width of the target picture and the target side length.
  3. 3. The face centering display method according to claim 1, wherein if the number of elements of the face rectangular array is greater than 0, the determining the face center point coordinates according to the face rectangular array includes: Summing the vertical coordinate of the upper left corner of the face frame and half of the width of the face frame, and dividing the sum by the number of elements of the face rectangular array to obtain the vertical coordinate of the face center point; summing the left upper corner abscissa of the face frame and half of the height of the face frame, and dividing the sum by the number of elements of the face rectangular array to obtain the face center point abscissa.
  4. 4. The face centering display method of claim 1, wherein the upper left corner ordinate, upper left corner abscissa, face frame width and face frame height are positive integers and are separated by commas.
  5. 5. A face centered display device, comprising: The device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring parameters of a target picture, and the parameters of the target picture comprise the height and the width of the target picture; the first determining unit is used for determining default centering display rectangular parameters according to the parameters of the target picture, wherein the default centering display rectangular parameters are used for performing default centering cutting when no face exists in the target picture; The face recognition unit is used for recognizing the human image in the target picture to obtain a face rectangular array, wherein the face rectangular array consists of an upper left corner ordinate, an upper left corner abscissa, a face frame width and a face frame height of a face frame, and the upper left corner ordinate, the upper left corner abscissa, the face frame width and the face frame height of the face frame are all positive integers and are separated by commas; the second determining unit is used for determining the coordinates of the central point of the face according to the face rectangular array; The third determining unit is used for comparing the coordinates of the central point of the human face with the coordinates of the central point of the target picture to determine the azimuth of the coordinates of the central point of the human face in the target picture; according to the azimuth of the face center point coordinate in the target picture, calculating to obtain a face rectangle parameter by utilizing the face center point coordinate, the parameter of the target picture and a default centering display rectangle parameter; the device comprises a centering display unit, a rectangle proportion determining unit, a picture moving unit and a face centering display unit, wherein the centering display unit is used for paving a predetermined display area according to the aspect ratio of a target picture, the rectangle proportion determining unit is used for determining the rectangle proportion according to the rectangle parameter of the face and the parameter of the target picture, the picture is moved to the predetermined display area according to the rectangle proportion to finish the face centering display, and the predetermined display area is selected by a user.
  6. 6. The face centering display device of claim 5, wherein the first determination unit comprises: a side length determining unit, configured to take a minimum value of the height and the width of the target picture as a target side length; and the first determining subunit is used for determining default centered display rectangular parameters according to the height and the width of the target picture and the target side length.
  7. 7. An electronic device, comprising: One or more processors; A storage device having one or more programs stored thereon; The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the face centered display method of any of claims 1-4.
  8. 8. A computer storage medium having a computer program stored thereon, wherein the computer program when executed by a processor implements the face centering display method of any one of claims 1 to 4.

Description

Face centering display method and device, electronic equipment and computer storage medium Technical Field The present application relates to the field of computer technologies, and in particular, to a face centering display method and apparatus, an electronic device, and a computer storage medium. Background With the development of the internet, more and more users like to share and express information such as dynamic information, comments and blogs through a social platform. Social platforms often design templates with relatively uniform page styles to present content for the convenience of users to browse and click on the content of interest. At present, in the related art, aiming at the processing of the picture, centering clipping processing is often adopted, if the main body of the picture is a human face, the human face is not always centered due to the diversity of shooting modes and skills, and therefore the human face is incomplete, and the attractiveness is very affected. Disclosure of Invention In view of the above, the application provides a face centering display method, a device, an electronic device and a computer storage medium, which solve the problem of centering display of a social platform picture face and avoid bad user experience such as slow network loading, loading failure and the like caused by secondary request interaction of clicking a picture to view an original picture. The first aspect of the present application provides a face centering display method, including: acquiring parameters of a target picture, wherein the parameters of the target picture comprise the height and the width of the target picture; determining default centered display rectangle parameters according to the parameters of the target picture; carrying out face recognition on the portrait in the target picture to obtain a face rectangle array, wherein the face rectangle array consists of a left upper corner ordinate, a left upper corner abscissa, a face frame width and a face frame height of a face frame; according to the face rectangle array, determining the coordinates of a face center point; determining a face rectangle parameter according to the face center point coordinates, the center point coordinates of the target picture and a default center display rectangle parameter; And finishing the face centering display according to the predetermined display area, the parameters of the target picture and the face rectangle parameters. Optionally, the determining a default centered display rectangle parameter according to the parameter of the target picture includes: Taking the minimum value of the height and the width of the target picture as a target side length; and determining default centered display rectangular parameters according to the height and width of the target picture and the target side length. Optionally, if the number of elements of the face rectangle array is greater than 0, determining the coordinates of the face center point according to the face rectangle array includes: Summing the vertical coordinate of the upper left corner of the face frame and half of the width of the face frame, and dividing the sum by the number of elements of the face rectangular array to obtain the vertical coordinate of the face center point; summing the left upper corner abscissa of the face frame and half of the height of the face frame, and dividing the sum by the number of elements of the face rectangular array to obtain the face center point abscissa. Optionally, the determining the face rectangle parameter according to the face center point coordinate, the center point coordinate of the target picture and the default center display rectangle parameter includes: comparing the face center point coordinate with the center point coordinate of the target picture to determine the azimuth of the face center point coordinate in the target picture; And calculating to obtain the rectangular parameters of the human face by utilizing the coordinates of the central point of the human face, the parameters of the target picture and the default centered display rectangular parameters according to the coordinates of the central point of the human face in the azimuth of the target picture. Optionally, the finishing the face centering display according to the predetermined display area, the parameter of the target picture and the face rectangle parameter includes: filling the predetermined display area according to the aspect ratio of the target picture; Determining a rectangle proportion according to the face rectangle parameters and the parameters of the target picture; And moving the picture to the predetermined display area according to the rectangle proportion, and finishing the face centering display. Optionally, the upper left corner ordinate, the upper left corner abscissa, the face frame width and the face frame height of the face frame are positive integers and are separated by commas. The second aspect of the pres