Image fusion method, electronic device and storage medium

By extending image blocks and edge fusion, the problem of large memory consumption and splicing lines in image splicing is solved, and efficient image fusion is achieved.

CN117710202BActive Publication Date: 2024-09-24HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311064852.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-22
Publication Date
2024-09-24
Estimated Expiration
2043-08-22

AI Technical Summary

Technical Problem

In existing image stitching technology, memory consumption is large or there are problems with stitching lines.

Method used

Generate extended image blocks by performing preset extension processing on each image block of the input image, and use transparency or Gaussian image fusion algorithms during edge fusion to calculate pixel values ​​in overlapping areas to avoid stitching lines and optimize memory usage.

Benefits of technology

It effectively reduces the memory consumption when merging image blocks, eliminates splicing line problems, and improves the performance and quality of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117710202B
    Figure CN117710202B
Patent Text Reader

Abstract

The present application relates to an image fusion method, an electronic device and a storage medium. The method extends the four boundaries of each image block in the input image according to a preset extension length to obtain an extended image block of each image block, and pre-processes each extended image block in the input image. When the method outputs each extended image block in sequence, each extended image block is edge-fused with an adjacent extended image block to obtain a fused output image. The above technical solution pre-processes the extended image block corresponding to each image block in the input image, and outputs each processed extended image block in sequence. When outputting each extended image block, each extended image block is edge-fused with an extended image block adjacent to each extended image block to obtain a fused output image, which can solve the technical problem of the presence of a splicing line in the fused output image or reduce the memory consumed by the image blocks when they are fused.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the related art, there are mainly two solutions for stitching images. In the first stitching solution, all the images to be stitched are cached at the same time, and then the overlapping areas of the images to be stitched are fused. However, this stitching solution takes up a lot of memory, resulting in high memory consumption. Another stitching solution is to only crop the image content of the core area as the stitched image, and stitch the cropped images together. However, this stitching solution will cause some stitching lines between the stitched images. Summary of the invention

[0003] In view of the above, it is necessary to provide an image fusion method, an electronic device and a storage medium to solve the technical problem of the splicing line after the image blocks are fused or the technical problem of excessive memory consumption when the image blocks are fused.

[0004] In a first aspect, an embodiment of the present application provides an image fusion method, the method comprising: obtaining an input image, wherein the input image includes a preset number of image blocks; extending the boundaries of each image block in the input image according to a preset extension length to obtain an extended image block corresponding to each image block; preprocessing each extended image block; edge-fusing each extended image block with an adjacent extended image block to obtain a fused output image. The above technical solution preprocesses the extended image block corresponding to each image block in the input image, and outputs each processed extended image block in sequence. When outputting each extended image block, each extended image block is edge-fused with an extended image block adjacent to each extended image block to obtain a fused output image, which can solve the technical problem of the presence of a splicing line in the fused output image or reduce the memory consumed by the image blocks when they are fused.

[0005] In one embodiment of the present application, edge fusion is performed on each extended image block with an adjacent extended image block to obtain a fused output image, including: determining a first overlapping area and a first non-overlapping area between each extended image block and an adjacent extended image block; retaining pixel values ​​of the first non-overlapping area; and obtaining pixel values ​​of the first overlapping area based on pixel values ​​of the extended image blocks in the first overlapping area and pixel values ​​of the adjacent extended image blocks. In the above technical solution, by retaining the pixel values ​​of the first non-overlapping area and obtaining pixel values ​​of the first overlapping area based on the pixel values ​​of each extended image block in the first overlapping area and the pixel values ​​of the adjacent extended image blocks in the first overlapping area, the problem of a splicing line when the extended image block is fused with the adjacent extended image block can be avoided and the memory consumed by the image blocks when they are fused can be reduced.

[0006] In one embodiment of the present application, determining the first overlapping area and the first non-overlapping area between each extended image block and the adjacent extended image block includes: taking the area corresponding to the non-overlapping pixel coordinates of each extended image block and the adjacent extended image block as the first non-overlapping area; taking the area corresponding to the overlapping pixel coordinates of each extended image block and the adjacent extended image block as the first overlapping area. In the above technical solution, by taking the area corresponding to the non-overlapping pixel coordinates of each extended image block and the adjacent extended image block as the first non-overlapping area, and taking the area corresponding to the overlapping pixel coordinates of each extended image block and the adjacent extended image block as the first overlapping area, the overlapping area and the non-overlapping area between the extended image block and the adjacent extended image block can be accurately determined.

[0007] In one embodiment of the present application, the pixel value of the first overlapping area is obtained according to the pixel value of the extended image block in the first overlapping area and the pixel value of the adjacent extended image block, including: calculating the pixel value of the first overlapping area according to the formula P(x,y)=alpha1(x,y)*Patch1(x,y)+(1-alpha1(x,y))*Patch2(x,y), wherein Patch1(x,y) is the pixel value of each extended image block in the first overlapping area, Patch2(x,y) is the pixel value of the adjacent extended image block in the first overlapping area, alpha1(x,y) is the weight parameter of each extended image block, alpha1(x,y)=1-x / 32, wherein x is the width of the first overlapping area. The above technical solution can avoid the problem of a splicing line after the extended image block and the adjacent extended image block are merged according to the formula P(x,y)=alpha1(x,y)*Patch1(x,y)+(1-alpha1(x,y))*Patch2(x,y).

[0008] In one embodiment of the present application, the four edges of each image block in the input image are extended according to a preset extension length to obtain an extended image block corresponding to each image block, including: extending each image block along the four edges according to the preset extension length to obtain an extended area corresponding to the image block, and taking the image block including the extended area after extension as the extended image block; according to the positional relationship between the extended area of ​​the extended image block and the image block, taking the extended area located above the image block as the upper extended area, taking the extended area located below the image block as the lower extended area, taking the extended area located to the left of the image block as the left extended area, and taking the extended area located to the right of the image block as the right extended area. In the above technical solution, the extended area of ​​the image block can be divided into four different areas according to the positional relationship between the extended area of ​​the extended image block and the image block.

