Face region image reconstruction method and system based on single-frame HDR

By only HDR reconstruction of the face area in the single-frame HDR algorithm, combined with HDRUNet model, tone mapping and skin detection, the real-time and computing resource problems of the single-frame HDR algorithm in high-resolution image processing are solved, and efficient HDR image reconstruction and fusion effect is achieved.

CN119831861APending Publication Date: 2025-04-15NANJING TUJIE INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411867255.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The existing single-frame HDR algorithm cannot achieve real-time performance during high-resolution image processing, and the computing resources are consumed relatively large.

Method used

A method for image reconstruction of face area based on single-frame HDR is proposed. Through face detection and boundary expansion, only the face area is reconstructed, HDR reconstruction is performed using the HDRUNet model, and tone mapping and skin detection are performed. Finally, the HDR reconstruction image is weighted and fused with the original image.

Benefits of technology

HDR reconstruction of high-resolution images is realized under limited computing resources, meeting real-time requirements, and through skin detection and fusion optimization, ensuring the high overlap between the brightness boundary and the edge of the face.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119831861A_ABST
    Figure CN119831861A_ABST
Patent Text Reader

Abstract

The invention provides a face region image reconstruction method and system based on a single-frame HDR, and solves the problems that an existing single-frame HDR algorithm cannot process a high-resolution image in real time and is large in computing resource, and the like, and the method comprises the steps: carrying out the face detection to collect an image, carrying out the face screening through an UltraFace lightweight face detection model, and carrying out the recognition of the face region image through the UltraFace lightweight face detection model; the face frame with the largest area in each single-frame image is screened out, the coordinates of the face frame are correspondingly recorded, and boundary expansion is carried out on the face area; performing exponential weighted average and normalization processing on the current frame image and the corresponding historical frame image to obtain a more stable face frame; s2, performing HDR reconstruction on the face region in the face frame obtained in the step S2 through an HDRUNet model, and performing tone mapping and skin detection on the reconstructed image; and carrying out transparency calculation on the image after HDR reconstruction and the original image by taking a skin detection result as a mask, and carrying out weighted fusion on a calculation result and outputting the calculation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of HDR algorithm technology, and in particular to a method and system for reconstructing a face region image based on single-frame HDR. Background Art

[0002] High Dynamic Range Imaging (HDRI or HDR) is a set of technologies used in computer graphics and film photography to achieve a larger exposure dynamic range (i.e., a larger difference between light and dark) than ordinary digital imaging technology. The purpose of high dynamic range imaging is to correctly represent the brightness of a large range in the real world, from direct sunlight to the darkest shadow.

[0003] The characteristics of HDR are: large picture information content and rich light and shadow details. For example, when shooting indoors, the picture includes darker scenes indoors and very bright scenes outdoors. HDR can make both indoor and outdoor scenes appear well in the photo.

[0004] There are currently two mainstream HDR algorithms based on deep learning:

[0005] 1.Multi-frame HDR

[0006] Multi-frame HDR (also known as multi-exposure image fusion) converts a sequence of images with multiple exposure levels into a high-quality full-exposure image. Because the image information of different exposure levels is fused, the details of the highlights and shadows can be better preserved, so higher-quality HDR images can usually be produced.

[0007] 2. Single Frame HDR

[0008] Single-frame HDR only requires one frame of image to complete HDR reconstruction, which reduces processing delays and reduces the risk of motion artifacts caused by multiple frame images.

[0009] Multi-frame HDR requires capturing multiple frames of images. If there are moving objects in the scene, motion artifacts may be generated, and processing delays are increased, requiring higher computing resources for real-time processing. Although single-frame HDR has lower processing delays than multi-frame HDR, it still cannot achieve real-time processing when facing high-resolution images, and still requires higher computing resources.

[0010] In order to further reduce the processing computing resources under single-frame HDR, we propose a face area image reconstruction method and system based on single-frame HDR to solve the problem. Summary of the invention

