Display picture adjusting method and device based on human face, equipment and medium
By comparing the face data in the video file with the standard face data in the face database, calculating the difference coefficient and adjusting the video proportion, the picture deformation problem caused by incorrect video proportion is solved, and the correct proportion display and high-quality viewing experience are realized during video playback.
Patent Information
- Application Number
- CN202411704505.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-07
AI Technical Summary
The video uploaded by users may be incorrect in proportion due to differences in the device and shooting environment, which will lead to deformation of the video during playback, affecting the user's viewing experience.
By obtaining the target face data in the video file, using the standard face data in the face database for comparison, calculating the difference coefficient, and determining the adjustment coefficient based on the difference coefficient, adjusting the display screen of the video file to maintain the correct proportion.
It realizes the display ratio of the video screen quickly and accurately, avoids the deformation of the screen during video playback, and improves the user's viewing experience.
Smart Images

Figure CN119583847A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing technology, and in particular to a display image adjustment method, device, equipment and medium based on human face. Background Art
[0002] With the development of smart display terminals, more and more users have begun to upload videos to online video platforms and social media platforms for playback. However, the videos uploaded by users may come from different devices and shooting environments, which will lead to differences in video ratios. When the platform displays these videos, the picture will be distorted, for example, face deformation, which greatly affects the user's viewing experience.
[0003] In order to meet users' diverse playback requirements or provide better visual effects, the picture display effect can be adjusted by manually adjusting the aspect ratio of each frame. However, since a video includes a large number of frames, the workload of video processing is very large. If scripts and automated tools are used to crop or fill the video to adjust the display ratio, the correct ratio of the video display cannot be automatically determined, and cropping and filling will destroy the integrity of the original video.
[0004] Therefore, since an incorrect video ratio may cause the image to be distorted during video playback, how to quickly and accurately correct the display ratio of the video image has become an urgent problem to be solved.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] The present application provides a method, device, equipment and medium for adjusting a display screen based on a face, so as to solve the above-mentioned technical problem that "incorrect video ratio may cause screen deformation during video playback".
[0007] According to one aspect of an embodiment of the present application, the present application provides a display screen adjustment method based on face, including: obtaining a video file to be adjusted, and obtaining target face data to be adjusted from the video file, wherein the target face data includes a first face area and a first feature point data; determining a second face area matching the first face area in a face database, and extracting second feature point data corresponding to the second face area; comparing the first face area with the second face area using the first feature point data and the second feature point data to obtain a difference coefficient between the first face area and the second face area; determining an adjustment coefficient based on the difference coefficient, and adjusting the display screen of the video file according to the adjustment coefficient.
[0008] Optionally, the target face data to be adjusted is obtained from the video file, including: extracting multiple key frames from the video file, wherein each key frame contains a face area; extracting an initial face area from each key frame; clustering each initial face area, and selecting a first face area from each initial face area according to the clustering result; extracting first feature point data from the key frame where the first face area is located; and determining the first face area and the first feature point data as the target face data.
[0009] Optionally, selecting a first face region from each initial face region according to the clustering results includes: determining the number of face regions in each clustering cluster according to the clustering results; determining the clustering cluster with the largest number of face regions as the target cluster; and determining the initial face region corresponding to the target cluster as the first face region.
[0010] Optionally, determining a second face region matching the first face region in a face database includes: performing feature extraction on the first face region to obtain a first feature vector; extracting multiple second feature vectors from the face database, wherein the second feature vectors are feature vectors of the face region in the face database; performing similarity comparison between the first feature vector and each second feature vector to determine a third feature vector among each second feature vector that has the highest similarity to the first feature vector; and determining the face region corresponding to the third feature vector as the second face region.
[0011] Optionally, the first feature point data and the second feature point data are used to compare the first face area and the second face area to obtain a difference coefficient between the first face area and the second face area, including: extracting multiple first feature points from the first feature point data, and calculating a first parameter of each first feature point, wherein the first parameter includes the distance between each first feature point; extracting each second feature point from the second feature point data, and calculating a second parameter of each second feature point, wherein the second parameter includes the distance between each second feature point; calculating a parameter difference between the first parameter and the second parameter, and determining the parameter difference as the difference coefficient between the first face area and the second face area.
[0012] Optionally, determining the adjustment coefficient according to the difference coefficient includes: determining a width adjustment value according to the difference coefficient, and determining a height adjustment value according to the difference coefficient; and determining the width adjustment value and the height adjustment value as the adjustment coefficient.
[0013] Optionally, before determining in the face database a second face region that matches the first face region, the method further includes generating a face database in the following manner: obtaining frontal photos of multiple persons from a video library, and extracting face regions from the frontal photos; extracting feature points from each face region, and proofreading the extracted feature points; if the feature points pass the proofreading, marking the feature points on the face region; saving the marked face region and feature point data to generate a face database, wherein the feature point data includes marking information on the face region.
[0014] According to another aspect of an embodiment of the present application, the present application provides a display screen adjustment device based on face, including: an acquisition module, used to acquire a video file to be adjusted, and acquire target face data to be adjusted from the video file, wherein the target face data includes a first face area and first feature point data; a determination module, used to determine a second face area matching the first face area in a face database, and extract second feature point data corresponding to the second face area; a comparison module, used to compare the first face area with the second face area using the first feature point data and the second feature point data, and obtain a difference coefficient between the first face area and the second face area; an adjustment module, used to determine an adjustment coefficient based on the difference coefficient, and adjust the display screen of the video file according to the adjustment coefficient.
[0015] According to another aspect of an embodiment of the present application, the present application provides an electronic device, including a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, the memory and the processor communicate through the communication bus and the communication interface, and the steps of the above method are implemented when the processor executes the computer program.
[0016] According to another aspect of an embodiment of the present application, the present application also provides a computer-readable medium having a non-volatile program code executable by a processor, and the program code enables the processor to execute the above method.
[0017] The above technical solution provided by the embodiment of the present application has the following advantages compared with the related art:
[0018] The present application adopts a display screen adjustment method based on human face, including: obtaining a video file to be adjusted, and obtaining target human face data to be adjusted from the video file, wherein the target human face data includes a first human face area and a first feature point data; determining a second human face area matching the first human face area in a human face database, and extracting second feature point data corresponding to the second human face area; using the first feature point data and the second feature point data to compare the first human face area with the second human face area, and obtaining the difference coefficient between the first human face area and the second human face area; determining an adjustment coefficient according to the difference coefficient, and adjusting the display screen of the video file according to the adjustment coefficient. By comparing the human face in the video file to be adjusted with the standard human face in the human face database, determining the difference coefficient between the human face in the screen and the standard human face, and then determining the corresponding adjustment coefficient according to the difference coefficient, and finally adjusting the display screen of the video file according to the adjustment coefficient, the video screen will not be deformed during playback, which solves the problem that the video screen is deformed during video playback due to incorrect video ratio. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] Figure 1 A flowchart of an optional method for adjusting a display image based on a face provided according to an embodiment of the present application;
[0022] Figure 2 A block diagram of an optional display image adjustment device based on human face provided according to an embodiment of the present application;
[0023] Figure 3 A schematic diagram of an optional electronic device structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0025] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.
[0026] With the development of smart display terminals, more and more users have begun to upload videos to online video platforms and social media platforms for playback. However, the videos uploaded by users may come from different devices and shooting environments, which will lead to differences in video ratios. When the platform displays these videos, the picture will be distorted, for example, face deformation, which greatly affects the user's viewing experience.
[0027] In order to meet users' diverse playback requirements or provide better visual effects, the picture display effect can be adjusted by manually adjusting the aspect ratio of each frame. However, since a video includes a large number of frames, the workload of video processing is very large. If scripts and automated tools are used to crop or fill the video to adjust the display ratio, the correct ratio of the video display cannot be automatically determined, and cropping and filling will destroy the integrity of the original video.
[0028] Therefore, since an incorrect video ratio may cause the image to be distorted during video playback, how to quickly and accurately correct the display ratio of the video image has become an urgent problem to be solved.
[0029] In order to solve the problems mentioned in the background technology, according to one aspect of the embodiments of the present application, a display image adjustment method based on human face is provided, such as Figure 1 As shown, including:
[0030] Step 101, obtaining a video file to be adjusted, and obtaining target face data to be adjusted from the video file, wherein the target face data includes a first face region and first feature point data;
[0031] Step 103, determining a second face region matching the first face region in a face database, and extracting second feature point data corresponding to the second face region;
[0032] Step 105, comparing the first face region and the second face region using the first feature point data and the second feature point data to obtain a difference coefficient between the first face region and the second face region;
[0033] Step 107: determining an adjustment coefficient according to the difference coefficient, and adjusting the display screen of the video file according to the adjustment coefficient.
[0034] This application is used to adjust the display ratio of a video screen, especially a video screen containing a face. The specific method is to first compare the face in the video file to be adjusted with the standard face in the face database, determine the difference coefficient between the face in the screen and the standard face, then determine the corresponding adjustment coefficient based on the difference coefficient, and finally adjust the display screen of the video file according to the adjustment coefficient so that the video screen will not be deformed during playback.
[0035] Since the degree of deformation of the video screen will directly affect the degree of deformation of the display object in the video screen, this application uses the human face as the calculation object for proportional adjustment. As long as you know how to adjust the proportion of the human face, you can simultaneously apply it to the entire video screen for proportional adjustment.
[0036] To calculate the adjustment parameters used when adjusting the proportion of a face, the face in the video can be detected and then compared with the standard face in the face database to determine the adjustment parameters. The display screen of the video file is then proportionally adjusted according to the adjustment parameters so that the video file can be displayed on the display device in a normal proportion.
[0037] By using the face-based video picture adjustment method provided in the present application, the video can be adjusted to the correct display ratio before it is played, so that the video can be adapted for playback on any platform, and there is no need for manual frame-by-frame adjustment, which can save a lot of manpower.
[0038] Through accurate detection, matching and calculation of adjustment parameters of the face area, intelligent optimization of the video display ratio is achieved, which is especially suitable for video content scenes with faces as the main subject.
[0039] As an optional embodiment, target face data to be adjusted is obtained from a video file, including: extracting multiple key frames from the video file, wherein each key frame contains a face area; extracting an initial face area from each key frame; clustering each initial face area, and selecting a first face area from each initial face area according to the clustering result; extracting first feature point data from the key frame where the first face area is located; and determining the first face area and the first feature point data as target face data.
[0040] Extracting multiple key frames from a video file includes: extracting key frames at a certain time interval (for example, extracting 1 frame per second); using a face detection algorithm (such as a cascade classifier or a deep learning model based on Haar features) to filter out key frames containing at least one face area from the extracted frames.
[0041] Key frames can also be obtained by random extraction. Random extraction of frames can ensure that the extracted frames are randomly distributed in the video content, thereby increasing the diversity and representativeness of the extracted frames, helping to capture different scenes and details in the video and improving the comprehensiveness of video content extraction.
[0042] By extracting key frames for analysis, you can reduce the amount of processing while ensuring that frames with representative content in the video are included.
[0043] Extracting the initial face region from each key frame is to extract the bounding box of the face in each key frame (the smallest area where the face is located) to obtain the initial face region.
[0044] The main faces appearing in the video file (i.e., the first face area) are selected through clustering, and then the key frames where the first face area is located are found, and the first feature point data are extracted from these key frames. The first feature point data is the first feature point on the first face area, such as key points such as eyes, nose, and corners of mouth.
[0045] Through key frame extraction, cluster analysis and feature point detection, the target face data can be effectively screened out from the video file, ensuring that subsequent adjustment operations can be calculated with the first face area in the target face data as a reference.
[0046] As an optional embodiment, a first face region is selected from each initial face region according to the clustering results, including: determining the number of face regions in each clustering cluster according to the clustering results; determining the clustering cluster with the largest number of face regions as the target cluster; and determining the initial face region corresponding to the target cluster as the first face region.
[0047] After clustering the initial face regions using a clustering algorithm, multiple clusters are obtained, the face regions in each cluster are counted, and the size of each cluster (ie, the number of face regions included) is counted.
[0048] The cluster with the largest number of face regions usually represents the most common and most frequently appearing faces in the video. Therefore, the cluster with the largest number of face regions is found and identified as the target cluster. The face regions in the target cluster all belong to the same person.
[0049] As an optional embodiment, determining a second face region matching a first face region in a face database includes: performing feature extraction on the first face region to obtain a first feature vector; extracting multiple second feature vectors from the face database, wherein the second feature vectors are feature vectors of the face region in the face database; performing similarity comparison between the first feature vector and each second feature vector to determine a third feature vector having the highest similarity to the first feature vector among each second feature vector; and determining the face region corresponding to the third feature vector as the second face region.
[0050] The feature extraction model may be used to extract features from the first face region. As for how to extract feature vectors of faces, the prior art already has relatively mature technologies, which will not be elaborated in this application.
[0051] The feature vectors of the face regions may be pre-stored in the face database and directly extracted for use when needed, or the feature vectors of each face region in the face database may be extracted in the manner of extracting features from the first face region as described above.
[0052] Optionally, cosine similarity or Euclidean distance may be used to calculate the similarity between the first feature vector and the second feature vector.
[0053] A third feature vector having the highest similarity to the first feature vector is found from each second feature vector, and a face region corresponding to the third feature vector is found from a face database, and is determined as a second face region.
[0054] This application calculates similarity based on the feature vector of the face to find a matching face template from the face database. This matching based on feature vector similarity can ensure the accuracy and robustness of the match, and can effectively avoid mismatching caused by factors such as angle and lighting.
[0055] As an optional embodiment, the first feature point data and the second feature point data are used to compare the first face area and the second face area to obtain the difference coefficient between the first face area and the second face area, including: extracting multiple first feature points from the first feature point data, and calculating the first parameter of each first feature point, wherein the first parameter includes the distance between each first feature point; extracting each second feature point from the second feature point data, and calculating the second parameter of each second feature point, wherein the second parameter includes the distance between each second feature point; calculating the parameter difference between the first parameter and the second parameter, and determining the parameter difference as the difference coefficient between the first face area and the second face area.
[0056] The first feature points represent feature points identified from the first face region, including but not limited to nose, eyes, and mouth, etc. Similarly, the second feature points represent feature points detected from the second face region, including but not limited to nose, eyes, and mouth, etc.
[0057] Calculating the first parameter of each first feature point is to calculate the Euclidean distance between the two feature points, and the calculation of the second parameter is similar.
[0058] Calculating the parameter difference between the first parameter and the second parameter does not simply calculate the distance of the same feature point, but converts it into a ratio for calculation. Specifically, it includes: selecting one of the distances as the reference distance, calculating the ratio of other distances relative to the reference distance, and then using the ratio for comparison to find the difference with the ratio in the second parameter.
[0059] For example, if the distance ratio between the two eyes in the second parameter is defined as 1, the distance ratio from the left eye to the nose is defined as 1.5. The specific calculation method is: Euclidean distance from the left eye to the nose / Euclidean distance between the two eyes. Similarly, calculate the distance ratios between other feature points; then recalculate the corresponding distance ratios based on the first parameter (also define the distance ratio between the two eyes as 1), and then calculate the distance ratios of other feature points; compare the distance ratios between the same feature points to determine the differences.
[0060] Calculating the coefficient of difference using the above distance definition is actually calculating the distribution pattern of various organs on the face, finding the difference in distribution, and making corresponding adjustments, so that the distribution of the first face area can be adjusted to the distribution of the standard face (i.e., the second face area).
[0061] In addition, when calculating the difference coefficient between the first face region and the second face region, the relative positions of the feature points may also be considered, and the difference coefficient may be calculated in combination with the relative positions.
[0062] Optionally, the aspect ratios of the first face area and the second face area in the video screen may be directly compared, that is, the first parameter is the aspect ratio of the first face area, the second parameter is the aspect ratio of the second face area, and the difference coefficient may be obtained by dividing the two aspect ratios.
[0063] The present application does not limit the calculation method of the difference coefficient, that is, the difference can be determined based on the ratio of the length and width of the face, the distance ratio between the facial features, the relative position ratio of the facial features and the face, and other common facial proportion relationships. As long as the difference between the first face area and the second face area can be found, it will be sufficient.
[0064] By calculating the difference coefficient between the first face region and the second face region, the deformation degree of the first face region can be determined, and thus the parameters to be adjusted can be determined according to the deformation degree.
[0065] As an optional embodiment, determining the adjustment coefficient according to the difference coefficient includes: determining a width adjustment value according to the difference coefficient, and determining a height adjustment value according to the difference coefficient; and determining the width adjustment value and the height adjustment value as the adjustment coefficient.
[0066] When adjusting the ratio of the display screen, the width and height are mainly adjusted, so the adjustment coefficient includes a width adjustment value and a height adjustment value.
[0067] You can adjust only the height, only the width, or both the width and height.
[0068] By adjusting the coefficient to adjust the display ratio of the video image, deformation problems during display can be avoided, providing a better user viewing experience for social media and online video platforms.
[0069] After determining the adjustment parameters, it is possible to determine how to adjust the display screen ratio. At this time, geometric transformations (such as scaling, cropping, and rotation) can be applied to process the video frames to ensure that the face ratio in each frame is consistent with the standard template (i.e., the face in the face database).
[0070] In order to solve edge problems that may occur after geometric transformation, such as blank areas and uneven edges, the video file after proportional adjustment can be extended and blurred at the edges, including: copying adjacent pixels or using some interpolation algorithm to generate new pixel values; for areas with uneven edges or jagged effects, blurring technology is used to smooth these edges (for example, by applying Gaussian blur, mean blur and other algorithms).
[0071] Re-encode the processed frame sequence into a video file, ensuring that the format and quality are maintained.
[0072] In order to improve the efficient batch processing of video ratio adjustment, the present application also provides a multi-threaded approach for video processing, including: dividing the video frame into multiple parts and using multiple threads to process these parts simultaneously, which can significantly improve the processing speed, especially for long videos or high-resolution videos.
[0073] Optionally, a GPU (Graphics Processing Unit) acceleration method may be used to perform video processing, including: utilizing the parallel processing capability of the GPU to accelerate computationally intensive tasks such as geometric transformation, edge filling, and video encoding, which may further shorten processing time and improve processing efficiency.
[0074] As an optional embodiment, before determining in the face database a second face region that matches the first face region, the method also includes generating a face database in the following manner: obtaining frontal photos of multiple persons from a video library, and extracting face regions from the frontal photos; extracting feature points from each face region, and proofreading the extracted feature points; if the feature points pass the proofreading, marking the feature points on the face region; saving the marked face region and feature point data to generate a face database, wherein the feature point data includes marking information on the face region.
[0075] Extract multiple photos containing frontal high-definition faces of people from a video library or other media resources, and then extract the face areas therein.
[0076] Feature points are extracted from each facial area. Each feature point contains coordinate information, which indicates the position of the corners of the eyes, the tip of the nose, the corners of the mouth, etc. The coordinate information will also be used in the subsequent calculation of the distance of the feature points.
[0077] The purpose of proofreading is to ensure that the distribution of key feature points is consistent with the normal face structure (such as the distance between the two eyes, the relative position of the nose and the mouth). The extracted feature points can be proofread manually or by calling a proofreading tool.
[0078] This application pre-generates a face database containing face regions and feature point annotations, which provides data support for subsequent feature matching and similarity calculations.
[0079] The present application adopts a display screen adjustment method based on human face, including: obtaining a video file to be adjusted, and obtaining target human face data to be adjusted from the video file, wherein the target human face data includes a first human face area and a first feature point data; determining a second human face area matching the first human face area in a human face database, and extracting second feature point data corresponding to the second human face area; using the first feature point data and the second feature point data to compare the first human face area with the second human face area, and obtaining the difference coefficient between the first human face area and the second human face area; determining an adjustment coefficient according to the difference coefficient, and adjusting the display screen of the video file according to the adjustment coefficient. By comparing the human face in the video file to be adjusted with the standard human face in the human face database, determining the difference coefficient between the human face in the screen and the standard human face, and then determining the corresponding adjustment coefficient according to the difference coefficient, and finally adjusting the display screen of the video file according to the adjustment coefficient, the video screen will not be deformed during playback, which solves the problem that the video screen is deformed during video playback due to incorrect video ratio.
[0080] According to another aspect of the embodiment of the present application, the present application provides a display image adjustment device based on human face, such as Figure 2 As shown, including:
[0081] An acquisition module 202 is used to acquire a video file to be adjusted, and acquire target face data to be adjusted from the video file, wherein the target face data includes a first face region and first feature point data;
[0082] A determination module 204, configured to determine a second face region matching the first face region in a face database, and extract second feature point data corresponding to the second face region;
[0083] A comparison module 206, configured to compare the first face region with the second face region using the first feature point data and the second feature point data to obtain a difference coefficient between the first face region and the second face region;
[0084] The adjustment module 208 is used to determine an adjustment coefficient according to the difference coefficient, and adjust the display screen of the video file according to the adjustment coefficient.
[0085] It should be noted that the acquisition module 202 in this embodiment can be used to execute step 101 in the embodiment of the present application, the determination module 204 in this embodiment can be used to execute step 103 in the embodiment of the present application, the comparison module 206 in this embodiment can be used to execute step 105 in the embodiment of the present application, and the adjustment module 208 in this embodiment can be used to execute step 107 in the embodiment of the present application.
[0086] Optionally, the acquisition module 202 includes:
[0087] A first extraction submodule is used to extract multiple key frames from the video file, wherein each key frame contains a face area;
[0088] The second extraction submodule is used to extract the initial face area from each key frame;
[0089] A clustering submodule, used to cluster the initial face regions and select a first face region from the initial face regions according to the clustering result;
[0090] A third extraction submodule is used to extract first feature point data from the key frame where the first face area is located;
[0091] The determination submodule is used to determine the first face area and the first feature point data as target face data.
[0092] Optionally, the clustering submodule is further used to determine the number of face regions in each cluster according to the clustering results; determine the cluster with the largest number of face regions as the target cluster; and determine the initial face region corresponding to the target cluster as the first face region.
[0093] Optionally, the determination module 204 is also used to extract features from the first face area to obtain a first feature vector; extract multiple second feature vectors from the face database, wherein the second feature vector is a feature vector of the face area in the face database; compare the first feature vector with each second feature vector in similarity to determine a third feature vector with the highest similarity to the first feature vector among each second feature vector; and determine the face area corresponding to the third feature vector as the second face area.
[0094] Optionally, the comparison module 206 is also used to extract multiple first feature points from the first feature point data, and calculate the first parameter of each first feature point, wherein the first parameter includes the distance between each first feature point; extract each second feature point from the second feature point data, and calculate the second parameter of each second feature point, wherein the second parameter includes the distance between each second feature point; calculate the parameter difference between the first parameter and the second parameter, and determine the parameter difference as the difference coefficient between the first face area and the second face area.
[0095] Optionally, the adjustment module 208 is further configured to determine a width adjustment value according to the difference coefficient, and determine a height adjustment value according to the difference coefficient; and determine the width adjustment value and the height adjustment value as the adjustment coefficient.
[0096] Optionally, the device also includes a generation module, which is used to generate a face database in the following manner before determining a second face area matching the first face area in the face database: obtaining frontal photos of multiple persons from a video library, and extracting face areas from the frontal photos; extracting feature points from each face area, and proofreading the extracted feature points; if the feature points pass the proofreading, marking the feature points on the face area; saving the marked face area and feature point data to generate a face database, wherein the feature point data includes marking information on the face area.
[0097] It should be noted here that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments.
[0098] According to another aspect of the embodiments of the present application, the present application provides an electronic device, such as Figure 3 As shown, it includes a memory 301, a processor 303, a communication interface 305 and a communication bus 307. The memory 301 stores a computer program that can be run on the processor 303. The memory 301 and the processor 303 communicate through the communication interface 305 and the communication bus 307. When the processor 303 executes the computer program, the steps of the above method are implemented.
[0099] The memory and processor in the above electronic device communicate via a communication bus and a communication interface. The communication bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc.
[0100] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0101] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0102] According to another aspect of the embodiments of the present application, a computer-readable medium having a non-volatile program code executable by a processor is provided.
[0103] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0104] When the embodiments of the present application are specifically implemented, reference may be made to the above-mentioned embodiments, which have corresponding technical effects.
[0105] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof.
[0106] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0107] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0108] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0109] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0110] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0111] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0112] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk. It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.
[0113] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A display image adjustment method based on human face, characterized in that: include: Acquire a video file to be adjusted, and acquire target face data to be adjusted from the video file, wherein the target face data includes a first face region and first feature point data; Determine in a face database a second face region that matches the first face region, and extract second feature point data corresponding to the second face region; Comparing the first face region with the second face region using the first feature point data and the second feature point data to obtain a difference coefficient between the first face region and the second face region; An adjustment coefficient is determined according to the difference coefficient, and a display screen of the video file is adjusted according to the adjustment coefficient.
2. The method according to claim 1, characterized in that The step of obtaining the target face data to be adjusted from the video file includes: Extracting a plurality of key frames from the video file, wherein each of the key frames contains a face region; Extracting an initial face region from each of the key frames; Clustering the initial face regions, and selecting the first face region from the initial face regions according to the clustering result; Extracting the first feature point data from the key frame where the first face area is located; The first face area and the first feature point data are determined as the target face data.
3. The method according to claim 2, characterized in that The step of selecting the first face region from each of the initial face regions according to the clustering result includes: Determining the number of face regions in each cluster according to the clustering results; Determine the cluster with the largest number of face regions as the target cluster; The initial face region corresponding to the target cluster is determined as the first face region.
4. The method according to claim 1, characterized in that The determining, in a face database, a second face region matching the first face region comprises: Extracting features from the first face region to obtain a first feature vector; Extracting a plurality of second feature vectors from the face database, wherein the second feature vectors are feature vectors of face regions in the face database; Comparing the first feature vector with each of the second feature vectors for similarity, so as to determine a third feature vector having the highest similarity to the first feature vector among the second feature vectors; The face region corresponding to the third feature vector is determined as the second face region.
5. The method according to claim 1, characterized in that The comparing the first face region and the second face region by using the first feature point data and the second feature point data to obtain a difference coefficient between the first face region and the second face region includes: Extracting a plurality of first feature points from the first feature point data, and calculating a first parameter of each of the first feature points, wherein the first parameter includes a distance between each of the first feature points; Extracting each second feature point from the second feature point data, and calculating a second parameter of each second feature point, wherein the second parameter includes a distance between each second feature point; A parameter difference between the first parameter and the second parameter is calculated, and the parameter difference is determined as the difference coefficient between the first face area and the second face area.
6. The method according to claim 1, characterized in that The determining the adjustment coefficient according to the difference coefficient includes: determining a width adjustment value according to the difference coefficient, and determining a height adjustment value according to the difference coefficient; The width adjustment value and the height adjustment value are determined as the adjustment coefficient.
7. The method according to claim 1, characterized in that Before determining in a face database a second face region matching the first face region, the method further comprises generating the face database in the following manner: Obtaining front-facing photos of multiple persons from a video library, and extracting face regions from the front-facing photos; Extracting feature points from each of the face regions, and proofreading the extracted feature points; If the feature points pass the verification, marking the feature points on the face area; The marked face area and feature point data are saved to generate the face database, wherein the feature point data includes the marking information on the face area.
8. A display image adjustment device based on human face, characterized in that: include: An acquisition module, used to acquire a video file to be adjusted, and acquire target face data to be adjusted from the video file, wherein the target face data includes a first face area and first feature point data; a determination module, configured to determine in a face database a second face region that matches the first face region, and extract second feature point data corresponding to the second face region; a comparison module, configured to compare the first face region with the second face region by using the first feature point data and the second feature point data, and obtain a difference coefficient between the first face region and the second face region; The adjustment module is used to determine an adjustment coefficient according to the difference coefficient, and adjust the display screen of the video file according to the adjustment coefficient.
9. An electronic device, comprising a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, and the memory and the processor communicate through the communication bus and the communication interface, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer readable medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the method according to any one of claims 1 to 7.