Image fusion method and device, electronic equipment and storage medium

By performing pixel sampling and automated processing on images, the problem of poor image fusion results caused by users manually setting parameters is solved, achieving efficient and accurate image fusion, which is suitable for terminal devices and cloud services.

CN119671874BActive Publication Date: 2025-12-05GUANGZHOU KINDLINK SOFTWARE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411656914.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-12-05
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

In existing technologies, the image fusion process requires users to manually set fusion parameters, which leads to poor final results and affects image quality and fusion efficiency.

Method used

By sampling pixels of the initial insertion image to obtain primary color channel values ​​and spatial dispersion, reference pixels are determined, and background and foreground pixels are distinguished based on color similarity. The transparency is then adjusted to generate the target insertion image, thus achieving automated image fusion.

Benefits of technology

It improves the accuracy and immediacy of image fusion, avoids stitching artifacts, enhances image synthesis quality and visual effects, and is suitable for various terminal devices and cloud services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119671874B_ABST
    Figure CN119671874B_ABST
Patent Text Reader

Abstract

The application provides an image fusion method and device, electronic equipment and storage medium, which are applied to the field of computer images. The method comprises the following steps: performing pixel sampling on an initial insertion image to obtain original color channel values of each pixel point in the initial insertion image; determining color parameters of each pixel point; determining spatial dispersion degrees of each pixel point; determining a reference pixel point among each pixel point based on the color parameters and the spatial dispersion degrees; determining a background pixel point and a foreground pixel point among each pixel point based on the chroma difference values between each pixel point and the reference pixel point; correcting the transparency of the background pixel point to a target transparency, and generating a target insertion image based on the background pixel point and the foreground pixel point of the target transparency; and inserting the target insertion image into a preset insertion position of a target image, thereby improving the adaptability and instantaneity of image fusion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer graphics, and more particularly to image fusion methods, apparatus, electronic devices, and storage media. Background Technology

[0002] With the continuous development of computer image processing technology, image fusion, as a solution that can merge different media videos, has been widely used in many industries. In related technologies, in order to merge different media videos, users often need to manually set the fusion parameters, which results in the final image fusion effect failing to meet the usage requirements. Summary of the Invention

[0003] This application provides an image fusion method, apparatus, electronic device, and storage medium, aiming to perform real-time dynamic control of electronic devices, thereby improving driving safety. The technical solution is as follows:

[0004] In a first aspect, this application provides an image fusion method, comprising: acquiring an initial insertion image and a target image; performing pixel sampling on the initial insertion image to obtain the primary color channel value of each pixel in the initial insertion image; determining the color parameter of each pixel based on the primary color channel value of each pixel; determining the spatial dispersion of each pixel based on the primary color channel value of each pixel and the position information of each pixel in the initial insertion image; determining a reference pixel in each pixel based on the color parameter and the spatial dispersion; determining a background pixel and a foreground pixel in each pixel based on the chromaticity difference between each pixel and the reference pixel; correcting the transparency of the background pixel to a target transparency, and generating a target insertion image based on the background pixel and the foreground pixel with the target transparency; and inserting the target insertion image into a preset insertion position of the target image.

[0005] In the above technical solution, pixel sampling of the initial inserted image is used to obtain primary color channel values ​​and determine color parameters and spatial dispersion, enabling comprehensive analysis of image features from two key dimensions: color and spatial distribution. Based on this, reference pixels are determined, and background and foreground pixels are distinguished, allowing for accurate identification of key elements and background parts in the image, providing data support for subsequent image processing. The process of correcting the transparency of background pixels and generating the target inserted image ensures a more natural and harmonious fusion of the inserted and target images, avoiding harsh stitching marks and effectively improving the quality and visual effect of image synthesis. Finally, the target inserted image is inserted into the preset position of the target image, achieving real-time image fusion and expanding application scenarios, thereby enhancing the applicability and immediacy of image fusion.

[0006] In conjunction with the first aspect, in some possible implementations, pixel sampling is performed on the initial inserted image to obtain the primary color channel value of each pixel in the initial inserted image, including: dividing the inserted image into multiple sub-images of a preset size, wherein each sub-image contains at least one pixel; selecting a preset number of pixels from each sub-image; and performing color quantization on each pixel based on a preset color quantization algorithm to determine the primary color channel value of each pixel.

[0007] Combining the first aspect and the above implementation methods, in some possible implementation methods, color quantization is performed on each pixel based on a preset color quantization algorithm to determine the primary color channel value corresponding to each pixel. This includes: obtaining the initial primary color channel value of the first pixel among all pixels, where the first pixel is any pixel among all pixels; converting the initial primary color channel value into binary data and storing the binary data in layers to obtain the color quantization parameter of the first pixel; obtaining the quantization parameter set corresponding to the color quantization parameter, and determining the primary color channel value corresponding to the quantization parameter set as the primary color channel value of the first pixel.

[0008] In the above technical solution, by dividing the initial inserted image into multiple sub-images, block processing of the image can be achieved, greatly reducing the amount of data processed at one time and lowering the system's computational burden and memory usage. Simultaneously, selecting only a preset number of pixels from each sub-image for processing further reduces the computational load, allowing the entire color quantization process to be completed in a shorter time. This is particularly beneficial when dealing with high-resolution images or scenarios requiring real-time image processing, significantly improving processing speed and meeting immediacy requirements. By converting the initial primary color channel values ​​into binary data and storing them in layers, color information distortion caused by data format conversion or error accumulation during calculation can be avoided. Furthermore, the layered storage method allows for hierarchical management and retrieval of color information according to different needs and accuracy requirements, reducing storage space usage and improving image efficiency during storage and transmission.

[0009] Combining the first aspect and the above implementation methods, in some possible implementation methods, the color parameters of each pixel are determined based on the primary color channel values ​​of each pixel, including: determining the maximum and minimum primary color values ​​of the first pixel in the primary color channel values; determining the color saturation of the first pixel based on the maximum and minimum primary color values; and determining the color brightness value of the first pixel based on the primary color channel values ​​of the first pixel and the weight values ​​of each primary color channel.

[0010] Combining the first aspect and the above implementation methods, in some possible implementation methods, the spatial dispersion of each pixel is determined based on the primary color channel value and the position information of each pixel in the initial inserted image, including: obtaining the average position information of the primary color channel value of the first pixel in the initial inserted image; and determining the spatial dispersion of the first pixel based on the average position information and the first position information of the first pixel in the initial inserted image.

[0011] In the above technical solution, by analyzing the primary color channel values ​​of the first pixel, its maximum and minimum primary color values ​​are determined. Then, the color saturation of the first pixel is calculated based on these two values. Simultaneously, by combining the primary color channel values ​​of the first pixel with the weight values ​​of each primary color channel, the color brightness value of the pixel can be determined, thus providing an important basis for subsequent color parameter analysis. By obtaining the average position information of the primary color channel values ​​of the first pixel in the initial inserted image and comparing it with the actual position information of the first pixel in the initial inserted image, the spatial dispersion of the pixel is determined. This process helps to evaluate the distribution of pixels throughout the image, providing crucial information for subsequent pixel classification and image processing. Through precise calculation of the color saturation, color brightness value, and spatial dispersion of the first pixel, the accuracy of image fusion is improved.

[0012] Combining the first aspect and the above implementation methods, in some possible implementation methods, before determining the spatial dispersion of each pixel based on the primary color channel value and the position information of each pixel in the initial inserted image, the method further includes: classifying the primary color channel values ​​of each pixel to obtain a set of primary color channel values; in each pixel, obtaining the set of pixels corresponding to the target primary color channel value in the set of primary color channel values, wherein the target primary color channel value is any primary color channel value in the set of primary color channel values; and determining the average position information of the target primary color channel value based on the second position information of each second pixel in the set of pixels in the initial inserted image.

[0013] Combining the first aspect and the above implementation methods, in some possible implementation methods, a reference pixel is determined among each pixel based on color parameters and spatial dispersion, including: inputting the color saturation, color brightness value, and spatial dispersion of the first pixel into a pre-trained weight analysis model to obtain saturation weight, brightness value weight, and dispersion weight; determining the pixel score of the first pixel based on its color saturation, color brightness value, spatial dispersion, and saturation weight, brightness value weight, and dispersion weight; and determining the third pixel with the largest pixel score among all pixels as the reference pixel.

[0014] In the above technical solution, by meticulously classifying the primary color channel values ​​of each pixel, this method can accurately identify and organize color information in the image, thus ensuring the accuracy of color classification. Furthermore, by utilizing the positional information of pixels to calculate the average position of the target primary color channel values, the accuracy of color distribution analysis is enhanced. In addition, by applying a pre-trained weighted analysis model, this method dynamically evaluates the importance of color saturation, brightness value, and spatial dispersion of each pixel, thereby assigning a reasonable weight to each pixel. This weight-based pixel score calculation method not only improves the accuracy of pixel selection but also makes the entire image processing process more efficient and intelligent. Finally, by selecting the pixel with the highest pixel score as the reference point, this method optimizes the calculation process while ensuring the accuracy of the processing results, thereby improving the immediacy of image fusion.