[0011] The technical problem to be solved by the present invention is to overcome the defects of the prior art. The present invention proposes a method and system for reconstructing a face area image based on a single-frame HDR. The method and system are based on a single-frame HDR and only perform HDR reconstruction on the face area on this basis, so as to further reduce the consumption of computing resources and achieve real-time requirements in high-resolution scenarios.

[0012] In order to solve the above technical problems, the technical solution adopted by the present invention is: a face area image reconstruction method based on a single-frame HDR, comprising the following steps:

[0013] S1. Face detection: After collecting images, the UltraFace lightweight face detection model is used to screen faces to select the face frame with the largest area in each single frame image, record the coordinates of the face frame and expand the boundary of the face area;

[0014] S2, performing exponential weighted averaging and normalization processing on the current frame image and its corresponding historical frame image to obtain a more stable face frame;

[0015] S3, reconstructing the face area in the face frame obtained in S2 by using the HDRUNet model, and performing tone mapping and skin detection on the reconstructed image. In skin detection, the RGB image is first converted to the YCrCb color space, the Cr component is extracted and Gaussian filtering is performed on the Cr component, and then the Cr component is subjected to binary threshold segmentation processing to obtain the skin area, and then the obtained skin area is optimized and fused;

[0016] S4, using the skin detection result as a mask to calculate the transparency of the HDR reconstructed image and the original image, and then weightedly fusing the calculation results and outputting them.

[0017] Furthermore, in step S1, the specific calculation steps for selecting the face frame with the largest area in each single frame image are as follows:

[0018] Define the coordinates of the i-th face frame boxi = [xi0, yi0, xi1, yi1], then the area of ​​each face frame is A i =(x i 1-x i 0)×(y i 1-y i 0);

[0019] The corresponding face frame with the largest area max_face = max{Ai|i = 1, 2, ..., n}, where n is the number of face frames

[0020] The face frame index k corresponding to the largest area makes A k =max_face.

[0021] Furthermore, the specific step of expanding the boundary of the face region in step S1 is to expand the detected face region according to the ratio of 0.2 for the upper boundary, 0.5 for the lower boundary, and 0.25 for the left and right boundaries.

[0022] Furthermore, the specific calculation steps of the exponential weighted average and normalization processing in step S2 are as follows:

[0023] For each pixel point i that needs to be processed in the current frame image, traverse the corresponding pixel points in all historical frame images, calculate the Euclidean distance d between the current frame pixel point and the historical frame pixel point, and record the maximum distance max_dist. The Euclidean distance calculation formula is as follows:

[0024]

[0025] Traverse all historical frames again, use the exponential decay formula to calculate the weight of each historical frame, take the weighted average of the coordinates of the pixel point in the current frame and the coordinates of the corresponding pixel points in all historical frames, get the smoothed pixel coordinates, and then divide the smoothed pixel coordinates by sum_val to get the final smoothed coordinates.

[0026] The corresponding weight calculation formula is:

[0027] w j =e (-max_dist·(volume-j)·coeff)

[0028] The cumulative weight calculation formula is:

[0029]

[0030] Then the weighted average and normalized formula of the x-coordinate of pixel i is:

[0031]

[0032] Wherein, point is each pixel point to be processed in the current frame image, and each pixel point includes two coordinates (x, y); point[i][0] represents the x coordinate of the i-th pixel point in the current frame image, and the y coordinate can be changed from 0 to 1; Pre_point is each pixel point to be processed in the historical frame image; j represents the number of historical frames; pre_point[j][i][0] represents the x coordinate of the i-th pixel point in the j-th historical frame, and the y coordinate can be changed from 0 to 1; sum_val is used to accumulate weights; max_dist is the maximum distance between the current frame pixel and the historical frame pixel; volume is the number of historical frames; j is the index of the current historical frame; coeff is the smoothing coefficient.

[0033] Furthermore, the specific steps of tone mapping in step S3 are as follows:

