Image fusion method and device and storage medium

By first determining the color fusion style during image fusion and performing color fusion of the corresponding style, combined with brightness fusion, the problem of consistent image fusion styles under environmental changes in the existing technology is solved, and the adaptability and quality of image fusion are improved.

CN118537239APending Publication Date: 2024-08-23YANTAI RAYTRON TECH CO LTD

Patent Information

Application Number
CN202410898040.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

When the existing technology fuses infrared images and visible light images in different environments, the fusion style is consistent and cannot adapt to environmental changes, resulting in poor image fusion quality.

Method used

By first determining the currently required color fusion style, the infrared image and the visible light image are color fused in the corresponding style, and combined with the brightness fusion image to generate the final fusion image to improve the adaptability of image fusion to different environments and scenes.

Benefits of technology

It improves the adaptability of image fusion to different environments and scenes, ensures the quality of image fusion, and ensures that detailed fusion images can be obtained in different environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537239A
    Figure CN118537239A
Patent Text Reader

Abstract

The invention discloses an image fusion method and device and a storage medium, and relates to the field of image processing, and the method comprises the steps: obtaining an infrared image and a visible light image of a same target scene; performing brightness fusion on the infrared image and the visible light image to obtain a brightness fusion image; determining a currently required color fusion style, and performing color fusion of a corresponding style on the infrared image and the visible light image based on the color fusion style to obtain a color fusion image; and determining a final fusion image based on the brightness fusion image and the color fusion image. According to the invention, for color fusion, the currently required color fusion style needs to be determined firstly, then color fusion of the corresponding style is performed on the infrared image and the visible light image, and then the final fusion image is obtained by combining the brightness fusion image and the color fusion image determined based on the currently required color fusion style. Therefore, the adaptability of image fusion to different environments and scenes is improved, and the quality of image fusion is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to an image fusion method, device and storage medium. Background Art

[0002] Infrared images can highlight the high thermal features and contour features of objects in low-brightness environments, but lack color information; visible light images have rich detail features in well-lit environments. Therefore, the fusion of infrared images and visible light images aims to combine the advantages of the two modal images to obtain a fused image with richer details. However, since the image shooting environment changes in real time, the fused image style obtained by using the same fusion method in different environments is consistent, and it cannot adapt well to the fusion of infrared images and visible light images in different environments. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide an image fusion method, device and storage medium, which can first determine the currently required color fusion style, then perform color fusion of the infrared image and the visible light image in the corresponding style, and then combine the brightness fusion image and the color fusion image determined based on the currently required color fusion style to obtain the final fusion image, thereby improving the adaptability of image fusion to different environments and scenes and ensuring the quality of image fusion. The specific scheme is as follows:

[0004] In a first aspect, the present application provides an image fusion method, comprising:

[0005] Acquire infrared images and visible light images of the same target scene;

[0006] Performing brightness fusion on the infrared image and the visible light image to obtain a brightness fused image;

[0007] Determine a currently required color fusion style, and perform color fusion of a corresponding style on the infrared image and the visible light image based on the color fusion style to obtain a color fusion image;

[0008] A final fused image is determined based on the brightness fused image and the color fused image.

[0009] Optionally, performing brightness fusion on the infrared image and the visible light image to obtain a brightness fused image includes:

[0010] The infrared brightness channel data and the visible light brightness channel data are brightness-fused using a preset fusion network to obtain a brightness-fused image;

[0011] The infrared brightness channel data is brightness channel data extracted from the infrared image; and the visible light brightness channel data is brightness channel data extracted from the visible light image.

[0012] Optionally, the using a preset fusion network to perform brightness fusion on the infrared brightness channel data and the visible light brightness channel data to obtain a brightness fused image includes:

[0013] Using a first input branch in a preset fusion network to perform multi-layer cross fusion on the infrared brightness channel data and the visible light brightness channel data, and using a second input branch in the preset fusion network to perform multi-layer cross fusion on the infrared brightness channel data and the visible light brightness channel data;

[0014] The outputs of the first input branch and the second input branch are multi-scale fused through the output branch in the preset fusion network to obtain a brightness fused image.

[0015] Optionally, determining the currently required color fusion style includes:

[0016] Determine the currently required color fusion style based on the color fusion style selection instruction input by the user;

[0017] Or, the currently required color fusion style is determined based on the environmental information of the target scene; the environmental information includes the ambient brightness.

[0018] Optionally, the determining a currently required color fusion style based on the environmental information of the target scene includes:

[0019] Obtaining the current ambient brightness of the target scene, and determining whether the ambient brightness is greater than a preset brightness threshold;

[0020] If the ambient brightness is greater than the preset brightness threshold, determining that the color fusion style is a color weighted fusion style;

[0021] If the ambient brightness is not greater than the preset brightness threshold, determining that the color fusion style is a color difference fusion style;

[0022] Accordingly, the color fusion of the infrared image and the visible light image in a corresponding style based on the color fusion style to obtain a color fusion image includes:

[0023] If the color fusion style is a color weighted fusion style, weighted fusion is performed on the color channel data respectively extracted from the infrared image and the visible light image to obtain a color space weighted fusion image;

[0024] If the color fusion style is a color difference fusion style, difference fusion is performed on the brightness channel data respectively extracted from the infrared image and the visible light image to obtain a color space difference fusion image.

[0025] Optionally, the method further includes:

[0026] Fusing the contours of the object in the infrared image and the visible light image into a target image to obtain a contour fused image;

[0027] The target image is any one of the infrared image, the visible light image, the brightness fusion image, the color fusion image and the final fusion image.

[0028] Optionally, acquiring an infrared image and a visible light image of the same target scene includes:

[0029] Acquire a time-aligned infrared image and a visible light image for the same target scene from the infrared image queue and the visible light image queue;

[0030] spatially adjusting the time-aligned infrared image and the visible light image to obtain the time- and space-aligned infrared image and the visible light image;

[0031] The difference between the time stamps of the time-aligned infrared image and the visible light image is less than a preset difference; and the space-aligned infrared image and the visible light image have the same field of view and size.

[0032] Optionally, acquiring the time-aligned infrared image and visible light image for the same target scene from the infrared image queue and the visible light image queue includes:

[0033] Acquire an initial infrared image and an initial visible light image for the same target scene from the infrared image queue and the visible light image queue respectively, so as to obtain a current image to be compared;

[0034] Compare the timestamps of the current images to be compared. If the difference between the timestamps is not less than the preset difference, obtain the next image for the same target scene from the queue of the image with the smallest timestamp among the current images to be compared.

[0035] A new current image to be compared is determined based on the next image and the image with the largest timestamp among the current images to be compared, and the process jumps to the step of comparing the timestamps of the current images to be compared until the difference between the timestamps is less than a preset difference, so as to obtain a time-aligned infrared image and a visible light image for the same target scene based on the latest current image to be compared.

[0036] In a second aspect, the present application provides an image fusion device, comprising:

[0037] An image acquisition module, used to acquire infrared images and visible light images of the same target scene;

[0038] A brightness fusion module, used for performing brightness fusion on the infrared image and the visible light image to obtain a brightness fused image;

[0039] A color fusion module, used to determine a currently required color fusion style, and perform color fusion of a corresponding style on the infrared image and the visible light image based on the color fusion style to obtain a color fusion image;

[0040] An image determination module is used to determine a final fused image based on the brightness fused image and the color fused image.

[0041] In a third aspect, the present application provides an electronic device, including:

[0042] Memory, used to store computer programs;

[0043] A processor is used to execute the computer program to implement the aforementioned image fusion method.

[0044] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned image fusion method when executed by a processor.

[0045] In the present application, an infrared image and a visible light image of the same target scene are acquired; brightness fusion is performed on the infrared image and the visible light image to obtain a brightness fusion image; the currently required color fusion style is determined, and based on the color fusion style, the infrared image and the visible light image are color fused in a corresponding style to obtain a color fusion image; a final fusion image is determined based on the brightness fusion image and the color fusion image. It can be seen that for color fusion, the present application needs to first determine the currently required color fusion style, and then perform color fusion of the infrared image and the visible light image in a corresponding style according to the currently required color fusion style, thereby avoiding the use of the same color fusion style in different environments; and then further combine the brightness fusion image and the color fusion image determined based on the currently required color fusion style to obtain the final fusion image, which can improve the adaptability of image fusion to different environments and scenes and ensure the quality of image fusion. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0047] Figure 1 This is a flow chart of an image fusion method disclosed in this application;

[0048] Figure 2 A schematic diagram of an image disclosed in this application;

[0049] Figure 3 A schematic diagram of an image queue disclosed in this application;

[0050] Figure 4 This is a schematic diagram of a spatial alignment function module disclosed in this application;

[0051] Figure 5 This is an image brightness fusion flow chart disclosed in this application;

[0052] Figure 6 A fusion network structure diagram disclosed in this application;

[0053] Figure 7 This is a schematic diagram of the structure of an image fusion device disclosed in this application;

[0054] Figure 8 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0056] Since the image shooting environment changes in real time, and the style of the fused image obtained by using the same fusion method in different environments is consistent, it cannot adapt well to the fusion of infrared images and visible light images in different environments. To this end, the present application provides an image fusion method, which first determines the currently required color fusion style, then performs color fusion of the infrared image and the visible light image in the corresponding style, and then combines the brightness fusion image and the color fusion image determined based on the currently required color fusion style to obtain the final fused image, thereby improving the adaptability of image fusion to different environments and scenes and ensuring the quality of image fusion.

[0057] See also Figure 1 As shown, an embodiment of the present invention discloses an image fusion method, including:

[0058] Step S11, acquiring an infrared image and a visible light image of the same target scene.

[0059] In this embodiment, the infrared sensor and the visible light sensor are pre-aligned with the same target area, so that the infrared sensor and the visible light sensor are used to collect images of the same target area, thereby obtaining an infrared image and a visible light image of the same target scene.