[0015] In combination with the first aspect and the above implementation methods, some possible implementation methods also include: obtaining the number of times the primary color channel value of the first pixel appears during the pixel traversal process; obtaining the frequency weight corresponding to the number of occurrences based on the weight analysis model; determining the pixel score of the first pixel based on the color saturation, color brightness value, spatial dispersion, and saturation weight, brightness value weight, and dispersion weight, including: determining the pixel score of the first pixel based on the color saturation, color brightness value, spatial dispersion, number of occurrences, and saturation weight, brightness value weight, dispersion weight, and frequency weight of the first pixel.

[0016] In the above technical solution, the number of times the primary color channel value of the first pixel appears during the entire pixel traversal is statistically analyzed, and a weighted analysis model is used to obtain the corresponding frequency weight. This solution not only considers the color attributes of the pixel (such as saturation, brightness, and spatial dispersion) but also incorporates information on the pixel's occurrence frequency, thus providing a more comprehensive evaluation for each pixel. When determining the pixel score of the first pixel, color saturation, brightness, spatial dispersion, and their weights are integrated, while also considering the number of times the pixel appears and its corresponding weight, thereby improving the accuracy and efficiency of image processing.

[0017] Combining the first aspect and the above implementation methods, in some possible implementation methods, based on the chromaticity difference between each pixel and the reference pixel, background pixels and foreground pixels are determined in each pixel, including: determining the color similarity between each pixel in the initial inserted image and the reference pixel; if the color similarity is less than a preset similarity threshold, the pixel is determined as a foreground pixel; if the color similarity is greater than or equal to the preset similarity threshold, the pixel is determined as a background pixel.

[0018] In combination with the first aspect and the above implementation methods, in some possible implementation methods, correcting the transparency of the background pixels to the target transparency includes: determining the saturation overflow value and grayscale overflow value of the background pixels based on the color similarity between the background pixels and the reference pixels; generating a saturation smoothing mask for the background pixels based on the saturation overflow value and the grayscale overflow value; and correcting the transparency of the background pixels to the target transparency based on the saturation smoothing mask.

[0019] In the above technical solution, by calculating the color similarity between each pixel in the inserted image and the reference pixel and comparing the color similarity with a preset similarity threshold, pixels can be effectively distinguished into foreground pixels and background pixels, so as to accurately identify the foreground objects and background in the initial image. For pixels identified as background, this method further determines the saturation overflow value and grayscale overflow value based on their color similarity with the reference pixel. These overflow values ​​reflect the degree of difference between the background pixel and the reference pixel in color, which can accurately adjust the color attributes of the background pixel. By generating a saturation smoothing mask through the calculated saturation overflow value and grayscale overflow value, the transparency of the background pixel is corrected to the target transparency, thereby improving the accuracy of image fusion.

[0020] Secondly, this application provides an image fusion apparatus, comprising:

[0021] The image acquisition unit is used to acquire the initial insertion image and the target image, perform pixel sampling on the initial insertion image, and obtain the primary color channel value of each pixel in the initial insertion image;

[0022] The color acquisition unit is used to determine the color parameters of each pixel based on the primary color channel value of each pixel.

[0023] The dispersion acquisition unit is used to determine the spatial dispersion of each pixel based on the primary color channel value of each pixel and the position information of each pixel in the initial inserted image.

[0024] A pixel determination unit is used to determine a reference pixel among all pixels based on color parameters and spatial dispersion.

[0025] A chromaticity contrast unit is used to determine the background and foreground pixels among the pixels based on the chromaticity difference between each pixel and the reference pixel.

[0026] The correction unit is used to correct the transparency of the background pixels to the target transparency, and generate a target insertion image based on the background pixels and foreground pixels with the target transparency;

[0027] The insertion unit is used to insert the target image into a preset insertion position of the target image.

[0028] Thirdly, this application provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the image fusion method as described above.

[0029] Fourthly, this application provides a computer-readable storage medium storing a computer program, which, when executed, implements the image fusion method as described above. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 This is a system architecture diagram of an image fusion method provided in an embodiment of this application;

[0032] Figure 2 This is a schematic flowchart of an image fusion method provided in an embodiment of this application;

[0033] Figure 3 This is a schematic flowchart of an image fusion method provided in an embodiment of this application;

[0034] Figure 4 This is a scene illustration of an image fusion method provided in an embodiment of this application;

[0035] Figure 5 This is a schematic flowchart of an image fusion method provided in an embodiment of this application;

[0036] Figure 6 This is a schematic flowchart of an image fusion method provided in an embodiment of this application;

[0037] Figure 7 This is a schematic flowchart of an image fusion method provided in an embodiment of this application;

[0038] Figure 8 This is a schematic flowchart of an image fusion method provided in an embodiment of this application;

[0039] Figure 9 This is a schematic flowchart of an image fusion method provided in an embodiment of this application;

[0040] Figure 10 This is a scene illustration of an image fusion method provided in an embodiment of this application;

[0041] Figure 11 This is a scene illustration of an image fusion method provided in an embodiment of this application;

[0042] Figure 12 This is a schematic diagram of the structure of an image fusion device provided in an embodiment of this application;

[0043] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0044] To make the features and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0045] The technical solutions in this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0046] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0047] In related technologies, image fusion requires users to manually select the background color. This manual selection process is not only time-consuming but also demands a certain level of expertise from the user. An inappropriate background color selection can lead to poor fusion results, such as blurred edges and background residue, thus affecting the quality of the final image or video.

[0048] To improve the applicability and immediacy of image fusion, this application provides an image fusion method, which is executed by a terminal device or a server. Detailed descriptions are provided below. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments. Please refer to... Figure 1 , Figure 1 This is a system architecture diagram of an image fusion method provided in an embodiment of this application. The specific process of the image fusion method is as follows:

[0049] Figure 1 This is a system architecture diagram of an image fusion method provided in an embodiment of this application. The system architecture includes a terminal device 140, an Internet 130, a gateway 120, a server 110, etc.

[0050] Terminal device 140 includes, but is not limited to, mobile phones, computers, and intelligent voice interaction devices. This application embodiment can be applied to various scenarios, including but not limited to cloud technology and artificial intelligence. Furthermore, it can be a single device or a collection of multiple devices. For example, multiple desktop computers can be interconnected via a local area network, sharing a single monitor to work collaboratively, forming a single terminal device 140. Terminal device 140 can communicate with the Internet 130 via wired or wireless means to exchange data.

[0051] Server 110 refers to a computer system that can provide certain services to terminal device 140. Compared to ordinary terminal device 140, server 110 has higher requirements in terms of stability, security, and performance. Server 110 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0052] Gateway 120, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from terminal device 140 to server 110 are forwarded to the corresponding server 110 via gateway 120. Messages sent from server 110 to terminal device 140 are also forwarded to the corresponding terminal device 140 via gateway 120.

[0053] In this embodiment, both the terminal device and the server run a preset image fusion application. This application merges two or more images. When the server is the executing entity, it receives a video data fusion request from the terminal device, merges the video data uploaded by the terminal device based on the preset image fusion application, and returns the video stream data to the terminal device in real time. The terminal device then plays and displays the video upon receiving the returned video stream data. When the terminal device is the executing entity, the preset image fusion application running on it performs the image fusion task. Specifically, the terminal device receives images to be merged input by the user, or retrieves these images from local storage or network resources. Then, the image fusion application on the terminal device performs fusion processing on these images according to preset algorithms and parameters, generating a new merged image. After processing, the terminal device can directly display the merged image or send the merged image data to other devices or platforms for further processing or sharing.

[0054] Furthermore, regardless of whether the image fusion task is performed on the server or the terminal device, the preset image fusion application should have high flexibility and scalability to support image input of different formats, resolutions and numbers, and be able to adjust the fusion algorithm and parameters of the image fusion application according to actual needs, so as to obtain the best fusion effect.

[0055] Specifically, the image fusion application processes an initial insertion image and a target image. The initial insertion image is a frame from the video selected by the user to be inserted, and the target image can be a frame from a real-time video. A preset pixel sampling algorithm is used to sample the pixels of the initial insertion image. After sampling is complete, a preset pixel color quantization algorithm is called to quantize the color of each pixel. After quantization, each pixel is traversed to determine the frequency of occurrence, color saturation, color brightness, and spatial dispersion of the color corresponding to the primary color channel value of each pixel.

[0056] A pre-trained weighted analysis model is used to calculate weights for the frequency of occurrence, color saturation, color brightness, and spatial dispersion of the primary color channel values ​​of each pixel. This yields frequency weights, saturation weights, brightness weights, and dispersion weights. These weights are then substituted into the pixel score calculation formula to obtain the pixel score for each pixel. The pixel with the highest score is identified and designated as the reference pixel, thus obtaining the initial color key for the inserted image.

[0057] After obtaining the reference pixel, the pixels of the entire initial insertion image are traversed to determine the color similarity between each pixel and the reference pixel. Pixels with a color similarity greater than or equal to a preset similarity threshold are identified as background pixels, and pixels with a color similarity less than the preset similarity threshold are identified as foreground pixels. At the same time, the saturation overflow value and grayscale overflow value of the background pixels are determined by the color similarity. The transparency of the background pixels is adjusted to the target transparency by using the saturation overflow value and grayscale overflow value and combined with the foreground pixels to generate the target insertion image. The target insertion image is then inserted into the preset insertion position of the target image.

[0058] based on Figure 1 The system architecture diagram shown below will be used in conjunction with... Figures 2-10 This application provides a detailed description of an image fusion method based on an embodiment.