[0034] Gamma correction is performed on the HDR reconstructed image. The gamma correction formula is:

[0035] I gamma =I γ

[0036] Among them, I is the pixel value of the original image, γ is the gamma value, I gamma is the pixel value after applying gamma correction;

[0037] Calculate percentiles to compress the dynamic range of the image, and normalize the image data to a reasonable range. The corresponding percentile calculation and normalization formulas are:

[0038]

[0039] Where p is the percentile, N is the number of data elements, sorted_data is the sorted data, I norm is the normalized pixel value;

[0040] The hyperbolic tangent function compresses the pixel value into the range of [-1,1] to make the image details more obvious. The corresponding hyperbolic tangent and logarithmic transformation formulas are:

[0041] I Iog =log(1+μ·tanh(I norm ))

[0042] Where μ is a constant, tanh is the hyperbolic tangent function, I log is the pixel value after logarithmic transformation;

[0043] The pixel values ​​after logarithmic transformation are scaled to the range of [0,255] and converted to a color image of 8-bit unsigned integer type. The corresponding scaling formula is:

[0044]

[0045] Among them, I log I is the pixel value after logarithmic transformation. scaled is the pixel value after scaling.

[0046] Furthermore, in step S3, the YCrCb color space conversion formula is as follows:

[0047] Y=0.299R+0.587G+0.114B

[0048] Cr=0.713(RY)+128

[0049] Cb=0.564(BY)+128

[0050] Among them, Y represents the brightness component, Cr represents the red difference component, Cb represents the blue difference component, and R, G, and B represent the values ​​of the red, green, and blue color channels in the color image.

[0051] Furthermore, the transparency in step S4 is calculated as follows:

[0052] The HDR reconstructed image uses the skin detection result as the foreground mask, and the original image uses the inverse of the skin detection result as the background mask. The transparency of the HDR reconstructed image and the original image are calculated respectively. The corresponding transparency calculation formula is as follows:

[0053] alpha=mask / 255.0

[0054] result=I*alpha

[0055] Among them, mask is the pixel value of the mask image, ranging from 0 to 255, alpha is the calculated transparency value, ranging from 0 to 1, I is the pixel value of the original image, and result is the transparency of the original image calculated based on the mask.

[0056] Furthermore, the calculation steps of the image fusion in step S4 are as follows:

[0057] The HDR reconstructed image and the original image after calculating the transparency are weighted fused, and the corresponding image fusion calculation formula is as follows:

[0058] result=w1*I1+w2*I2+beta

[0059] Among them, I1 and I2 are the pixel values ​​of the two images to be fused, w1 and w2 are weight coefficients, beta is the offset, and result is the pixel value of the fused image.

[0060] A system is constructed according to the above-mentioned single-frame HDR-based face region image reconstruction method, including:

[0061] The acquisition module has a built-in camera to detect facial images;

[0062] The preprocessing module is used to filter out the largest face frame in each single frame image and expand the boundary accordingly, and then assign different weights to the historical frame images for smoothing to reduce image jitter and make the expanded face frame more stable;

[0063] The reconstruction processing module has a built-in HDRUNet model to perform HDR reconstruction on the image output by the preprocessing module, and then perform tone mapping and skin detection on the reconstructed image;

[0064] The fusion module superimposes and fuses the HDR reconstructed image with the original image using the skin detection result as the background mask, so that the transition between the brightness of the facial area and the surrounding environment is more natural, and the brightness of the HDR reconstructed image and the brightness of the original image are simultaneously fused.

[0065] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of a method for reconstructing a face region image based on a single-frame HDR are implemented as claimed in the claim.