[0060] In order to avoid the deviation of infrared images and visible light images for the same target scene in time and space, this embodiment sets an infrared image queue and a visible light image queue to first save the infrared image collected by the infrared sensor to the end of the infrared image queue, and save the visible light image collected by the visible light sensor to the end of the visible light image queue. Then, the infrared image and visible light image aligned in time and space for the same target scene are obtained from the infrared image queue and the visible light image queue. It should be noted that the infrared image and the visible light image have corresponding timestamp information when they are collected. In this way, this embodiment can eliminate the deviation of infrared images and visible light images in time and space by using infrared images and visible light images aligned in time and space for the same target scene.

[0061] Step S12: performing brightness fusion on the infrared image and the visible light image to obtain a brightness fused image.

[0062] In this embodiment, for image brightness fusion, the brightness channel data is extracted from the infrared image to obtain infrared brightness channel data, and the brightness channel data is extracted from the visible light image to obtain visible light brightness channel data. Then, a preset fusion network is used to perform brightness fusion on the infrared brightness channel data and the visible light brightness channel data to obtain a brightness fused image.

[0063] According to one of the embodiments, for the extraction of brightness channel data, the infrared image and the visible light image can be converted into YUV format, and the image data of the Y channel can be extracted from the infrared image and the visible light image in YUV format respectively, so as to obtain the infrared brightness channel data and the visible light brightness channel data.

[0064] Step S13: determining a currently required color fusion style, and based on the color fusion style, performing color fusion of a corresponding style on the infrared image and the visible light image to obtain a color fusion image.

[0065] In this embodiment, it is considered that the image performance characteristics are different under different ambient brightness conditions. For example, when the ambient brightness is low, the brightness of the image will be more obvious than the color of the image, and the fused image lacks rich texture features. However, when the ambient brightness is high, the color of the image will be more obvious than the brightness of the image, and an image with rich texture features can be fused. Therefore, before color fusion of the image, this embodiment needs to first determine the currently required color fusion style, and then perform color fusion of the infrared image and the visible light image in the corresponding style based on the currently required color fusion style, so as to obtain a color fusion image. In this way, by performing image color fusion based on the currently required color fusion style, the adaptability of image fusion to different environments and scenes can be improved, and the quality of image fusion can be guaranteed.

[0066] It should be noted that there is no obvious order relationship between image color fusion and image brightness fusion. Image brightness fusion can be performed first and then image color fusion, or image color fusion can be performed first and then image brightness fusion, or image brightness fusion and image color fusion can be performed at the same time.

[0067] Among them, in determining the currently required color fusion style, in a specific implementation, the currently required color fusion style can be determined based on the color fusion style selection instruction input by the user. For example, the selection buttons configured for each color fusion style can be displayed through the style selection interface; the user can select the desired color fusion style by clicking the selection button or touching the screen on the style selection interface; accordingly, when the style selection interface detects a click event or a touch screen event, it can obtain the color fusion style selection instruction corresponding to the click event or the touch screen event, and then determine the currently required color fusion style based on the color fusion style selection instruction.

[0068] In another specific implementation, the currently required color fusion style can be determined based on the environmental information of the target scene, wherein the environmental information includes the environmental brightness. The environmental brightness can be the image brightness determined from the infrared image and / or the visible light image, or the environmental brightness of the target scene collected by a brightness sensor.

[0069] Further, the color fusion style currently required is determined based on the environmental information of the target scene, including: obtaining the environmental brightness of the target scene, and judging whether the environmental brightness is greater than a preset brightness threshold; if the environmental brightness is greater than the preset brightness threshold, the color fusion style is determined to be a color weighted fusion style; if the environmental brightness is not greater than the preset brightness threshold, the color fusion style is determined to be a color difference fusion style. Among them, the preset brightness threshold can be set by the user according to the actual image fusion requirements. It should be noted that if the environmental brightness is greater than the preset brightness threshold, that is, the current lighting is sufficient, an image with rich texture features can be fused, and more details can be obtained through color weighted fusion at this time; if the environmental brightness is not greater than the preset brightness threshold, that is, the current lighting is poor, the fused image lacks rich texture features, and the color features are less, and it is difficult to highlight the fused object. At this time, the fused object can be well highlighted through color difference fusion. In this way, by adopting different color fusion styles for different environmental brightness, differentiated color fusion is achieved, and the adaptability of color fusion images to different environments is improved.

[0070] According to one of the embodiments, if the color fusion style is a weighted color fusion style, the color channel data extracted from the infrared image and the visible light image are weightedly fused to obtain a color space weighted fusion image. Specifically, based on the color channel data in the infrared image and the color channel data in the visible light image, the color values ​​between the corresponding pixels in the infrared image and the visible light image are determined, and the color values ​​between the corresponding pixels are weighted averaged to obtain the weighted color values ​​of the corresponding pixels; finally, the color space weighted fusion image is determined based on the weighted color values ​​of the corresponding pixels. The corresponding pixels refer to the pixels at the same position in the infrared image and the visible light image.

