Image fusion methods, apparatus, computer equipment and storage media

Through stereo matching and weakening processing of visible light images and near-infrared images, the problem of perspective risk in image fusion is solved and the image quality is improved.

CN112257664BActive Publication Date: 2024-09-06GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011260808.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-12
Publication Date
2024-09-06
Estimated Expiration
2040-11-12

AI Technical Summary

Technical Problem

There is a great risk of perspective when fusing visible light images with near-infrared images in the prior art, especially when the visible light image is taken at close range or contains a target subject.

Method used

By performing stereo matching between the visible light image and the near-infrared image to be fused, a depth image is obtained, and based on the depth image, it is determined whether the visible light image meets the preset conditions. If so, the near-infrared image is weakened to obtain the weakened near-infrared image. image and fuse the visible light image with the attenuated near-infrared image to reduce the risk of perspective.

Benefits of technology

Significantly reduces the risk of perspective in fused images and improves image quality, especially when visible light images are taken at close range or contain target subjects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112257664B
    Figure CN112257664B
Patent Text Reader

Abstract

The present application relates to an image fusion method, device, computer equipment and storage medium. The method obtains a depth image by stereo matching a visible light image to be fused and a near-infrared image to be fused, and determines whether the visible light image meets a preset condition based on the depth image. When the visible light image meets the preset condition, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image, wherein the preset condition characterizes that the visible light image belongs to a close-up image and / or contains a target subject. When the visible light image belongs to a close-up image or contains a target subject, the above method weakens the near-infrared image to weaken the perspective effect of the near-infrared image. Therefore, the image fusion method proposed in the present application can avoid the perspective problem existing in the fused image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image fusion method, apparatus, computer equipment and storage medium. Background Art

[0002] With the popularization of devices with camera functions such as cameras, iPads, and mobile phones, users have increasingly higher requirements for the quality of captured images.

[0003] In order to improve the quality of captured images, a method of fusing multiple different types of captured images has emerged. For example, the industry has proposed that the high brightness of visible light images and the more detailed information contained in near-infrared images can be fully utilized, and the RGB image captured by the visible light image acquisition device and the NIR image captured by the near-infrared image acquisition device can be fused to obtain a fused image with better shooting quality.

[0004] However, due to the strong penetrating power of near-infrared light, there is a great risk of perspective in the fused image. Summary of the invention

[0005] Based on this, it is necessary to provide an image fusion method, device, computer equipment and storage medium that can reduce the risk of perspective in response to the above technical problems.

[0006] In a first aspect, an image fusion method is provided, the method comprising:

[0007] Performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image;

[0008] Determining whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject;

[0009] If so, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image.

[0010] In a second aspect, an image fusion device is provided, the device comprising:

[0011] A matching module, used for performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image;

[0012] A determination module, configured to determine whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject;

[0013] The first fusion module is used to weaken the near-infrared image according to the depth image to obtain a weakened near-infrared image when the visible light image meets a preset condition, and fuse the visible light image and the weakened near-infrared image to obtain a fused image.

[0014] In a third aspect, a computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0015] Performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image;

[0016] Determining whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject;

[0017] If so, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image.

[0018] In a fourth aspect, a computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the following steps are implemented:

[0019] Performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image;

[0020] Determining whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject;

[0021] If so, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image.

[0022] The above-mentioned image fusion method, device, computer equipment and storage medium obtain a depth image by stereo matching the visible light image to be fused and the near-infrared image to be fused, and determine whether the visible light image meets the preset conditions according to the depth image. When the visible light image meets the preset conditions, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image, wherein the preset conditions characterize that the visible light image belongs to a close-up image and / or contains a target subject. In the above-mentioned method, when the visible light image belongs to a close-up image or contains a target subject, the near-infrared image is weakened to weaken the perspective effect of the near-infrared image, and then the weakened near-infrared image and the visible light image are fused to obtain a fused image. Compared with the method of directly fusing the near-infrared image and the visible light image, the image fusion method proposed in this application greatly reduces the perspective risk of the fused image. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is an internal structure diagram of a computer device in one embodiment;

[0024] Figure 2 is a schematic diagram of a flow chart of an image fusion method in one embodiment;

[0025] Figure 3 for Figure 2 A flowchart of an implementation method of S102 in the embodiment;

[0026] Figure 4 for Figure 3 A flowchart of an implementation method of S201 in the embodiment;

[0027] Figure 5 for Figure 3 A flow chart of another implementation method of S201 in the embodiment;

[0028] Figure 6 for Figure 5 A flowchart of an implementation method of S403 in the embodiment;

[0029] Figure 7 for Figure 2 A flow chart of another implementation method of S102 in the embodiment;

[0030] Figure 8 for Figure 2 A flowchart of an implementation method of S103 in the embodiment;

[0031] Fig. 9 for Figure 2 A flowchart of an implementation method of S101 in the embodiment;

[0032] Fig.10 is a schematic diagram of a flow chart of an image fusion method in one embodiment;

[0033] Fig.11 for Figure 2 A flowchart of an implementation method of S103 in the embodiment;

[0034] Fig.12 is a schematic diagram of a flow chart of an image fusion method in one embodiment;

[0035] Fig.13 is a structural block diagram of an image fusion device in one embodiment;