[0059] Based on the above, this application proposes an image fusion method. Please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic flowchart of an image fusion method provided in an embodiment of this application. Figure 2 As shown, the method in this application embodiment may include the following steps S101-S101.

[0060] S101, acquire the initial insertion image and the target image, perform pixel sampling on the initial insertion image, and obtain the primary color channel value of each pixel in the initial insertion image.

[0061] In this embodiment, the initial insertion image is a frame from a video selected by the user beforehand, and the target image is a frame from a real-time video of a real-world scene. Each pixel in the initial insertion image contains values ​​for the red, green, and blue primary color channels. Following a predetermined sampling algorithm, the initial image is divided into a predetermined number of sub-images, and a predetermined number of pixels are selected from each sub-image. Simultaneously, the primary color channel values ​​of each pixel are recorded. These primary color channel values ​​are typically represented as integers, ranging from 0 to 255, corresponding to the intensity of the color.

[0062] Specifically, a preset pixel sampling algorithm, including but not limited to Poisson-Disk Sampling, is used to divide the initial inserted image into multiple sub-images of the same size according to a preset grid size. Within each sub-image, a pixel is randomly selected as the target pixel. After random sampling, the number of collected pixels is approximately N / 16, thereby reducing data redundancy and the amount of data required for subsequent processing.

[0063] It should be noted that each pixel is typically composed of three color channels: red (R), green (G), and blue (B). Each channel can have 256 different brightness levels (from 0 to 255). Therefore, each pixel can be represented as (R, G, B), where R, G, and B are all integers between 0 and 255.

[0064] Since each channel has 256 possible values, the total number of combinations for the three channels is 1,677,721. To reduce the number of colors and the amount of data, this embodiment uses an octree color quantization algorithm to traverse the primary color values ​​of each pixel in the initial inserted image and converts each primary color value into binary data, which is then distributed to the leaf nodes in the octree. This reduces the number of colors per pixel from 16,777,216 to 262,144, thereby significantly reducing memory usage and computational complexity while maintaining the basic visual quality of the image.

[0065] The primary color channel value of each pixel is obtained and color quantization is performed to obtain the color quantization parameter corresponding to each pixel. The set of quantization parameters corresponding to the color quantization parameter is further determined. There are multiple ranges of color quantization parameters in the set of quantization parameters, which are used to determine the parameter range range corresponding to the color quantization parameter, so that the primary color channel value corresponding to the color range is determined as the primary color channel value of each pixel.

[0066] S102, determine the color parameters of each pixel based on the primary color channel value of each pixel.

[0067] In this embodiment, color parameters include color saturation and color brightness. Saturation refers to the vividness of a color, i.e., its purity or intensity. It indicates the distance of the color from the center point on the color wheel; the higher the saturation, the more vivid the color; the lower the saturation, the closer the color is to gray. Color brightness refers to the lightness or darkness of a color, describing its brightness or dullness. In the RGB color model, brightness can be obtained by calculating the weighted average of the RGB three channels, where the weight of each channel reflects the human eye's sensitivity to different colors.

[0068] Specifically, the red, green, and blue channel values ​​of each pixel are extracted from the primary color channel values. The maximum and minimum brightness values ​​corresponding to the values ​​of the red, green, and blue channels are then found. By calculating the brightness difference between the maximum and minimum brightness values ​​and dividing the brightness difference by the maximum brightness value, the color saturation of each pixel can be obtained.

[0069] Extract the maximum brightness value of the red, green, and blue channels of each pixel from the primary color channel values, and add the maximum brightness values ​​together to obtain the color brightness value of each pixel.

[0070] S103, based on the primary color channel value of each pixel and the position information of each pixel in the initial inserted image, determine the spatial dispersion of each pixel.

[0071] Specifically, the coordinates of the primary color channel values ​​of all pixels within the preset neighborhood of each pixel are traversed, and the coordinates are summed and divided by the total number of pixels in the neighborhood to obtain the average position information. The actual coordinate position and average position information of the currently traversed pixel are then substituted into the Euclidean distance formula to obtain the Euclidean distance of the current pixel, and this Euclidean distance is used as the spatial dispersion of the current pixel.

[0072] S104, determines the reference pixel point among each pixel point based on color parameters and spatial dispersion.

[0073] Specifically, after obtaining the color saturation, brightness, and spatial dispersion of each pixel in steps S102-S103, these values ​​are output to a pre-trained weight analysis model to obtain the saturation weight for color saturation, the brightness weight for color brightness, and the dispersion weight for spatial dispersion. Simultaneously, the number of times the primary color channel value corresponding to the currently traversed pixel appears during the entire traversal process is determined, and this occurrence count is input to the weight analysis model to obtain the corresponding frequency weight.

[0074] The pixel score for each pixel is obtained by combining the color saturation, color brightness, spatial dispersion, and occurrence frequency of each pixel, along with the weights of saturation, brightness, dispersion, and occurrence. The pixel with the highest pixel score is then determined as the reference pixel.

[0075] S105, based on the chromaticity difference between each pixel and the reference pixel, determine the background pixel and the foreground pixel in each pixel.

[0076] Specifically, the color of each pixel is traversed, and the color of each pixel and the primary color channel value of the reference pixel are converted into a chroma space. Then, the chroma difference between each pixel and the reference pixel is obtained. Here, the chroma space is a mathematical method to represent color. It uses basic parameters to describe and record color. The color in the space is specified by three-dimensional coordinates representing three color attribute parameters.

[0077] The similarity between each pixel and the green screen color is determined by calculating the vector length of the chromaticity difference, i.e., the chromaticity distance. Based on a preset similarity threshold and the calculated chromaticity distance and the color similarity of the reference pixel, if the color similarity is less than the preset similarity threshold, the pixel is determined as the foreground pixel; if the color similarity is greater than or equal to the preset similarity threshold, the pixel is determined as the background pixel.

[0078] S106, the transparency of the background pixels is corrected to the target transparency, and a target insertion image is generated based on the background pixels and foreground pixels with the target transparency.

[0079] Specifically, the color similarity between each background pixel and a reference pixel is obtained. It is then determined whether the color similarity of each background pixel falls within a preset color similarity range. The corresponding saturation and grayscale overflow values ​​are then obtained, and preset saturation adjustment parameters and grayscale adjustment parameters are further determined. A saturation smoothing mask is generated for each background pixel based on these parameters. The saturation smoothing mask is applied to the transparency channel of each background pixel to correct its transparency. Finally, a target insertion image is generated based on the transparent background pixels and foreground pixels.

[0080] S107, Insert the target image into the preset insertion position of the target image.

[0081] In this embodiment, the preset insertion position is determined by the user based on the actual scenario and is not specifically limited here.

[0082] Specifically, the system obtains the preset insertion position marked by the user in the target image, adjusts the size of the target insertion image according to the size of the preset insertion position, and then inserts the target insertion image into the preset insertion position of the target image.

[0083] Please refer to the following: Figure 3 , Figure 3 This is a scene illustration of an image fusion method provided in an embodiment of this application. For example... Figure 3 As shown, the target image is a frame of a real-time conference video. At this time, the background pixels of the initial inserted image are black. After the transparency of the initial inserted image is corrected, the target inserted image with transparent background pixels is obtained and then inserted into the target image for display.

[0084] As shown above, by sampling the initial insertion image to obtain the primary color channel values ​​and determining the color parameters and spatial dispersion, it is possible to comprehensively analyze image features from two key dimensions: color and spatial distribution. Based on this, determining reference pixels and distinguishing between background and foreground pixels enables accurate identification of key elements and background parts in the image, providing data support for subsequent image processing. The process of correcting the transparency of background pixels and generating the target insertion image ensures a more natural and harmonious fusion between the insertion and target images, avoiding harsh stitching marks and effectively improving the quality and visual effect of image synthesis. Finally, inserting the target insertion image into the preset position of the target image achieves seamless image fusion and expands application scenarios, thereby improving the applicability and immediacy of image fusion.

[0085] Image processing generates a large amount of redundant data, which impacts resource consumption. Please see [link / reference]. Figure 4 , Figure 4 This is a schematic flowchart of an image fusion method provided in an embodiment of this application. Figure 4 As shown, the method in this application embodiment may include the following steps S201-S206.

[0086] S201, the initial inserted image is divided into multiple sub-images of preset size, and each sub-image contains at least one pixel.

[0087] In the embodiments of this application, a preset pixel sampling algorithm, including but not limited to the Poisson-Disk Sampling algorithm, can be used to divide the initial inserted image according to a preset grid size. The number of divisions and the granularity of division can be set according to the actual scenario and are not specifically limited here.

[0088] Specifically, the initial inserted image is divided into several sub-images according to a preset number or size of divisions. For example, the initial inserted image can be divided into 88 sub-images of size 4*4.

[0089] S202, Select a preset number of pixels from each sub-image.

[0090] Specifically, each sub-image is traversed, and a preset number of pixels are selected from each sub-image using a random selection strategy. The preset number is set by the user according to actual needs and is not specifically limited here. For example, if the preset number of pixels is 1, and there are 4 sub-images, namely sub-image A, sub-image B, sub-image C, and sub-image D, then according to the preset number of pixels, 1 pixel is selected from each of sub-images A, B, C, and D respectively, thereby reducing resource overhead.