[0009] In one embodiment of the present application, each extended image block is edge-fused with an adjacent extended image block to obtain a fused output image, including: merging the extended image block P of the Mth row and the Nth column in the matrix constructed based on the image blocks in a first preset order. (M,N) Display on the canvas, where M is any positive integer greater than or equal to 1 and less than or equal to S, N is any positive integer greater than or equal to 1 and less than or equal to L, S is the number of rows of the matrix, and L is the number of columns of the matrix; retain the extended image block P of the Mth row and the Nth column (M,N) The image block, the right extension area and the lower extension area in the Mth row and the (N+1)th column are extended image blocks P according to the first preset order. (M,N+1) Display the extended image block P at row M and column N (M,N) The adjacent position of the image block P of the Mth row and the (N+1th column) (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extended area is fused according to the preset image fusion algorithm; the extended image block P of the Mth row and the (N+1th column (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm to update the extended image block P of the Mth row and the Nth column (M,N) ; Extend the (M+1)th row and Nth column image block P (M+1,N) Display it on the canvas and extend the (M+1)th row and Nth column image block P (M+1,N) The upper extension area and the extended image block P of the Mth row and the Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm; the extended image block P of the (M+1)th row and the Nth column is (M+1,N) The upper extension area and the extended image block P of the Mth row and the (N+1)th column(M,N+1) The overlapping area between them is fused according to the preset image fusion algorithm. In the above technical solution, the extended image block P of the (M+1)th row and the Nth column is (M+1,N) Display it on the canvas and extend the (M+1)th row and Nth column image block P (M+1,N) The upper extension area and the extended image block P of the Mth row and the Nth column (M,N) The overlapping areas between them are fused according to the preset image fusion algorithm, and the (M+1)th row and Nth column extended image block P (M+1,N) The upper extension area and the extended image block P of the Mth row and the (N+1)th column (M,N+1) The overlapping area between them can be avoided by fusing according to the preset image fusion algorithm to avoid the extended image block P of the Mth row and the Nth column. (M,N) Its adjacent extended image block P (M,N+1) , P (M+1,N) The overlapping areas between them will have the problem of stitching lines after fusion.

[0010] In one embodiment of the present application, the extended image block P of the Mth row and the (N+1)th column is (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extension area of ​​the image is fused according to the preset image fusion algorithm, including: determining the extended image block P of the Mth row and the (N+1th column) (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) retaining the pixel value of the second non-overlapping area; and extending the image block P in the Mth row and the (N+1th column) in the second overlapping area according to the second non-overlapping area; (M,N+1) The pixel value of the image block in the second overlapping area is the extended image block P in the Mth row and the Nth column. (M,N) In the above technical solution, the pixel values ​​of the second non-overlapping area are retained, and the extended image block P of the Mth row and the (N+1)th column in the second overlapping area is obtained. (M,N+1) The pixel value of the image block in the second overlapping area is the extended image block P in the Mth row and the Nth column. (M,N) The pixel values ​​of the right extended area are obtained by obtaining the pixel values ​​of the second overlapping area, which can avoid the extended image block P of the (N+1)th column. (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extension area has a splicing line problem after fusion.

[0011] In one embodiment of the present application, according to the extended image block P in the Mth row and the (N+1)th column in the second overlapping area (M,N+1)The pixel value of the image block in the second overlapping area is the extended image block P in the Mth row and the Nth column. (M,N) The pixel value of the right extended area of ​​, obtaining the pixel value of the second overlapping area includes: calculating the pixel value of the second overlapping area according to the formula P(x,y)=alpha2(x,y)*Patch3(x,y)+(1-alpha2(x,y))*Patch4(x,y), where Patch3(x,y) is the extended image block P of the Mth row and the (N+1)th column in the second overlapping area. (M,N+1) Patch4(x, y) is the pixel value of the image block in the Mth row and the Nth column in the second overlapping area. (M,N) The pixel value of the right extended area is calculated according to the formula P(x,y)=alpha2(x,y)*Patch3(x,y)+(1-alpha2(x,y))*Patch4(x,y), which can avoid the extended image block P of the Mth row and the (N+1)th column. (M,N+1) The image block in the second overlapping area and the extended image block P in the Mth row and the Nth column (M,N) There is a problem with the stitching line when blending the right extended area.

[0012] In one embodiment of the present application, the extended image block P of the Mth row and the (N+1)th column is (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm to update the extended image block P of the Mth row and the Nth column (M,N) It includes: determining the extended image block P of the Mth row and the (N+1)th column (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) retaining the pixel values ​​of the third non-overlapping area; and extending the image block P according to the Mth row and the (N+1)th column in the third overlapping area. (M,N+1) The pixel value in the left extended area of ​​, the extended image block P of the Mth row and the Nth column in the third overlapping area (M,N) In the above technical solution, the pixel values ​​of the third non-overlapping area are retained, and the extended image block P of the Mth row and the (N+1)th column in the third overlapping area is obtained. (M,N+1) The pixel value in the left extended area of ​​, the extended image block P of the Mth row and the Nth column in the third overlapping area (M,N)The pixel value of the third overlapping area can be obtained by using the pixel value of the third overlapping area, which can avoid the extended image block P of the Mth row and the (N+1)th column. (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) The overlapping areas between them will have the problem of stitching lines after fusion.

[0013] In one embodiment of the present application, according to the extended image block P in the Mth row and the (N+1)th column in the third overlapping area (M,N+1) The pixel value in the left extended area of ​​, the extended image block P of the Mth row and the Nth column in the third overlapping area (M,N) The pixel value of the third overlapping area is obtained by: calculating the pixel value of the third overlapping area according to the formula P(x,y)=alpha3(x,y)*Patch5(x,y)+(1-alpha3(x,y))*Patch6(x,y), where Patch5(x,y) is the extended image block P of the Mth row and the (N+1)th column in the third overlapping area. (M,N+1) Patch6(x, y) is the pixel value in the left extended area of ​​the third overlapping area, and Patch6(x, y) is the extended image block P in the Mth row and Nth column of the third overlapping area. (M,N) , alpha3(x,y) is the weight parameter, alpha(x,y)=1-x3 / 32, where x3 is the width of the third overlapping area.

[0014] In one embodiment of the present application, the method further includes: determining a preset extension length according to the receptive field of the artificial intelligence AI network. In the above technical solution, the preset extension length is determined according to the receptive field of the artificial intelligence AI network, and the four edges of the image block are extended according to the preset extension length to obtain an extended image block corresponding to the image block, so that the extended image block can be recognized and processed by the AI ​​network.

[0015] In one embodiment of the present application, preprocessing each extended image block in the input image includes: preprocessing the extended image blocks of each image block in sequence by a first processor; processing the extended image blocks corresponding to each image block after the preprocessing by a second processor using an AI network; and post-processing each extended image block after the AI ​​network processing by a third processor. The above technical solution realizes heterogeneous calculation of the extended image blocks, hides the time of preprocessing and post-processing of the extended image blocks in the calculation time of the AI ​​network, and reduces the processing time of the extended image blocks by performing heterogeneous calculation on the extended image blocks, and improves the image processing performance.

[0016] In one embodiment of the present application, the first processor is a graphics processor, the second processor is an embedded neural network processor, and the third processor is a central processing unit.

[0017] In a second aspect, an embodiment of the present application provides an electronic device, which includes a memory and a processor: the memory is used to store program instructions; the processor is used to read and execute the program instructions stored in the memory, and when the program instructions are executed by the processor, the electronic device executes the above-mentioned image fusion method.

[0018] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores program instructions. When the program instructions are executed by a processor, the above-mentioned image fusion method is executed.

[0019] In addition, the technical effects brought about by the second to third aspects can be found in the descriptions related to the methods of each design in the above method part, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 Schematic diagram of the existence of stitching lines between related stitched images.

[0022] Figure 2 It is a schematic diagram of the structure of a terminal device in one embodiment of the present application.

[0023] Figure 3 Flow chart of an image fusion method in one embodiment of the present application.

[0024] Figure 4A It is a schematic diagram of capturing an image block from an input image in one embodiment of the present application.

[0025] Figure 4B This is a schematic diagram of an image block displayed in an input image in an implementation of the present application.

[0026] Figure 5 It is a schematic diagram of extending an image block in an input image to obtain an extended image block in an embodiment of the present application.

[0027] Figure 6 It is a schematic diagram of extending an image block in an embodiment of the present application.

[0028] Figure 7 This is a schematic diagram of extending an image block in another embodiment of the present application.

[0029] Figure 8A schematic diagram of performing heterogeneous computing on image blocks in one embodiment of the present application.

[0030] Fig. 9 This is a schematic diagram of an image block displayed on a canvas in an embodiment of the present application.

[0031] Fig.10 It is a schematic diagram of edge fusion between each extended image block and an adjacent extended image block in one embodiment of the present application.

[0032] Fig.11 Detailed description is a flow chart of a method for edge-blending an extended image block with an adjacent extended image block in one embodiment of the present application.

[0033] Fig.12 This is a flowchart of an image fusion method in another embodiment of the present application.

[0034] Fig.13 It is a schematic diagram of outputting an image in an embodiment of the present application.

[0035] Fig.14 Schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0036] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.

[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by technicians in the technical field in this application. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. It should be understood that, unless otherwise specified in this application, " / " means or. For example, A / B can represent A or B. "And / or" in this application is only a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. "At least one" means one or more. "Multiple" means two or more than two. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, a, b and c seven situations.

[0038] In the related art, there are mainly two solutions for stitching images. The first stitching solution is to cache all the images to be stitched at the same time, and then fuse the overlapping areas of the images to be stitched. However, this stitching solution will occupy a large amount of system memory when all the images to be stitched need to be cached at the same time, resulting in high system memory consumption. Another stitching solution is to only crop the image content of the core area as the stitched image, and stitch the cropped stitched images together. However, the size of the stitched image in this stitching solution is composed of the sizes of all the stitched images, resulting in some stitching line problems between the stitched images (refer to Figure 1 ).

[0039] In order to solve the above problems, the present application provides an image fusion method. The method is applied in a terminal device. Figure 2 As shown, it is a schematic diagram of the structure of the terminal device in one embodiment of the present application. The terminal device 10 includes, but is not limited to, a first processor 11, a second processor 12 and a third processor 13. The first processor 11 is used to pre-process the image to improve the image quality and recognition accuracy. The second processor 12 is used to process the image through an artificial intelligence (AI) network. The AI ​​network includes at least one of an artificial neural network, a convolutional neural network, and a recurrent neural network. The third processor 13 is used to post-process and edge-blend the image. In one embodiment of the present application, the first processor 11 may be a graphics processing unit (GPU), and the second processor 12 may be an embedded neural network processor (Neural-network Processing Units, NPU) or a digital signal processor (Digital Signal Processing, DSP). The third processor 13 may be a central processing unit (CPU).

[0040] refer to Figure 3 FIG. 1 is a flow chart of an image fusion method in an embodiment of the present application. The image fusion method is applied in a terminal device 10. The method comprises the following steps.

[0041] Step S301: acquiring an input image, wherein the input image includes a preset number of image blocks.

[0042] In one embodiment of the present application, the terminal device obtains the image selected by the user as the input image according to the user's selection operation on at least one image stored in the local gallery, so as to fuse the image blocks in the image selected by the user in the gallery. In another embodiment of the present application, the terminal device uses an image captured by a camera device, such as a camera, as the input image, so as to fuse the image blocks in the captured image. The input image includes a preset number of image blocks, each image block has a different position in the input image, and each image block has the same or different size. Figure 4A As shown, it is a schematic diagram of capturing image blocks from an input image in one embodiment of the present application. An image block is image content captured sequentially from an input image according to a preset order and a preset size. For example, an image block is obtained by sequentially capturing image content of a preset size starting from the left boundary of the input image in a left-to-right order. When capturing image blocks from an input image in a left-to-right order, if the right boundary of the image block exceeds the right boundary of the input image, the right boundary of the image block is aligned with the right boundary of the input image and then the image content of the preset size is captured as the image block. The captured image blocks are distributed at different positions of the input image, and all image blocks constitute the input image. Reference Figure 4B In one embodiment of the present application, the image blocks are displayed on the canvas in a matrix, and the matrix includes S rows and L columns, where S and L are positive integers greater than 2.

[0043] Step S302, obtaining the receptive field of the AI ​​network, and determining a preset extension length of the image block according to the receptive field.

[0044] Receptive Field refers to the size of the area on which the pixels on the feature map output by each layer of the AI ​​network are mapped back to the input image. In one embodiment of the present application, determining the preset extension length of the image block according to the receptive field includes: setting the preset extension length of the image block to be greater than or equal to the preset ratio of the receptive field, for example, the preset ratio may be one twelfth of the receptive field. The preset extension length of the image block is used to characterize the length extending outward from the four sides of the image block. For example, if the area corresponding to the receptive field of the AI ​​network is 96, the preset extension length of the image block is greater than or equal to 96 / 12=8.

[0045] Step S303 : Extending the periphery of each image block in the input image according to a preset extension length to obtain an extended image block corresponding to each image block.

[0046] In one embodiment of the present application, each image block in the input image is extended along four edges according to a preset extension length to obtain an extension area corresponding to the image block, and the image block including the extension area after extension is used as the extended image block.

[0047] refer to Figure 5FIG. 1 is a schematic diagram of extending an image block in an input image to obtain an extended image block in an embodiment of the present application. For example, an image block in the input image is a 456*456 pixel square block, and the preset extension length is 16 pixels. After the image block is extended along the four sides of the square block according to the preset extension length of 16 pixels, the extended area of ​​the image block is obtained, and the image block including the extended area is used as the extended image block, that is, a 488*488 pixel square block. Figure 5 In one embodiment of the present application, according to the positional relationship between the extended area and the image block, the extended area located above the image block is used as the upper extended area of ​​the image block, the extended area located below the image block is used as the lower extended area of ​​the image block, the extended area located to the left of the image block is used as the left extended area of ​​the image block, and the extended area located to the right of the image block is used as the right extended area of ​​the image block.

[0048] In one embodiment of the present application, if the extended area of ​​the extended image block does not exceed the boundary of the input image, the image content corresponding to the extended area of ​​the extended image block on the input image is intercepted as the image content of the extended area. If the extended area of ​​the extended image block exceeds the boundary of the input image, the extended area that does not exceed the boundary of the input image is taken as the first area, and the extended area that exceeds the boundary of the input image is taken as the second area; the image content corresponding to the first area on the input image is intercepted as the image content of the first area, and the second area is mirrored along the boundary of the input image to obtain the image content of the second area. For example, referring to Figure 6 When the image block P1 is extended, if the extended area A of the image block P1 does not exceed the boundary of the input image, the image content corresponding to the extended area A on the input image is intercepted as the image content of the extended area A. Figure 7 When the image block P2 is extended, if the extended area of ​​the image block P2 exceeds the boundary of the input image, the extended area that does not exceed the boundary of the input image is taken as the first area B1, and the extended area that exceeds the boundary of the input image is taken as the second area B2. The image content corresponding to the first area B1 on the input image is intercepted as the image content of the first area B1, and the second area B2 is mirrored along the boundary of the input image to obtain the image content of the second area B2.

[0049] In one embodiment of the present application, the input image can be directly extended according to a preset extension length to obtain a target input image, and then the extended image block can be intercepted from the target input image according to a preset order and the size of the extended image block. For example, image contents of corresponding sizes are intercepted in sequence starting from the left border of the target input image to obtain the extended image block. When the extended image block is intercepted from the input image in a left-to-right order, if the right border of the extended image block exceeds the right border of the target input image, the right border of the extended image block is aligned with the right border of the target input image, and then the image content of the corresponding size is intercepted as the extended image block.

[0050] Step S304, pre-processing the extended image blocks of each image block in turn.

[0051] In one embodiment of the present application, the first processor 11 of the terminal device 10 performs pre-processing on the extended image block corresponding to each image block of the input image to improve the quality and recognition accuracy of the image block. The pre-processing method includes, but is not limited to: at least one of a smoothing algorithm, an edge detection algorithm, and a histogram equalization algorithm. For example, the first processor 11 of the terminal device 10 performs pre-processing on each extended image block of the input image according to the smoothing algorithm to remove noise in the corresponding extended image block. The smoothing algorithm includes, but is not limited to, a moving average method, an exponential smoothing method, and a Gaussian filter method.

[0052] In one embodiment of the present application, the first processor 11 of the terminal device 10 pre-processes each extended image block of the input image according to an edge detection algorithm to remove noise in the corresponding extended image block. The edge detection algorithm includes, but is not limited to: at least one of a fuzzy processing method, a threshold processing method, and a morphological processing method. In one embodiment of the present application, the first processor 11 of the terminal device 10 pre-processes each extended image block of the input image according to a histogram equalization algorithm to improve the brightness and contrast of the image. The edge detection algorithm includes, but is not limited to: a fuzzy processing method, a threshold processing method, and a morphological processing method.

[0053] Step S305: Using the AI ​​network to process the extended image block corresponding to each pre-processed image block.

[0054] In one embodiment of the present application, the second processor 12 of the terminal device 10 processes the extended image block corresponding to each image block after pre-processing through the AI ​​network to reduce noise or perform image motion deblurring on the extended image block of each image block. In one embodiment of the present application, the AI ​​network processes the extended image block corresponding to each image block after pre-processing according to a preset deblurring algorithm to perform image motion deblurring on the extended image block of each image block. The preset deblurring algorithm includes at least one of a motion deblurring method based on wavelet transform, a motion deblurring method based on Wiener filtering, and a motion deblurring method based on adaptive filtering. In one embodiment of the present application, the AI ​​network processes the extended image block corresponding to each image block of the input image in a block-by-block manner, which can solve the problem that the AI ​​network needs to normalize the size of the input image when processing the entire input image, and solves the problem that the AI ​​network cannot complete the reasoning due to the input image being too large when performing reasoning.

[0055] Step S306, post-processing each extended image block after being processed by the AI ​​network.

[0056] In one embodiment of the present application, the third processor 102 of the terminal device 10 performs post-processing on the extended image block corresponding to each image block processed by the AI ​​network. The post-processing includes at least one of image enhancement, denoising, sharpening, edge detection, image segmentation, and image fusion. Figure 8 As shown, in the embodiment of the present application, the first processor 11 performs pre-processing on the extended image block corresponding to each image block of the input image; the second processor 12 processes each extended image block after the pre-processing by using the AI ​​network; and the third processor 102 performs post-processing on each extended image block after the AI ​​network processing, thereby realizing heterogeneous computing of the extended image blocks, hiding the time for pre-processing and post-processing of the extended image blocks in the computing time of the AI ​​network, and performing heterogeneous computing on the extended image blocks, thereby reducing the processing time of the extended image blocks and improving the image processing performance.

[0057] Step S307 , outputting each processed extended image block in sequence, and when outputting each extended image block, edge-fusing each extended image block with an extended image block adjacent to each extended image block to obtain a fused output image.

[0058] refer to Fig. 9 , the extended image blocks are output on the canvas in a matrix, the matrix includes S rows and L columns, where S and L are positive integers greater than 2. In one embodiment of the present application, an extended image block adjacent to an extended image block refers to an image block that has an overlapping area with the extended image block. For example, referring to Fig. 9, there is an overlapping area between the extended image block P2 and the extended image block P1, then the extended image block P2 is an adjacent extended image block of the extended image block P1. In one embodiment of the present application, according to the position of each extended image block in the input image, all the extended image blocks processed according to the AI ​​network are displayed on a canvas in sequence, and when each extended image block is displayed on the canvas, each extended image block is edge-fused with the extended image blocks adjacent to each extended image block to obtain an output image. In one embodiment of the present application, according to the position of each image block in the input image, the extended image blocks corresponding to each image block processed by the AI ​​network are displayed on the canvas in sequence from left to right and from top to bottom, and when each extended image block is displayed on the canvas, each extended image block is edge-fused with the extended image blocks adjacent to each extended image block to obtain an output image, and the output image is displayed.

[0059] In one embodiment of the present application, each extended image block is edge-fused with an adjacent extended image block according to a preset image fusion algorithm to obtain an output image. The preset image fusion algorithm includes a transparency (Alpha) image fusion algorithm or a Gaussian image fusion algorithm. Fig.10 The figure is a schematic diagram of edge fusion of each extended image block with an adjacent extended image block in an embodiment of the present application. In an embodiment of the present application, according to a preset image fusion algorithm, edge fusion of each extended image block P3 with an adjacent extended image block P4 to obtain an output image includes: determining a first overlapping area R1 and a first non-overlapping area R2 in each extended image block P3 and an adjacent extended image block P4; retaining the pixel value of the first non-overlapping area R2; and obtaining the pixel value of the first overlapping area R1 according to the pixel value of each extended image block P3 in the first overlapping area R1 and the pixel value of the adjacent extended image block P4 in the first overlapping area R1.

[0060] In one embodiment of the present application, the pixel value of the first overlapping region R1 is calculated according to the formula P(x,y)=alpha1(x,y)*Patch1(x,y)+(1-alpha1(x,y))*Patch2(x,y), where Patch1(x,y) is the pixel value of each extended image block P3 in the first overlapping region R1, Patch2(x,y) is the pixel value of the adjacent extended image block P4 in the first overlapping region R1, and alpha1(x,y) is the weight parameter of each extended image block. In one embodiment of the present application, alpha1(x,y)=1-x1 / 32, where x1 is the width of the first overlapping region R1, and the width of the first overlapping region R1 is twice the preset extension length.

[0061] In one embodiment of the present application, the first overlapping area R1 and the first non-overlapping area R2 between each extended image block P3 and the adjacent extended image block P4 are determined according to the pixel coordinates of each extended image block P3 and the adjacent extended image block P4 in the input image. Specifically, the area corresponding to the non-overlapping pixel coordinates of each extended image block P3 and the adjacent extended image block P4 is taken as the first non-overlapping area R2, and the area corresponding to the overlapping pixel coordinates of each extended image block P3 and the adjacent extended image block P4 is taken as the first overlapping area R1.

[0062] refer to Fig.11 FIG. 1 is a flow chart of a method for edge-blending an extended image block with an adjacent extended image block in an embodiment of the present application. The method comprises the following steps.

[0063] Step S901: The extended image block P of the Mth row and the Nth column in the matrix constructed based on the image blocks is arranged in a first preset order. (M,N) Displayed on the canvas.

[0064] In one embodiment of the present application, the first preset order is an order from left to right, or an order from right to left. Figure 8 The terminal device sequentially places the extended image block P of the Mth row and the Nth column of the matrix from left to right. (M,N) In one embodiment of the present application, M is a positive integer greater than or equal to 1 and less than or equal to S, N is a positive integer greater than or equal to 1 and less than or equal to L, and M and N start from 1, S is the number of rows of the matrix, and L is the number of columns of the matrix.

[0065] Step S902: retain the extended image block P of the Mth row and the Nth column (M,N) The image block in, the right extension area and the bottom extension area.

[0066] refer to Fig. 9 In the embodiment of the present application, since the extended image blocks are output to the canvas in order from left to right, the output extended image block P of the Mth row and the Nth column (M,N) The right extension area and the lower extension area of ​​the next output image block P of the Mth row and the (N+1)th column (M,N+1) There are overlapping areas in the image blocks, so it is necessary to retain the extended image block P (M,N) The right extension area and the lower extension area of ​​​​the image block P are subsequently extended (M,N) The next output extended image block P (M,N+1) Edge fusion is performed to eliminate the stitching line of the output image. In another embodiment of the present application, if the extended image block is output to the canvas in sequence from right to left, the image block, the left extended area and the lower extended area in the extended image block are retained.

[0067] Step S903: The extended image block P of the Mth row and the (N+1)th column is arranged according to a first preset order. (M,N+1) Display the extended image block P at row M and column N (M,N) The adjacent position of the image block P of the Mth row and the (N+1th column) (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extended area is fused according to the preset image fusion algorithm.

[0068] In one embodiment of the present application, the extended image block P of the Mth row and the (N+1)th column is (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extension area of ​​the image is fused according to the preset image fusion algorithm, including: determining the extended image block P of the Mth row and the (N+1th column) (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) retain the pixel value of the second non-overlapping area; and according to the extended image block P of the Mth row and the (N+1th column) in the second overlapping area (M,N+1) The pixel value of the image block in the second overlapping area is the extended image block P in the Mth row and the Nth column. (M,N) The pixel values ​​of the second overlapping area are obtained by calculating the pixel values ​​of the right extended area of ​​the second overlapping area. An embodiment of the application calculates the pixel values ​​of the second overlapping area according to the formula P(x,y)=alpha2(x,y)*Patch3(x,y)+(1-alpha2(x,y))*Patch4(x,y), where Patch3(x,y) is the extended image block P of the Mth row and the (N+1)th column in the second overlapping area. (M,N+1) Patch4(x, y) is the pixel value of the image block in the Mth row and the Nth column in the second overlapping area. (M,N) The pixel value of the right extended area, alpha2(x,y) is the weight parameter, alpha2(x,y)=1-x2 / 32, where x2 is the width of the second overlapping area.

[0069] Step S904: Extend the image block P at the Mth row and the (N+1)th column (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm to update the extended image block P of the Mth row and the Nth column (M,N) .

[0070] In one embodiment of the present application, the extended image block P of the Mth row and the (N+1)th column is determined(M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) retain the pixel value of the third non-overlapping area; and according to the extended image block P of the Mth row and the (N+1th column) in the third overlapping area (M,N+1) The pixel value in the left extended area of ​​, the extended image block P of the Mth row and the Nth column in the third overlapping area (M,N) The pixel value of the third overlapping area is obtained by calculating the pixel value of the third overlapping area. One embodiment of the present application calculates the pixel value of the third overlapping area according to the formula P(x,y)=alpha3(x,y)*Patch5(x,y)+(1-alpha3(x,y))*Patch6(x,y), where Patch5(x,y) is the extended image block P of the Mth row and the (N+1)th column in the third overlapping area. (M,N+1) Patch6(x, y) is the pixel value in the left extended area of ​​the third overlapping area, and Patch6(x, y) is the extended image block P in the Mth row and Nth column of the third overlapping area. (M,N) , alpha3(x,y) is the weight parameter, alpha(x,y)=1-x3 / 32, where x3 is the width of the third overlapping area.

[0071] Step S905, update N according to the formula N=N+1, and determine whether N is less than (L-1). If N is less than (L-1), execute step S902. If N is greater than or equal to (L-1), execute step S906.

[0072] Step S906, set N to 1, update M according to the formula M=M+1, and determine whether M is greater than S. If M is less than or equal to S, execute step S907, and if M is greater than S, the process ends.

[0073] Step S907: Extend the Mth row and Nth column image block P (M,N) Display it on the canvas and extend the image block P in the Mth row and Nth column (M,N) The upper extension area and the extended image block P of the (M-1)th row and Nth column (M-1,N) The overlapping areas between them are fused according to the preset image fusion algorithm, and the Mth row and Nth column extended image block P (M,N) The upper extension area and the extended image block P of the (M-1)th row and (N+1)th column (M-1,N+1) The overlapping areas between them are fused according to the preset image fusion algorithm.

[0074] In one embodiment of the present application, the Mth row and the Nth column of the extended image block P (M,N) The upper extension area and the extended image block P of the (M-1)th row and Nth column (M-1,N)The method flow for fusing the overlapping area between the two images according to a preset image fusion algorithm includes: determining the extended image block P of the Mth row and the Nth column (M,N) The upper extension area and the extended image block P of the (M-1)th row and Nth column (M-1,N) retaining the pixel values ​​of the fourth non-overlapping area; extending the image block P according to the Mth row and the Nth column in the fourth overlapping area; (M,N) The pixel values ​​in the upper extended area of ​​the (M-1)th row and the Nth column of the extended image block P (M-1,N) The pixel value of the fourth overlapping area is obtained.

[0075] In one embodiment of the present application, the Mth row and the Nth column of the extended image block P (M,N) The upper extension area and the extended image block P of the (M-1)th row and (N+1)th column (M-1,N+1) The overlapping area between the Mth row and the Nth column includes: determining the extended image block P (M,N) The upper extension area and the extended image block P of the (M-1)th row and (N+1)th column (M-1,N+1) retaining the pixel values ​​of the fifth non-overlapping area; extending the image block P according to the Mth row and the Nth column in the fifth overlapping area; (M,N) The pixel values ​​in the upper extended area of ​​the (M-1)th row and the (N+1)th column of the extended image block P (M-1,N+1) The pixel value of the fifth overlapping area is obtained.

[0076] After step S907 is executed, step S902 is executed until all the extended image blocks in all rows are updated on the canvas.

[0077] In one embodiment of the present application, the terminal device 10 performs a check on any extended image block P in the matrix. (M,N) and the extended image block P (M,N) Adjacent extended image block P (M,N+1) and P (M+1,N) Performing edge fusion, comprising: according to a first preset order, the extended image block P of the Mth row and the Nth column in the matrix constructed based on the image block (M,N) Display on the canvas; keep the extended image block P of the Mth row and Nth column (M,N) The image block, the right extension area and the lower extension area in the Mth row and the (N+1)th column are extended according to the first preset order. (M,N+1) Display the extended image block P at row M and column N (M,N) The adjacent position of the image block P of the Mth row and the (N+1th column) (M,N+1)The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extended area is fused according to the preset image fusion algorithm; the extended image block P of the Mth row and the (N+1th column (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm to update the extended image block P of the Mth row and the Nth column (M,N) ; Extend the (M+1)th row and Nth column image block P (M+1,N) Display it on the canvas and extend the (M+1)th row and Nth column image block P (M+1,N) The upper extension area and the extended image block P of the Mth row and the Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm; the extended image block P of the (M+1)th row and the Nth column is (M+1,N) The upper extension area and the extended image block P of the Mth row and the (N+1)th column (M,N+1) The overlapping areas between them are fused according to the preset image fusion algorithm.

[0078] In the embodiment of the present application, the first processor 11 performs pre-processing on the extended image block, the second processor 12 processes the extended image block of each pre-processed image block through the AI ​​network, and the third processor 102 performs post-processing on the extended image block, thereby realizing heterogeneous calculation of the extended image block. By performing heterogeneous calculation on the extended image block, the processing time of the extended image block is reduced and the image processing performance is improved. At the same time, the present application also outputs each processed extended image block in sequence, and when outputting each extended image block, each extended image block is edge-fused with the extended image blocks adjacent to each extended image block to obtain a fused output image, which can solve the technical problem of the existence of a splicing line in the fused output image or reduce the memory consumed by the image blocks when they are fused.

[0079] refer to Fig.12 FIG. 2 is a flow chart of an image fusion method in another embodiment of the present application. The image fusion method comprises the following steps.

[0080] Step S1201: obtaining an input image, wherein the input image includes a preset number of image blocks.

[0081] The specific implementation content of step S1201 can be referred to Figure 2 The description content of step S201 in .

[0082] Step S1202 : Extend the boundaries of each image block in the input image according to a preset extension length to obtain an extended image block corresponding to each image block.

[0083] In one embodiment of the present application, the receptive field of the AI ​​network is obtained, and the preset extension length of the image block is determined according to the receptive field. The specific implementation content of step S2102 can be referred to Figure 3 The description content of step S303 in .

[0084] Step S1203: pre-process each extended image block in the input image.

[0085] In one embodiment of the present application, preprocessing each extended image block in the input image includes at least one of pre-processing, processing through an AI network, and post-processing each extended image block in the input image. In this embodiment, for the specific implementation process of processing each extended image block in the input image through an AI network, please refer to Figure 3 For the specific implementation process of pre-processing each extended image block in the input image, please refer to the contents of step S304 in Figure 3 For the specific implementation process of post-processing each extended image block in the input image, please refer to Figure 3 The recorded content of step S306.

[0086] Step S1204: output each processed extended image block in sequence, and when outputting each extended image block, edge-fuse each extended image block with an extended image block adjacent to each extended image block to obtain a fused output image.

[0087] In one embodiment of the present application, according to the position of each image block in the input image, all processed extended image blocks are sequentially displayed on a canvas, and when each extended image block is displayed on the canvas, each extended image block is edge-fused with an extended image block adjacent to each extended image block to obtain an output image. Fig.13 In the embodiment of this case, the image output by edge fusion of the extended image block and the adjacent extended image block does not have the problem of stitching lines. The present application pre-processes the extended image block corresponding to each image block in the input image, and sequentially outputs each processed extended image block, and when outputting each extended image block, edge-fuses each extended image block with the extended image blocks adjacent to each extended image block to obtain the fused output image, which can solve the technical problem of the existence of stitching lines in the fused output image or reduce the memory consumed when the image blocks are fused.

[0088] The electronic device 100 involved in the embodiment of the present application is introduced below. Fig.14 FIG. 1 is a schematic diagram of the hardware structure of an electronic device 100 in an embodiment of the present application. The electronic device 100 may be Figure 1 The terminal device 10 in.

[0089] In this embodiment, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a keyboard 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0090] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0091] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0092] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0093] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0094] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0095] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0096] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device 100 through the power management module 141.

[0097] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0098] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0099] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0100] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0101] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0102] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0103] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0104] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0105] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0106] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0107] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.