[0036] Fig.14 is a structural block diagram of an image fusion device in one embodiment;

[0037] Fig.15 is a structural block diagram of an image fusion device in one embodiment;

[0038] Fig.16 is a structural block diagram of an image fusion device in one embodiment;

[0039] Fig.17 is a structural block diagram of an image fusion device in one embodiment;

[0040] Fig.18 is a structural block diagram of an image fusion device in one embodiment;

[0041] Fig.19 is a structural block diagram of an image fusion device in one embodiment;

[0042] Fig. 20 is a structural block diagram of an image fusion device in one embodiment;

[0043] Fig.21 is a structural block diagram of an image fusion device in one embodiment;

[0044] Fig. 22 is a structural block diagram of an image fusion device in one embodiment;

[0045] Fig.23 FIG. 4 is a structural block diagram of an image fusion device in an embodiment. DETAILED DESCRIPTION

[0046] 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.

[0047] The image fusion method provided in this application can be applied to Figure 1 In the computer device shown in the figure, the computer device may be a server, or the computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 1 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. 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. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0048] Those skilled in the art will understand that Figure 1 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.

[0049] In one embodiment, Figure 2 As shown, an image fusion method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate, including the following steps:

[0050] S101, stereo matching is performed on the visible light image to be fused and the near infrared image to be fused to obtain a depth image.

[0051] Among them, the visible light image is also called RGB image, and the near infrared image is also called (Near Infrared) NIR image. In this embodiment, the visible light image acquisition device and the near infrared image acquisition device can simultaneously shoot the same target object, and transmit the visible light image and near infrared image obtained after shooting to the computer device respectively. When the computer device acquires the visible light image and the near infrared image, the corresponding stereo matching algorithm can be further used to stereo match the visible light image and the near infrared image to obtain a depth image.

[0052] S102, determining whether the visible light image satisfies a preset condition based on the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject.

[0053] Among them, close-up images refer to images where the distance between the subject and the device that collects the image is within a preset range, and the preset range is pre-set by the computer device, that is, images within the distance range pre-defined by the computer device belong to close-up images, and images outside the distance range do not belong to close-up images. The target subject can be a subject object with vital signs such as a person or an animal, or other subjects that do not require a perspective effect, and this embodiment is not limited to this.

[0054] In this embodiment, when the computer device obtains a depth image based on the aforementioned steps, the depth image can be analyzed, and the visible light image can be determined through the depth image whether the visible light image is a close-up image, or whether the visible light image contains the target subject, or whether the visible light image is both a close-up image and contains the target subject. It should be noted that if the visible light image is a close-up image, it means that the image may have a perspective risk, and if the visible light image contains the target subject, it means that the image may also have a perspective risk.

[0055] S103: If the conditions are met, the near infrared image is weakened according to the depth image to obtain a weakened near infrared image, and the visible light image and the weakened near infrared image are fused to obtain a fused image.

[0056] In practical applications, since near-infrared images have the characteristic of strong perspective, if the near-infrared image and the visible light image are fused, it will bring certain perspective risks to the fused image, especially when the visible light image is a close-up image or includes the target subject, it will bring greater perspective risks to the fused image. Based on this, in this embodiment, when the computer device determines that the visible light image meets the preset conditions, it means that there may be a great perspective risk after the visible light image and the near-infrared image are fused. At this time, the computer device can weaken the near-infrared image according to the depth image to weaken the perspective effect of the near-infrared image, or weaken the fusion strength of the near-infrared image during the later fusion, to reduce the perspective risk brought by the fused near-infrared image, and then use the corresponding image fusion method to fuse the weakened near-infrared image and the visible light image to obtain a fused image. The specific fusion method can adopt the Laplace fusion method, the fusion method based on machine learning, etc., which is not limited here.

[0057] The image fusion method described in the above embodiment obtains a depth image by stereo matching the visible light image to be fused and the near-infrared image to be fused, and determines whether the visible light image meets the preset conditions based on the depth image. When the visible light image meets the preset conditions, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image. In the above method, when the visible light image is a close-range image or contains a target subject, the near-infrared image is weakened to weaken the perspective effect of the near-infrared image, and then the weakened near-infrared image and the visible light image are fused to obtain a fused image. Compared with the method of directly fusing the near-infrared image and the visible light image, the image fusion method proposed in this application greatly reduces the perspective risk of the fused image.

[0058] In practical applications, there is also an application scenario, that is, when the depth image determines that the visible light image does not meet the preset conditions, it means that the visible light image is a long-distance image, or the visible light image does not contain the target subject, which also means that the image after the visible light image and the near-infrared image are fused in this scenario is unlikely to have a perspective risk. Therefore, in this application scenario, the computer device can directly use the corresponding image fusion method to fuse the visible light image and the near-infrared image, without the need to weaken the near-infrared image.

[0059] In one embodiment, when the preset condition indicates that the visible light image is a close-up image, the present application provides a specific implementation of S102, such as Figure 3 As shown, the “determining whether the visible light image meets the preset condition according to the depth image” in the above S102 includes:

[0060] S201, extracting a first distance value of the depth image; the first distance value represents the distance between the photographed object and the visible light image acquisition device; if the first distance value is less than a preset distance value, executing step S202, if the first distance value is not less than the preset distance value, executing step S203.