[0066] Compared with the prior art, the beneficial effects of the present invention include: HDR reconstruction is performed only on the face area through a single-frame HDR algorithm, which can ensure that the HDR reconstruction of the image is completed under limited computing resources, is more suitable for mobile devices and embedded systems, especially those applications that emphasize low power consumption, and is more suitable for scenes such as conference scenes where single-person face image detection is required to ensure real-time requirements, and synchronously optimizes the brightness boundary of the HDR reconstructed image and the original image using skin detection and subsequent operations, so that the brightness boundary is highly coincident with the face edge. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] The disclosure of the present invention is described with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. In the accompanying drawings, the same reference numerals are used to refer to the same components. Among them:

[0068] Figure 1 The overall flow chart of the reconstruction method proposed according to one embodiment of the present invention is schematically shown. DETAILED DESCRIPTION

[0069] It is easy to understand that according to the technical solution of the present invention, without changing the essential spirit of the present invention, a person skilled in the art can propose a variety of interchangeable structural modes and implementation modes. Therefore, the following specific implementation modes and drawings are only exemplary descriptions of the technical solution of the present invention, and should not be regarded as the whole of the present invention or as a limitation or restriction to the technical solution of the present invention.

[0070] According to one embodiment of the present invention, Figure 1 Shown.

[0071] The present invention only performs HDR reconstruction on a single face area based on a single-frame HDR algorithm. Compared with multi-frame HDR, which has a better HDR effect, the use of a single-frame HDR algorithm can have a faster reasoning speed and less resource occupation, but it still cannot achieve real-time processing when facing high-resolution images, and still requires higher computing resources. For example, in a conference scene, basically only the face area of ​​the participants will appear in the conference video, so it is only necessary to ensure that the face area of ​​the participants is clearly visible. Obviously, the single-frame HDR algorithm is more applicable.

[0072] In order to further reduce the computing resources of the processing process, in the present invention, HDR reconstruction is only performed on a single face area. The specific steps can be divided into:

[0073] Step 1: After the camera captures the image, use the UltraFace lightweight face detection model to perform face detection on the image. If a face is detected, it will determine whether there are multiple faces. If so, the face with the largest area will be selected. Since face detection only gives the face area and does not include the forehead, ears, neck and other areas, in order to make the skin area of ​​the face HDR reconstructed image and the original image fused more natural, the detected face area is expanded according to a certain ratio;

[0074] Step 2: Then, HDR reconstruction and skin detection are performed on the expanded face area. The HDR reconstruction uses the HDRUNet model with faster inference speed in the single-frame HDR algorithm. In skin detection, the RGB image is first converted to the YCrCb color space, the Cr component is extracted, and then the Cr component is subjected to binary threshold segmentation processing (Otsu method) to obtain the skin area. Then, the obtained skin area is expanded, eroded, and mean filtered to optimize the fusion effect.

[0075] Step 3. Finally, the HDR reconstructed image is superimposed and fused with the original image using the skin detection result as the background mask. In order to make the transition between the brightness of the facial area and the surrounding environment more natural, the brightness of the HDR reconstructed image and the brightness of the original image are fused again.

[0076] For step 1, after the camera captures the image, the UltraFace lightweight face detection model is used to detect the face. If a face is detected, it will determine whether there are multiple faces. If so, the face with the largest area is selected. Assuming that the coordinates of the i-th face frame boxi=[xi0,yi0,xi1,yi1], the face frame screening process is as follows:

[0077] (1) Calculate the area of ​​each face frame

[0078] A i =(x i 1-xi 0)×(y i 1-y i 0);

[0079] (2) Find the face frame with the largest area

[0080] max_face=max{Ai|i=1,2,...,n};

[0081] Where n is the number of face boxes.

[0082] (3) Find the face frame index k corresponding to the largest area, such that:

[0083] A k =max__face;

[0084] (4) Finally, record the coordinates of the face frame corresponding to the index.

[0085] Since face detection only gives the face area, excluding the forehead, ears, neck and other areas, in order to make the skin area after the face HDR reconstructed image and the original image fused more natural, the detected face area is expanded according to the ratio of 0.2 for the upper boundary, 0.5 for the lower boundary, and 0.25 for the left and right boundaries.