[0071] According to another embodiment, if the color fusion style is a color difference fusion style, the brightness channel data extracted from the infrared image and the visible light image are difference fused to obtain a color space difference fused image. Specifically, the brightness difference between corresponding pixels is determined based on the brightness channel data in the infrared image and the visible light image, and the brightness difference and the inverse of the brightness difference are mapped to obtain a color space difference fused image.

[0072] Among them, for the color space difference fusion image, first determine the brightness value between the corresponding pixels based on the brightness channel data in the infrared image and the brightness channel data in the visible light image, and determine the brightness difference based on the brightness value between the corresponding pixels, then offset the brightness difference to obtain a first offset value, and offset the opposite of the brightness difference to obtain a second offset value; wherein the first offset value and the second offset value are both positive numbers. Then, weighted processing is performed on the first offset value and the second offset value to obtain the color value of the corresponding pixel, and finally the color space difference fusion image can be obtained based on the color value of the corresponding pixel. Among them, offset refers to transforming the brightness difference or the opposite of the brightness difference based on the offset, and the transformation includes one or a combination of increase, decrease, multiplication, and division.

[0073] Step S14: determining a final fused image based on the brightness fused image and the color fused image.

[0074] In this embodiment, after obtaining the brightness fusion image and the color fusion image, the brightness fusion image and the color fusion image are fused to obtain a final fusion image. In this way, the advantages of the infrared image and the visible light image can be combined through the final fusion image, thereby obtaining richer image details.

[0075] Furthermore, the present embodiment can also extract the contour of the object from the infrared image and the visible light image, and fuse the contour of the object in the infrared image and the visible light image into the target image to obtain a contour fused image. The target image is any one of the infrared image, the visible light image, the brightness fused image, the color fused image, and the final fused image. It should be noted that the contour fused image obtained by fusing the object contour into the target image is consistent with the color of the target image.

[0076] According to one of the embodiments, for the extraction of object contours, the object contours can be extracted from infrared images and visible light images through segmentation algorithms and morphological processing algorithms. In addition, the object contours can be assigned colors through color templates, such as yellow, green, cyan and other colors, so that the object contours can be displayed separately from the image. In addition, the object contours can also be highlighted or displayed using contour lines; wherein the contour lines include solid lines and dotted lines. It should be noted that the above-mentioned color assignments, highlighting and contour lines are all for the purpose of making the object contours in the image distinguishable from the image for display. Of course, other methods can also be used, which are not limited here.

[0077] by Figure 2 For example, Figure 2 (a) is an infrared image. Figure 2 (b) is the visible light image, Figure 2 (a) and Figure 2 (b) Temporally and spatially aligned infrared and visible light images of the same target scene. Figure 2 (c) is a brightness fusion image obtained by fusing the brightness channel data in the infrared image and the visible light image; Figure 2 (d) is a color space weighted fusion image obtained by weighted fusion of color channel data in infrared image and visible light image; Figure 2 (e) is the color space difference fusion image obtained by difference fusion of the brightness channel data in the infrared image and the visible light image. Figure 2 (f) is the contour fusion image obtained by fusing the object contours in the infrared image and the visible light image into the visible light image.

[0078] Furthermore, the present embodiment can also set an image switching interface, and a corresponding image switching button is set for each image on the image switching interface, so that the user can freely switch the image he wants to view by clicking the image switching button on the image switching interface. For example, the user can switch to the infrared image by clicking the infrared image switching button; the brightness fusion image switching button can be switched to the brightness fusion image; the color space weighted fusion image switching button can be switched to the color space weighted fusion image; the contour fusion image switching button can be switched to the contour fusion image; the final fusion image switching button can be switched to the final fusion image determined based on the brightness fusion image and the color fusion image. That is, each image corresponds to an image switching button, and by clicking the image switching button, the user can freely switch the image for viewing. Of course, the infrared image, the visible light image and all the fusion images can be displayed on the same interface at the same time, or the part of the image selected by the user can be displayed on the same interface at the same time, so as to facilitate the user to compare.

[0079] In addition, the present embodiment may also set an image saving interface, and set a one-key save button, a batch save button, and image save buttons corresponding to each image on the image saving interface, so that the user can save images according to their own personalized needs. Specifically, the user can save all infrared images, visible light images, and all fused images by clicking the one-key save button on the image saving interface; the selected images can be saved in batches by clicking the batch save button after selecting one or more images to be saved; and the corresponding single image can be saved by clicking the image save button corresponding to each image.

[0080] It should also be noted that the acquisition of the infrared image and the visible light image of the same target scene in step S11 may specifically include:

[0081] Step S111: Obtain temporally aligned infrared images and visible light images for the same target scene from the infrared image queue and the visible light image queue; wherein, the difference between the timestamps of the temporally aligned infrared images and visible light images is less than a preset difference.

[0082] Step S112: Perform spatial adjustment on the temporally aligned infrared images and visible light images to obtain the temporally and spatially aligned infrared images and visible light images; wherein, the spatially aligned infrared images and visible light images have the same field of view angle and size.