[0061] Among them, the preset distance value is determined in advance by the computer device according to actual application requirements. When the first distance value of the depth image is less than the preset distance value, it means that the visible light image corresponding to the depth image belongs to a close-up image; when the first distance value of the depth image is not less than the preset distance value, it means that the visible light image corresponding to the depth image does not belong to a close-up image. In this embodiment, when the computer device obtains the depth image, it can further calculate the first distance value according to the depth value of each pixel on the depth image, so as to judge whether the visible light image corresponding to the depth image belongs to a close-up image according to the first distance value.

[0062] S202: Determine whether the visible light image meets a preset condition.

[0063] This embodiment relates to a scenario in which a computer device determines that a visible light image is an image captured at a close distance. In this scenario, the computer device directly determines that the visible light image meets a preset condition. That is, when the first distance value is less than the preset distance value, it indicates that the distance between the photographed object and the device for capturing the visible light image is very close, which is a close-up shot.

[0064] S203: Determine whether the visible light image meets a preset condition.

[0065] This embodiment relates to a scenario in which a computer device determines that a visible light image does not belong to a close-up shot image. In this scenario, the computer device directly determines that the visible light image does not meet a preset condition. That is, when the first distance value is greater than or equal to the preset distance value, it indicates that the distance between the photographed object and the visible light image acquisition device is very far, and the image is shot at a long distance.

[0066] In the above embodiment, since the depth image can reflect the distance between the photographed object and the visible light image acquisition device, the present method provides a way to determine the close-up image using the depth image. The method only requires stereo matching of the visible light image and the near-infrared image in advance to obtain the depth image, and then it can be determined whether the visible light image is a close-up image. Therefore, the method is simple and practical and can improve the image fusion speed.

[0067] Optionally, the above step S201 "extracting the first distance value of the depth image" is as follows: Figure 4 As shown, specifically including:

[0068] S301, extracting the depth value of each pixel in the depth image.

[0069] Among them, the depth value of a pixel in the depth image represents the distance between the corresponding photographed position of the pixel and the acquisition device. The larger the depth value, the farther the distance between the corresponding photographed position of the pixel and the acquisition device, and the smaller the depth value, the closer the distance between the corresponding photographed position of the pixel and the acquisition device.

[0070] In this embodiment, when the computer device acquires the depth image, the depth value of each pixel in the depth image can be further extracted, so as to determine whether the visible light image corresponding to the depth image is a close-up image based on the depth value of each pixel.

[0071] S302: Obtain an average depth value of the pixels in the depth image according to the depth value of each pixel.

[0072] When the computer device extracts the depth value of each pixel in the depth image, it can further calculate the average of these depth values ​​to obtain the average depth value of the pixels in the depth image, so as to then determine whether the visible light image corresponding to the depth image is a close-up image based on the average depth value.

[0073] S303: Determine the average depth value as the first distance value of the depth image.

[0074] When the computer device obtains the average depth value, it is equivalent to obtaining the distance between the photographed device and the acquisition device, that is, the first distance value. The computer device can then determine whether the visible light image is a close-up image based on the first distance value. In this embodiment, since the depth value of each pixel on the depth image can reflect the distance between the shooting position corresponding to each pixel and the acquisition device, and the depth value of each pixel is different, the average depth value can reflect the distance between each object contained in the visible light image and the acquisition device, rather than just the distance between the target object focused on by the acquisition device and the acquisition device. Therefore, the above method can improve the accuracy of the judgment by calculating the average depth value of the depth image to determine whether the visible light image is a close-up image, which is convenient for accurate weakening of the near-infrared image in the later stage.

[0075] Above Figure 3-Figure 4 The embodiment is an implementation method for determining whether a visible light image meets a preset condition. The present application also provides another implementation method for determining whether a visible light image meets a preset condition, such as Figure 5 As shown, the method includes:

[0076] S401, extracting a second distance value from a depth image.

[0077] The second distance value represents the distance between the photographed object and the device for collecting the visible light image. In this embodiment, when the computer device acquires the depth image, the second distance value can be further calculated based on the depth value of each pixel on the depth image, so as to judge whether the visible light image corresponding to the depth image belongs to the close-up image based on the second distance value. It should be noted that the second distance value is different from the aforementioned Figure 3 The first distance value in the embodiments has the same meaning and is obtained in the same manner. For details, please refer to the above description and will not be repeated here.

[0078] S402: Acquire a focus parameter of a device for acquiring a visible light image, and determine a third distance value of the visible light image according to the focus parameter.

[0079] In practical applications, the computer device can determine the distance between the visible light image and the acquisition device by analyzing the focusing parameters of the acquisition device. Therefore, in this embodiment, the computer device can first read the focusing parameters from the acquisition device of the visible light image, and then further analyze the focusing parameters to obtain the distance between the visible light image and the acquisition device, that is, the third distance value.

[0080] S403: Determine whether the visible light image meets a preset condition according to the second distance value and the third distance value.

[0081] When the computer device obtains the second distance value and the third distance value based on steps S401 and S402, it can determine whether the second distance value belongs to the short distance range, and whether the third distance value belongs to the short distance range. When the second distance value and the third distance value both belong to the short distance range, it means that the visible light image was taken at a very close distance to the acquisition device. At this time, the computer device can determine that the visible light image meets the preset conditions.