[0108] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.

[0109] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0110] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0111] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.

[0112] The internal memory 121 or the external memory interface 120 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 110. The one or more computer programs include multiple instructions. When the multiple instructions are executed by the processor 110, the image fusion method in the above embodiment can be executed on the electronic device 100 to realize the image fusion function of the electronic device 100.

[0113] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0114] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.

[0115] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0116] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.

[0117] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device 100 and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0118] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0119] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0120] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

[0121] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0122] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

[0123] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0124] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.

[0125] The keyboard 190 includes a power button, a volume button, etc. The keyboard 190 can be a mechanical keyboard or a touch keyboard. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0126] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0127] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0128] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0129] This embodiment further provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on the electronic device 100, the electronic device 100 executes the above-mentioned related method steps to implement the image fusion method in the above-mentioned embodiment.

[0130] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the image fusion method in the above-mentioned embodiment.

[0131] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes the image fusion method in the above-mentioned method embodiments.

[0132] Among them, the electronic device 100, computer storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0133] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0134] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0135] The unit described as a separate component may or may not be physically separated, and the component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.

[0136] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0137] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0138] The above implementation modes are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the above preferred implementation modes, a person skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. An image fusion method, characterized in that: The method comprises: Acquire an input image, wherein the input image includes a preset number of image blocks; Extending the perimeter of each image block in the input image according to a preset extension length to obtain an extended image block corresponding to each image block; Preprocessing each extended image block; The method performs edge fusion on each of the extended image blocks and adjacent extended image blocks to obtain a fused output image, including: displaying each of the preprocessed extended image blocks on a canvas in sequence according to the position of each of the extended image blocks in the input image, and when displaying each of the extended image blocks on the canvas, edge fusion on each of the extended image blocks and adjacent extended image blocks of the extended image block until all the extended image blocks are fused to obtain the output image.