[0083] In this embodiment, first obtain temporally aligned infrared images and visible light images for the same target scene from the infrared image queue and the visible light image queue; wherein, the difference between the timestamps of the temporally aligned infrared images and visible light images is less than a preset difference. Then perform spatial adjustment on the temporally aligned infrared images and visible light images to obtain the temporally and spatially aligned infrared images and visible light images for the same target scene; wherein, the spatially aligned infrared images and visible light images have the same field of view angle and size.

[0084] It should be noted that the preset difference can be either a value determined based on FPS (Frame Per Second) or a value preset by the user, and no specific limitation is made here. Taking the preset difference as a value determined based on FPS (frames per second) as an example, the difference between the timestamps of the temporally aligned infrared images and visible light images being less than the preset difference can be expressed as Tstamp ir -Tstamp vi <T, (T = 1 / (FPS * 2)). Wherein, Tstamp ir represents the timestamp of the infrared image, and Tstamp vi represents the timestamp of the visible light image, and T represents the preset difference.

[0085] Among them, for obtaining the time-aligned infrared image and visible light image for the same target scene from the infrared image queue and the visible light image queue, it can specifically include: obtaining the initial infrared image and the initial visible light image for the same target scene from the head of the infrared image queue and the head of the visible light image queue, respectively, to obtain the current image to be compared. Then, the timestamps of the current images to be compared are compared. If the difference between the timestamps of the current images to be compared is less than the preset difference, the time-aligned infrared image and visible light image for the same target scene are determined based on the current images to be compared, that is, the current images to be compared are used as the time-aligned infrared image and visible light image for the same target scene. If the difference between the timestamps of the current images to be compared is not less than the preset difference, the next image for the same target scene is obtained from the queue where the image with the smallest timestamp in the current images to be compared is located, that is, the image to be replaced with the smallest timestamp in the current images to be compared is determined, and the next image for the same target scene is obtained from the head of the queue where the image to be replaced is located; then, a new current image to be compared is determined based on the next image and the reference image with the largest timestamp in the current images to be compared, and the process jumps again to the above step of comparing the timestamps of the current image to be compared.

[0086] by Figure 3 For example, a number of infrared images are stored in the infrared image queue in chronological order, and a number of visible light images are stored in the visible light image queue in chronological order. Infrared image 1 and visible light image 1 for the same target scene are obtained from the head of the infrared image queue and the head of the visible light image queue respectively. If the difference between the timestamps of infrared image 1 and visible light image 1 is greater than or equal to the preset difference, it is considered that infrared image 1 and visible light image 1 do not meet the time alignment condition, and visible light image 1 with a larger timestamp is used as a reference image, and the next image for the same target scene, that is, infrared image 2, is obtained from the head of the infrared image queue where infrared image 1 with a smaller timestamp is located. Then, the timestamps of infrared image 2 and visible light image 1 are compared again. If the difference between the timestamps of infrared image 2 and visible light image 1 is less than the preset difference, it is considered that infrared image 2 and visible light image 1 meet the time alignment condition. At this time, infrared image 2 and visible light image 1 are the infrared image and visible light image that are time-aligned for the same target scene. Furthermore, infrared image 3 and visible light image 2 for the same target scene are obtained from the head of the infrared image queue and the head of the visible light image queue respectively, and the above timestamp comparison process is repeated to continuously obtain time-aligned infrared images and visible light images for the same target scene.

[0087] Among them, spatially adjusting the time-aligned infrared image and visible light image to obtain the time-aligned and space-aligned infrared image and visible light image may specifically include: Figure 4As shown, after obtaining the time-aligned infrared image and visible light image, the spatial alignment function module is turned on to use the infrared image as a reference image, and the visible light image is adjusted by arrow keys and / or rotation keys and / or image scaling and / or image cropping, so as to obtain a visible light image with the same field of view and size as the infrared image, that is, the time- and space-aligned infrared image and visible light image can be obtained. The arrow keys include but are not limited to the four keys of up, down, left, and right.

[0088] It can be seen that this embodiment can eliminate the deviation of infrared images and visible light images in time and space by obtaining infrared images and visible light images that are aligned in time and space for the same target scene; and, for color fusion, this embodiment needs to first determine the currently required color fusion style, and then perform color fusion of the infrared image and the visible light image in the corresponding style according to the currently required color fusion style, so as to avoid using the same color fusion style in different environments; and then further combine the brightness fusion image and the color fusion image determined based on the currently required color fusion style to obtain the final fused image, which can improve the adaptability of image fusion to different environments and scenes and ensure the quality of image fusion. In addition, this embodiment also realizes the free switching and saving of images by setting an image switching interface and an image saving interface.

[0089] Based on the previous embodiment, it can be known that the previous embodiment describes the overall process of determining the final fused image based on the brightness fused image and the color fused image. Next, this embodiment will elaborate on how to perform image brightness fusion. Figure 5 As shown, an embodiment of the present invention discloses a process of image brightness fusion, including:

[0090] Step S21: Acquire an infrared image and a visible light image of the same target scene.