[0082] Optionally, based on the method described in the above embodiment, the above step S403 "determines whether the visible light image meets the preset condition according to the second distance value and the third distance value", such as Figure 6 As shown, including:

[0083] S501, if the second distance value is less than the preset distance value, execute step S502, if the second distance value is not less than the preset distance value, execute step S503.

[0084] In this embodiment, the computer device first determines the distance between the visible light image and the acquisition device based on the second distance value. That is, when the second distance value is less than the preset distance threshold, it can be preliminarily determined that the visible light image was taken when the distance to the acquisition device is relatively close; and when the second distance value is not less than the preset distance threshold, it means that the visible light image was taken when the distance to the acquisition device is relatively far.

[0085] S502, determine whether the third distance value is less than the preset distance value, if the third distance value is less than the preset distance value, execute step S504, if the third distance value is not less than the preset distance value, execute step S503.

[0086] In practical applications, in order to improve the accuracy of determining whether a visible light image is an image captured at a close distance, this embodiment further determines whether a third distance value is less than a preset distance value when the computer device determines that the second distance value is less than a preset distance value. If the third distance value is also less than the preset distance value, it can be said that the possibility that the visible light image is an image captured at a close distance is relatively high; if the third distance value is not less than the preset distance value, it can be said that the possibility that the visible light image is an image captured at a close distance is relatively low.

[0087] S503: Determine whether the visible light image meets a preset condition.

[0088] This embodiment relates to a scenario in which a computer device determines that a visible light image does not belong to an image taken at a close distance. In this scenario, the computer device determines that the visible light image does not meet a preset condition.

[0089] S504: Determine whether the visible light image meets a preset condition.

[0090] This embodiment relates to a scenario in which a computer device determines that a visible light image is an image taken at a close distance. In this scenario, the computer device determines that the visible light image meets a preset condition.

[0091] In the above embodiment, since the depth image can reflect the distance between the photographed object and the acquisition device of the visible light image, and the focusing parameter of the acquisition device can reflect the distance between the focused photographed object and the acquisition device of the visible light image, the present method provides a method of simultaneously using the depth image and the focusing parameter to determine the close-up image, which can accurately determine whether the visible light image is a close-up image, and thus can effectively reduce the perspective risk of the fused image in the later stage.

[0092] In one embodiment, when the preset condition indicates that the visible light image contains the target subject, the present application provides a specific implementation of the above S102, such as Figure 7 As shown, the “determining whether the visible light image meets the preset condition according to the depth image” in the above S102 includes:

[0093] S601, performing image recognition on the depth image to obtain the type of each subject in the visible light image. If the type of the subject is consistent with the type of the target subject, executing step S602; if the type of the subject is inconsistent with the type of the target subject, executing step S603.

[0094] The photographed subject may be various types of photographed subjects such as people, animals, mountains, buildings, etc. The target subject may be determined in advance by the computer device according to the recognition requirements. In practical applications, since it is not desired that images containing photographed subjects with vital signs such as people and animals have a perspective effect, the target subject is a photographed subject with vital signs such as people and animals.

[0095] In this embodiment, when the computer device acquires the depth image, a corresponding image recognition method or classification method may be used to identify the type of the subject contained in the depth image. Since the depth image is an image obtained by stereo matching the visible light image and the near infrared image, the subject contained in the depth image is the same as the subject contained in the visible light image. Therefore, when the computer device identifies the type of the subject contained in the depth image, it is equivalent to the computer device identifying the type of the subject contained in the visible light image.

[0096] When the computer device identifies the type of each subject in the visible light image, it can further determine whether the type of the subject is consistent with the type of the target subject. If the type of the subject is consistent with the type of the target subject, it means that the visible light image contains subjects with life characteristics such as people or animals; if the type of the subject is inconsistent with the type of the target subject, it means that the visible light image does not contain subjects with life characteristics such as people or animals.

[0097] S602: Determine whether the visible light image meets a preset condition.

[0098] This embodiment relates to a scenario in which a computer device determines that a visible light image contains a target subject. In this scenario, the computer device determines that the visible light image satisfies a preset condition.

[0099] S603: Determine whether the visible light image meets a preset condition.

[0100] This embodiment relates to a scenario in which a computer device determines that a visible light image does not include a target subject. In this scenario, the computer device determines that the visible light image does not meet a preset condition.

[0101] In the above method, since the target subject is a photographic subject with vital signs such as a person or an animal, the above step of determining whether the visible light image contains the target subject is equivalent to determining whether the visible light image contains a person or an animal. Because in practical applications, the smaller the perspective effect of an image containing a photographic subject with vital signs such as a person or an animal, the better, this embodiment uses an image containing a photographic subject with vital signs such as a person or an animal as a preset condition, which can facilitate the subsequent targeted processing of weakening the perspective effect of such images.

[0102] In one embodiment, there is provided Figure 2 One implementation of S103 in the embodiment is as follows: Figure 8 As shown, the above-mentioned "weakening the near-infrared image according to the depth image to obtain a weakened near-infrared image" in S103 includes:

[0103] S701, determining the weight of each pixel point according to the depth value of each pixel point in the depth image, and obtaining a weight distribution map.