[0091] Please refer to the following: Figure 5 , Figure 5 This is a scene illustration of an image fusion method provided in an embodiment of this application. For example... Figure 5 As shown, the initial insertion image is divided into multiple square regions of a preset size, where each square region is a sub-image. Then, a pixel is randomly selected within each sub-image region and used as the target pixel for that sub-image. Since only one pixel is selected for each sub-image, the number of pixels collected in the entire initial insertion image is significantly reduced to approximately 1 / 16 of the original. This effectively reduces the number of pixels while maintaining image quality, thereby reducing storage space usage.

[0092] S203 performs color quantization on each pixel based on a preset color quantization algorithm to determine the primary color channel value of each pixel.

[0093] Specifically, step S203 is described in step S101 above and will not be repeated here.

[0094] S204, obtain the initial primary color channel value of the first pixel in each pixel, where the first pixel is any pixel in each pixel.

[0095] Specifically, the coordinates of the first pixel in the initial inserted image are located to obtain the primary color channel value corresponding to the first pixel. Each pixel consists of three primary color channels: red, green, and blue, representing the intensity of the pixel under red, green, and blue light, respectively. Therefore, for a selected first pixel, its initial primary color channel value can be obtained by reading its values ​​in the red, green, and blue channels.

[0096] For example, taking an RGB initial insertion image with a resolution of 800×600 pixels as an example, assume that the pixel (0,0) located at the top left corner of the initial insertion image is randomly selected as the first pixel. This first pixel is composed of the three primary color channels: red (R), green (G), and blue (B). Using appropriate image processing software or programming language libraries, such as the PIL library in Python, the initial insertion image at this coordinate (0,0) is located. Then, the value of the initial insertion image in the R channel is read as 200; the value in the G channel as 100; and the value in the B channel as 50. That is, the initial primary color channel values ​​corresponding to the first pixel (0,0) are R=200, G=100, and B=50. These values ​​represent that the intensity of the first pixel in red light is 200, the intensity in green light is 100, and the intensity in blue light is 50.

[0097] S205 converts the initial primary color channel values ​​into binary data and saves the binary data in layers to obtain the color quantization parameters of the first pixel.

[0098] Specifically, the initial primary color channel values ​​of the first pixel, for example, R=200, G=100, B=50, are converted into binary data, i.e., R channel is 11001000, G channel is 01100100, and B channel is 00110010. These binary data are then arranged into a 24-bit binary number in descending order of the most significant bit. This 24-bit binary number is then divided into three layers of 8 bits each, corresponding to the R, G, and B channels respectively. An octree color quantization algorithm is used to construct an octree to represent the color space of the image, and the color value of the first pixel is inserted into the corresponding node in the octree. By recursively inserting the color values ​​of other pixels and splitting and merging nodes, the color quantization parameters of the first pixel are finally generated. During this process, the number of colors in each node needs to be checked. If the number of colors exceeds a preset threshold, the node is merged into a representative color value. Finally, the node corresponding to the first pixel is found in the octree, and the representative color value of that node is obtained as the color quantization parameter of the first pixel. This method not only effectively reduces the number of colors in an image, but also maintains the overall visual quality of the image.

[0099] S206, obtain the set of quantization parameters corresponding to the color quantization parameters, and determine the primary color channel value corresponding to the quantization parameter set as the primary color channel value of the first pixel.

[0100] Specifically, the set of quantization parameters to which the color quantization parameter of the first pixel belongs is determined. This set of quantization parameters contains multiple ranges of color quantization parameters. By finding the position of the color quantization parameter of the first pixel within these ranges, the parameter range corresponding to that color quantization parameter can be determined. The primary color channel value corresponding to the parameter range is then reassigned to the first pixel as its primary color channel value.

[0101] For example, the primary color channel values ​​of the first pixel are (R=180, G=120, B=60). Processing this image using a color quantization algorithm yields the color quantization parameters of the first pixel as (R=4, G=3, B=2). Further, the set of quantization parameters to which these color quantization parameters belong is determined. For example, the ranges for R, G, and B are all [0,7]. By searching, the ranges corresponding to R=4 are determined to be [3,5], G=3 to [2,4], and B=2 to [1,3]. Finally, the primary color channel values ​​corresponding to these ranges are calculated. For example, the primary color channel value corresponding to the R range is 150, the G range is 110, and the B range is 70.

[0102] As shown above, dividing the initial inserted image into multiple sub-images enables block-based image processing, significantly reducing the amount of data processed at once and lowering the system's computational burden and memory usage. Furthermore, selecting only a preset number of pixels from each sub-image for processing further reduces computation, allowing the entire color quantization process to be completed in a shorter time. This is particularly beneficial for high-resolution images or real-time image processing scenarios, significantly improving processing speed and meeting immediacy requirements. Converting the initial primary color channel values ​​to binary data and storing them in layers avoids color information distortion caused by data format conversion or error accumulation during calculation. Moreover, layered storage allows for hierarchical management and retrieval of color information based on different needs and precision requirements, reducing storage space usage and improving image storage and transmission efficiency.

[0103] Spatial dispersion is an important indicator of how evenly a pixel is distributed within its neighborhood. Without knowing the spatial dispersion of pixels, it's impossible to accurately analyze the features of pixels in an image, thus affecting the final result of image fusion. Please see [link to relevant documentation]. Figure 6 , Figure 6 This is a schematic flowchart of an image fusion method provided in an embodiment of this application. Figure 6 As shown, the method in this application embodiment may include the following steps S301-S305.

[0104] S301, in the primary color channel values ​​of the first pixel, determine the maximum and minimum primary color values ​​of the first pixel.

[0105] S302 determines the color saturation of the first pixel based on the maximum and minimum primary color values.

[0106] Specifically, in S301-S302, the red, green and blue channel values ​​of the first pixel are extracted from the primary color channel value of the first pixel, and the maximum and minimum brightness values ​​corresponding to the values ​​of the red, green and blue channels are found respectively. By calculating the brightness difference between the maximum and minimum brightness values, and further dividing the brightness difference by the maximum brightness value, the color saturation of the first pixel can be obtained.

[0107] For example, the primary color channel values ​​of the first pixel are 200 for the red channel, 100 for the green channel, and 50 for the blue channel. It can be seen that the red channel value of 200 is the maximum brightness value among the three channels, while the blue channel value of 50 is the minimum brightness value. Then, the brightness difference is calculated, i.e., 200 minus 50 equals 150. Finally, the brightness difference of 150 is divided by the maximum brightness value of 200, resulting in 0.75. Therefore, the color saturation of the first pixel is 0.75.

[0108] S303, determine the color brightness value of the first pixel based on the primary color channel value and the weight value of each primary color channel.

[0109] Specifically, the maximum brightness value of the red, green, and blue channels of each pixel is extracted from the primary color channel value. The maximum brightness value is then multiplied by the channel weight and added together to obtain the color brightness value of the first pixel.

[0110] For example, the primary color channel values ​​of the first pixel include a red channel value of 150, a green channel value of 200, and a blue channel value of 100. The preset weights of the red channel are 0.299, the green channel is 0.587, and the blue channel is 0.114. Then, the color brightness value of the first pixel is (150*0.299)+(200*0.587)+(100*0.114)=44.85+117.4+11.4=173.65.

[0111] S304, obtain the average position information of the primary color channel value of the first pixel in the initial inserted image.

[0112] S305, based on the average position information and the first position information of the first pixel in the initial inserted image, determine the spatial dispersion of the first pixel.

[0113] Specifically, in steps S304-S305, the neighborhood of the first pixel is determined in the initial inserted image. This neighborhood is a rectangular area of ​​a preset size. Each pixel within the neighborhood is traversed, and its coordinates are summed and then divided by the total number of pixels within the neighborhood to obtain the average position information of the first pixel. For example, taking a 3x3 neighborhood, assuming the first pixel's position is (5,5), the coordinates of its neighboring pixels are (4,4), (4,5), (4,6), (5,4), (5,5), (5,6), (6,4), (6,5), and (6,6). The average of these coordinates is calculated, resulting in the average position information (5,5), where the coordinates represent the average distribution coordinates of the red, green, and blue channels of each pixel within the neighborhood. Spatial dispersion is measured by calculating the Euclidean distance between two positions. The Euclidean distance formula is: distance = sqrt((x1-x2)^2 + (y1-y2)^2), where (x1, y1) are the actual coordinates of the first pixel, and (x2, y2) represent the average position information. For example, the actual position of the first pixel is (5, 5), and the average position information is (5, 5). Substituting these values ​​into the Euclidean distance formula, we find that the spatial dispersion of the first pixel is 0.

[0114] As shown above, by analyzing the primary color channel values ​​of the first pixel, the maximum and minimum primary color values ​​of the first pixel are determined. Then, the color saturation of the first pixel is calculated based on these two values. Simultaneously, by combining the primary color channel values ​​of the first pixel with the weight values ​​of each primary color channel, the color brightness value of the pixel can be determined, thus providing an important basis for subsequent color parameter analysis. By obtaining the average position information of the primary color channel values ​​of the first pixel in the initial inserted image and comparing it with the actual position information of the first pixel in the initial inserted image, the spatial dispersion of the pixel is determined. This process helps to evaluate the distribution of pixels throughout the image, providing key information for subsequent pixel classification and image processing. Accurate calculation of the color saturation, color brightness value, and spatial dispersion of the first pixel improves the accuracy of image fusion.