[0086] Since jitter may occur due to image noise or detection error during face movement, the present invention adopts the idea of ​​exponential weighted moving average (EWMA) to perform smoothing by assigning different weights to historical data (i.e., historical frame images, in this embodiment, the twenty frames before the current frame image), thereby reducing the jitter and further processing the face frame expanded in step 1 to make the expanded face frame more stable.

[0087] For the time series x t , its smoothed value s t The exponentially weighted moving average formula is as follows:

[0088] s t =αx t +(1-α)s t-1

[0089] Among them, x t is the data point at the current moment, s t is the smoothed value at the current moment, s t-1 is the smoothing value of the previous moment, α is the smoothing factor, and its value range is between 0 and 1. The larger α is, the greater the influence of the current data point is; the smaller α is, the greater the influence of historical data is.

[0090] In this embodiment, the specific implementation of smoothing is slightly different from the weighted moving average, but the core idea is similar. The following are the detailed steps and formulas:

[0091] (1) Initialization

[0092] sum_val is used to accumulate weights and is initialized to 1. max_dist is used to record the maximum distance and is initialized to 0;

[0093] (2) Calculate the maximum distance

[0094] For each pixel point i that needs to be processed in the current frame image, traverse the corresponding pixel points in all historical frame images, calculate the Euclidean distance d between the current frame pixel point and the historical frame pixel point, and record the maximum distance max_dist.

[0095] The formula for calculating the Euclidean distance between the current pixel and the historical pixel is as follows:

[0096]

[0097] (3) Weighted average and normalization

[0098] Traverse all historical frames again, use the exponential decay formula to calculate the weight of each historical frame, take the weighted average of the coordinates of the pixel point in the current frame and the coordinates of the corresponding pixel points in all historical frames to get the smoothed pixel coordinates, and then divide the smoothed pixel coordinates by sum_val to get the final smoothed coordinates.

[0099] The weight calculation formula is as follows:

[0100] ω j =e (-max_dist·(volume-j)·coeff) ;

[0101] The cumulative weight calculation formula is as follows:

[0102]

[0103] The weighted average and normalization formula of the x-coordinate of pixel i is as follows:

[0104]

[0105] Where: point is each pixel point that needs to be processed in the current frame image, and each pixel point includes two coordinates (x, y); point[i][0] represents the x coordinate of the i-th pixel point in the current frame image, and the y coordinate can be changed from 0 to 1; Pre_point is each pixel point that needs to be processed in the historical frame image; j represents the number of historical frames; pre_point[j][i][0] represents the x coordinate of the i-th pixel point in the j-th historical frame, and the y coordinate can be changed from 0 to 1; sum_val is used to accumulate weights; max_dist is the maximum distance between the current frame pixel and the historical frame pixel; volume is the number of historical frames; j is the index of the current historical frame; coeff is the smoothing coefficient.

[0106] For step 2, in this embodiment, HDR reconstruction and skin detection are performed on the expanded face area, wherein the HDR reconstruction uses the HDRUNet model with a faster inference speed in the single-frame HDR algorithm; after the model infers the HDR image, tone mapping is required to convert the high dynamic range image into a low dynamic range image suitable for display on a standard display.

[0107] The main steps and formulas for tone mapping are as follows:

[0108] (1) Gamma correction

[0109] First, gamma correction is performed on the HDR reconstructed image, which is a nonlinear operation used to adjust the brightness and contrast of the image. In this solution, the gamma value is 4.8, which will increase the brightness of the image and enhance the contrast. The gamma correction formula is as follows:

[0110] I gamma =I γ

[0111] Where I is the pixel value of the original image. γ is the gamma value, which is 4.8 by default in this solution. gamma is the pixel value after applying gamma correction;

[0112] (2) Calculate percentiles and normalize