[0104] In this embodiment, after the computer device acquires the depth image, the weight of each pixel can be set according to the depth value of each pixel. Specifically, if the depth value of the pixel is larger, the corresponding pixel weight is set larger, indicating that the distance between the corresponding photographed position of the pixel and the acquisition device is farther; if the depth value of the pixel is smaller, the corresponding pixel weight is set smaller, indicating that the distance between the corresponding photographed position of the pixel and the acquisition device is closer. After the computer device determines the weight of each pixel on the depth image, a map, i.e., a weight distribution map, can be obtained.

[0105] S702, performing frequency domain space conversion on the near infrared image to obtain a frequency domain image.

[0106] The frequency domain image is also called a detail image because it contains more high-frequency information in the original image. In this embodiment, when the computer device acquires a near-infrared image, the near-infrared image can be converted into a frequency domain space to extract detail information in the near-infrared image to obtain a frequency domain image.

[0107] S703, performing a weakening process on the pixel value of each pixel point in the frequency domain image according to the weight distribution map to obtain a weakened near-infrared image.

[0108] In this embodiment, when the computer device obtains the weight distribution map and the frequency domain image, the gray value of each pixel in the frequency domain image can be further weakened according to the weight corresponding to each pixel on the weight distribution map to obtain a weakened near-infrared image. Optionally, in the above-mentioned weakening process, the computer device can directly multiply the weight of each pixel on the weight distribution map with the gray value of each pixel on the frequency domain image, and the image obtained after the operation is the weakened near-infrared image. Obviously, the smaller the weight of the pixel, the smaller the gray value of the corresponding weakened pixel in the near-infrared image, indicating that the weakening strength on the pixel is stronger, and the weakening of the gray value (equivalent to the detail information) of the pixel at the close-range shooting position is effectively realized. The above method provides a method for weakening the detail information on the near-infrared image based on the weight distribution map, thereby reducing the fusion strength of the near-infrared image with perspective characteristics in the later fusion with the visible light image, thereby reducing the perspective risk of the fused image.

[0109] In practical applications, before a computer device performs stereo matching on a visible light image and a near-infrared image, the computer device also needs to obtain calibration parameters of the visible light image acquisition device and the near-infrared image acquisition device, so as to use the calibration parameters to achieve stereo matching of the visible light image and the near-infrared image, and to align the visible light image and the near-infrared image. Therefore, in one embodiment, the present application also provides a stereo matching method based on calibration parameters, such as Fig. 9 As shown, the above S101 "stereo-matching the visible light image to be fused and the near infrared image to be fused to obtain a depth image" includes:

[0110] S801, using a preset stereo matching algorithm, stereo matching is performed on the visible light image and the near infrared image according to calibration parameters to obtain a disparity map.

[0111] Among them, the calibration parameters include: distortion coefficient, internal reference and external reference. When the computer device obtains the distortion coefficient, it can first assume the pixel coordinates of the visible light image under ideal conditions, and then calculate the real pixel coordinates according to the position of the acquisition device shooting. According to the correspondence between the real pixel coordinates and the ideal pixel coordinates, the corresponding distortion coefficient can be obtained by using Taylor series expansion. When the computer device obtains the internal reference and external reference, it can first find the conversion relationship between the physical coordinate system of the visible light image and the image pixel coordinate system as relation 1, then find the conversion relationship between the acquisition device coordinate system and the image physical coordinate system as relation 2, and then find the conversion relationship between the world coordinate system and the acquisition device coordinate system as relation 3, and find the relationship between the spatial point projection to the pixel point in the world coordinate system as relation 4. According to the above four relations, the internal reference and external reference of the acquisition device can be obtained. The specific implementation method can refer to Zhang's calibration method. This calibration method belongs to the prior art and is not introduced in detail here.

[0112] In this embodiment, after the computer device obtains the calibration parameters of the visible light image acquisition device and the near infrared image acquisition device, it can use a preset stereo matching algorithm to perform stereo matching on the visible light image and the near infrared image according to the calibration parameters to obtain a disparity map.

[0113] S802, converting the disparity map into a depth map.

[0114] When the computer device obtains the disparity map, it can use the corresponding image conversion method to convert the disparity map into a depth map for subsequent use. The above method provides a method for obtaining a depth image corresponding to a visible light image through a stereo matching method. Since the stereo matching algorithm is relatively mature, the method is simple and practical.

[0115] Accordingly, when the computer device executes Figure 2Before the step of “fusing the visible light image and the weakened near-infrared image” in S103 of the embodiment, the computer device also needs to align the visible light image and the weakened near-infrared image. On this basis, the present application also provides a method for aligning the visible light image and the weakened near-infrared image based on calibration parameters, such as Fig.10 As shown, the method includes:

[0116] S901, converting the visible light image and the weakened near infrared image to the same plane according to the calibration parameters.

[0117] In this embodiment, when the computer device acquires a visible light image and a weakened near-infrared image, the visible light image and the weakened near-infrared image can be converted to the same plane through left and right translation, up and down translation, rotation and other operations, so that the visible light image and the weakened near-infrared image can be accurately fused later.

[0118] S902: Align the visible light image and the weakened near infrared image in the same plane according to a feature point matching method to obtain an aligned visible light image and an aligned near infrared image.