2. The image fusion method according to claim 1, characterized in that: The step of edge-fusing each of the extended image blocks with an adjacent extended image block to obtain a fused output image comprises: Determine a first overlapping area and a first non-overlapping area between each extended image block and an adjacent extended image block; retaining pixel values ​​of the first non-overlapping area; The pixel value of the first overlapping area is obtained according to the pixel value of the extended image block in the first overlapping area and the pixel value of the adjacent extended image block.

3. The image fusion method according to claim 2, characterized in that: The determining of a first overlapping area and a first non-overlapping area between each extended image block and an adjacent extended image block comprises: Taking the area corresponding to the non-overlapping pixel coordinates in each extended image block and the adjacent extended image block as the first non-overlapping area; An area corresponding to pixel coordinates that overlap between each extended image block and an adjacent extended image block is used as the first overlapping area.

4. The image fusion method according to claim 2, characterized in that: The step of obtaining the pixel value of the first overlapping area according to the pixel value of the extended image block in the first overlapping area and the pixel value of the adjacent extended image block includes: The pixel value of the first overlapping area is calculated according to the formula P(x, y) = alpha1 (x, y) * Patch1(x, y) + (1- alpha1 (x, y)) *Patch2(x, y), where Patch1(x, y) is the pixel value of each extended image block in the first overlapping area, Patch2(x, y) is the pixel value of the adjacent extended image block in the first overlapping area, alpha1 (x, y) is the weight parameter of each extended image block, alpha1 (x, y)=1-x / 32, where x is the width of the first overlapping area.