[0091] Step S22: extracting brightness channel data from the infrared image and the visible light image respectively to obtain infrared brightness channel data and visible light brightness channel data.

[0092] In this embodiment, infrared images and visible light images that are aligned in time and space for the same target scene are obtained from the infrared image queue and the visible light image queue, and the infrared images and visible light images that are aligned in time and space are converted into YUV format. Then, the image data of the Y channel, that is, the image data of the brightness channel, are decomposed from the infrared images and visible light images in the YUV format, thereby obtaining infrared brightness channel data and visible light brightness channel data.

[0093] Step S23, using the first input branch in the preset fusion network to perform multi-layer cross fusion on the infrared brightness channel data and the visible light brightness channel data, and using the second input branch in the preset fusion network to perform multi-layer cross fusion on the infrared brightness channel data and the visible light brightness channel data.

[0094] Step S24: performing multi-scale fusion on the outputs of the first input branch and the second input branch through the output branch in the preset fusion network to obtain a brightness fused image.

[0095] In this embodiment, the infrared brightness channel data and the visible light brightness channel data are input into a preset fusion network, so that the preset fusion network is used to perform brightness fusion on the infrared brightness channel data and the visible light brightness channel data, thereby obtaining a brightness fused image.

[0096] Before using the preset fusion network, it is necessary to complete the training of the preset fusion network. Specifically, the initial fusion network with pre-configured hyperparameters is iteratively trained using the training set and based on the preset loss function to obtain several fusion networks; during the iterative training process, several fusion networks are evaluated to select the preset fusion network that meets the preset evaluation conditions from the several fusion networks. Among them, the preset loss function can be a loss function constructed based on the structural similarity loss function and the gradient loss function; the preset evaluation condition can be an evaluation condition constructed based on the structural similarity index (SSIM) and the pixel-level image fusion quality evaluation index (Qabf).

[0097] According to one of the embodiments, a preset evaluation index is constructed based on a structural similarity index and a pixel-level image fusion quality evaluation index, and a plurality of fusion networks are evaluated using the preset evaluation index to obtain evaluation index values ​​corresponding to the plurality of fusion networks, respectively, and then a fusion network with the largest evaluation index value is selected from the plurality of fusion networks as the preset fusion network.

[0098] In this embodiment, for the preset loss function, specifically, the structural similarity loss is calculated based on the predicted brightness fusion image output by the fusion network and the corresponding true brightness fusion image, and the gradient loss is calculated based on the maximum gradient corresponding to the predicted brightness fusion image and the maximum gradient corresponding to the true brightness fusion image, and then the structural similarity loss and the gradient loss are weighted averaged to obtain the final loss.

[0099] For the construction of the training set, infrared images and visible light images that are aligned in time and space are collected; wherein, the infrared images and visible light images that are aligned in time and space correspond to the same scene. Then, the infrared images and visible light images that are aligned in time and space are converted into YUV format, so as to extract two modes of brightness channel data from the infrared images and visible light images in YUV format, namely, infrared brightness channel data and visible light brightness channel data, respectively, so as to obtain brightness image data pairs based on the infrared brightness channel data and visible light brightness channel data. By performing image enhancement on the brightness image data pairs, a richer brightness image data pair is obtained, and the image data in the brightness image data pairs is normalized, so as to normalize the pixel values ​​corresponding to each pixel point to between [0,1]; wherein, image enhancement includes but is not limited to cropping, rotation, mirroring, scaling, brightness enhancement according to a certain ratio, etc. It should be noted that for each brightness image data pair, the brighter pixels in the infrared brightness channel data are extracted, and the brightness values ​​of the remaining pixels in the infrared brightness channel data and the corresponding pixels in the visible light brightness channel data are weighted averaged to obtain the brightness values ​​corresponding to the remaining pixels, and the true brightness fusion image is obtained based on the brightness values ​​corresponding to the brighter pixels and the brightness values ​​corresponding to the remaining pixels. After that, a training set can be constructed based on the brightness image data pairs and the corresponding true brightness fusion images. It should be noted that the image sizes of the infrared images and visible light images aligned in time and space are the same, for example, the image width can be 640 and the image height can be 480.

[0100] The preset fusion network is specifically a fusion network constructed based on an encoder and a decoder, and the encoder adopts a dual-tower structure with two inputs. Specifically, the infrared brightness channel data and the visible light brightness channel data are cross-fused in multiple layers using the first input branch in the preset fusion network, and the infrared brightness channel data and the visible light brightness channel data are cross-fused in multiple layers using the second input branch in the preset fusion network, and then the output branch in the preset fusion network is used to perform multi-scale fusion on the outputs of the first input branch and the second input branch, so as to obtain a brightness fusion image.

[0101] For multi-layer cross fusion, since the structures of the first input branch and the second input branch in the preset fusion network are the same, each input branch includes multiple convolution modules, and a residual convolution module is also included between every two convolution modules. It should be noted that the convolution module is used to extract features from the input data; the residual convolution module is used to fuse the outputs of the previous convolution modules in the two input branches. Specifically, by inputting the infrared brightness channel data into the first input branch, and the visible light brightness channel data into the second input branch, the outputs of the previous convolution modules in the first input branch and the second input branch are respectively fused through the residual convolution modules contained in each, and after the last convolution modules in the first input branch and the second input branch respectively extract features from the outputs of their respective previous residual convolution modules, multi-layer cross fusion is completed.