[0113] The dynamic range of HDR images is usually very large, and direct display may cause some areas to be too bright or too dark. By calculating percentiles, the dynamic range of the image can be effectively compressed to make it more suitable for display and processing. The normalization operation normalizes the image data to a reasonable range to avoid problems in subsequent processing caused by excessive values.

[0114] The formula for calculating percentiles and normalization is as follows:

[0115]

[0116] Where p is the percentile, which is 99 in this solution. N is the number of data elements. sorted_data is the sorted data. norm is the normalized pixel value;

[0117] (3) Hyperbolic tangent and logarithmic transformation

[0118] The hyperbolic tangent function compresses the pixel values ​​into the range of [-1, 1], which can further enhance the contrast of the image. The logarithmic transformation is used to further compress the dynamic range and make the details of the image more obvious.

[0119] The hyperbolic tangent and logarithmic transformation formulas are as follows:

[0120] I log =log(1+μ·tanh(I norm ))

[0121] Where μ is a constant, which is 5000 in this solution. Tanh is the hyperbolic tangent function. log is the pixel value after logarithmic transformation;

[0122] (4) Scaling and color conversion

[0123] Finally, the pixel values ​​after logarithmic transformation are scaled to the range of [0,255] and converted to a color image of 8-bit unsigned integer type. The scaling formula is:

[0124]

[0125] Among them, I log I is the pixel value after logarithmic transformation. scaled is the pixel value after scaling.

[0126] For the skin detection process, in this embodiment, the RGB image is first converted to the YCrCb color space, the Cr component is extracted, and the Cr component is Gaussian filtered to reduce the influence of noise. Then, the Cr component is subjected to self-binarization threshold segmentation processing (Otsu method) to obtain the skin area. Then, the obtained skin area is dilated, eroded, and other operations are performed to eliminate the noise points of the skin detection. The mean filtering operation is used to blur the skin boundary to lay the foundation for the subsequent calculation of transparency.

[0127] The YCrCb color space conversion formula is as follows:

[0128] Y=0.299R+0.587G+0.114B

[0129] Cr=0.713(RY)+128

[0130] Cb=0.564(BY)+128

[0131] Among them: Y represents the brightness component, Cr represents the red difference component, Cb represents the blue difference component, and R, G, and B represent the values ​​of the red, green, and blue color channels in the color image.

[0132] As for step three, in this embodiment, the transparency of the HDR reconstructed image and the original image is calculated using the skin detection result as a mask, and the calculation results are superimposed and fused.

[0133] (1) Transparency calculation

[0134] The HDR reconstructed image uses the skin detection result as the foreground mask, and the original image uses the inverse of the skin detection result as the background mask, and the transparency of the HDR reconstructed image and the original image are calculated respectively. The transparency calculation formula is as follows:

[0135] alpha=mask / 255.0

[0136] result=I*alpha

[0137] Where mask is the pixel value of the mask image (ranging from 0 to 255). alpha is the calculated transparency value (ranging from 0 to 1). I is the pixel value of the original image. result is the transparency of the original image calculated based on the mask.

[0138] (2) Image Fusion

[0139] The HDR reconstructed image and the original image after calculating the transparency are weighted fused. The image fusion calculation formula is as follows:

[0140] result=w1*I1+w2*I2+beta

[0141] Where I1 and I2 are the pixel values ​​of the two images to be fused. w1 and w2 are weight coefficients, which are both 1.0 by default in this solution. beta is the offset, which is 0 by default in this solution. result is the pixel value of the fused image.

[0142] Similarly, a system constructed according to the above-mentioned method for reconstructing a face region image based on a single-frame HDR is also within the protection scope of the present invention. Specifically, the system may include:

[0143] The acquisition module has a built-in camera to detect facial images;

[0144] The preprocessing module is used to filter out the largest face frame in each single frame image and expand the boundary accordingly, and then assign different weights to the historical frame images for smoothing to reduce image jitter and make the expanded face frame more stable;