[0115] Average location information is an important indicator used to describe the central tendency of a group of pixels in an image. Without accurate average location information, it is impossible to precisely determine the center position of these pixels, thus affecting the accuracy of subsequent spatial analysis and processing tasks. Please see [link to relevant documentation]. Figure 7 , Figure 7 This is a schematic flowchart of an image fusion method provided in an embodiment of this application. Figure 7 As shown, the method in this application embodiment may include the following steps S401-S403.

[0116] S401, classify the primary color channel values ​​of each pixel to obtain a set of primary color channel values.

[0117] Specifically, the primary color channel values ​​of each pixel are iterated through, and it is checked whether the primary color channel value falls within a preset channel value range, so as to classify the primary color channel values ​​and generate a set of primary color channel values.

[0118] S402, in each pixel, obtain the set of pixels corresponding to the target primary color channel value in the primary color channel value set.

[0119] Specifically, the primary color channel value of the current pixel is obtained as the target primary color channel value. The target primary color channel value is then matched with the set of primary color channel values ​​to obtain the set of pixels corresponding to the channel value range of the target primary color channel value.

[0120] S403, based on the second position information of each second pixel in the pixel set in the initial inserted image, determine the average position information of the target primary color channel value.

[0121] Specifically, in S403, the second position information of the second pixel is accumulated and then divided by the total number of the second pixels to obtain the average position information of the target primary color channel value. For example, the second position information of the second pixel is (4,4), (4,5), (4,6), (5,4), (5,5), (5,6), (6,4), (6,5) and (6,6), so the average position information is (5,5).

[0122] As shown above, by categorizing the primary color channel values ​​of each pixel, we can obtain a set containing different primary color channel values, which helps us manage and process image data more effectively. By selecting any target primary color channel value from the set of primary color channel values ​​and obtaining the corresponding set of pixels, we can perform in-depth analysis on specific color features. Based on the second position information of each second pixel in the pixel set in the initial inserted image, we can calculate the average position information of the target primary color channel value. This process helps to reveal the overall distribution of pixels with the same or similar color features in the image.

[0123] Weighted analysis models assign different weights to different features, thus highlighting those features that are more important for the final score calculation. In image processing, certain color channels or texture features may reflect key information about the image more effectively than other features. By assigning these features higher weights, their greater role in the score calculation can be ensured. See also Figure 8 , Figure 8 This is a schematic flowchart of an image fusion method provided in an embodiment of this application. Figure 8 As shown, the method in this application embodiment may include the following steps S501-S503.

[0124] S501, input the color saturation, color brightness value and spatial dispersion of the first pixel into the pre-trained weight analysis model to obtain the saturation weight, brightness value weight and dispersion weight.

[0125] In the embodiments of this application, the first pixel is any pixel among all pixels.

[0126] Specifically, three key color attributes are extracted from the first pixel: color saturation, color brightness, and spatial dispersion. Color saturation, color brightness, and spatial dispersion describe the vividness, brightness, and distribution of the pixel's color in the image space, respectively. These attributes are then input into a pre-trained weighted analysis model, which is built based on machine learning algorithms and calculates corresponding weights based on the input pixel attributes. After receiving the input attributes, the weighted analysis model processes them and outputs three weight values: saturation weight, brightness weight, and dispersion weight.

[0127] S502, based on the color saturation, color brightness value, spatial dispersion, and saturation weight, brightness value weight, and dispersion weight of the first pixel, determine the pixel score of the first pixel.

[0128] For example, the first pixel A has a color saturation of 80, a color brightness of 150, and a spatial dispersion of 0.2. Simultaneously, using a pre-trained weighted analysis model, the saturation weight is 0.3, the brightness weight is 0.5, and the dispersion weight is 0.2. Multiplying each attribute value by its corresponding weight and then summing them yields the pixel score of the first pixel. Specifically, the pixel score is calculated as follows: Pixel score = 80 × 0.3 + 150 × 0.5 + 0.2 × 0.2 = 24 + 75 + 0.04 = 99.04.

[0129] S503 determines the third pixel with the highest pixel score among all pixels as the reference pixel.

[0130] For example, there are three pixels, namely pixel A, pixel B, and pixel C, each with a value of 90.5. Pixel A has a pixel score of 85.3, pixel B has a pixel score of 95.2, and pixel C has a pixel score of 88.7. Since pixel B has the largest pixel score, it is determined as the reference pixel.

[0131] As shown above, by meticulously classifying the primary color channel values ​​of each pixel, this method can accurately identify and organize color information in the image, thus ensuring the accuracy of color classification. Furthermore, by utilizing the pixel's positional information to calculate the average position of the target primary color channel values, the accuracy of color distribution analysis is enhanced. In addition, by applying a pre-trained weighted analysis model, this method dynamically evaluates the importance of each pixel's color saturation, brightness value, and spatial dispersion, thereby assigning a reasonable weight to each pixel. This weight-based pixel score calculation method not only improves the accuracy of pixel selection but also makes the entire image processing process more efficient and intelligent.

[0132] To improve the accuracy of the weighted analysis model, please refer to [link / reference needed]. Figure 9 , Figure 9 This is a schematic flowchart of an image fusion method provided in an embodiment of this application. Figure 6 As shown, the method in this application embodiment may include the following steps S601-S603.

[0133] It's important to note that in statistical or data analysis, changes in the frequency of an event, such as the occurrence of a color, have different relative importance at different stages. When an event changes from a rare state (e.g., occurring only once) to a slightly more common state (e.g., occurring twice), this change is considered significant and potentially important, as it may signal the beginning of a new trend or pattern. However, when the event has already occurred frequently (e.g., 100 times) and only increases to a slightly higher frequency (e.g., 101 times), this small change seems relatively insignificant overall because its proportion of the total frequency remains almost unchanged, making it unlikely to represent any significant new information or trend. In short, as the frequency of an event increases, the relative importance of the same frequency increment gradually decreases.

[0134] S601, obtain the number of times the primary color channel value of the first pixel appears during the pixel traversal process.

[0135] Specifically, for each pixel traversed, the primary color channel value of the current pixel is compared with the primary color channel value of the first pixel. If the primary color channel values ​​are the same, the occurrence count of the primary color channel value of the first pixel is accumulated.

[0136] S602, obtain the frequency weight corresponding to the frequency of occurrence based on the weight analysis model.

[0137] Specifically, the occurrence count is passed as input to a pre-trained weighted analysis model. This model, built on a machine learning algorithm, calculates the corresponding weights based on the input pixel attributes. After receiving the input attributes, the weighted analysis model processes them and outputs the occurrence count weights.

[0138] S603 determines the pixel score of the first pixel based on its color saturation, color brightness value, spatial dispersion, occurrence frequency, as well as saturation weight, brightness value weight, dispersion weight, and occurrence frequency weight.

[0139] For example, the first pixel A has a color saturation of 80, a color brightness of 150, a spatial dispersion of 0.2, and an occurrence frequency of 2. Simultaneously, through a pre-trained weighted analysis model, the weights are saturation (0.3), brightness (0.5), dispersion (0.2), and occurrence frequency (3). Multiplying each attribute value by its corresponding weight and then summing them yields the pixel score of the first pixel. Specifically, the pixel score is calculated as follows: Pixel score = 80 × 0.3 + 150 × 0.5 + 0.2 × 0.2 + 2 × 6 = 24 + 75 + 0.04 + 6 = 105.04.

[0140] As shown above, by counting the number of times the primary color channel value of the first pixel appears during the entire pixel traversal, and using a weighted analysis model to obtain the corresponding frequency weight, this scheme not only considers the pixel's color attributes (such as saturation, brightness, and spatial dispersion) but also incorporates information about the pixel's occurrence frequency, thus providing a more comprehensive evaluation for each pixel. When determining the pixel score of the first pixel, color saturation, brightness, spatial dispersion, and their weights are integrated, while also considering the number of times the pixel appears and its corresponding weight, thereby improving the accuracy and efficiency of image processing.

[0141] Because background pixels may contain various noise and interference information, this information can negatively impact the performance of image processing algorithms. If not properly distinguished, this interference information may be mistaken for useful data, leading to inaccurate results. See also... Figure 10 , Figure 10 This is a schematic flowchart of an image fusion method provided in an embodiment of this application. Figure 10 As shown, the method in this application embodiment may include the following steps S701-S705.

[0142] S701, Determine the color similarity between each pixel in the initial inserted image and the reference pixel.

[0143] Specifically, each pixel in the inserted image and the reference pixel are converted from the RGB color space to the perceptually uniform CIE Lab color space to eliminate brightness differences between different color channels and more accurately reflect human visual perception. Next, the Euclidean distance between each pixel in the inserted image and the reference pixel in the Lab color space is calculated, and this Euclidean distance is used as the color similarity between each pixel and the reference pixel.

[0144] S702, if the color similarity is less than the preset similarity threshold, then the pixel is determined as a foreground pixel.

[0145] S703, if the color similarity is greater than or equal to the preset similarity threshold, then the pixel is determined as a background pixel.