[0102] For multi-scale fusion, the output branch in the preset fusion network includes multiple upsampling convolution modules, and a convolution module is included between every two upsampling convolution modules. The output of the previous convolution module in the output branch and the output of the corresponding layer in the two input branches are fused through the upsampling convolution module in the output branch, and the output of the previous upsampling convolution module in the output branch is feature extracted through the convolution module in the output branch. After the last upsampling convolution module in the output branch is fused, multi-scale fusion is completed to obtain a brightness fused image.

[0103] by Figure 6For example, the preset fusion network adopts a U-shaped network structure including an encoder and a decoder, wherein the encoder uses a dual-tower structure with two inputs, and each input branch in the dual-tower structure of the encoder contains 3 convolution modules, and a residual convolution module is included between every two convolution modules. Among them, the convolution module in the input branch contains a convolution layer with a step size of 2, and the output channel is twice the input channel. The convolution module in the input branch is used for two times downsampling and doubling the number of channels; the residual convolution module in the input branch contains two convolution kernels of size 3. Among them, the residual convolution module in any input branch uses the output of the previous convolution module in the two input branches as input at the same time to fuse the infrared brightness channel data and the visible light brightness channel data; for example, the residual convolution module 11 fuses the outputs of the convolution module 11 and the convolution module 21. And after any input branch is cross-fused with two residual convolution modules, the last convolution module further extracts features from the output of the previous residual convolution module, thereby completing the multi-layer feature fusion of the encoder. Moreover, the outputs of the corresponding two convolution modules in the two input branches can be used as the input of the corresponding upsampling convolution module in the decoder after concat and convolution layer channel compression. For example, the outputs of the convolution module 11 and the convolution module 21 in the two input branches can be used as the input of the upsampling convolution module 31 in the decoder after concat and convolution layer channel compression.

[0104] The decoder in the preset fusion network includes three upsampling convolution modules, and a convolution module is included between every two upsampling convolution modules; wherein the convolution module in the output branch includes a convolution layer with a step size of 1. The upsampling convolution module includes a Concat splicing layer, a convolution layer, an upsampling layer and a convolution layer in sequence. Specifically, the outputs of the corresponding two convolution modules in the two input branches of the encoder are concat spliced ​​and compressed by the convolution layer channel to obtain a splicing feature, and then the upsampling convolution module receives the splicing feature and the output of the previous convolution module from the output branch as input, and obtains the output of the upsampling convolution module after splicing by the Concat splicing layer, channel compression of the convolution layer, double upsampling of the upsampling layer to scale the feature map size, and feature extraction of the convolution layer. It should be noted that after being processed by the last upsampling convolution module 31 in the output branch, the final brightness fusion image can be obtained. That is, the number of output channels of the upsampling convolution module 31 in the output branch of the decoder is 1, which is used to obtain a single-channel brightness fusion image. For example, the outputs of the convolution module 11 and the convolution module 21 in the two input branches are concatenated and compressed through the convolution layer channels to obtain a concatenated feature, and the concatenated feature is used as the input of the upsampling convolution module 31 in the output branch of the decoder. At the same time, the output of the previous convolution module 31 in the output branch is also used as the input of the upsampling convolution module 31. The two inputs are then processed by the upsampling convolution module 31 to obtain the final brightness fused image.

[0105] It can be seen that this embodiment can eliminate the deviation of the infrared image and the visible light image in time and space by acquiring the infrared image and the visible light image aligned in time and space; and, this embodiment performs image fusion on the brightness channel data extracted from the infrared image and the visible light image through a fusion network, so as to obtain a brightness fused image with richer details; further, this embodiment can greatly improve the quality of image fusion by adopting a dual-tower structure fusion network to perform multi-layer cross-fusion on the infrared brightness channel data and the visible light brightness channel data.

[0106] See also Figure 7 As shown, an embodiment of the present invention discloses an image fusion device, comprising:

[0107] An image acquisition module 11 is used to acquire an infrared image and a visible light image of the same target scene;

[0108] A brightness fusion module 12, used for performing brightness fusion on the infrared image and the visible light image to obtain a brightness fused image;

[0109] A color fusion module 13 is used to determine a currently required color fusion style, and perform color fusion of a corresponding style on the infrared image and the visible light image based on the color fusion style to obtain a color fusion image;

[0110] The image determination module 14 is configured to determine a final fused image based on the brightness fused image and the color fused image.

[0111] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.

[0112] It can be seen that for color fusion, the present application needs to first determine the currently required color fusion style, and then perform color fusion of the infrared image and the visible light image in the corresponding style according to the currently required color fusion style, so as to avoid using the same color fusion style in different environments; then further combine the brightness fusion image and the color fusion image determined based on the currently required color fusion style to obtain the final fused image, which can improve the adaptability of image fusion to different environments and scenes and ensure the quality of image fusion.

