Image fusion method, device and computer equipment
By determining and replacing the motion changing areas between images in dynamic scenes in HDR image generation, combined with weight and brightness adjustments, the problem of low HDR image quality in dynamic scenes is solved and clearer image generation is achieved.
Patent Information
- Application Number
- CN202010771465.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-04
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-08-04
AI Technical Summary
In traditional HDR image generation methods, there are moving objects in multi-frame images due to object movement in dynamic scenes, resulting in transparent or blurry "ghosts" in the generated HDR images, seriously affecting image quality.
By acquiring multiple initial frame images with different exposures and alignment, determine the motion change area between the reference frame image and the non-reference frame image, replace it as a replacement block, and fuse the replaced images, using The weight generation function and brightness mapping function adjust pixel values to remove "ghosts" caused by movement changes of moving objects.
It effectively improves the quality of the generated HDR images, removes the blur problems caused by dynamically moving objects, and makes the generated images clearer and richer.
Smart Images

Figure CN112132769B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an image fusion method, device and computer equipment. Background Art
[0002] High-Dynamic Range (HDR) imaging technology can expand the dynamic range of images, so that the acquired images can contain detailed information of both bright and dark areas in the scene, making the images clearer and more informative, greatly improving the image quality. Due to the excellent characteristics of HDR images, which have great scientific research and commercial application value, they have become a hot research direction in many fields such as image processing, computer graphics, and photography, and have promoted the widespread application of this technology in various fields such as digital photography, biomedicine, film and television production, electronic products, game special effects, and remote sensing detection.
[0003] In the traditional way, low dynamic range (LDR) images with different exposures are captured, and then the best parts of the scene information in multiple frames are synthesized together according to different weight fusion algorithms to obtain an HDR image with rich details and clear colors in the bright and dark parts of the scene.
[0004] However, the above method can only be applied to multi-frame LDR images taken in static scenes. In dynamic scenes, due to the presence of moving objects such as people and vehicles in the scene, the acquired multi-frame images contain moving objects, which will cause the obtained HDR image to appear transparent or blurred, i.e. "ghosting", which seriously affects the image quality of the generated HDR image. Summary of the invention
[0005] Based on this, it is necessary to provide an image generation method, apparatus, computer device and storage medium that can improve the image quality of generated images in response to the above technical problems.
[0006] An image fusion method, the method comprising:
[0007] Acquire multiple frames of initial frame images with different exposures and after alignment and registration;
[0008] Determine a reference frame image from a plurality of initial frame images with different exposures;
[0009] Determine, according to the reference frame image and each non-reference frame image in the plurality of initial frame images with different exposures, each motion change region of the reference frame image relative to each non-reference frame image;
[0010] Using each motion change area as a replacement block to replace the corresponding block area in each non-reference frame image, so as to obtain each frame image after replacement;
[0011] The replaced multiple frame images are fused to obtain a fused image.
[0012] In one embodiment, fusing the replaced multiple frame images to obtain a fused image includes:
[0013] Based on the grayscale value of each pixel in each frame image after replacement, the weight value of each pixel in each frame image is calculated according to the weight generation function;
[0014] According to the weight value and gray value of each pixel in each frame image, the replaced multiple frame images are fused to obtain a fused image.
[0015] In one embodiment, each initial frame image includes a plurality of moving objects;
[0016] Determining a reference frame image from a plurality of initial frame images with different exposures includes:
[0017] Determine the brightness level of each moving object in each initial frame image, and select the initial frame image with an exposure within a threshold range as the reference frame image corresponding to each moving object according to each brightness level;
[0018] Determining, according to the reference frame image and each non-reference frame image in a plurality of initial frame images with different exposures, each motion change region of the reference frame image relative to each non-reference frame image, including:
[0019] Determine, according to the reference frame images and the non-reference frame images corresponding to the moving objects, the moving change regions of the moving objects in the reference frame images relative to the non-reference frame images;
[0020] Each motion change area is used as a replacement block to replace the corresponding block area in each non-reference frame image, and each frame image after replacement is obtained, including:
[0021] According to each motion change area of each moving object in the reference frame image relative to each non-reference frame image as the replacement block of the corresponding non-reference frame image, the block area corresponding to each moving object in each non-reference frame image is replaced to obtain each frame image after replacement.
[0022] In one embodiment, after obtaining each frame image after replacement, the method further includes:
[0023] Determine a first brightness level in each frame of the image according to the grayscale value of each pixel of the replacement block in each frame of the image;
[0024] Determine the second brightness level corresponding to each frame image according to the grayscale value of each pixel of the non-replacement block in each frame image, or determine the second brightness level corresponding to each frame image according to the pixel value of each pixel of the replaced block in each non-reference frame image, and the replaced block is the area replaced by the replacement block in the non-reference frame image;
[0025] Determine a brightness mapping function corresponding to each frame of image according to a first brightness level and a second brightness level corresponding to each frame of image;
[0026] The grayscale value of each pixel of the replacement block in each frame image is adjusted according to the brightness mapping function corresponding to each frame image to obtain each frame image after adjustment.
[0027] In one embodiment, determining each second brightness level corresponding to the non-replacement block in each frame image according to the gray value of each pixel of the non-replacement block in each frame image includes:
[0028] According to the grayscale value of each pixel of the non-replacement block within the preset range of the edge of the replacement block in each frame image, each second brightness level corresponding to the non-replacement block in each frame image is determined.
[0029] In one embodiment, determining each first brightness level of the replacement block in each frame image according to the gray value of each pixel of the replacement block in each frame image includes:
[0030] Determine the object area brightness level of the moving object area in the replacement image block corresponding to each frame image according to the gray value of each pixel point of the moving object in the replacement image block of each frame image;
[0031] Determine the brightness level of the non-object area of the non-moving object in the replacement block of each frame image according to the gray value of each pixel point in the non-moving object area in the replacement block of each frame image;
[0032] The brightness level of the object area and the brightness level of the non-object area are used as the first brightness level of the replacement block in the frame image.
[0033] In one embodiment, determining a brightness mapping function corresponding to each frame of image according to a first brightness level and a second brightness level corresponding to each frame of image includes:
[0034] Determine, according to the second brightness level corresponding to each frame image, a first brightness mapping function of the moving object area and a second brightness mapping function of the non-moving object area in the corresponding replacement block;
[0035] The grayscale value of each pixel of the replacement block in each frame image is adjusted according to the brightness mapping function corresponding to each frame image to obtain each adjusted frame image, including:
[0036] The grayscale values of each pixel in the moving object area of the replacement block are adjusted according to the first brightness mapping function, and the grayscale values of each pixel in the non-moving object area of the replacement block are adjusted according to the second brightness mapping function to obtain adjusted frame images.
[0037] In one embodiment, determining each motion change region of the reference frame image relative to each non-reference frame image according to the reference frame image and each non-reference frame image in a plurality of initial frame images with different exposures includes:
[0038] The reference frame image and each non-reference frame image are respectively formed into image pairs;
[0039] Each image pair is input into a pre-trained motion change region detection model to obtain each motion change region of the reference frame image relative to each non-reference frame image.
[0040] In one embodiment, the motion change region detection model is a trained deep neural network model, and the motion change region detection model includes a motion change region feature extraction encoding network and a motion change region decoding and reconstruction network;
[0041] Each image pair is input into a pre-trained motion change region detection model to obtain the motion change regions of the reference frame image relative to each non-reference frame image, including:
[0042] The image pair is input into the motion change region feature extraction and encoding network, and after multiple downsampling convolution, pooling, and activation operations, an initial feature map set corresponding to the reference frame image and the non-reference frame image is obtained;
[0043] Perform association fusion on the initial feature map set to obtain a fused feature map;
[0044] Perform feature extraction and encoding on the fused feature map to obtain the final feature encoding;
[0045] The final feature code is input into the motion change region decoding and reconstruction network, and the motion change region is reconstructed through multiple upsampling operations to obtain the motion change regions of the moving object in the non-reference frame image relative to the reference frame image.
[0046] In one embodiment, obtaining a set of initial feature maps corresponding to a reference frame image and a non-reference frame image respectively includes:
[0047] Obtaining a first initial feature map corresponding to the reference frame image and a second initial feature map corresponding to the non-reference frame image;
[0048] The initial feature map set is associated and fused to obtain a fused feature map, including:
[0049] Based on a window of a preset size, determining a first feature region corresponding to the window from a first initial feature map, and determining a second feature region corresponding to the first feature region from a second initial feature map;
[0050] Performing cross-correlation feature fusion calculation on the first feature region and the second feature region to obtain a fusion feature;
[0051] According to a window of a preset size, the first initial feature map and the second initial feature map are traversed to obtain a fused feature map corresponding to the reference frame image and the non-reference frame image.
[0052] In one embodiment, determining a second feature region corresponding to the first feature region from the second initial feature map includes:
[0053] Determine a second feature region corresponding to a key coordinate position of the first feature region from the second initial feature map, wherein the size of the second feature region is larger than that of the first feature region;
[0054] The first feature region and the second feature region are subjected to cross-correlation feature fusion calculation to obtain fusion features, including:
[0055] A third feature region is selected from the second feature region through a window having the same size as the first feature region, and a cross-correlation feature fusion calculation is performed on the third feature region and the first feature region to obtain a fusion feature.
[0056] An image fusion device, comprising:
[0057] An initial frame image acquisition module is used to acquire multiple frames of initial frame images with different exposures and after alignment and registration;
[0058] A reference frame image determination module, used to determine a reference frame image from a plurality of initial frame images with different exposure levels;
[0059] A motion change region determination module, used to determine the motion change regions of the reference frame image relative to the non-reference frame images based on the reference frame image and the non-reference frame images in the multiple frames of initial frame images with different exposures;
[0060] A replacement module, used to use each motion change area as a replacement block to replace the corresponding block area in each non-reference frame image to obtain each frame image after replacement;
[0061] The fusion module is used to fuse the replaced multiple frame images to obtain a fused image.
[0062] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0063] The above-mentioned image generation method, device, computer equipment and storage medium obtain multiple frames of initial frame images with different exposures and after alignment and registration; determine the reference frame image from the multiple frames of initial frame images with different exposures; determine the motion change areas of the reference frame image relative to each non-reference frame image according to the reference frame image and each non-reference frame image in the multiple frames of initial frame images with different exposures; use each motion change area as a replacement block to replace the corresponding block area in each non-reference frame image to obtain each replaced frame image; fuse the replaced multiple frame images to obtain a fused image. Therefore, according to the motion change areas of the moving object in the reference frame image relative to each non-reference frame image, the corresponding block area in each non-reference frame image can be replaced to obtain each replaced frame image and fuse them, so that the "ghost" caused by the movement and change of the dynamically moving moving object in different frame images can be removed, thereby improving the image quality of the generated fused image. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 is a schematic diagram of a flow chart of an image fusion method in one embodiment;
[0065] Figure 2 is a schematic diagram of multiple initial frame images in one embodiment;
[0066] Figure 3 is a schematic diagram of multiple frame images in one embodiment;
[0067] Figure 4 is a graph of a triangular weight function and a Gaussian weight function in one embodiment;
[0068] Figure 5 is a structural diagram of a motion change region detection model in one embodiment;
[0069] Figure 6 is a structural diagram of a motion change region detection model in another embodiment;
[0070] Figure 7 is a schematic diagram of initial feature map fusion in one embodiment;
[0071] Figure 8 is a structural block diagram of an image fusion device in one embodiment;
[0072] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0073] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0074] The image fusion method provided in the present application can be applied to an image processing device. Among them, the image processing device has image acquisition and image fusion processing functions. Specifically, the image processing device acquires multiple frames of initial frame images with different exposures, and the multiple frames of initial frame images with different exposures have been aligned and registered. Then, the image processing device can determine the reference frame image from the multiple frames of initial frame images with different exposures, and then determine the motion change areas of the reference frame image relative to the non-reference frame images based on the reference frame image and the multiple frames of initial frame images with different exposures. Further, the image processing device can use each motion change area as a replacement block to replace the corresponding block area in each non-reference frame image to obtain each replaced frame image, and fuse the replaced multiple frame images to obtain a fused image. Among them, the image processing device can be, but is not limited to, various cameras, video cameras, video recorders and other devices with image acquisition functions and image processing functions, or it can also be a small server or a server cluster.
[0075] In one embodiment, Figure 1 As shown, an image fusion method is provided, and the method is applied to an image processing device, comprising the following steps:
[0076] Step S102, obtaining a plurality of aligned and registered initial frame images with different exposure levels.
[0077] The initial frame image refers to an initial image collected by an image processing device, which may be a low dynamic range (LDR) image. Each initial frame image may include a moving object, such as a moving person or object.
[0078] In this embodiment, after acquiring multiple frames of initial frame images, the image processing device may perform alignment and registration on the acquired multiple frames of images.
[0079] Specifically, the image processing device randomly selects an initial frame image from multiple initial frame images as the target image, and randomly selects a preset number of discrete pixel points in the target image. Further, the image processing device determines the pixel points that match the discrete pixel points from other initial frame images according to the pixel values of the discrete pixel points, and moves the pixel points of other initial frame images as a whole according to the relevant set constraints, so that most of the pixel points in the multiple initial frame images are aligned and registered.
[0080] Step S104, determining a reference frame image from a plurality of initial frame images with different exposure levels.
[0081] The reference frame image refers to an initial frame image used for reference comparison.
[0082] As mentioned above, among the multiple initial frame images, the exposure of each initial frame image is different, and the brightness levels of the obtained multiple initial frame images are different. The image processing device can determine the reference frame image from the multiple initial frame images according to the brightness level of each initial frame image, and perform subsequent processing.
[0083] Step S106 , determining each motion change region of the reference frame image relative to each non-reference frame image according to the reference frame image and each non-reference frame image in the plurality of initial frame images with different exposures.
[0084] The motion change area refers to the motion area of the moving object in the reference frame image compared with the non-reference frame image. Figure 2 , F2 is a reference frame image, F1 and F3 are non-reference frame images, the area composed of area 201 and area 202 is a motion change area of the reference frame image F2 relative to the non-reference frame image F1, and area 203 and area 202 are motion change areas of the reference frame image F2 relative to the non-reference frame image F3.
[0085] In this embodiment, the image processing device can determine each motion change area of the reference frame image relative to each non-reference frame image by comparing and determining each non-reference frame image with the reference frame image.
[0086] In this embodiment, the image processing device can determine the motion change areas of the reference frame image relative to the non-reference frame images simultaneously and in parallel, that is, the image processing device can determine the motion change areas of F1 relative to F2 and F3 simultaneously and in parallel.
[0087] Step S108 : using each motion change region as a replacement block to replace the corresponding block region in each non-reference frame image, so as to obtain each frame image after replacement.
[0088] In this embodiment, after the image processing device determines each motion change area of the reference frame image relative to each non-reference frame image, it can use each motion change area as a replacement block to replace the corresponding block area in the non-reference image that determines each motion change area, so as to obtain a replaced frame image.
[0089] Continuing with the previous example, if the region composed of region 201 and region 202 is the motion change region of reference image F2 relative to non-reference image F1, then the region composed of region 201 and region 202 is used as the replacement block to replace the corresponding block region in non-reference image F1. Similarly, if the region composed of region 203 and region 202 is the motion change region of reference image F2 relative to non-reference image F3, then the region composed of region 203 and region 202 is used as the replacement block to replace the corresponding block region in non-reference image F3 to obtain each frame image after replacement, as shown in FIG. Figure 3 shown.
[0090] Step S110, fusing the replaced multiple frame images to obtain a fused image.
[0091] Specifically, after replacing the corresponding block areas in each non-reference frame image based on each replacement block, the image processing device can fuse the multiple frame images corresponding to the multiple initial frame images based on the grayscale value of each pixel point in each frame image obtained after the replacement to obtain a fused image. That is, the replaced multiple LDR image frames are fused to generate an HDR image with rich details in bright and dark parts and clear colors.
[0092] In the above-mentioned image fusion method, multiple frames of initial frame images with different exposures and after alignment and registration are obtained; a reference frame image is determined from the multiple frames of initial frame images with different exposures; the motion change regions of the reference frame image relative to each non-reference frame image are determined according to the reference frame image and each non-reference frame image in the multiple frames of initial frame images with different exposures; each motion change region is used as a replacement block to replace the corresponding block region in each non-reference frame image to obtain each replaced frame image; and the replaced multiple frame images are fused to obtain a fused image. Therefore, according to the motion change regions of the moving object in the reference frame image relative to each non-reference frame image, the corresponding block region in each non-reference frame image is replaced to obtain each replaced frame image and fuse it, so that the "ghost image" caused by the movement and change of the dynamically moving moving object in different frame images can be removed, thereby improving the image quality of the generated fused image.
[0093] In one of the embodiments, fusing the replaced multiple frame images to obtain a fused image may include: calculating the weight value of each pixel in each frame image according to a weight generation function based on the grayscale value of each pixel in each frame image after replacement; fusing the replaced multiple frame images according to the weight value and grayscale value of each pixel in each frame image to obtain a fused image.
[0094] The weight generation function refers to a function that generates the weight value corresponding to each pixel in the image based on the gray value of each pixel in the image. For example, it may include but is not limited to a triangular weight function, a weighted average function, a Gaussian weight function, etc. The curve graph of the triangular weight function is as follows: Figure 4 As shown in (a), the curve of the Gaussian weight function is as follows Figure 4 As shown in (b), the function expression of the Gaussian weight function is shown in formula (1).
[0095]
[0096] Among them, Z ij is the pixel value of the pixel point determined by the coordinate position i and j, W(Z ij ) is the weight value corresponding to the pixel.
[0097] In this embodiment, the image processing device can obtain the grayscale value of each pixel in each replaced frame image by identifying each replaced frame image.
[0098] Furthermore, the image processing device can calculate the weight value corresponding to each pixel according to a predetermined weight generation function, and then fuse multiple frame images based on the calculated weight value and the grayscale value of each pixel to obtain a fused image.
[0099] In this embodiment, the image processing device fuses the replaced multiple frame images according to the weight value and grayscale value of each pixel in each frame image to obtain a fused image, which may include: normalizing the weight value of the pixel at the same position in each frame image to obtain the normalized weight value of the pixel at the same position in each frame image, the image processing device traverses each pixel of each frame image to obtain the normalized weight value of each pixel in each frame image, and further, the image processing device fuses the replaced multiple frame images according to the normalized weight value and grayscale value of each pixel in each frame image to obtain a fused image.
[0100] For example, continue to refer to Figure 3In the replaced frame image F11, the pixel value of pixel point A is 50, and the weight value of the point calculated by the weight generation function is 55. In the frame image F21, the pixel value of pixel point A is 60, and the weight value of the point calculated by the weight generation function is 66. In the frame image F31, the pixel value of pixel point A is 180, and the weight value of the point calculated by the weight generation function is 150. The image processing device can normalize the weight values of pixel point A in each frame image and then perform pixel fusion, that is, the final fused pixel value of pixel point A is (55 / (55+66+150))*50+(66 / (55+66+150))*60+(150 / (55+66+150))*180=127.6.
[0101] In this embodiment, the image processing device processes each pixel in each frame of the image, and fuses the multiple frames of the image to obtain a fused image.
[0102] Optionally, the image processing device may also calculate a weight value of each pixel based on the brightness value of each pixel, and fuse each frame image based on the brightness value of each pixel and the calculated weight value to obtain a fused image.
[0103] In the above embodiment, the weight value of each pixel in each frame image is calculated based on the grayscale value of each pixel in each frame image after replacement, and then the replaced multiple frame images are fused according to the weight value and grayscale value of each pixel in each frame image to obtain a fused image, so that the pixel value of each pixel in the fused image can be generated based on the weight ratio of each frame image, thereby improving the quality of the generated fused image.
[0104] In one embodiment, each initial frame image may include multiple moving objects. Determining the reference frame image from multiple initial frame images with different exposures may include: determining the brightness level of each moving object in each initial frame image, and selecting the initial frame image with an exposure within a threshold range as the reference frame image corresponding to each moving object according to each brightness level.
[0105] As mentioned above, each initial frame image includes a moving object, and each may include multiple moving objects. Figure 2 , each initial frame image may include a moving object B and a moving object D.
[0106] In this embodiment, according to the different brightness levels of each moving object in each initial frame image, the image processing device may determine that the corresponding reference frame image may be different. For example, for moving object B, if the exposure corresponding to its brightness level in the initial frame image F2 is within the threshold range, the initial frame image F2 may be determined as the reference frame image corresponding to moving object B, and for moving object D, if the exposure corresponding to its brightness level in the initial frame image F1 is within the threshold range, the initial frame image F1 may be determined as the reference frame image corresponding to moving object D.
[0107] In this embodiment, the brightness level of the moving object can be determined by calculating the grayscale value of each pixel of the moving object in each frame image. For example, the image processing device adds the pixel values of each pixel constituting the moving object in the initial frame image F1 and calculates the average value to obtain the brightness level of the moving object in the initial frame image F1. Similarly, the image processing device can obtain the brightness level of the moving object in the initial frame images F2 and F3.
[0108] In this embodiment, based on the reference frame image and each non-reference frame image in a plurality of initial frame images with different exposure levels, determining each motion change area of the reference frame image relative to each non-reference frame image can include: based on the reference frame image and each non-reference frame image corresponding to each moving object, determining each motion change area of each moving object in the reference frame image relative to each non-reference frame image.
[0109] Specifically, continue to refer to Figure 2 For the moving object B, the corresponding reference frame image is F2, then the motion change region corresponding to the corresponding non-reference frame image F1 is the region composed of region 201 and region 202, and the motion change region corresponding to the corresponding non-reference frame image F3 is the region composed of region 203 and region 202. For the moving object B, the corresponding reference frame image is F1, then the motion change region corresponding to the corresponding non-reference frame image F2 is the region composed of region 204 and region 205, and the motion change region corresponding to the corresponding non-reference frame image F3 is the region composed of region 206 and region 205.
[0110] In this embodiment, each motion change area is used as a replacement block to replace the corresponding block area in each non-reference frame image to obtain each replaced frame image, which may include: using each motion change area of each moving object in the reference frame image relative to each non-reference frame image as a replacement block of the corresponding non-reference frame image, replacing the corresponding block area of each moving object in each non-reference frame image to obtain each replaced frame image.
[0111] Continue to refer Figure 2For the moving object B, the image processing device uses the motion change region composed of region 201 and region 202 as a replacement block to replace the corresponding block region in the non-reference frame image F1. In addition, the image processing device uses the motion change region composed of region 203 and region 302 as a replacement block to replace the corresponding block region in the non-reference frame image F3. For the moving object D, the image processing device can use the motion change region composed of region 204 and region 205 as a replacement block to replace the corresponding block region in the non-reference frame image F2, and the image processing device uses the motion change region composed of region 206 and region 205 as a replacement block to replace the corresponding block region in the non-reference frame image F3.
[0112] In the above embodiment, by determining the reference frame image corresponding to each moving object, and then determining the motion change area of the non-reference frame image corresponding to each moving object and replacing them, the determination of the reference frame image can be made more targeted, the determination of the motion change area can be made more accurate, and the image quality of the generated fused image can be improved.
[0113] In one of the embodiments, the image processing device may also make an overall judgment on each initial frame image and determine a reference frame image, without determining a reference frame image for each moving object separately. Specifically, the image processing device may judge the grayscale value of each pixel of each initial frame image based on a preset threshold, and count the number of pixels in each initial frame image whose grayscale value is within the preset threshold range. Then, the image processing device determines the reference frame image from the multiple frames of initial frame images with different exposures based on the number of pixels in each frame image whose grayscale value is within the preset threshold range.
[0114] In one of the embodiments, based on a reference frame image and each non-reference frame image in a plurality of initial frame images with different exposures, determining each motion change region of the reference frame image relative to each non-reference frame image can include: forming the reference frame image and each non-reference frame image into image pairs; inputting each image pair into a pre-trained motion change region detection model, and obtaining each motion change region of the reference frame image relative to each non-reference frame image.
[0115] In this embodiment, after the image processing device determines the reference frame image and each non-reference frame image, each non-reference frame image and the reference frame image can be combined into an image pair. Figure 3 When the reference frame image is F2, the reference frame image F2 and the non-reference frame image F1 can form an image pair, and the reference frame image F2 and the non-reference frame image F3 can form another image pair, and each image pair is input into a pre-trained motion change region detection model to determine the motion change regions of the reference frame image relative to each non-reference frame image.
[0116] In the above embodiment, by generating an image pair and inputting a pre-trained motion change region detection model, the motion change region detection is performed, so that the motion change region detection can be made more accurate, thereby improving the accuracy of subsequent fusion image generation.
[0117] In one of the embodiments, the motion change region detection model is a trained deep learning neural network model, and the motion change region detection model includes a motion change region feature extraction encoding network and a motion change region decoding and reconstruction network.
[0118] In this embodiment, each image pair is input into a pre-trained motion change region detection model to obtain each motion change region of the reference frame image relative to each non-reference frame image, which can include: inputting the image pair into a motion change region feature extraction and encoding network, and obtaining an initial feature map set corresponding to the reference frame image and the non-reference frame image through multiple downsampling convolution, pooling, and activation operations; associating and fusing the initial feature map set to obtain a fused feature map; performing feature extraction and encoding on the fused feature map to obtain a final feature code; inputting the final feature code into a motion change region decoding and reconstruction network, and reconstructing the motion change region through multiple upsampling operations to obtain each motion change region of the moving object in the non-reference frame image relative to the reference frame image.
[0119] In this embodiment, the model structure of the motion change region detection model can be as follows: Figure 5 As shown, the image processing device can input the image pair into the motion change area detection model, and perform downsampling convolution, pooling, activation operations and other processing on the image pair through the model to respectively obtain the initial feature map corresponding to the reference frame image in the image pair and the initial feature map corresponding to the non-reference frame image, that is, the initial feature map set.
[0120] In this embodiment, the image processing device does not limit the tape size of the downsampling convolution performed by the model, the method and algorithm of the pooling processing and activation operation, etc.
[0121] Furthermore, the image processing device may perform associative fusion on the initial feature maps in the initial feature map set to obtain a fused feature map including features of the reference frame image and features of the non-reference frame image.
[0122] In this embodiment, the image processing device may continue to perform multiple downsampling convolutions, pooling processes, and activation processes on the obtained fused feature map to perform feature extraction encoding to obtain the final feature encoding.
[0123] Furthermore, the image processing device inputs the final feature code into the motion change region decoding and reconstruction network, reconstructs the motion change region through multiple upsampling operations, and obtains each motion change region of the moving object in the non-reference frame image relative to the reference frame image.
[0124] Specifically, the motion change region decoding and reconstruction network completes the moving object detection based on the output features of the motion change region feature extraction and encoding network, and realizes the moving object region reconstruction through deconvolution, upsampling, interpolation and expansion operations, and restores the image size containing the target area to the same size as the output image. Among them, the splicing layer in the network model is used to connect and fuse some feature layers in the motion change region feature extraction and encoding network with the corresponding feature maps of the same size in the motion change region decoding and reconstruction network, so as to improve the detection accuracy.
[0125] In the above embodiment, feature extraction is performed on the image processing devices of the reference frame image and the non-reference frame image respectively through the motion change area feature extraction coding network to obtain a corresponding initial feature map set, which can more effectively extract the corresponding features in each image, and then the initial feature map set is associated and fused to obtain a fused feature map, which can make the fused feature map contain the features of the reference frame image and the non-reference frame image, thereby improving the accuracy of subsequent data processing.
[0126] In one embodiment, the image processing device can also directly input the image pair into Figure 6 The network model shown in the figure is used to perform motion change region. That is, the image processing device inputs the reference frame image and the non-reference frame image in the image pair in the form of stacking the previous and subsequent frame images. Figure 6 The network model shown is used to extract features and detect motion change areas.
[0127] In one of the embodiments, the image processing device obtains a set of initial feature maps corresponding to a reference frame image and a non-reference frame image, respectively, which may include: obtaining a first initial feature map corresponding to the reference frame image and a second initial feature map corresponding to the non-reference frame image. The image processing device associates and fuses the set of initial feature maps to obtain a fused feature map, which may include: based on a window of a preset size, determining a first feature region corresponding to the window from the first initial feature map, and determining a second feature region corresponding to the first feature region from the second initial feature map; performing cross-correlation feature fusion calculation on the first feature region and the second feature region to obtain a fused feature; and traversing the first initial feature map and the second initial feature map according to a window of a preset size to obtain a fused feature map corresponding to the reference frame image and the non-reference frame image.
[0128] Specifically, refer to Figure 7, the first initial feature map corresponding to the reference frame image is T1, the second initial feature map corresponding to the non-reference frame image is T2, and the fusion feature map is H.
[0129] In this embodiment, the image processing device can determine the first feature region X1 corresponding to the window from the first initial feature map T1 based on the window of the preset size, and determine the corresponding second feature region Y1 from the second initial feature map T2 according to the first feature region X1. Further, the image processing device performs cross-correlation feature fusion calculation on the first feature region X1 and the second feature region Y1 to obtain a fused feature, that is, a feature H1 in the fused feature map.
[0130] In one embodiment, the image processing device determines the second feature region corresponding to the first feature region from the second initial feature map, which may include: determining the second feature region corresponding to the key coordinate position of the first feature region from the second initial feature map, wherein the size of the second feature region is larger than the first feature region. The image processing device performs cross-correlation feature fusion calculation on the first feature region and the second feature region to obtain a fused feature, which may include: selecting a third feature region from the second feature region through a window with the same size as the first feature region, and performing cross-correlation feature fusion calculation on the third feature region and the first feature region to obtain a fused feature.
[0131] Specifically, continue to refer to Figure 7 After the image processing device determines the first feature region X1 corresponding to the window from the first initial feature map T1, it can determine the coordinate position consistent with the coordinate position of the center point of the first feature region X1 in the second initial feature map T2 according to the coordinate position of the center point of the first feature region X1, and based on the coordinate position and the correlation range, determine the area corresponding to the coordinate position within the upper, lower, left, and right correlation range as the second feature region Y1. The correlation range can be 2S+1, and S refers to an empirical value, for example, it can be 0.
[0132] In this embodiment, the key point coordinate position may also be other coordinate positions, such as the upper left corner coordinate, the upper right corner coordinate, or other coordinate positions with key significance.
[0133] Further, the image processing device selects a third feature region Y2 from the second feature region with a step size of K1 and K2 through a window having the same size as the first feature region, and performs cross-correlation feature fusion calculation on the selected third feature region Y2 and the first feature region X1 to obtain a fusion feature. K1 refers to the moving step size of the left and right movement in the second feature region Y1, and K2 refers to the moving step size of the up and down movement in the second feature region Y1.
[0134] In this embodiment, the image processing device can traverse the first initial feature map T1 and the second initial feature map T2 with the window of the preset size to obtain the fusion features of each point in the first initial feature map T1 and the second initial feature map T2, thereby obtaining the fusion feature map H corresponding to the reference frame image and the non-reference frame image.
[0135] In the above embodiment, by determining the key coordinate position of the first feature area and determining the corresponding feature area from the second initial feature map, the first feature area and the second feature area for fusion calculation are made to have a strong correlation, thereby improving the accuracy of the determined motion change area.
[0136] In one embodiment, after obtaining each frame image after replacement, the above method may further include: determining a first brightness level in each frame image according to the grayscale value of each pixel of the replacement block in each frame image; determining a second brightness level corresponding to each frame image according to the grayscale value of each pixel of the non-replaced block in each frame image, or determining the second brightness level corresponding to each frame image according to the pixel value of each pixel of the replaced block in each non-reference frame image, where the replaced block is the area replaced by the replacement block in the non-reference frame image; determining a brightness mapping function corresponding to each frame image according to the first brightness level and the second brightness level corresponding to each frame image; adjusting the grayscale value of each pixel of the replacement block in each frame image according to the brightness mapping function corresponding to each frame image to obtain each adjusted frame image.
[0137] In this embodiment, since the exposure of each initial frame image is not the same, after the corresponding block area in each non-reference frame image is replaced by the reference frame image relative to each motion change area of each non-reference frame image, there is an obvious difference between the original image area and the replaced block area in each frame image, so the replaced block needs to be smoothly fused.
[0138] In this embodiment, continue to refer to Figure 3 The image processing device can determine the first brightness level in each frame image according to the grayscale value of each pixel of the replaced block in the frame image corresponding to each non-reference frame image. For example, for frame image F11, the image processing device can determine its corresponding first brightness level according to the grayscale value of each pixel of the replaced block 301, and for frame image F31, the image processing device can determine its corresponding first brightness level according to the grayscale value of each pixel of the replaced block 303.
[0139] In this embodiment, the first brightness level may be specifically calculated by calculating the average grayscale value of each pixel constituting the replacement block in the frame image, and using this as the first brightness level of the replacement block. Alternatively, it may be other ways, which are not limited in this application.
[0140] Furthermore, the image processing device may determine the second brightness level corresponding to each frame of image according to the grayscale value of each pixel of the non-replaced block in each frame of image. Figure 3 For the frame image F11, the image processing device can determine the corresponding second brightness level according to the grayscale value of each pixel point of the frame image without replacing the block 301, that is, the grayscale value of each pixel point of the non-replaced block. For the frame image F31, the image processing device can determine the corresponding first brightness level according to the grayscale value of each pixel point of the frame image without replacing the block 303, that is, the grayscale value of each pixel point of the non-replaced block.
[0141] Alternatively, the image processing device also determines the second brightness level corresponding to each frame image according to the pixel value of each pixel point of the replaced block in each non-reference frame image. Figure 2 , corresponding to Figure 3 The initial frame image of each frame image in the non-reference frame image. Among them, the non-reference frame image corresponding to the frame image F11 is F1, and the non-reference frame image corresponding to the frame image F31 is F3. In the non-reference frame image F1, blocks 207 and 208 are replaced blocks corresponding to the replaced frame image F11, and the image processing device can determine the second brightness level of the corresponding frame image F11 according to the pixel value of each pixel point of the replaced blocks 207 and 208 in the non-reference frame image F1. Similarly, in the non-reference frame image F3, blocks 209 and 210 are replaced blocks corresponding to the replaced frame image F31, and the image processing device can determine the second brightness level of the corresponding frame image F31 according to the pixel value of each pixel point of the replaced blocks 209 and 210 in the non-reference frame image F3.
[0142] In this embodiment, the brightness mapping function may be a brightness adjustment weight coefficient. After determining the first brightness level and the second brightness level corresponding to each frame image, the image processing device may determine the corresponding brightness adjustment weight coefficient according to the second brightness level and the first brightness level.
[0143] In one of the embodiments, the image processing device can pre-set the correspondence between the brightness mapping function and the first brightness level and the second brightness level. After the image processing device determines the first brightness level and the second brightness level corresponding to each frame image, it can determine the corresponding brightness mapping function based on the correspondence.
[0144] In one of the embodiments, the image processing device may also directly divide the second brightness level by the first brightness level, and use the obtained value as a brightness mapping function to adjust the brightness of the replacement image block.
[0145] In this embodiment, the image processing device adjusts the grayscale value of each pixel of the replacement block in the corresponding frame image through a brightness mapping function to obtain each adjusted frame image. Specifically, if the first brightness level is greater than the second brightness level, the image processing device can lower the brightness of the replacement block according to the brightness mapping function so that the brightness of the replacement block is consistent with that of the non-replacement block in the frame image. Similarly, when the first brightness level is less than the second brightness level, the image processing device can increase the brightness of the replacement block according to the brightness mapping function.
[0146] In the above embodiment, by calculating the first brightness level and the second brightness level of each frame image, determining the brightness mapping function according to the first brightness level and the second brightness level, and adjusting the brightness level of the replacement block, the brightness level of the replacement block and the non-replacement block in each frame image can be made consistent, thereby reducing the difference between the replacement block and the non-replacement block in each frame image, and improving the image quality of the subsequently generated fused image.
[0147] In one of the embodiments, determining the second brightness levels of the non-replaced blocks in each frame image according to the grayscale value of each pixel of the non-replaced blocks in each frame image may include: determining the second brightness levels of the non-replaced blocks in each frame image according to the grayscale value of each pixel of the non-replaced blocks within a preset range of the edge of the replacement blocks in each frame image.
[0148] Specifically, the image processing device may pre-set a preset edge range for the replacement block, for example, setting the block area within a range of 10 pixels from the replacement block to be within the preset edge range.
[0149] Furthermore, the image processing device may perform calculations based on the grayscale values of each pixel within a preset range of the edge of the replacement block to determine the second brightness level of the corresponding frame image.
[0150] In the above embodiment, the second brightness levels of the non-replaced blocks in each frame image are determined based on the grayscale values of the pixels of the non-replaced blocks within a preset range of the edge of the replaced blocks in each frame image. This eliminates the need to calculate the pixels of the entire non-replaced blocks of the frame image, thereby reducing the amount of data calculations and improving data processing efficiency.
[0151] In this embodiment, when calculating the first brightness level of the replacement block in each frame of image, the image processing device may calculate the first brightness level of the replacement block by region.
[0152] In one of the embodiments, determining each first brightness level of the replacement block in each frame image according to the grayscale value of each pixel of the replacement block in each frame image may include: determining the object area brightness level of the moving object area in the replacement block of each frame image according to the grayscale value of each pixel of the moving object in the replacement block of each frame image; determining the non-object area brightness level of the non-moving object in the replacement block of each frame image according to the grayscale value of each pixel of the non-moving object area in the replacement block of each frame image; and using the object area brightness level and the non-object area brightness level as the first brightness level of the replacement block in the frame image.
[0153] Continue to refer Figure 3 , the replacement block includes an area where a moving object is located and an area where a non-moving object is located. In this embodiment, the brightness level of the area where the moving object is located and the brightness level of the area where the non-moving object is located can be calculated respectively to obtain the object area brightness level corresponding to the moving object area in the replacement block and the non-object area brightness level corresponding to the non-moving object area in the replacement block.
[0154] In one embodiment, determining a brightness mapping function corresponding to each frame image based on a first brightness level and a second brightness level corresponding to each frame image may include: determining a first brightness mapping function for a moving object area and a second brightness mapping function for a non-moving object area in a corresponding replacement block based on a second brightness level corresponding to each frame image.
[0155] Specifically, the image processing device can determine the first brightness mapping function of the moving object area in the corresponding replacement block based on the second brightness level and the brightness level of the object area. Similarly, the image processing device can determine the second brightness mapping function of the non-moving object area in the corresponding replacement block based on the second brightness level and the brightness level of the non-object area.
[0156] In this embodiment, the grayscale value of each pixel point of the replacement block in each frame image is adjusted according to the brightness mapping function corresponding to each frame image to obtain the adjusted frame images, which may include: adjusting the grayscale value of each pixel point in the moving object area of the replacement block according to the first brightness mapping function, and adjusting the grayscale value of each pixel point in the non-moving object area of the replacement block according to the second brightness mapping function to obtain the adjusted frame images.
[0157] In the above embodiment, by respectively obtaining the object area brightness level of the moving object area and the non-object area brightness level of the non-moving object in the replacement block, and respectively determining the corresponding first brightness mapping function and second brightness mapping function, the moving object area and the non-moving object area of the replacement block are respectively adjusted according to the first brightness mapping function and the second brightness mapping function, thereby improving the accuracy of the brightness adjustment and further improving the image quality of the generated fused image.
[0158] In one of the embodiments, the second brightness level corresponding to the moving object area in the replacement block can be determined based on the grayscale value of each pixel point in the moving object area in the replaced block, and the second brightness level corresponding to the non-moving object area in the replacement block can be determined based on the grayscale value of each pixel point in the non-moving object area in the replaced block, and subsequent processing can further improve the accuracy of brightness adjustment.
[0159] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0160] In one embodiment, Figure 8 As shown, an image fusion device is provided, comprising: an initial frame image acquisition module 100, a reference frame image determination module 200, a motion change region determination module 300, a replacement module 400 and a fusion module 500, wherein:
[0161] The initial frame image acquisition module 100 is used to acquire multiple frames of initial frame images with different exposure levels and after alignment and registration.
[0162] The reference frame image determination module 200 is used to determine a reference frame image from a plurality of initial frame images with different exposure levels.
[0163] The motion change region determination module 300 is used to determine the motion change regions of the reference frame image relative to each non-reference frame image based on the reference frame image and each non-reference frame image in a plurality of initial frame images with different exposures.
[0164] The replacement module 400 is used to use each motion change area as a replacement block to replace the corresponding block area in each non-reference frame image to obtain each frame image after replacement.
[0165] The fusion module 500 is used to fuse the replaced multiple frame images to obtain a fused image.
[0166] In one embodiment, the fusion module 500 may include:
[0167] The weight value calculation submodule is used to calculate the weight value of each pixel in each frame image according to the weight generation function based on the gray value of each pixel in each frame image after replacement.
[0168] The fusion submodule is used to fuse the replaced multiple frame images according to the weight value and gray value of each pixel in each frame image to obtain a fused image.
[0169] In one embodiment, each initial frame image may include multiple moving objects. The reference frame image determination module 200 is used to determine the brightness level of each moving object in each initial frame image, and select an initial frame image with an exposure within a threshold range as a reference frame image corresponding to each moving object according to each brightness level.
[0170] In this embodiment, the motion change region determination module 300 is used to determine the motion change regions of each moving object in the reference frame image relative to each non-reference frame image according to the reference frame image and each non-reference frame image corresponding to each moving object.
[0171] In this embodiment, the replacement module 400 is used to replace the block areas corresponding to each moving object in each non-reference frame image according to each motion change area of each moving object in the reference frame image relative to each non-reference frame image as the replacement blocks of the corresponding non-reference frame image, so as to obtain each frame image after replacement.
[0172] In one embodiment, the above device may further include:
[0173] The first brightness level determination module is used to determine the first brightness level in each frame image according to the grayscale value of each pixel point of the replaced block in each frame image after the replacement module 400 obtains each frame image after replacement.
[0174] The second brightness level determination module is used to determine the second brightness level corresponding to each frame image according to the grayscale value of each pixel point of the non-replacement block in each frame image, or to determine the second brightness level corresponding to each frame image according to the pixel value of each pixel point of the replaced block in each non-reference frame image, and the replaced block is the area replaced by the replacement block in the non-reference frame image.
[0175] The brightness mapping function determination module is used to determine the brightness mapping function corresponding to each frame image according to the first brightness level and the second brightness level corresponding to each frame image.
[0176] The grayscale value adjustment module is used to adjust the grayscale value of each pixel point of the replacement block in each frame image according to the brightness mapping function corresponding to each frame image to obtain each frame image after adjustment.
[0177] In one embodiment, the second brightness level determination module is used to determine the second brightness levels of the non-replacement blocks in each frame image according to the grayscale value of each pixel of the non-replacement blocks within a preset range of the edge of the replacement blocks in each frame image.
[0178] In one embodiment, the first brightness level determination module may include:
[0179] The object area brightness level determination submodule is used to determine the object area brightness level of the moving object area in the replacement block corresponding to each frame image according to the grayscale value of each pixel point of the moving object in the replacement block of each frame image.
[0180] The non-object area brightness level determination submodule is used to determine the brightness level of the non-object area of the non-moving object in the replacement block of each frame image according to the grayscale value of each pixel point in the non-moving object area in the replacement block of each frame image.
[0181] The first brightness level determination submodule is used to use the brightness level of the object area and the brightness level of the non-object area as the first brightness level of the replacement block in the frame image.
[0182] In one embodiment, the brightness mapping function determination module is used to determine a first brightness mapping function of a moving object area and a second brightness mapping function of a non-moving object area in a corresponding replacement block according to a second brightness level corresponding to each frame image.
[0183] In this embodiment, the grayscale value adjustment module is used to adjust the grayscale value of each pixel point in the moving object area of the replacement block according to the first brightness mapping function, and adjust the grayscale value of each pixel point in the non-moving object area of the replacement block according to the second brightness mapping function to obtain adjusted frame images.
[0184] In one embodiment, the motion change region determination module 300 may include:
[0185] The image pair generation submodule is used to form image pairs from the reference frame image and each non-reference frame image.
[0186] The motion change region determination submodule is used to input each image pair into a pre-trained motion change region detection model to obtain each motion change region of the reference frame image relative to each non-reference frame image.
[0187] In one of the embodiments, the motion change region detection model is a trained deep learning neural network model, and the motion change region detection model includes a motion change region feature extraction encoding network and a motion change region decoding and reconstruction network.
[0188] In this embodiment, the motion change area determination submodule may include:
[0189] The initial feature map set generation unit is used to input the image pair into the motion change area feature extraction and encoding network, and obtain the initial feature map sets corresponding to the reference frame image and the non-reference frame image respectively after multiple downsampling convolution, pooling and activation operations.
[0190] The association fusion unit is used to perform association fusion on the initial feature map set to obtain a fused feature map.
[0191] The coding extraction unit is used to perform feature extraction coding on the fused feature map to obtain the final feature coding.
[0192] The reconstruction unit is used to input the final feature code into the motion change region decoding and reconstruction network, reconstruct the motion change region through multiple upsampling operations, and obtain the motion change regions of the moving object in the non-reference frame image relative to the reference frame image.
[0193] In one of the embodiments, the initial feature map set generation unit is used to obtain a first initial feature map corresponding to a reference frame image and a second initial feature map corresponding to a non-reference frame image.
[0194] In this embodiment, the association fusion unit may include:
[0195] The first feature region and the second feature region determining subunit is used to determine the first feature region corresponding to the window from the first initial feature map based on the window of a preset size, and to determine the second feature region corresponding to the first feature region from the second initial feature map.
[0196] The fusion calculation subunit is used to perform cross-correlation feature fusion calculation on the first feature area and the second feature area to obtain a fusion feature.
[0197] The fused feature map generating subunit is used to traverse the first initial feature map and the second initial feature map according to a window of a preset size to obtain a fused feature map corresponding to the reference frame image and the non-reference frame image.
[0198] In one embodiment, the first feature region and second feature region determining subunit is used to determine the second feature region corresponding to the key coordinate position of the first feature region from the second initial feature map, and the size of the second feature region is larger than the first feature region.
[0199] In this embodiment, the fusion calculation subunit is used to select a third feature region from the second feature region through a window with the same size as the first feature region, and perform cross-correlation feature fusion calculation on the third feature region and the first feature region to obtain a fused feature.
[0200] For the specific definition of the image fusion device, please refer to the definition of the image fusion method above, which will not be repeated here. Each module in the above-mentioned image fusion device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0201] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as initial frame images and fused images. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an image fusion method is implemented.
[0202] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0203] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program: acquiring multiple frames of initial frame images with different exposures and after alignment and registration; determining a reference frame image from the multiple frames of initial frame images with different exposures; determining, based on the reference frame image and each non-reference frame image in the multiple frames of initial frame images with different exposures, each motion change region of the reference frame image relative to each non-reference frame image; using each motion change region as a replacement block to replace the corresponding block region in each non-reference frame image to obtain each replaced frame image; and fusing the multiple replaced frame images to obtain a fused image.
[0204] In one of the embodiments, when the processor executes the computer program, it implements fusing the replaced multiple frame images to obtain a fused image, which may include: calculating the weight value of each pixel in each frame image according to a weight generation function based on the grayscale value of each pixel in each frame image after replacement; fusing the replaced multiple frame images according to the weight value and grayscale value of each pixel in each frame image to obtain a fused image.
[0205] In one embodiment, each initial frame image may include multiple moving objects. When the processor executes the computer program, determining the reference frame image from multiple initial frame images with different exposures may include: determining the brightness level of each moving object in each initial frame image, and selecting the initial frame image with an exposure within a threshold range as the reference frame image corresponding to each moving object according to each brightness level.
[0206] In this embodiment, when the processor executes the computer program, it determines the motion change areas of the reference frame image relative to the non-reference frame images based on the reference frame image and the non-reference frame images in the multiple frames of initial frame images with different exposures. It can include: determining the motion change areas of each moving object in the reference frame image relative to each non-reference frame image based on the reference frame image and the non-reference frame images corresponding to each moving object.
[0207] In this embodiment, when the processor executes the computer program, each motion change area is used as a replacement block to replace the corresponding block area in each non-reference frame image to obtain each replaced frame image, which may include: using each motion change area of each moving object in the reference frame image relative to each non-reference frame image as a replacement block of the corresponding non-reference frame image, replacing the corresponding block area of each moving object in each non-reference frame image, to obtain each replaced frame image.
[0208] In one of the embodiments, after the processor executes the computer program to obtain the replaced frames of images, the following steps may also be implemented: determine the first brightness level in the corresponding frames of images according to the grayscale value of each pixel of the replaced blocks in each frame of images; determine the second brightness level in the corresponding frames of images according to the grayscale value of each pixel of the non-replaced blocks in each frame of images, or determine the second brightness level in the corresponding frames of images according to the pixel value of each pixel of the replaced blocks in each non-reference frame of images, where the replaced blocks are areas replaced by the replaced blocks in the non-reference frame of images; determine the brightness mapping function in the corresponding frames of images according to the first brightness level and the second brightness level in the corresponding frames of images; and adjust the grayscale value of each pixel of the replaced blocks in the frames of images according to the brightness mapping function in the corresponding frames of images to obtain the adjusted frames of images.
[0209] In one embodiment, when the processor executes the computer program, it determines the second brightness levels corresponding to the non-replaced blocks in each frame image according to the grayscale value of each pixel of the non-replaced blocks in each frame image, which may include: determining the second brightness levels corresponding to the non-replaced blocks in each frame image according to the grayscale value of each pixel of the non-replaced blocks within a preset range of the edge of the replacement blocks in each frame image.
[0210] In one of the embodiments, when the processor executes the computer program, it is implemented to determine the first brightness levels of the replacement blocks corresponding to each frame image according to the grayscale value of each pixel point of the replacement block in each frame image, which may include: determining the object area brightness level of the moving object area in the replacement block corresponding to each frame image according to the grayscale value of each pixel point of the moving object in the replacement block of each frame image; determining the non-object area brightness level of the non-moving object in the replacement block of each frame image according to the grayscale value of each pixel point of the non-moving object area in the replacement block of each frame image; using the object area brightness level and the non-object area brightness level as the first brightness level of the replacement block in the frame image.
[0211] In one embodiment, when the processor executes a computer program, it determines the brightness mapping function corresponding to each frame image according to the first brightness level and the second brightness level corresponding to each frame image, which may include: determining the first brightness mapping function of the moving object area and the second brightness mapping function of the non-moving object area in the corresponding replacement block according to the second brightness level corresponding to each frame image.
[0212] In this embodiment, when the processor executes the computer program, it adjusts the grayscale value of each pixel point of the replacement block in each frame image according to the brightness mapping function corresponding to each frame image to obtain the adjusted frame images, which may include: adjusting the grayscale value of each pixel point in the moving object area of the replacement block according to the first brightness mapping function, and adjusting the grayscale value of each pixel point in the non-moving object area of the replacement block according to the second brightness mapping function to obtain the adjusted frame images.
[0213] In one of the embodiments, when the processor executes the computer program, it determines the motion change regions of the reference frame image relative to the non-reference frame images based on the reference frame image and the non-reference frame images in the multiple frames of initial frame images with different exposures, which can include: forming image pairs of the reference frame image and the non-reference frame images; inputting the image pairs into a pre-trained motion change region detection model to obtain the motion change regions of the reference frame image relative to the non-reference frame images.
[0214] In one of the embodiments, the motion change region detection model is a trained deep learning neural network model, and the motion change region detection model includes a motion change region feature extraction encoding network and a motion change region decoding and reconstruction network.
[0215] In this embodiment, when the processor executes the computer program, each image pair is input into a pre-trained motion change area detection model to obtain each motion change area of the reference frame image relative to each non-reference frame image. It can include: inputting the image pair into the motion change area feature extraction and encoding network, and obtaining an initial feature map set corresponding to the reference frame image and the non-reference frame image through multiple downsampling convolution, pooling, and activation operations; associating and fusing the initial feature map set to obtain a fused feature map; performing feature extraction and encoding on the fused feature map to obtain a final feature code; inputting the final feature code into the motion change area decoding and reconstruction network, reconstructing the motion change area through multiple upsampling operations, and obtaining each motion change area of the moving object in the non-reference frame image relative to the reference frame image.
[0216] In one embodiment, when a processor executes a computer program, obtaining a set of initial feature maps corresponding to a reference frame image and a non-reference frame image respectively may include: obtaining a first initial feature map corresponding to the reference frame image and a second initial feature map corresponding to the non-reference frame image.
[0217] In this embodiment, when the processor executes the computer program, it implements associative fusion of the initial feature map set to obtain a fused feature map, which may include: based on a window of a preset size, determining a first feature area corresponding to the window from the first initial feature map, and determining a second feature area corresponding to the first feature area from the second initial feature map; performing cross-correlation feature fusion calculation on the first feature area and the second feature area to obtain a fused feature; according to the window of the preset size, traversing the first initial feature map and the second initial feature map to obtain a fused feature map corresponding to the reference frame image and the non-reference frame image.
[0218] In one embodiment, when the processor executes a computer program, determining a second feature area corresponding to a first feature area from a second initial feature map may include: determining a second feature area at a key coordinate position corresponding to the first feature area from the second initial feature map, wherein the size of the second feature area is larger than that of the first feature area.
[0219] In this embodiment, when the processor executes the computer program, it implements cross-correlation feature fusion calculation on the first feature area and the second feature area to obtain a fused feature, which may include: selecting a third feature area from the second feature area through a window with the same size as the first feature area, and performing cross-correlation feature fusion calculation on the third feature area and the first feature area to obtain a fused feature.
[0220] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining multiple frames of initial frame images with different exposures and after alignment and registration; determining a reference frame image from the multiple frames of initial frame images with different exposures; determining each motion change region of the reference frame image relative to each non-reference frame image based on the reference frame image and each non-reference frame image in the multiple frames of initial frame images with different exposures; using each motion change region as a replacement block to replace the corresponding block region in each non-reference frame image to obtain each replaced frame image; and fusing the multiple replaced frame images to obtain a fused image.
[0221] In one embodiment, when the computer program is executed by the processor, fusing the replaced multiple frame images to obtain a fused image may include: calculating the weight value of each pixel in each frame image according to a weight generation function based on the grayscale value of each pixel in each frame image after replacement; fusing the replaced multiple frame images according to the weight value and grayscale value of each pixel in each frame image to obtain a fused image.
[0222] In one embodiment, each initial frame image may include multiple moving objects. When the computer program is executed by the processor, determining the reference frame image from multiple initial frame images with different exposures may include: determining the brightness level of each moving object in each initial frame image, and selecting the initial frame image with an exposure within a threshold range as the reference frame image corresponding to each moving object according to each brightness level.
[0223] In this embodiment, when the computer program is executed by the processor, it is implemented to determine the motion change areas of the reference frame image relative to the non-reference frame images based on the reference frame image and the non-reference frame images in the multiple frames of initial frame images with different exposures. It may include: determining the motion change areas of each moving object in the reference frame image relative to each non-reference frame image based on the reference frame image and each non-reference frame image corresponding to each moving object.
[0224] In this embodiment, when the computer program is executed by the processor, each motion change area is used as a replacement block to replace the corresponding block area in each non-reference frame image to obtain each replaced frame image, which may include: using each motion change area of each moving object in the reference frame image relative to each non-reference frame image as a replacement block of the corresponding non-reference frame image, replacing the corresponding block area of each moving object in each non-reference frame image, to obtain each replaced frame image.
[0225] In one of the embodiments, after the computer program is executed by the processor to obtain the replaced frames of images, the following steps may also be implemented: determine the first brightness level in the corresponding frames of images according to the grayscale value of each pixel of the replaced blocks in each frame of images; determine the second brightness level corresponding to each frame of images according to the grayscale value of each pixel of the non-replaced blocks in each frame of images, or determine the second brightness level corresponding to each frame of images according to the pixel value of each pixel of the replaced blocks in each non-reference frame of images, where the replaced blocks are areas replaced by the replaced blocks in the non-reference frame of images; determine the brightness mapping function corresponding to each frame of images according to the first brightness level and the second brightness level corresponding to each frame of images; and adjust the grayscale value of each pixel of the replaced blocks in each frame of images according to the brightness mapping function corresponding to each frame of images to obtain adjusted frames of images.
[0226] In one embodiment, when the computer program is executed by the processor, it is implemented to determine the second brightness levels corresponding to the non-replaced blocks in each frame image according to the grayscale value of each pixel of the non-replaced blocks in each frame image, which may include: determining the second brightness levels corresponding to the non-replaced blocks in each frame image according to the grayscale value of each pixel of the non-replaced blocks within a preset range of the edge of the replacement blocks in each frame image.
[0227] In one embodiment, when the computer program is executed by the processor, it is implemented to determine the first brightness levels of the replacement blocks corresponding to each frame image according to the grayscale value of each pixel point of the replacement block in each frame image, which may include: determining the object area brightness level of the moving object area in the replacement block of each frame image according to the grayscale value of each pixel point of the moving object in the replacement block of each frame image; determining the non-object area brightness level of the non-moving object in the replacement block of each frame image according to the grayscale value of each pixel point of the non-moving object area in the replacement block of each frame image; using the object area brightness level and the non-object area brightness level as the first brightness level of the replacement block in the frame image.
[0228] In one embodiment, when the computer program is executed by a processor, it is implemented to determine the brightness mapping function corresponding to each frame image according to the first brightness level and the second brightness level corresponding to each frame image, which may include: determining the first brightness mapping function of the moving object area and the second brightness mapping function of the non-moving object area in the corresponding replacement block according to the second brightness level corresponding to each frame image.
[0229] In this embodiment, when the computer program is executed by the processor, the grayscale value of each pixel point of the replacement block in each frame image is adjusted according to the brightness mapping function corresponding to each frame image to obtain the adjusted frame images, which may include: adjusting the grayscale value of each pixel point in the moving object area of the replacement block according to the first brightness mapping function, and adjusting the grayscale value of each pixel point in the non-moving object area of the replacement block according to the second brightness mapping function to obtain the adjusted frame images.
[0230] In one of the embodiments, when the computer program is executed by the processor, it is implemented to determine the motion change areas of the reference frame image relative to each non-reference frame image based on the reference frame image and each non-reference frame image in a plurality of frames of initial frame images with different exposures, which may include: forming image pairs of the reference frame image and each non-reference frame image; inputting each image pair into a pre-trained motion change area detection model, and obtaining each motion change area of the reference frame image relative to each non-reference frame image.
[0231] In one of the embodiments, the motion change region detection model is a trained deep learning neural network model, and the motion change region detection model includes a motion change region feature extraction encoding network and a motion change region decoding and reconstruction network.
[0232] In this embodiment, when the computer program is executed by the processor, each image pair is input into a pre-trained motion change area detection model to obtain each motion change area of the reference frame image relative to each non-reference frame image. It can include: inputting the image pair into a motion change area feature extraction and encoding network, and obtaining an initial feature map set corresponding to the reference frame image and the non-reference frame image through multiple downsampling convolution, pooling, and activation operations; associating and fusing the initial feature map set to obtain a fused feature map; performing feature extraction and encoding on the fused feature map to obtain a final feature code; inputting the final feature code into a motion change area decoding and reconstruction network, reconstructing the motion change area through multiple upsampling operations, and obtaining each motion change area of the moving object in the non-reference frame image relative to the reference frame image.
[0233] In one embodiment, when the computer program is executed by a processor, obtaining a set of initial feature maps corresponding to a reference frame image and a non-reference frame image respectively may include: obtaining a first initial feature map corresponding to the reference frame image and a second initial feature map corresponding to the non-reference frame image.
[0234] In this embodiment, when the computer program is executed by the processor, it implements associative fusion of the initial feature map set to obtain a fused feature map, which may include: based on a window of a preset size, determining a first feature area corresponding to the window from the first initial feature map, and determining a second feature area corresponding to the first feature area from the second initial feature map; performing cross-correlation feature fusion calculation on the first feature area and the second feature area to obtain a fused feature; according to the window of the preset size, traversing the first initial feature map and the second initial feature map to obtain a fused feature map corresponding to the reference frame image and the non-reference frame image.
[0235] In one embodiment, when the computer program is executed by a processor, determining a second feature area corresponding to a first feature area from a second initial feature map may include: determining a second feature area at a key coordinate position corresponding to the first feature area from the second initial feature map, wherein the size of the second feature area is larger than that of the first feature area.
[0236] In this embodiment, when the computer program is executed by the processor, it implements cross-correlation feature fusion calculation on the first feature area and the second feature area to obtain a fused feature, which may include: selecting a third feature area from the second feature area through a window with the same size as the first feature area, and performing cross-correlation feature fusion calculation on the third feature area and the first feature area to obtain a fused feature.
[0237] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0238] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0239] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An image fusion method, characterized in that: The method comprises: Acquire multiple frames of initial frame images with different exposures and after alignment and registration; Determine a reference frame image from the multiple frames of initial frame images with different exposure levels; Determine, according to the reference frame image and each non-reference frame image in the multiple frames of initial frame images with different exposures, each motion change region of the reference frame image relative to each non-reference frame image; Using each of the motion change regions as a replacement block to replace a corresponding block region in each non-reference frame image, to obtain each frame image after replacement; Fusing the replaced multiple frame images to obtain a fused image; After obtaining each frame image after replacement, the method further includes: Determine a first brightness level in each frame of the image according to the grayscale value of each pixel of the replacement block in each frame of the image; Determining the second brightness level corresponding to each frame image according to the grayscale value of each pixel of the non-replacement block in each frame image, or determining the second brightness level corresponding to each frame image according to the pixel value of each pixel of the replaced block in each non-reference frame image, wherein the replaced block is the area replaced by the replacement block in the non-reference frame image; Determine a brightness mapping function corresponding to each frame of image according to a first brightness level and a second brightness level corresponding to each frame of image; The grayscale value of each pixel of the replacement block in each frame image is adjusted according to the brightness mapping function corresponding to each frame image to obtain each frame image after adjustment.
2. The method according to claim 1, characterized in that: The step of fusing the replaced multiple frames of images to obtain a fused image includes: Based on the grayscale value of each pixel in each frame image after replacement, the weight value of each pixel in each frame image is calculated according to the weight generation function; According to the weight value and gray value of each pixel in each frame image, the replaced multiple frame images are fused to obtain a fused image.
3. The method according to claim 1, characterized in that Each of the initial frame images includes a plurality of moving objects; The step of determining a reference frame image from the multiple frames of initial frame images with different exposure levels comprises: Determine the brightness level of each moving object in each initial frame image, and select the initial frame image with an exposure within a threshold range as the reference frame image corresponding to each moving object according to each brightness level; The step of determining, based on the reference frame image and each non-reference frame image in the multiple frames of initial frame images with different exposures, each motion change region of the reference frame image relative to each non-reference frame image comprises: Determine, according to the reference frame images and the non-reference frame images corresponding to the moving objects, the moving change regions of the moving objects in the reference frame images relative to the non-reference frame images; The step of using each of the motion change regions as replacement blocks to replace corresponding block regions in each non-reference frame image to obtain each frame image after replacement includes: According to each motion change area of each moving object in the reference frame image relative to each non-reference frame image as the replacement block of the corresponding non-reference frame image, the block area corresponding to each moving object in each non-reference frame image is replaced to obtain each frame image after replacement.
4. The method according to claim 1, characterized in that: The determining of each second brightness level corresponding to the non-replacement block in each frame image according to the gray value of each pixel point of the non-replacement block in each frame image includes: According to the grayscale value of each pixel of the non-replacement block within the preset range of the edge of the replacement block in each frame image, each second brightness level corresponding to the non-replacement block in each frame image is determined.
5. The method according to claim 1, characterized in that The step of determining the first brightness levels of the replaced blocks in each frame of image according to the grayscale values of the pixels of the replaced blocks in each frame of image comprises: Determine the object area brightness level of the moving object area in the replacement image block corresponding to each frame image according to the gray value of each pixel point of the moving object in the replacement image block of each frame image; Determine the brightness level of the non-object area of the non-moving object in the replacement block of each frame image according to the gray value of each pixel point in the non-moving object area in the replacement block of each frame image; The object area brightness level and the non-object area brightness level are used as the first brightness level of the replacement block in the frame image.
6. The method according to claim 5, characterized in that The step of determining a brightness mapping function corresponding to each frame image according to the first brightness level and the second brightness level corresponding to each frame image includes: Determine, according to the second brightness level corresponding to each frame image, a first brightness mapping function of the moving object area and a second brightness mapping function of the non-moving object area in the corresponding replacement block; The step of adjusting the grayscale value of each pixel of the replacement block in each frame image according to the brightness mapping function corresponding to each frame image to obtain each adjusted frame image includes: The grayscale value of each pixel point in the moving object area of the replacement block is adjusted according to the first brightness mapping function, and the grayscale value of each pixel point in the non-moving object area of the replacement block is adjusted according to the second brightness mapping function to obtain each adjusted frame image.
7. The method according to claim 1, characterized in that The step of determining, based on the reference frame image and each non-reference frame image in the multiple frames of initial frame images with different exposures, each motion change region of the reference frame image relative to each non-reference frame image comprises: The reference frame image and each non-reference frame image are respectively formed into image pairs; Each of the image pairs is input into a pre-trained motion change region detection model to obtain each motion change region of the reference frame image relative to each of the non-reference frame images.
8. The method according to claim 7, characterized in that The motion change region detection model is a trained deep neural network model, and the motion change region detection model includes a motion change region feature extraction encoding network and a motion change region decoding and reconstruction network; The step of inputting each of the image pairs into a pre-trained motion change region detection model to obtain each motion change region of the reference frame image relative to each of the non-reference frame images comprises: Inputting the image pair into a motion change region feature extraction and encoding network, and performing multiple downsampling convolution, pooling, and activation operations to obtain an initial feature map set corresponding to the reference frame image and the non-reference frame image respectively; Associating and fusing the initial feature map set to obtain a fused feature map; Performing feature extraction and encoding on the fused feature map to obtain a final feature code; The final feature code is input into a motion change region decoding and reconstruction network, and the motion change region is reconstructed through multiple upsampling operations to obtain each motion change region of the moving object in the non-reference frame image relative to the reference frame image.
9. The method according to claim 8, characterized in that The obtaining of an initial feature map set corresponding to the reference frame image and the non-reference frame image respectively comprises: Obtaining a first initial feature map corresponding to the reference frame image and a second initial feature map corresponding to the non-reference frame image; The associating and fusing the initial feature map set to obtain a fused feature map includes: Based on a window of a preset size, determining a first feature region corresponding to the window from a first initial feature map, and determining a second feature region corresponding to the first feature region from a second initial feature map; Performing cross-correlation feature fusion calculation on the first feature region and the second feature region to obtain a fusion feature; According to the window of the preset size, the first initial feature map and the second initial feature map are traversed to obtain a fused feature map corresponding to the reference frame image and the non-reference frame image.
10. The method according to claim 9, characterized in that The determining, from the second initial feature map, a second feature region corresponding to the first feature region comprises: Determine a second feature region corresponding to a key coordinate position of the first feature region from a second initial feature map, wherein the size of the second feature region is larger than that of the first feature region; The performing cross-correlation feature fusion calculation on the first feature region and the second feature region to obtain a fusion feature includes: A third feature region is selected from the second feature region through a window having the same size as the first feature region, and a cross-correlation feature fusion calculation is performed on the third feature region and the first feature region to obtain a fused feature.
11. An image fusion device, characterized in that: include: An initial frame image acquisition module is used to acquire multiple frames of initial frame images with different exposures and after alignment and registration; A reference frame image determination module, used to determine a reference frame image from the multiple initial frame images with different exposure levels; A motion change region determination module, configured to determine, based on the reference frame image and each non-reference frame image in the plurality of initial frame images with different exposures, each motion change region of the reference frame image relative to each non-reference frame image; A replacement module, used to use each of the motion change regions as a replacement block to replace the corresponding block region in each non-reference frame image, so as to obtain each frame image after replacement; A fusion module, used for fusing the replaced multiple frame images to obtain a fused image; A first brightness level determination module is used to determine the first brightness level in each frame image according to the gray value of each pixel point of the replacement block in each frame image after the replacement module obtains each frame image after replacement; A second brightness level determination module is used to determine the second brightness level corresponding to each frame image according to the grayscale value of each pixel of the non-replacement block in each frame image, or to determine the second brightness level corresponding to each frame image according to the pixel value of each pixel of the replaced block in each non-reference frame image, where the replaced block is the area replaced by the replacement block in the non-reference frame image; A brightness mapping function determination module, used to determine a brightness mapping function corresponding to each frame image according to a first brightness level and a second brightness level corresponding to each frame image; The grayscale value adjustment module is used to adjust the grayscale value of each pixel point of the replacement block in each frame image according to the brightness mapping function corresponding to each frame image to obtain each frame image after adjustment.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