[0146] Specifically, in S702-S703, the preset similarity threshold is set by the user according to the actual scenario, and is not specifically limited here. For example, the preset color similarity threshold is set to 50. For a pixel A in the inserted image, its RGB value is (240, 10, 10). After converting it to the CIE Lab color space, the color similarity is calculated with the reference pixel, and the distance is found to be 40. Since 40 is less than the preset similarity threshold of 50, pixel A is determined to be a foreground pixel. For another example, pixel B has an RGB value of (100, 100, 100) and a color similarity distance of 60. Since the color similarity of pixel B is greater than the preset 50, pixel B is determined to be a background pixel.

[0147] S704 determines the saturation overflow value and grayscale overflow value of the background pixel based on the color similarity between the background pixel and the reference pixel.

[0148] Specifically, after obtaining the color similarity of each background pixel according to S703 above, for each background pixel falling into a specific color similarity range, the saturation overflow adjustment parameter and grayscale overflow value adjustment parameter corresponding to that range are obtained. Using the saturation adjustment parameter and grayscale value adjustment parameter, a saturation smoothing mask is generated for each background pixel and the saturation smoothing mask is combined with the transparency channel of the background pixel to correct the transparency of the background pixel.

[0149] S705 generates a saturation smoothing mask for background pixels based on saturation overflow and grayscale overflow values, and corrects the transparency of background pixels to the target transparency based on the saturation smoothing mask.

[0150] For example, the initial transparency of background pixel A is 0.6, and the color similarity of background pixel A is 45, which falls within the color similarity range of 40 to 50. The corresponding saturation overflow adjustment parameter for this range is 10, and the grayscale overflow adjustment parameter is 5. Therefore, the saturation of background pixel A is increased using the saturation adjustment parameter 10, while the grayscale value is appropriately reduced using the grayscale adjustment parameter 5. Based on the saturation overflow adjustment parameter 10 and the grayscale adjustment parameter 5, a saturation smoothing mask with a value of 0.7 is generated. This saturation smoothing mask of 0.7 is combined with the original transparency channel value of background pixel A (0.5) to adjust the transparency channel value of background pixel A to 0.6 (i.e., 0.7 × 0.5 + 0.5 × (1 - 0.7)).

[0151] As shown above, by calculating the color similarity between each pixel in the inserted image and the reference pixel and comparing the color similarity with a preset similarity threshold, pixels can be effectively distinguished into foreground pixels and background pixels, so as to accurately identify the foreground objects and background in the initial image. For pixels identified as background, this method further determines the saturation overflow value and grayscale overflow value based on their color similarity with the reference pixel. These overflow values ​​reflect the degree of difference between the background pixel and the reference pixel in color, and can accurately adjust the color attributes of the background pixel. By generating a saturation smoothing mask through the calculated saturation overflow value and grayscale overflow value, the transparency of the background pixel is corrected to the target transparency, thereby improving the accuracy of image fusion.

[0152] Please refer to the following: Figure 11 , Figure 11 This is a scene illustration of an image fusion method provided in an embodiment of this application. For example... Figure 11 As shown, the background pixels of the initial inserted image are black. After the transparency of the background pixels of the initial inserted image is corrected, the target inserted image with transparent background pixels is obtained.

[0153] based on Figure 1 The system architecture will be discussed below. Figure 12 This application provides a detailed description of the image fusion apparatus provided in its embodiments. It should be noted that... Figure 12 The image fusion apparatus in the present application is used to perform the present application. Figures 2-6 The methods shown in the embodiments are for illustrative purposes only, illustrating the parts relevant to the embodiments of this application. For specific technical details not disclosed, please refer to this application. Figures 2-10 In the embodiment shown, the image fusion device 800 may include an image acquisition unit 801, a color acquisition unit 802, a dispersion acquisition unit 803, a pixel determination unit 804, a color comparison unit 805, a correction unit 806, and an insertion unit 807, as detailed below:

[0154] The image acquisition unit 801 is used to acquire an initial insertion image and a target image, perform pixel sampling on the initial insertion image, and obtain the primary color channel value of each pixel in the initial insertion image;

[0155] Color acquisition unit 802 is used to determine the color parameters of each pixel based on the primary color channel value of each pixel;

[0156] The dispersion acquisition unit 803 is used to determine the spatial dispersion of each pixel based on the primary color channel value of each pixel and the position information of each pixel in the initial inserted image.

[0157] The pixel determination unit 804 is used to determine a reference pixel in each pixel based on color parameters and spatial dispersion.

[0158] The chromaticity contrast unit 805 is used to determine the background pixel and the foreground pixel in each pixel based on the chromaticity difference between each pixel and the reference pixel.

[0159] The correction unit 806 is used to correct the transparency of the background pixels to the target transparency, and generate a target inserted image based on the background pixels and foreground pixels with the target transparency;

[0160] The insertion unit 807 is used to insert the target image into a preset insertion position of the target image.

[0161] In some embodiments, the image acquisition unit 801 further includes an image segmentation unit, a selection unit, and a quantization unit.

[0162] An image segmentation unit is used to divide an inserted image into multiple sub-images of a preset size, wherein each sub-image contains at least one pixel.

[0163] The selection unit is used to select a preset number of pixels from each sub-image;

[0164] The quantization unit is used to perform color quantization on each pixel based on a preset color quantization algorithm in order to determine the primary color channel value of each pixel.

[0165] In some embodiments, the image acquisition unit 801 further includes a channel value acquisition unit, a data conversion unit, and a channel value determination unit.

[0166] The channel value acquisition unit is used to acquire the initial primary color channel value of the first pixel in each pixel point, where the first pixel point is any pixel point in each pixel point;

[0167] The data conversion unit is used to convert the initial primary color channel values ​​into binary data and save the binary data in layers to obtain the color quantization parameters of the first pixel.

[0168] The channel value determination unit is used to obtain the set of quantization parameters corresponding to the color quantization parameters, and determine the primary color channel value corresponding to the set of quantization parameters as the primary color channel value of the first pixel.

[0169] In some embodiments, the color acquisition unit 802 further includes a primary color value acquisition unit, a saturation acquisition unit, and a brightness value acquisition unit.

[0170] The primary color value acquisition unit is used to determine the maximum and minimum primary color values ​​of the first pixel from the primary color channel values ​​of the first pixel.

[0171] A saturation acquisition unit is used to determine the color saturation of the first pixel based on the maximum and minimum primary color values.

[0172] The brightness value acquisition unit is used to determine the color brightness value of the first pixel based on the primary color channel value of the first pixel and the weight value of each primary color channel.

[0173] In some embodiments, the dispersion acquisition unit 803 further includes a location acquisition unit and a dispersion determination unit.

[0174] The position acquisition unit is used to acquire the average position information of the primary color channel value of the first pixel in the initially inserted image;

[0175] The dispersion determination unit is used to determine the spatial dispersion of the first pixel based on the average position information and the first position information of the first pixel in the initial inserted image.

[0176] In some embodiments, the dispersion acquisition unit 803 further includes a classification unit, a set acquisition unit, and an average location determination unit.

[0177] The classification unit is used to classify the primary color channel values ​​of each pixel to obtain a set of primary color channel values;

[0178] The set acquisition unit is used to acquire the set of pixels corresponding to the target primary color channel value in the set of primary color channel values ​​in each pixel. The target primary color channel value is any primary color channel value in the set of primary color channel values.

[0179] The average position determination unit is used to determine the average position information of the target primary color channel value based on the second position information of each second pixel in the pixel set in the initial inserted image.

[0180] In some embodiments, the pixel determination unit 804 further includes an input unit, a pixel score determination unit, and a determination unit.

[0181] The input unit is used to input the color saturation, color brightness value and spatial dispersion of the first pixel into the pre-trained weight analysis model to obtain the saturation weight, brightness value weight and dispersion weight.

[0182] The pixel score determination unit is used to determine the pixel score of the first pixel based on the color saturation, color brightness value, spatial dispersion, and saturation weight, brightness value weight, and dispersion weight of the first pixel.

[0183] The determination unit is used to determine the third pixel with the largest pixel score among all pixels as the reference pixel.

[0184] In some embodiments, the pixel determination unit 804 further includes a count acquisition unit, a count weight acquisition unit, and a second pixel score determination unit.

[0185] The count acquisition unit is used to obtain the number of times the primary color channel value of the first pixel appears during the pixel traversal process;

[0186] The frequency weight acquisition unit is used to obtain the frequency weight corresponding to the frequency of occurrence based on the weight analysis model.

[0187] The second pixel score determination unit is used to determine the pixel score of the first pixel based on the color saturation, color brightness value, spatial dispersion, occurrence frequency, and saturation weight, brightness value weight, dispersion weight, and occurrence frequency weight of the first pixel.

[0188] In some embodiments, the color comparison unit 805 further includes a similarity calculation unit, a first determination unit, and a second determination unit.

[0189] The similarity calculation unit is used to determine the color similarity between each pixel in the initial inserted image and the reference pixel.

[0190] The first determination unit is used to determine the pixel as a foreground pixel if the color similarity is less than a preset similarity threshold.

[0191] The second determination unit is used to determine a pixel as a background pixel if the color similarity is greater than or equal to a preset similarity threshold.

[0192] In some embodiments, the correction unit 806 further includes an overflow value calculation unit and a saturation correction unit.

[0193] The overflow value calculation unit is used to determine the saturation overflow value and grayscale overflow value of the background pixel based on the color similarity between the background pixel and the reference pixel.