[0145] The reconstruction processing module has a built-in HDRUNet model to perform HDR reconstruction on the image output by the preprocessing module, and then perform tone mapping and skin detection on the reconstructed image;

[0146] The fusion module superimposes and fuses the HDR reconstructed image with the original image using the skin detection result as the background mask, so that the transition between the brightness of the facial area and the surrounding environment is more natural, and the brightness of the HDR reconstructed image and the brightness of the original image are simultaneously fused.

[0147] In addition, the above-mentioned method steps and system can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, 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 and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0148] The technical scope of the present invention is not limited to the contents in the above description. Those skilled in the art can make various deformations and modifications to the above embodiments without departing from the technical idea of ​​the present invention, and these deformations and modifications should all fall within the protection scope of the present invention.

Claims

1. A facial region image reconstruction method based on a single-frame HDR, characterized in that: The steps include: S1. Face detection: After collecting images, the UltraFace lightweight face detection model is used to screen faces to select the face frame with the largest area in each single frame image, record the coordinates of the face frame and expand the boundary of the face area; S2, performing exponential weighted averaging and normalization processing on the current frame image and its corresponding historical frame image to obtain a more stable face frame; S3, reconstructing the face area in the face frame obtained in S2 by using the HDRUNet model, and performing tone mapping and skin detection on the reconstructed image. In skin detection, the RGB image is first converted to the YCrCb color space, the Cr component is extracted and Gaussian filtering is performed on the Cr component, and then the Cr component is subjected to binary threshold segmentation processing to obtain the skin area, and then the obtained skin area is optimized and fused; S4, using the skin detection result as a mask to calculate the transparency of the HDR reconstructed image and the original image, and then weightedly fusing the calculation results and outputting them.

2. The method for reconstructing a face region image based on a single-frame HDR according to claim 1, characterized in that: In step S1, the specific calculation steps for selecting the face frame with the largest area in each single frame image are as follows: Define the coordinate box of the i-th face box i =[x i 0,y i 0,x i 1,y i 1], then the area of ​​each face frame is A i =(x i 1-x i 0)×(y i 1-y i 0); The corresponding face frame with the largest area max_face = max{Ai|i = 1, 2, ..., n}, where n is the number of face frames The face frame index k corresponding to the largest area makes A k =max_face.

3. The method for reconstructing a face region image based on a single-frame HDR according to claim 1, characterized in that: The specific steps of extending the boundary of the face area in step S1 are: The detected face area is expanded in the ratio of 0.2 for the upper boundary, 0.5 for the lower boundary, and 0.25 for the left and right boundaries.

4. The method for reconstructing a face region image based on a single-frame HDR according to claim 1, characterized in that: The specific calculation steps of the exponential weighted average and normalization processing in step S2 are as follows: For each pixel point i that needs to be processed in the current frame image, traverse the corresponding pixel points in all historical frame images, calculate the Euclidean distance d between the current frame pixel point and the historical frame pixel point, and record the maximum distance max_dist. The Euclidean distance calculation formula is as follows: Traverse all historical frames again, use the exponential decay formula to calculate the weight of each historical frame, take the weighted average of the coordinates of the pixel point in the current frame and the coordinates of the corresponding pixel points in all historical frames, get the smoothed pixel coordinates, and then divide the smoothed pixel coordinates by sum_val to get the final smoothed coordinates. The corresponding weight calculation formula is: w j =e (-max_dist·(volume-j)·coeff) The cumulative weight calculation formula is: Then the weighted average and normalized formula of the x-coordinate of pixel i is: Wherein, point is each pixel point to be processed in the current frame image, and each pixel point includes two coordinates (x, y); point[i][0] represents the x coordinate of the i-th pixel point in the current frame image, and the y coordinate can be changed from 0 to 1; Pre_point is each pixel point to be processed in the historical frame image; j represents the number of historical frames; pre_point[j][i][0] represents the x coordinate of the i-th pixel point in the j-th historical frame, and the y coordinate can be changed from 0 to 1; sum_val is used to accumulate weights; max_dist is the maximum distance between the current frame pixel and the historical frame pixel; volume is the number of historical frames; j is the index of the current historical frame; coeff is the smoothing coefficient.