[0119] In this embodiment, when the computer device converts the visible light image and the weakened near-infrared image to the same plane, the feature point matching method can be further used to align the visible light image and the weakened near-infrared image so that the visible light image and the weakened near-infrared image can be accurately fused thereafter, thereby avoiding the phenomenon of ghosting when the images are fused.

[0120] In practical applications, after the computer device aligns the visible light image and the weakened near-infrared image based on the above steps, the aligned visible light image and the aligned near-infrared image can be fused to obtain a fused image.

[0121] In one embodiment, the present application provides a specific implementation method for fusing images, that is, the “fusing the visible light image and the weakened near infrared image to obtain a fused image” in the above S103, such as Fig.11 As shown, including:

[0122] S1001, performing downsampling and convolution operations on the visible light image to obtain a Laplacian pyramid image of the visible light image.

[0123] In this embodiment, when the computer device acquires a visible light image, the computer device may first use the visible light image as a 0-layer image, then downsample the visible light image to a preset resolution to obtain a 1-layer downsampled image, then perform a convolution operation on the 1-layer downsampled image to obtain a 1-layer convolution image, and then use the 0-layer image to subtract the 1-layer convolution image to obtain a transformed 1-layer image; using the same method, the computer device downsamples the above 1-layer downsampled image to a preset resolution to obtain a 2-layer downsampled image, then performs a convolution operation on the 2-layer downsampled image to obtain a 2-layer convolution image, and then uses the 1-layer downsampled image to subtract the 1-layer convolution image to obtain a transformed 2-layer image; using the same method, similar operations can also be performed on the 2-layer downsampled image. Finally, the image composed of the 0-layer image, the transformed 1-layer image, the transformed 2-layer image, etc. is the Laplacian pyramid image of the visible light image.

[0124] S1002, performing downsampling and convolution operations on the weakened near-infrared image to obtain a Laplacian pyramid image of the near-infrared image.

[0125] This embodiment relates to a method for obtaining a Laplacian pyramid image of a near-infrared image. The method may refer to the above-mentioned method for obtaining a Laplacian pyramid image of a visible light image. The specific method may refer to the description of S1001 above, which will not be described in detail here.

[0126] S1003: Fusing the Laplacian pyramid image of the visible light image and the Laplacian pyramid image of the near infrared image to obtain a fused image.

[0127] In this embodiment, when the computer device obtains the Laplacian pyramid image of the visible light image and the Laplacian pyramid image of the near-infrared image, each layer of the image in the Laplacian pyramid image of the visible light image can be fused with each layer of the image in the Laplacian pyramid image of the near-infrared image to obtain a fused Laplacian pyramid image, and then the fused images of each layer in the fused Laplacian pyramid image are fused in order from the top layer to the bottom layer to finally obtain a fused image. The Laplacian pyramid image fusion method described in the above embodiment can eliminate the ghosting problem caused by the misalignment of the visible light image and the near-infrared image.

[0128] Based on all the above embodiments, the present application also provides an image fusion method, such as Fig.12 As shown, the method includes:

[0129] S2001, obtaining a visible light image to be fused and a near infrared image to be fused.

[0130] S2002, obtaining calibration parameters of a visible light image acquisition device and a near infrared image acquisition device.

[0131] S2003, using a preset stereo matching algorithm, stereo matching is performed on the visible light image and the near infrared image according to calibration parameters to obtain a disparity map, and the disparity map is converted into a depth map.

[0132] S2004, determining whether the visible light image meets the preset conditions according to the depth image, if the visible light image meets the preset conditions, executing steps S2005-S2009, if the visible light image does not meet the preset conditions, executing steps S2010-S2011.

[0133] S2005, determining the weight of each pixel point according to the depth value of each pixel point in the depth image, and obtaining a weight distribution map.

[0134] S2006, performing frequency domain spatial conversion on the near infrared image to obtain a frequency domain image.

[0135] S2007, performing a weakening process on the pixel value of each pixel point in the frequency domain image according to the weight distribution map to obtain a weakened near-infrared image.

[0136] S2008 , aligning the visible light image and the weakened near infrared image according to the calibration parameters to obtain an aligned visible light image and an aligned near infrared image.

[0137] S2009: Fusing the aligned visible light image and the aligned near infrared image to obtain a fused image.

[0138] S2010, aligning the visible light image and the near infrared image according to the calibration parameters to obtain an aligned visible light image and an aligned near infrared image.

[0139] S2011, fusing the aligned visible light image and the aligned near infrared image to obtain a fused image.

[0140] The description of each step in the above method is consistent with the description of each step in the above embodiment. Please refer to the above description for details, which will not be repeated here.

[0141] It should be understood that although Figure 2-12 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 2-12At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0142] In one embodiment, Fig.13 As shown, an image fusion device is provided, comprising: a matching module 11, a determination module 12 and a first fusion module 13, wherein:

[0143] A matching module 11 is used to perform stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image;

[0144] A determination module 12 is used to determine whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject;

[0145] The first fusion module 13 is used to weaken the near-infrared image according to the depth image to obtain a weakened near-infrared image when the visible light image meets a preset condition, and fuse the visible light image and the weakened near-infrared image to obtain a fused image.

[0146] In one embodiment, Fig.14 As shown, the above-mentioned determination module 12 includes:

[0147] A first extraction unit 121 is used to extract a first distance value of the depth image when a preset condition indicates that the visible light image is a close-up image; the first distance value represents the distance between the photographed object and the acquisition device of the visible light image;

[0148] A first determining unit 122, configured to determine that the visible light image satisfies the preset condition when the first distance value is less than a preset distance value;

[0149] The second determining unit 123 is configured to determine that the visible light image does not satisfy the preset condition when the first distance value is not less than the preset distance value.

[0150] In one embodiment, Fig.15 As shown, the first extraction unit 121 includes:

[0151] The extraction subunit 1211 is used to extract the depth value of each pixel in the depth image;

[0152] The acquisition subunit 1212 is used to acquire an average depth value of the pixels in the depth image according to the depth value of each pixel;

[0153] The determining subunit 1213 is configured to determine the average depth value as a first distance value of the depth image.

[0154] In one embodiment, Fig.16 As shown, the above-mentioned determination module 12 includes:

[0155] A second extraction unit 124, configured to extract a second distance value of the depth image;

[0156] A third determining unit 125 is used to obtain a focusing parameter of the acquisition device of the visible light image, and determine a third distance value of the visible light image according to the focusing parameter;

[0157] The fourth determining unit 126 is configured to determine whether the visible light image satisfies a preset condition according to the second distance value and the third distance value.

[0158] In one embodiment, the fourth determination unit 126 is specifically used to determine whether the third distance value is less than the preset distance value when the second distance value is less than the preset distance value; if the third distance value is less than the preset distance value, it is determined that the visible light image meets the preset condition; if the third distance value is not less than the preset distance value, it is determined that the visible light image does not meet the preset condition; when the second distance value is not less than the preset distance value, it is determined that the visible light image does not meet the preset condition.

[0159] In one embodiment, Fig.17 As shown, the above-mentioned determination module 12 includes:

[0160] The recognition unit 127 is used to perform image recognition on the depth image to obtain the type of each subject in the visible light image when the preset condition indicates that the visible light image contains a target subject;

[0161] A fifth determining unit 128, configured to determine that the visible light image satisfies the preset condition when the type of the photographed subject is consistent with the type of the target subject;

[0162] The sixth determining unit 129 is configured to determine that the visible light image does not satisfy the preset condition when the type of the photographed subject is inconsistent with the type of the target subject.

[0163] In one embodiment, Fig.18 As shown, the first fusion module 13 includes:

[0164] A seventh determining unit 131, configured to determine a weight of each pixel point according to a depth value of each pixel point in the depth image to obtain a weight distribution map;

[0165] A spatial conversion unit 132 is used to perform frequency domain spatial conversion on the near infrared image to obtain a frequency domain image;

[0166] The weakening processing unit 133 is used to perform weakening processing on the pixel value of each pixel point in the frequency domain image according to the weight distribution map to obtain the weakened near-infrared image.

[0167] In one embodiment, Fig.19 As shown, the above device also includes:

[0168] A calibration module 14, used to obtain calibration parameters of the visible light image acquisition device and the near infrared image acquisition device;

[0169] The matching module 11 is specifically configured to use a preset stereo matching algorithm to perform stereo matching on the visible light image and the near infrared image according to the calibration parameters to obtain a disparity map; and convert the disparity map into the depth map.

[0170] In one embodiment, Fig. 20 As shown, the above device also includes:

[0171] An alignment module 15, configured to align the visible light image and the weakened near infrared image according to the calibration parameters to obtain an aligned visible light image and an aligned near infrared image;

[0172] The fusion module 13 is specifically used to fuse the aligned visible light image and the aligned near infrared image to obtain a fused image.

[0173] In one embodiment, Fig.21 As shown, the alignment module 15 comprises:

[0174] A conversion unit 151, configured to convert the visible light image and the weakened near infrared image into the same plane according to the calibration parameters;

[0175] The alignment unit 152 is used to align the visible light image and the weakened near-infrared image in the same plane according to a feature point matching method to obtain the aligned visible light image and the aligned near-infrared image.

[0176] In one embodiment, Fig. 22 As shown, the first fusion module 13 includes:

[0177] A first acquisition unit 134 is used to perform downsampling and convolution operations on the visible light image to obtain a Laplacian pyramid image of the visible light image;

[0178] A second acquisition unit 135 is used to perform downsampling and convolution operations on the weakened near-infrared image to obtain a Laplacian pyramid image of the near-infrared image;

[0179] The fusion unit 136 is configured to fuse the Laplacian pyramid image of the visible light image and the Laplacian pyramid image of the near infrared image to obtain the fused image.

[0180] In one embodiment, Fig.23 As shown, the above device also includes:

[0181] The second fusion module 16 is used to fuse the visible light image and the near infrared image to obtain a fused image when the visible light image does not meet the preset condition.

[0182] 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.

[0183] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0184] Performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image;

[0185] Determining whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject;

[0186] If so, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image.

[0187] The above embodiment provides a computer device, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0188] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0189] Performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image;

[0190] Determining whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject;

[0191] If so, the near-infrared image is weakened according to the depth image to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image.

[0192] The above embodiment provides a computer-readable storage medium, whose implementation principle and technical effect are similar to those of the above method embodiment, and will not be repeated here.