[0194] The saturation correction unit is used to generate a saturation smoothing mask for background pixels based on saturation overflow value and grayscale overflow value, and to correct the transparency of background pixels to the target transparency based on the saturation smoothing mask.

[0195] In this embodiment, pixel sampling of the initial inserted image is used to obtain primary color channel values ​​and determine color parameters and spatial dispersion, enabling comprehensive analysis of image features from two key dimensions: color and spatial distribution. Based on this, reference pixels are determined, and background and foreground pixels are distinguished, allowing for accurate identification of key elements and background parts in the image, providing data support for subsequent image processing. The process of correcting the transparency of background pixels and generating the target inserted image ensures a more natural and harmonious fusion between the inserted and target images, avoiding harsh stitching marks and effectively improving the quality and visual effect of image synthesis. Finally, the target inserted image is inserted into a preset position within the target image, achieving seamless image fusion and expanding application scenarios, thereby enhancing the applicability and immediacy of image fusion.

[0196] Furthermore, the image fusion apparatus provided in the above embodiments and the image fusion method embodiment belong to the same concept, and the implementation process can be found in the method embodiment, which will not be repeated here.

[0197] The sequence numbers of the embodiments described above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0198] This application also provides a computer storage medium that can store multiple program instructions, which are adapted to be loaded and executed by a processor as described above. Figures 4-10 The method steps of the illustrated embodiment can be found in the following documentation for detailed execution. Figures 4-10 The specific details of the illustrated embodiments will not be elaborated here.

[0199] Please see Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 13As shown, the electronic device 1000 may include: at least one processor 1001, such as a CPU; at least one network interface 1004; an input / output interface 1003; a memory 1005; and at least one communication bus 1002. The communication bus 1002 is used to enable communication between these components. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk drive. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 13 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, an input / output interface module, and an image fusion application.

[0200] exist Figure 13 In the electronic device 1000 shown, the input / output interface 1003 is mainly used to acquire audio and video signals and output them to the user's terminal device.

[0201] In some embodiments, the processor 1001 may be used to call an image fusion application stored in the memory 1005 and specifically perform the following operations: in response to a control operation on a display device, generating a first state control instruction based on the display state indicated by the control operation; sending the first state control instruction to the display device and obtaining first state response data returned by the display device after executing the first state control instruction; generating a first state change message based on the first state response data and setting the display content displayed by the first control device based on the first state change message; and sending the first state change message to a second control device so that the second control device sets the display content displayed by the second control device based on the first state change message.

[0202] Optionally, the processor 1001, in response to a control operation for the display device, generates a first state control instruction based on the display state indicated by the control operation. Specifically, it executes: calling a control operation for the display device in response to a control operation in the first view layer; the first control module parses the control operation to obtain the selected display content; and the first control module generates the first state control instruction based on the display state.

[0203] Optionally, the processor 1001, when executing the command to send a first state control instruction to the display device and to obtain the first state response data returned by the display device after executing the first state control instruction, specifically performs the following steps: calling the first control module to send the first state control instruction to the first calling module; the first calling module sending the first state control instruction to the display device based on the access interface of the display device; and the first calling module obtaining the first state response data returned by the display device after executing the first state control instruction.

[0204] Optionally, the processor 1001, in executing the process of generating a first state change message based on the first state response data and setting the display content displayed by the first control device based on the first state change message, specifically performs the following steps: calling the first calling module to send the first state response data to the first message synchronization service module; the first message synchronization service module generating the first state change message based on the first state response data; the first message synchronization service module pushing the first state change message to the first state storage module; and the first view layer retrieving the first state change message from the first state storage module to set the display content displayed by the first view layer.

[0205] Optionally, when the processor 1001 sends a first state change message to the second control device so that the second control device can set the display content displayed on the second control device based on the first state change message, the processor 1001 specifically executes the following: calling the first message synchronization service module to send the first state response data to the second message synchronization service module of the second control device so that the second control device can set the display content displayed on the second control device based on the first state change message.

[0206] Optionally, the processor 1001 is further configured to perform the following actions: calling the first message synchronization service module to receive a second state control instruction sent by the second message synchronization service module of the second control device; the first message synchronization service module sending the second state control instruction to the first control module; the first control module sending the second state control instruction to the first calling module; the first calling module sending the second state control instruction to the display device based on the access interface of the display device; the first calling module obtaining the second state response data returned by the display device after executing the second state control instruction; the first calling module sending the second state response data to the first message synchronization service module to generate a second state change message; the first message synchronization service module pushing the second state change message to the first state storage module; the first view layer obtaining the second state change message from the first state storage module to set the display content displayed by the first view layer; and the first message synchronization service module sending the second state change message to the second message synchronization service module of the second control device.

[0207] In this embodiment, a first state control command is generated based on the display state indicated by the control operation to ensure the accuracy and relevance of the command, avoiding misoperation or invalid command transmission. By sending the first state control command to the display device and obtaining the display device's response data in real time, the success of the command execution can be confirmed, providing a basis for subsequent state updates and enhancing the system's reliability and stability. A first state change message is generated based on the first state response data, and the display content displayed by the first control device is set based on the first state change message, ensuring real-time updates to the control device's display state. This allows users to intuitively understand the current display content, improving user experience and system interactivity. By sending the first state change message to the second control device, enabling the second control device to set its display content based on the first state change message, state synchronization between multiple control devices is achieved. This allows users on different control devices to promptly understand the latest display content, thereby enhancing state coordination and information sharing capabilities between different applications.

[0208] In some embodiments, the processor 1001 can be used to call an image fusion application stored in the memory 1005 and specifically perform the following operations: acquire an initial insertion image and a target image; perform pixel sampling on the initial insertion image to obtain the primary color channel value of each pixel in the initial insertion image; determine the color parameters of each pixel based on the primary color channel value of each pixel; determine the spatial dispersion of each pixel based on the primary color channel value of each pixel and the position information of each pixel in the initial insertion image; determine a reference pixel in each pixel based on the color parameters and spatial dispersion; determine a background pixel and a foreground pixel in each pixel based on the chromaticity difference between each pixel and the reference pixel; correct the transparency of the background pixel to the target transparency, and generate the target insertion image based on the background pixel and the foreground pixel with the target transparency.

[0209] Optionally, the processor 1001 performs pixel sampling on the initial inserted image to obtain the primary color channel value of each pixel in the initial inserted image. Specifically, it divides the inserted image into multiple sub-images of a preset size, with at least one pixel in each sub-image; selects a preset number of pixels from each sub-image; and performs color quantization on each pixel based on a preset color quantization algorithm to determine the primary color channel value of each pixel.

[0210] Optionally, the processor 1001 performs color quantization on each pixel based on a preset color quantization algorithm to determine the primary color channel value corresponding to each pixel. Specifically, it performs the following steps: obtaining the initial primary color channel value of the first pixel among all pixels, where the first pixel is any pixel among all pixels; converting the initial primary color channel value into binary data and storing the binary data in layers to obtain the color quantization parameters of the first pixel; obtaining the quantization parameter set corresponding to the color quantization parameters, and determining the primary color channel value corresponding to the quantization parameter set as the primary color channel value of the first pixel.

[0211] Optionally, the processor 1001, when performing the determination of color parameters for each pixel based on the primary color channel values ​​of each pixel, specifically performs the following: determining the maximum and minimum primary color values ​​of the first pixel from the primary color channel values; determining the color saturation of the first pixel based on the maximum and minimum primary color values; and determining the color brightness value of the first pixel based on the primary color channel values ​​of the first pixel and the weight values ​​of each primary color channel.

[0212] Optionally, the processor 1001, when executing the determination of the spatial dispersion of each pixel based on the primary color channel value and the position information of each pixel in the initial inserted image, specifically performs the following: obtaining the average position information of the primary color channel value of the first pixel in the initial inserted image; and determining the spatial dispersion of the first pixel based on the average position information and the first position information of the first pixel in the initial inserted image.

[0213] Optionally, before executing the determination of the spatial dispersion of each pixel based on the primary color channel values ​​and the position information of each pixel in the initial inserted image, the processor 1001 specifically performs the following: classifying the primary color channel values ​​of each pixel to obtain a set of primary color channel values; obtaining the set of pixels corresponding to the target primary color channel value in the set of primary color channel values, where the target primary color channel value is any primary color channel value in the set of primary color channel values; and determining the average position information of the target primary color channel value based on the second position information of each second pixel in the set of pixels in the initial inserted image.

[0214] Optionally, the processor 1001 determines a reference pixel among all pixels based on color parameters and spatial dispersion by: inputting the color saturation, color brightness value, and spatial dispersion of the first pixel into a pre-trained weight analysis model to obtain saturation weight, brightness value weight, and dispersion weight; determining the pixel score of the first pixel based on its color saturation, color brightness value, spatial dispersion, and the weights of saturation, brightness value, and dispersion; and determining the third pixel with the highest pixel score among all pixels as the reference pixel.

[0215] Optionally, the processor 1001 may also specifically perform the following: obtaining the number of times the primary color channel value of the first pixel appears during the pixel traversal process; obtaining the frequency weight corresponding to the number of occurrences based on a weight analysis model; and determining the pixel score of the first pixel based on its color saturation, color brightness value, spatial dispersion, and saturation weight, brightness value weight, and dispersion weight, including: determining the pixel score of the first pixel based on its color saturation, color brightness value, spatial dispersion, number of occurrences, and saturation weight, brightness value weight, dispersion weight, and frequency weight.