[0113] Furthermore, the present application also discloses an electronic device. Figure 8 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0114] Figure 8 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the image fusion method disclosed in any of the above embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0115] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0116] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0117] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, and may be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the image fusion method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.

[0118] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed image fusion method. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.

[0119] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0120] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0121] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0122] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0123] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An image fusion method, characterized in that: include: Acquire infrared images and visible light images of the same target scene; Performing brightness fusion on the infrared image and the visible light image to obtain a brightness fused image; Determine a currently required color fusion style, and perform color fusion of a corresponding style on the infrared image and the visible light image based on the color fusion style to obtain a color fusion image; A final fused image is determined based on the brightness fused image and the color fused image.

2. The image fusion method according to claim 1, characterized in that: The performing brightness fusion on the infrared image and the visible light image to obtain a brightness fused image includes: The infrared brightness channel data and the visible light brightness channel data are brightness-fused using a preset fusion network to obtain a brightness-fused image; The infrared brightness channel data is brightness channel data extracted from the infrared image; and the visible light brightness channel data is brightness channel data extracted from the visible light image.

3. The image fusion method according to claim 2, characterized in that: The method of using a preset fusion network to perform brightness fusion on infrared brightness channel data and visible light brightness channel data to obtain a brightness fused image includes: Using a first input branch in a preset fusion network to perform multi-layer cross fusion on the infrared brightness channel data and the visible light brightness channel data, and using a second input branch in the preset fusion network to perform multi-layer cross fusion on the infrared brightness channel data and the visible light brightness channel data; The outputs of the first input branch and the second input branch are multi-scale fused through the output branch in the preset fusion network to obtain a brightness fused image.

4. The image fusion method according to claim 1, characterized in that: The step of determining the currently required color fusion style includes: Determine the currently required color fusion style based on the color fusion style selection instruction input by the user; Or, the currently required color fusion style is determined based on the environmental information of the target scene; the environmental information includes the ambient brightness.

5. The image fusion method according to claim 4, characterized in that: The determining the currently required color fusion style based on the environmental information of the target scene includes: Obtaining the current ambient brightness of the target scene, and determining whether the ambient brightness is greater than a preset brightness threshold; If the ambient brightness is greater than the preset brightness threshold, determining that the color fusion style is a color weighted fusion style; If the ambient brightness is not greater than the preset brightness threshold, determining that the color fusion style is a color difference fusion style; Accordingly, the color fusion of the infrared image and the visible light image in a corresponding style based on the color fusion style to obtain a color fusion image includes: If the color fusion style is a color weighted fusion style, weighted fusion is performed on the color channel data respectively extracted from the infrared image and the visible light image to obtain a color space weighted fusion image; If the color fusion style is a color difference fusion style, difference fusion is performed on the brightness channel data respectively extracted from the infrared image and the visible light image to obtain a color space difference fusion image.

6. The image fusion method according to claim 1, characterized in that: Also includes: Fusing the contours of the object in the infrared image and the visible light image into a target image to obtain a contour fused image; The target image is any one of the infrared image, the visible light image, the brightness fusion image, the color fusion image and the final fusion image.

7. The image fusion method according to any one of claims 1 to 6, characterized in that: The step of acquiring the infrared image and the visible light image of the same target scene comprises: Acquire a time-aligned infrared image and a visible light image for the same target scene from the infrared image queue and the visible light image queue; spatially adjusting the time-aligned infrared image and the visible light image to obtain the time- and space-aligned infrared image and the visible light image; The difference between the time stamps of the time-aligned infrared image and the visible light image is less than a preset difference; and the space-aligned infrared image and the visible light image have the same field of view and size.

8. The image fusion method according to claim 7, characterized in that: The step of acquiring the time-aligned infrared image and visible light image for the same target scene from the infrared image queue and the visible light image queue includes: Acquire an initial infrared image and an initial visible light image for the same target scene from the infrared image queue and the visible light image queue respectively, so as to obtain a current image to be compared; Compare the timestamps of the current images to be compared. If the difference between the timestamps is not less than the preset difference, obtain the next image for the same target scene from the queue of the image with the smallest timestamp among the current images to be compared. A new current image to be compared is determined based on the next image and the image with the largest timestamp among the current images to be compared, and the process jumps to the step of comparing the timestamps of the current images to be compared until the difference between the timestamps is less than a preset difference, so as to obtain a time-aligned infrared image and a visible light image for the same target scene based on the latest current image to be compared.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the image fusion method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the image fusion method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Visible light image and infrared image fusion method, device and readable storage medium

    CN112767291A

  • Fusion method and system of infrared image and visible light image

    CN115345774A

  • Infrared and visible light image double-domain self-attention interactive fusion method

    CN117788989A

Cited By

  • Color image data processing method based on distributed photoelectric system

    CN119379858A

  • Self-adaptive low-illumination visible light and infrared image fusion method for intelligent reconnaissance equipment

    CN119850440A