5. The image fusion method according to claim 1, characterized in that: The step of extending the boundaries of each image block in the input image according to a preset extension length to obtain an extended image block corresponding to each image block includes: Extending each image block along four edges according to a preset extension length to obtain an extension area corresponding to the image block, and taking the image block including the extension area after extension as the extended image block; According to the positional relationship between the extended area of ​​the extended image block and the image block, the extended area located above the image block is used as the upper extended area, the extended area located below the image block is used as the lower extended area, the extended area located to the left of the image block is used as the left extended area, and the extended area located to the right of the image block is used as the right extended area.

6. The image fusion method according to claim 5, characterized in that: The step of edge-fusing each of the extended image blocks with an adjacent extended image block to obtain a fused output image includes: The extended image block P of the Mth row and the Nth column in the matrix constructed based on the image block is arranged according to a first preset order. (M,N) Display on the canvas, where M is any positive integer greater than or equal to 1 and less than or equal to S, N is any positive integer greater than or equal to 1 and less than or equal to L, S is the number of rows of the matrix, and L is the number of columns of the matrix; Keep the extended image block P of the Mth row and Nth column (M,N) The image block in, the right extension area and the lower extension area; According to the first preset order, the extended image block P of the Mth row and the (N+1th)th column (M,N+1) Display the extended image block P at row M and column N (M,N) The adjacent position of the image block P of the Mth row and the (N+1th column) (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extension area is fused according to the preset image fusion algorithm; The extended image block P of the Mth row and (N+1th column) (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm to update the extended image block P of the Mth row and the Nth column. (M,N); Extend the image block P by the (M+1)th row and Nth column (M+1,N) Display it on the canvas and extend the (M+1)th row and Nth column image block P (M+1,N) The upper extension area and the extended image block P of the Mth row and the Nth column (M,N) The overlapping areas between them are fused according to the preset image fusion algorithm; Extend the image block P by the (M+1)th row and Nth column (M+1,N) The upper extension area and the extended image block P of the Mth row and the (N+1)th column (M,N+1) The overlapping areas between them are fused according to the preset image fusion algorithm.

7. The image fusion method according to claim 6, characterized in that: The extended image block P of the Mth row and the (N+1)th column (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) The right extension area of ​​​​the image is fused according to the preset image fusion algorithm, including: Determine the extended image block P of the Mth row and the (N+1)th column (M,N+1) The image block in the Mth row and the Nth column of the extended image block P (M,N) a second overlapping area and a second non-overlapping area in the right extension area; retaining pixel values ​​of the second non-overlapping area; According to the extended image block P of the Mth row and the (N+1)th column in the second overlapping area (M,N+1) The pixel value of the image block in the second overlapping area is the extended image block P in the Mth row and the Nth column. (M,N) The pixel values ​​of the right extended area are obtained to obtain the pixel values ​​of the second overlapping area.

8. The image fusion method according to claim 7, characterized in that: The extended image block P of the Mth row and the (N+1)th column in the second overlapping area (M,N+1) The pixel value of the image block in the second overlapping area is the extended image block P in the Mth row and the Nth column. (M,N) The pixel value of the right extended area of ​​, to obtain the pixel value of the second overlapping area comprises: The pixel value of the second overlapping area is calculated according to the formula P(x, y) = alpha2 (x, y) * Patch3(x, y) + ( 1- alpha2 (x, y)) * Patch4(x, y), where Patch3(x, y) is the extended image block P of the Mth row and the (N+1)th column in the second overlapping area. (M,N+1) Patch4(x, y) is the pixel value of the image block in the Mth row and the Nth column in the second overlapping area. (M,N) The pixel value of the right extended area, alpha2 (x, y) is the weight parameter, alpha2 (x, y)=1-x2 / 32, where x2 is the width of the second overlapping area.

9. The image fusion method according to claim 6, characterized in that: The extended image block P of the Mth row and the (N+1)th column (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) The overlapping area between them is fused according to the preset image fusion algorithm to update the extended image block P of the Mth row and the Nth column. (M,N) include: Determine the extended image block P of the Mth row and the (N+1)th column (M,N+1) The left extension area and the extended image block P of the Mth row and Nth column (M,N) A third overlapping region and a third non-overlapping region in ; retaining pixel values ​​of the third non-overlapping area; According to the extended image block P of the Mth row and the (N+1)th column in the third overlapping area (M,N+1) The pixel value in the left extended area of ​​, the extended image block P of the Mth row and the Nth column in the third overlapping area (M,N) to obtain the pixel value of the third overlapping area.

10. The image fusion method according to claim 9, characterized in that: The extended image block P of the Mth row and the (N+1)th column in the third overlapping area (M,N+1) The pixel value in the left extended area of ​​, the extended image block P of the Mth row and the Nth column in the third overlapping area (M,N) The pixel value of the third overlapping area is obtained by: The pixel value of the third overlapping area is calculated according to the formula P(x, y) = alpha3(x, y) * Patch5(x, y) + ( 1- alpha3 (x, y)) * Patch6(x, y), where Patch5(x, y) is the extended image block P of the Mth row and the (N+1)th column in the third overlapping area. (M,N+1) Patch6(x, y) is the pixel value in the left extended area of ​​the third overlapping area, and Patch6(x, y) is the extended image block P of the Mth row and the Nth column in the third overlapping area. (M,N) , alpha3(x, y) is the weight parameter, alpha(x, y)=1-x3 / 32, where x3 is the width of the third overlapping area.

11. The image fusion method according to claim 1, characterized in that: The method further comprises: The preset extension length is determined according to the receptive field of the artificial intelligence AI network.

12. The image fusion method according to claim 11, characterized in that: The preprocessing of each of the extended image blocks in the input image comprises: Pre-processing the extended image blocks of each image block in sequence by a first processor; Processing, by a second processor, the extended image block corresponding to each of the pre-processed image blocks using the AI ​​network; Post-processing is performed on each extended image block processed by the AI ​​network through a third processor.

13. The image fusion method according to claim 12, characterized in that: The first processor is a graphics processor, the second processor is an embedded neural network processor, and the third processor is a central processing unit.

14. An electronic device, characterized in that: The electronic device comprises a memory and a processor: The memory is used to store program instructions; The processor is used to read and execute the program instructions stored in the memory. When the program instructions are executed by the processor, the electronic device executes the image fusion method according to any one of claims 1 to 13.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, and when the program instructions are executed on a terminal device, the electronic device executes the image fusion method according to any one of claims 1 to 13.