[0193] Those of ordinary skill 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 at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0194] 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.

[0195] 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: Performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image; Determining whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject; If it is satisfied, the weight of each pixel in the depth image is determined according to the depth value of each pixel to obtain a weight distribution map, the near-infrared image is converted into a frequency domain space to obtain a frequency domain image, the pixel value of each pixel in the frequency domain image is weakened according to the weight distribution map to obtain a weakened near-infrared image, and the visible light image and the weakened near-infrared image are fused to obtain a fused image.

2. The method according to claim 1, characterized in that If the preset condition indicates that the visible light image is an image taken at a close distance, determining whether the visible light image satisfies the preset condition according to the depth image includes: Extracting a first distance value of the depth image; the first distance value represents the distance between the photographed object and the acquisition device of the visible light image; If the first distance value is less than a preset distance value, determining that the visible light image meets the preset condition; If the first distance value is not less than the preset distance value, it is determined that the visible light image does not meet the preset condition.

3. The method according to claim 2, characterized in that The extracting the first distance value of the depth image includes: Extracting the depth value of each pixel in the depth image; According to the depth value of each pixel, an average depth value of the pixel in the depth image is obtained; The average depth value is determined as a first distance value of the depth image.

4. The method according to claim 1, characterized in that: If the preset condition indicates that the visible light image is an image taken at a close distance, determining whether the visible light image satisfies the preset condition according to the depth image includes: Extracting a second distance value of the depth image; the second distance value represents the distance between the photographed object and the acquisition device of the visible light image; Acquire a focus parameter of the visible light image acquisition device, and determine a third distance value of the visible light image according to the focus parameter; the third distance value represents the distance between the photographed object and the visible light image acquisition device; It is determined whether the visible light image meets a preset condition according to the second distance value and the third distance value.

5. The method according to claim 4, characterized in that The determining, according to the second distance value and the third distance value, whether the visible light image meets a preset condition includes: If the second distance value is less than a preset distance value, determining whether the third distance value is less than the preset distance value; if the third distance value is less than the preset distance value, determining that the visible light image meets the preset condition; if the third distance value is not less than the preset distance value, determining that the visible light image does not meet the preset condition; If the second distance value is not less than the preset distance value, it is determined that the visible light image does not meet the preset condition.

6. The method according to claim 1, characterized in that The preset condition indicates that the visible light image contains the target subject; and determining whether the visible light image satisfies the preset condition according to the depth image includes: Performing image recognition on the depth image to obtain the type of each subject in the visible light image; If the type of the photographed subject is consistent with the type of the target subject, determining that the visible light image meets the preset condition; If the type of the photographed subject is inconsistent with the type of the target subject, it is determined that the visible light image does not meet the preset condition.

7. The method according to claim 1, characterized in that The method further comprises: Acquire calibration parameters of the visible light image acquisition device and the near infrared image acquisition device; The step of performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image includes: Using a preset stereo matching algorithm, stereo matching is performed on the visible light image and the near infrared image according to the calibration parameters to obtain a disparity map; The disparity map is converted into the depth map.

8. The method according to claim 7, characterized in that The method further comprises: Aligning the visible light image and the weakened near-infrared image according to the calibration parameters to obtain an aligned visible light image and an aligned near-infrared image; The step of fusing the visible light image and the weakened near infrared image to obtain a fused image includes: The aligned visible light image and the aligned near infrared image are fused to obtain a fused image.

9. The method according to claim 8, characterized in that The step of aligning the visible light image and the weakened near infrared image according to the calibration parameters to obtain an aligned visible light image and an aligned near infrared image comprises: According to the calibration parameters, converting the visible light image and the weakened near infrared image to the same plane; According to the feature point matching method, the visible light image and the weakened near-infrared image in the same plane are aligned to obtain the aligned visible light image and the aligned near-infrared image.

10. The method according to any one of claims 1 to 6, characterized in that: The step of fusing the visible light image and the weakened near infrared image to obtain a fused image includes: Performing downsampling and convolution operations on the visible light image to obtain a Laplacian pyramid image of the visible light image; Performing downsampling and convolution operations on the weakened near-infrared image to obtain a Laplacian pyramid image of the near-infrared image; The Laplacian pyramid image of the visible light image and the Laplacian pyramid image of the near infrared image are fused to obtain the fused image.

11. The method according to claim 1, characterized in that: The method further comprises: If the visible light image does not meet the preset condition, the visible light image and the near infrared image are fused to obtain a fused image.

12. An image fusion device, characterized in that: The device comprises: A matching module, used for performing stereo matching on the visible light image to be fused and the near infrared image to be fused to obtain a depth image; A determination module, configured to determine whether the visible light image satisfies a preset condition according to the depth image; the preset condition indicates that the visible light image is a close-up image and / or contains a target subject; The first fusion module is used to determine the weight of each pixel point according to the depth value of each pixel point in the depth image when the visible light image meets the preset conditions, obtain a weight distribution map, perform frequency domain space conversion on the near-infrared image to obtain a frequency domain image, weaken the pixel value of each pixel point in the frequency domain image according to the weight distribution map to obtain a weakened near-infrared image, and fuse the visible light image and the weakened near-infrared image to obtain a fused image.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.