5. The method for reconstructing a face region image based on a single-frame HDR according to claim 1, characterized in that: The specific steps of tone mapping in step S3 are as follows: Gamma correction is performed on the HDR reconstructed image. The gamma correction formula is: I gamma =I γ Where I is the pixel value of the original image, γ is the gamma value, and I gamma is the pixel value after applying gamma correction; Calculate percentiles to compress the dynamic range of the image, and normalize the image data to a reasonable range. The corresponding percentile calculation and normalization formulas are: Where p is the percentile, N is the number of data elements, sorted_data is the sorted data, I norm is the normalized pixel value; The hyperbolic tangent function compresses the pixel value into the range of [-1,1] to make the image details more obvious. The corresponding hyperbolic tangent and logarithmic transformation formulas are: I log =log(1+μ·tanh(I norm )) Where μ is a constant, tanh is the hyperbolic tangent function, I log is the pixel value after logarithmic transformation; The pixel values ​​after logarithmic transformation are scaled to the range of [0,255] and converted to a color image of 8-bit unsigned integer type. The corresponding scaling formula is: Among them, I log I is the pixel value after logarithmic transformation. scaled is the pixel value after scaling.

6. The method for reconstructing a face region image based on a single-frame HDR according to claim 1, characterized in that: In step S3, the YCrCb color space conversion formula is as follows: Y=0.299R+0.587G+0.114B Cr=0.713(RY)+128 Cb=0.564(BY)+128 Among them, Y represents the brightness component, Cr represents the red difference component, Cb represents the blue difference component, and R, G, and B represent the values ​​of the red, green, and blue color channels in the color image.

7. The method for reconstructing a face region image based on a single-frame HDR according to claim 1, characterized in that: The transparency in step S4 is calculated as follows: The HDR reconstructed image uses the skin detection result as the foreground mask, and the original image uses the inverse of the skin detection result as the background mask. The transparency of the HDR reconstructed image and the original image are calculated respectively. The corresponding transparency calculation formula is as follows: alpha=mask / 255.0 result=I*alpha Among them, mask is the pixel value of the mask image, ranging from 0 to 255, alpha is the calculated transparency value, ranging from 0 to 1, I is the pixel value of the original image, and result is the transparency of the original image calculated based on the mask.

8. The method for reconstructing a face region image based on a single-frame HDR according to claim 1, characterized in that: The calculation steps of the image fusion in step S4 are as follows: The HDR reconstructed image and the original image after calculating the transparency are weighted fused, and the corresponding image fusion calculation formula is as follows: result=w1*I1+w2*I2+beta Among them, I1 and I2 are the pixel values ​​of the two images to be fused, w1 and w2 are weight coefficients, beta is the offset, and result is the pixel value of the fused image.

9. A system for constructing a facial region image reconstruction method based on a single-frame HDR according to any one of claims 1 to 8, characterized in that: include: The acquisition module has a built-in camera to detect facial images; The preprocessing module is used to filter out the largest face frame in each single frame image and expand the boundary accordingly, and then assign different weights to the historical frame images for smoothing to reduce image jitter and make the expanded face frame more stable; The reconstruction processing module has a built-in HDRUNet model to perform HDR reconstruction on the image output by the preprocessing module, and then perform tone mapping and skin detection on the reconstructed image; The fusion module superimposes and fuses the HDR reconstructed image with the original image using the skin detection result as the background mask, so that the transition between the brightness of the facial area and the surrounding environment is more natural, and the brightness of the HDR reconstructed image and the brightness of the original image are simultaneously fused.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method for reconstructing a face area image based on single-frame HDR as claimed in claim 1 are implemented.