[0216] Optionally, the processor 1001, when performing the process of determining background and foreground pixels based on the chromaticity difference between each pixel and the reference pixel, specifically performs the following steps: determining the color similarity between each pixel in the initially inserted image and the reference pixel; if the color similarity is less than a preset similarity threshold, then the pixel is determined as a foreground pixel; if the color similarity is greater than or equal to the preset similarity threshold, then the pixel is determined as a background pixel.

[0217] Optionally, the processor 1001, when performing the process of correcting the transparency of the background pixels to the target transparency, specifically performs the following steps: determining the saturation overflow value and grayscale overflow value of the background pixels based on the color similarity between the background pixels and the reference pixels; generating a saturation smoothing mask for the background pixels based on the saturation overflow value and the grayscale overflow value; and correcting the transparency of the background pixels to the target transparency based on the saturation smoothing mask.

[0218] In this embodiment, pixel sampling of the initial inserted image is used to obtain primary color channel values ​​and determine color parameters and spatial dispersion, enabling comprehensive analysis of image features from two key dimensions: color and spatial distribution. Based on this, reference pixels are determined, and background and foreground pixels are distinguished, allowing for accurate identification of key elements and background parts in the image, providing data support for subsequent image processing. The process of correcting the transparency of background pixels and generating the target inserted image ensures a more natural and harmonious fusion between the inserted and target images, avoiding harsh stitching marks and effectively improving the quality and visual effect of image synthesis. Finally, the target inserted image is inserted into a preset position within the target image, achieving seamless image fusion and expanding application scenarios, thereby enhancing the applicability and immediacy of image fusion.

[0219] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0220] The above-disclosed embodiments are merely preferred embodiments of this specification and should not be construed as limiting the scope of this specification. Therefore, any equivalent variations made in accordance with the claims of this specification shall still fall within the scope of this specification.

Claims

1. An image fusion method, characterized by, The method comprises: acquiring an initial insertion image and a target image, performing pixel sampling on the initial insertion image to obtain original color channel values of each pixel point in the initial insertion image; determining color parameters of each pixel point based on the original color channel values of each pixel point; determining spatial dispersion degrees of each pixel point based on the original color channel values of each pixel point and position information of each pixel point in the initial insertion image; determining a reference pixel point among each pixel point based on the color parameters and the spatial dispersion degrees; determining a background pixel point and a foreground pixel point among each pixel point based on a chroma difference value between each pixel point and the reference pixel point, the chroma difference value comprising color similarity between the pixel point and the reference pixel point; correcting a transparency of the background pixel point to a target transparency, and generating a target insertion image based on the background pixel point and the foreground pixel point with the target transparency, the target insertion image being used to display a picture composed of the foreground pixel point; inserting the target insertion image into a preset insertion position of the target image; the determining of the spatial dispersion degrees of each pixel point based on the original color channel values and the position information of each pixel point in the initial insertion image comprises: acquiring average position information of the original color channel values of a first pixel point in the initial insertion image, the first pixel point being any one of each pixel point in the initial insertion image; determining a spatial dispersion degree of the first pixel point based on the average position information and first position information of the first pixel point in the initial insertion image; the determining of the reference pixel point among each pixel point based on the color parameters and the spatial dispersion degrees comprises: inputting color saturation, color brightness value and spatial dispersion degree of the first pixel point into a pre-trained weight analysis model to obtain a saturation weight, a brightness value weight and a dispersion degree weight; determining a pixel score of the first pixel point based on the color saturation, the color brightness value, the spatial dispersion degree of the first pixel point and the saturation weight, the brightness value weight and the dispersion degree weight; determining a third pixel point with the largest pixel score among each pixel point as the reference pixel point, the third pixel point being any one of each pixel point in the initial insertion image.

2. The method of claim 1, wherein, the performing of the pixel sampling on the initial insertion image to obtain the original color channel values of each pixel point in the initial insertion image comprises: dividing the initial insertion image into a plurality of sub-images of a preset size, at least one pixel point being present in each sub-image; selecting a preset number of pixel points from each sub-image; performing color quantization on each pixel point based on a preset color quantization algorithm to determine the original color channel values of each pixel point.

3. The method of claim 2, wherein, the performing of the color quantization on each pixel point based on the preset color quantization algorithm to determine the original color channel values corresponding to each pixel point comprises: acquiring initial original color channel values of a first pixel point in each pixel point, the first pixel point being any one of each pixel point; convert the initial primary color channel values into binary data, and store the binary data in layers to obtain color quantization parameters of the first pixel point; obtain a quantization parameter set corresponding to the color quantization parameters, and determine primary color channel values corresponding to the quantization parameter set as the primary color channel values of the first pixel point.

4. The method of claim 3, wherein, The color parameters include color saturation and color brightness values; The method further includes: determining a maximum primary color value and a minimum primary color value of the first pixel point from the primary color channel values of the first pixel point; determining the color saturation of the first pixel point based on the maximum primary color value and the minimum primary color value; determining the color brightness value of the first pixel point based on the primary color channel values of the first pixel point and weight values of the primary color channels.

5. The method of claim 1, wherein, Before determining the spatial dispersion of each pixel point based on the primary color channel values and position information of each pixel point in the initial inserted image, the method further includes: classifying the primary color channel values of each pixel point to obtain a primary color channel value set; obtaining a pixel point set corresponding to a target primary color channel value in the primary color channel value set from each pixel point, the target primary color channel value being any primary color channel value in the primary color channel value set; determining average position information of the target primary color channel value based on second position information of each second pixel point in the pixel point set in the initial inserted image.

6. The method of claim 1, wherein, The method further includes: obtaining a number of occurrences of the primary color channel values of the first pixel point in a pixel point traversal process; obtaining a number weight corresponding to the number of occurrences based on the weight analysis model; The method further includes: determining the pixel score of the first pixel point based on the color saturation, the color brightness value, and the spatial dispersion of the first pixel point, and the saturation weight, the brightness value weight, and the dispersion weight.

7. The method of claim 1, wherein, The method further includes: determining background pixel points and foreground pixel points from each pixel point based on a color difference value between each pixel point and the reference pixel point. determining color similarity between each pixel point in the initial inserted image and the reference pixel point; if the color similarity is less than a preset similarity threshold, determining the pixel point as the foreground pixel point; 8. The method of claim 1, wherein, if the color similarity is greater than or equal to the preset similarity threshold, determining the pixel point as the background pixel point. The method further includes: determining a saturation overflow value and a grayscale overflow value of the background pixel point based on the color similarity between the background pixel point and the reference pixel point; generating a saturation smoothing mask of the background pixel point based on the saturation overflow value and the grayscale overflow value, and correcting the transparency of the background pixel point to the target transparency based on the saturation smoothing mask.

9. An image fusion apparatus characterized by comprising: The device comprises: An image acquisition unit is configured to acquire an initial insertion image and a target image, and perform pixel sampling on the initial insertion image to obtain original color channel values of each pixel point in the initial insertion image; A color acquisition unit is configured to determine color parameters of each pixel point based on the original color channel values of the pixel points; A dispersion acquisition unit is configured to determine spatial dispersions of each pixel point based on the original color channel values of the pixel points and position information of each pixel point in the initial insertion image; A pixel point determination unit is configured to determine a reference pixel point among the pixel points based on the color parameters and the spatial dispersions; A chroma contrast unit is configured to determine background pixel points and foreground pixel points among the pixel points based on chroma difference values of each pixel point and the reference pixel point; A correction unit is configured to correct transparency of the background pixel points to generate corrected background pixel points, and generate a target insertion image based on the corrected background pixel points and the foreground pixel points; An insertion unit is configured to insert the target insertion image into a preset insertion position of the target image; A position acquisition unit is configured to acquire average position information of original color channel values of a first pixel point in the initial insertion image, the first pixel point being any one of the pixel points in the initial insertion image; A dispersion determination unit is configured to determine a spatial dispersion of the first pixel point based on the average position information and first position information of the first pixel point in the initial insertion image; An input unit is configured to input color saturation, color brightness values and spatial dispersion of the first pixel point to a pre-trained weight analysis model to obtain saturation weight, brightness value weight and dispersion weight; A pixel score determination unit is configured to determine a pixel score of the first pixel point based on the color saturation, the color brightness values, the spatial dispersion of the first pixel point, and the saturation weight, the brightness value weight and the dispersion weight; A determination unit is configured to determine a third pixel point with the largest pixel score as a reference pixel point among the pixel points, the third pixel point being any one of the pixel points in the initial insertion image.

10. An electronic device, comprising: The electronic device comprises: A memory is configured to store executable program codes; A processor is configured to call and run the executable program codes from the memory, so that the electronic device performs the image fusion method according to any one of claims 1 to 8.

11. A computer readable storage medium, characterized in that, The computer readable storage medium stores a computer program, when the computer program is executed, the image fusion method according to any one of claims 1 to 8 is realized.

Citation Information

Patent Citations

  • Image color matting method and system, computer equipment and storage medium

    CN113409221A

  • Image processing method and device, computer device and storage medium

    CN113436284A