Image processing method and device

By calculating the mean square error of pixel values ​​on both sides of the splicing line in electronic equipment and performing image fusion processing, the problem of splicing traces in scenes such as night shooting is solved, and the performance and efficiency of image processing are optimized.

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

Patent Information

Application Number
CN202310990312.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-04
Publication Date
2024-09-13
Estimated Expiration
2043-08-04

AI Technical Summary

Technical Problem

Images taken by electronic devices in certain scenarios, such as photos taken at night, may have splicing traces visible to the naked eye after using existing image processing methods, which affects the beauty of the image, and existing methods may introduce additional calculations when optimizing the splicing traces. Causes algorithm performance to deteriorate.

Method used

By acquiring multiple image blocks output by the image processing model, the splicing process is performed according to the splicing rules, and the mean square error of the pixel values ​​on both sides of the splicing line is calculated. If the mean square error is greater than or equal to the preset value, image fusion processing is performed. To optimize stitching traces and reduce additional calculations.

Benefits of technology

It effectively optimizes the stitching traces of the entire image output by the electronic device, reduces the possibility of algorithm performance deterioration, reduces the number of image fusion operations, and improves the efficiency and clarity of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117726507B
    Figure CN117726507B
Patent Text Reader

Abstract

The present application provides an image processing method and device. The method can be applied to electronic devices. According to the method, after obtaining multiple image blocks output by an image processing model, the multiple image blocks are spliced ​​according to a splicing rule to obtain an image to be output, wherein two adjacent image blocks in the multiple image blocks have overlapping areas at corresponding positions in the image to be output, and the overlapping area contains the splicing line of the two adjacent image blocks; determine whether there will be splicing marks at the splicing line; if there will be splicing marks at the splicing line, perform image fusion on the overlapping area of ​​the two image blocks, and use the pixel values ​​of the new image blocks obtained by image fusion to cover the pixel values ​​of the overlapping area in the image to be output before image fusion. Thereby, while optimizing the splicing marks of the entire image output by the electronic device, as little additional calculation as possible is introduced, thereby minimizing the possibility of causing algorithm performance deterioration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to an image processing method and device. Background Art

[0002] In order to shorten the image processing time of electronic devices, the following image processing method is usually adopted, that is, the electronic device processes multiple image blocks in parallel based on the image processing model, and then splices the processed multiple image blocks to output a complete image. For example, the electronic device obtains an image by taking a photo, first cuts the image into multiple image blocks, and then processes them according to the above image processing method. For another example, the electronic device takes a panoramic photo, first obtains multiple image blocks, and then processes them according to the above image processing method.

[0003] However, when images acquired by electronic devices in certain scenarios, such as photos of billboards and display screens taken at night as images to be processed, and image processing is performed in the above manner, the final image is likely to have visible stitching marks, thereby affecting the aesthetics of the final image. Summary of the invention

[0004] The present application provides an image processing method and device. The image processing method can be applied to electronic devices. According to the image processing method, while optimizing the splicing traces of the entire image output by the electronic device, additional calculations can be introduced as little as possible, thereby minimizing the possibility of causing algorithm performance deterioration.

[0005] In a first aspect, the present application provides an image processing method, comprising: obtaining N first image blocks output by an image processing model, N ≥ 2 and N is an integer; performing splicing processing on the N first image blocks according to a splicing rule to obtain a first image, the splicing rule including a first position corresponding to each of the N first image blocks in the first image, wherein, among the N first image blocks, the i-th first position corresponding to the i-th first image block and the j-th first position corresponding to the j-th first image block overlap with each other and there is a first overlapping area, the first overlapping area in the first image includes a splicing line between the i-th first image block and the j-th first image block, and the first overlapping area is divided into two sub-overlapping areas by the splicing line, including a first sub-overlapping area close to the i-th first image block and a second sub-overlapping area close to the j-th first image block, 1≤i≤N, 1≤j≤N, i≠j, and i and j are both integers; calculating the mean square error of pixel values ​​on both sides of the stitching line in the first image, among the pixel values ​​on both sides, the pixel values ​​on one side are contained in the first sub-overlapping area and belong to the i-th first image block, and the pixel values ​​on the other side are contained in the second sub-overlapping area and belong to the j-th first image block; when the mean square error is greater than or equal to a preset value, performing image fusion processing on pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area to obtain a second image block, wherein the preset value is determined according to an image processing model; and overwriting the pixel values ​​of the first overlapping area in the first image with the pixel values ​​of the second image block to obtain an updated first image.

[0006] The above scheme determines whether the mean square error is greater than or equal to a preset value, and whether there will be splicing marks at the splicing line. If the mean square error is greater than or equal to the preset value, it is determined that there will be splicing marks, and image processing is performed on the pixel values ​​corresponding to the first overlapping area. Thus, while optimizing the splicing marks of the entire image output by the electronic device, as little additional calculation is introduced as possible, thereby minimizing the possibility of causing algorithm performance deterioration.

[0007] Optionally, when the mean square error is smaller than a preset value, it is considered that no splicing marks will appear at the connection point, and image processing will not be performed on the pixel values ​​corresponding to the first overlapping area.

[0008] Exemplarily, the image processing model may include one or more neural network models, and the one or more models may be used to improve the display effect of the image, such as improving brightness, improving clarity, reducing noise, sharpening, color correction, etc. N≥2 and N is an integer.

[0009] It is understandable that the preset value is determined according to the image processing model. When determining the preset value, one image processing model corresponds to one or more test scenes. Exemplarily, the image processing model is a model for improving the clarity of an image, and the multiple groups of test scenes corresponding to the image processing model include: a test scene for night scene shooting, a test scene for indoor shooting, and a test scene for shooting on a cloudy day. Optionally, the preset value is also determined according to the size of each first image block.

[0010] It should be noted that the stitching line involved in this application is only a logical stitching line, and it cannot be understood that if there is a stitching line between two image blocks, then there must be a stitching gap visible to the naked eye in the final image. If the difference between the adjacent pixels on both sides of the stitching line is small, the stitching gap between the two image blocks cannot be seen by the naked eye. Figure 2 As shown; if the difference between adjacent pixels on both sides of the stitching line is particularly large, the following will appear Figure 1 The visible seams shown.

[0011] In combination with the first aspect, in a possible implementation manner, each first image block includes a first valid part and a first filling part, and the splicing rule further includes: the first valid part included in each first image block corresponds to a first sub-position in the first image, and the first filling part included in each first image block corresponds to a second sub-position in the first image; wherein the i-th first image block includes the i-th first valid part and the i-th first filling part, the i-th first valid part corresponds to the i-th first sub-position, and the i-th first filling part corresponds to the i-th second sub-position; wherein, in the N first image blocks, the i-th second sub-position corresponds to The first sub-position corresponding to the first valid part included in at least one first image block in other first image blocks overlaps, and at least one first image block includes the j-th first image block, wherein, in the N first image blocks, the i-th first sub-position and the first sub-position corresponding to the first valid part included in other first image blocks do not overlap, and the i-th first sub-position and the first sub-position corresponding to the first valid part included in each first image block in at least one first image block are spliced ​​through adjacent edges, wherein the adjacent edge between the i-th first sub-position and the j-th first sub-position corresponding to the j-th valid part included in the j-th image is a splicing line.

[0012] In the above scheme, since the i-th second sub-position overlaps with the first sub-position corresponding to the first valid part included in at least one first image block in other first image blocks, when the mean square error is greater than or equal to the preset value, it is convenient to perform image fusion on the pixel values ​​corresponding to the first overlapping area.

[0013] It can be understood that when the i-th second sub-position overlaps the j-th first sub-sub-position, the pixel values ​​of the i-th first filling part and the j-th first valid part corresponding to the overlapping areas of the two positions are relatively close.

[0014] In combination with the first aspect, in a possible implementation method, the jth first image block includes the jth first valid part and the jth first filling part, the jth first valid part corresponds to the jth first sub-position, and the jth first filling part corresponds to the jth second sub-position; the first sub-overlapping area is the overlapping area of ​​the ith first sub-position and the jth second sub-position, and the second sub-overlapping area is the overlapping area of ​​the jth first sub-position and the ith second sub-position; image fusion processing is performed on the pixel values ​​corresponding to the ith first image block and the jth first image block in the first overlapping area, including: image fusion processing is performed on the pixel values ​​corresponding to the ith first valid part and the jth first filling part in the first sub-overlapping area, as well as the pixel values ​​corresponding to the jth first valid part and the ith first filling part in the second sub-overlapping area.

[0015] In combination with the first aspect, in a possible implementation method, N first image blocks are stitched together according to a stitching rule to obtain a first image, including: creating a second image and initializing pixel values ​​of the second image, the second image having the same size as the first image; removing N first filling parts in the N first image blocks respectively to obtain N first valid parts; and overwriting the pixel values ​​in the second image with the pixel values ​​of the N first valid parts according to the first sub-position in the first image corresponding to the first valid part included in each first image block to obtain the first image.

[0016] In the above solution, the pixel values ​​of the first effective part obtained by cutting off the first filling part are directly overlaid on the second image to obtain the first image, so as to facilitate the subsequent overlay of the second image block obtained by image fusion on the first image.

[0017] In combination with the first aspect, in a possible implementation manner, the method further includes: saving pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area.

[0018] The above scheme is to directly use the pixel values ​​corresponding to the saved first overlapping area for image fusion when the mean square error is determined to be greater than or equal to a preset value based on the N first valid parts obtained after cropping the first filling part and obtaining the first image based on the N first valid parts, thereby improving the efficiency of image fusion.

[0019] It is understandable that when performing the stitching process, all overlapping areas obtained by overlapping the first positions corresponding to the N first image blocks may be saved, so as to be flexibly called when image fusion is required in subsequent processes.

[0020] In combination with the first aspect, in a possible implementation manner, the i-th first effective part and the j-th first effective part are spliced ​​by adjacent edges, and the adjacent edges of the i-th first effective part and the j-th first effective part are a splicing line, a first pixel column adjacent to the splicing line in the i-th first effective part includes M first pixels, a second pixel column adjacent to the splicing line in the j-th first effective part includes M second pixels, the m-th first pixel in the first pixel column and the m-th second pixel in the second pixel column form a pixel pair, M≥2 and M is an integer, 1≤m≤M and m is an integer, and the mean square error of the pixel values ​​on both sides of the splicing line in the first image is calculated, including: calculating the square value of the difference between the pixel value of the first pixel and the pixel value of the second pixel in each of the M pixel pairs composed of the first pixel column and the second pixel column to obtain M square values; and calculating the average of the M square values ​​to obtain the mean square error.

[0021] The above solution uses the difference in the values ​​of adjacent pixels on both sides of the stitching line to facilitate judging whether stitching marks will appear on both sides after stitching.

[0022] In combination with the first aspect, in a possible implementation manner, the preset value is further determined according to a ratio of the size of the first valid part and the size of the first filling part in each first image block.

[0023] The above solution can improve the accuracy of judging whether stitching marks will appear by setting corresponding preset values ​​for different proportions of the sizes of the first effective part and the first filling part in each first image block.

[0024] In combination with the first aspect, in a possible implementation method, a third image taken by an electronic device is obtained, and the third image is the same size as the first image; the third image is cut into pieces according to a cutting rule to obtain N third image blocks, and the cutting rule includes a second position corresponding to each third image block in the N third image blocks in the third image, and each first image block is the same size as each third image block in the N third image blocks; the N third image blocks are input into an image processing model to obtain N first image blocks, and the N first image blocks correspond one-to-one to the N third image blocks.

[0025] In the above scheme, the electronic device first performs block processing on the captured image or image block to obtain N third image blocks, then performs image processing on the N third image blocks to obtain N first image blocks, and then performs splicing processing on the N first image blocks, which can realize parallel processing of image blocks and improve the efficiency of image processing.

[0026] In combination with the first aspect, in a possible implementation, obtaining N first image blocks output by an image processing model includes: obtaining N third image blocks taken by an electronic device, and each first image block is the same size as each third image block in the N third image blocks; inputting the N third image blocks into the image processing model to obtain N first image blocks, and the N first image blocks correspond one-to-one to the N third image blocks.

[0027] It can be understood that the implementation method in which N third image blocks are taken by an electronic device is suitable for panoramic shooting scenes; the implementation method of first acquiring the third image and then switching to obtain N third image blocks is suitable for scenes in which multiple image blocks are processed in parallel after taking pictures with a mobile phone in order to improve the efficiency of image processing.

[0028] In combination with the first aspect, in a possible implementation, each third image block includes a second valid part and a second filling part, and in each third image block, the block cutting rule also includes: the second valid part included in each third image block corresponds to a third sub-position in the third image, and the second filling part included in each third image block corresponds to a fourth sub-position in the third image; wherein the i-th third image block includes the i-th second valid part and the i-th second filling part, the i-th second valid part corresponds to the i-th third sub-position, and the i-th second filling part corresponds to the i-th fourth sub-position; wherein, among the N third image blocks, the i-th fourth sub-position overlaps with the third sub-position corresponding to the second valid part included in at least one third image block in the other third image blocks, and at least one third image block includes the j-th third image block, wherein, among the N third image blocks, the i-th third sub-position does not overlap with the third sub-positions corresponding to the second valid parts included in the other third image blocks.

[0029] In combination with the first aspect, in a possible implementation, the third image block is the same size as the first image block, and the method further includes: determining a first position corresponding to the i-th first image block in the first image based on a second position corresponding to the i-th third image block in the third image.

[0030] The above scheme determines the first position according to the second position obtained by segmenting the third image, which can restore the position of each image block before segmentation as much as possible in the splicing process, thereby reducing the impact of segmentation and splicing on image restoration.

[0031] In combination with the first aspect, in a possible implementation method, the i-th first valid part is the same size as the i-th second valid part, and the size of the i-th first filling part is the same size as the i-th second filling part, and the first position corresponding to the i-th first image block in the first image is determined according to the second position corresponding to the i-th third image block in the third image, including: determining the i-th first sub-position corresponding to the i-th first valid part in the first image according to the i-th third sub-position corresponding to the i-th second valid part in the third image, and determining the i-th second sub-position corresponding to the i-th first filling part in the first image according to the i-th fourth sub-position corresponding to the i-th second filling part in the third image.

[0032] The above scheme determines the first sub-position and the second sub-position according to the third sub-position and the fourth sub-position, which can restore the positions of each image block before segmentation as much as possible during the stitching process, thereby reducing the impact of the segmentation and stitching processes on the image restoration degree.

[0033] In combination with the first aspect, in a possible implementation manner, the preset value is further determined according to the proportion of the size of the i-th second filling part and / or the i-th second effective part in the size of the i-th third image.

[0034] In the above scheme, the proportion of the size of the i-th first filling part and the i-th first effective part in the size of the i-th first image is determined according to the proportion of the size of the i-th second filling part and / or the i-th second effective part in the size of the i-th third image, so that the preset value to be used can be determined when the third image is segmented.

[0035] Optionally, the preset value is also determined according to the size of the third image block.

[0036] In combination with the first aspect, in a possible implementation method, image fusion processing is performed on the pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area, including: based on the Alpha fusion method, image fusion processing is performed on the pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area.

[0037] The above solution can further reduce the computational complexity.

[0038] In a second aspect, the present application provides an electronic device, comprising one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in the first aspect and any possible implementation method of the first aspect.

[0039] In a third aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions so that the electronic device executes the method described in the first aspect and any possible implementation method of the first aspect.

[0040] In a fourth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on an electronic device, causes the electronic device to execute the method described in the first aspect and any possible implementation of the first aspect.

[0041] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect and any possible implementation of the first aspect.

[0042] It can be understood that the electronic device provided in the second aspect, the chip system provided in the third aspect, the computer storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram showing a whole image obtained by splicing multiple image blocks with splicing gaps;

[0044] Figure 2 The whole image obtained after processing multiple image blocks based on the image processing method provided by the present application is shown;

[0045] Figure 3 A schematic diagram showing an example of an image processing method provided by the present application;

[0046] Figure 4A A schematic diagram showing first positions of image block 1#i and image block 1#j respectively corresponding to the first image;

[0047] Figure 4B A schematic diagram showing first positions of image block 1#i, image block 1#j, image block 1#k and image block 1#s respectively corresponding to the first image;

[0048] Figure 5A Shown with Figure 4A A schematic diagram of an example of corresponding positions of the i-th first effective part and the i-th first filling part in the first image;

[0049] Figure 5B Shown with Figure 4B A schematic diagram of another example of corresponding positions of the i-th first valid part and the i-th first filling part in the first image;

[0050] Figure 5C Shown with Figure 4A A schematic diagram of an example of corresponding positions of the j-th first valid part and the j-th first filling part in the first image;

[0051] Fig. 6A A schematic diagram showing adjacent splicing of effective part 1#i and effective part 1#j in the first image;

[0052] Figure 6B A schematic diagram showing a process of processing a first test image block when the proportion of the first test filling portion is 25%;

[0053] Figure 6C A schematic diagram showing a process of processing a first test image block when the proportion of the first test filling portion is 5%;

[0054] Figure 7 Schematic diagrams of S104 and S105 are shown;

[0055] Figure 8 A schematic diagram of setting a coordinate system for image blocks to be fused is shown;

[0056] Fig. 9 A schematic diagram showing another example of the image processing method provided by the present application;

[0057] Fig.10 A schematic diagram of performing a slicing process on a third image provided by the present application is shown;

[0058] Fig.11A and Figure 6B Correspondingly, a schematic diagram is shown of an example of determining the proportion of the first test filling part in the first test image block according to the proportion of the second test filling part in the third test image block;

[0059] Fig. 11B and Figure 6C Correspondingly, a schematic diagram showing another example of determining the proportion of the first test filling part in the first test image block according to the proportion of the second test filling part in the third test image block;

[0060] Fig.12 A schematic diagram showing another example of the image processing method provided by the present application;

[0061] Fig.13 A schematic diagram of the hardware structure of an electronic device 1000 provided in an embodiment of the present application is shown;

[0062] Fig.14 A block diagram of a software system of an electronic device 1000 provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0063] In order to make the objectives, technical solutions and advantages of the present application more clear, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0064] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

[0065] It should be noted that the image processing method provided in the embodiments of the present application is applicable to any electronic device with a shooting function, such as mobile phones, tablet computers, cameras, smart wearable devices, etc., and the embodiments of the present application do not limit this. There are many ways for electronic devices to obtain images in this application. For example, electronic devices can capture images through image capture devices (such as cameras); for example, electronic devices can download images, etc.; for example, electronic devices can exchange images and other information with other electronic devices through some applications. This application does not limit this.

[0066] In order to shorten the image processing time of electronic devices, the following image processing method is usually adopted, that is, the electronic device processes multiple image blocks in parallel based on the image processing model, and then splices the processed multiple image blocks to output a complete image. For example, after the electronic device acquires the image and before the image is processed by the neural network model, it usually divides the image into several image blocks so that the neural network model can process these image blocks in parallel, and finally splices the image blocks processed by the neural network model into a whole image. Compared with the electronic device directly processing a complete image, this image processing method can greatly improve the image processing performance and greatly shorten the image processing time. For another example, when an electronic device takes a panoramic photo, it first takes multiple image blocks, and the neural network processes these image blocks in parallel, and finally splices the image blocks processed by the neural network model into a whole image.

[0067] However, when an electronic device acquires images in certain scenarios, such as taking photos of billboards and display screens at night as images to be processed, and performing image processing in the above manner, the final image is likely to have visible splicing gaps (or may also be referred to as splicing marks or splicing traces in this application) that are visible to the naked eye, thereby affecting the aesthetics of the final image. Figure 1 FIG. 1 shows a schematic diagram of a whole image obtained by splicing multiple image blocks and having splicing gaps. Figure 1 As shown in the grayscale image, there is a nearly white stitching gap at the location pointed by the arrow in the framed area. Figure 1 When displayed in color, the stitching gap is more obvious at the location pointed by the arrow.

[0068] The present application provides an image processing method. After acquiring a plurality of image blocks output by an image processing model, the plurality of image blocks are spliced ​​according to a splicing rule to obtain an image to be output, wherein two adjacent image blocks among the plurality of image blocks have overlapping areas at positions respectively corresponding to each other in the image to be output, and the overlapping area in the image to be output includes a splicing line of the two adjacent image blocks; determining whether a splicing mark will appear at the splicing line; and if a splicing mark will appear at the splicing line, performing image fusion on the overlapping area of ​​the two image blocks, and overwriting the pixel value of the overlapping area in the image to be output before the image fusion with the pixel value of the new image block obtained by the image fusion.

[0069] It is understandable that, for possible splicing gaps, the present application first determines whether there will be splicing marks, and then performs image fusion for the case where there will be splicing marks. Therefore, the solution of the present application, while optimizing the splicing marks, minimizes the introduction of additional calculations, thereby minimizing the possibility of causing algorithm performance deterioration.

[0070] Compared with the method of optimizing the splicing traces by performing an image fusion method on the pixel values ​​of the overlapping areas of all adjacent image blocks at the corresponding positions in the image to be output during splicing, the image processing method provided by the present application reduces the number of image fusion operations required as much as possible, thereby reducing the introduction of additional computational overhead as much as possible, and reducing the situation where the image fusion algorithm reduces the local clarity of the output whole image. It can be understood that each additional image fusion operation requires the introduction of additional computational processing, which will lead to the deterioration of the overall performance of the algorithm, and each overlapping area for image fusion has the possibility of reduced clarity due to the image fusion algorithm. However, splicing traces are not a problem that must occur during image processing, or splicing traces are not common processing effect defects during image processing. Therefore, even if the image fusion method is used to optimize the splicing traces for the overlapping areas of all adjacent image blocks, a large amount of additional computational overhead will be introduced, resulting in a significant deterioration in the performance of the algorithm, and the possibility of increased local clarity reduction of the output whole image. Such a method that brings more hidden dangers to solve a problem is too costly.

[0071] Figure 2 The whole image obtained by processing multiple image blocks based on the image processing method provided by the present application is shown. Figure 1 The corresponding multiple image blocks before splicing and Figure 2 The corresponding multiple image blocks before stitching are the same. Figure 2 As shown, there is no visible stitching trace in the entire image.

[0072] The image processing methods 100 to 300 provided in the present application are described in detail below with reference to the accompanying drawings. Figure 3 A schematic diagram of an image processing method 100 provided in the present application is shown, where steps S101 to S105 are performed by an electronic device.

[0073] S101, obtaining N first image blocks output by an image processing model.

[0074] The image processing model may include one or more neural network models, and the one or more models may be used to improve the display effect of the image, such as improving brightness, improving clarity, reducing noise, sharpening, color correction, etc. N≥2 and N is an integer.

[0075] As a possible implementation method, the image or image block input into the image processing model is determined based on an image captured by an electronic device. This possible implementation method will be described below with reference to a specific example.

[0076] S102: splicing N first image blocks according to a splicing rule to obtain a first image.

[0077] Among them, the splicing rule includes the first position corresponding to each first image block in the N first image blocks in the first image. In a possible implementation, the first position can be represented by coordinates. The coordinates can be located in the world coordinate system or in the coordinate system of the first image. For example, the vertex in the upper left corner of the first image is taken as the origin, the horizontal direction is the x-axis, the vertical direction is the y-axis, the horizontal coordinate of the vertex in the upper right corner is a positive value, and the vertical coordinate of the vertex in the lower left corner is a negative value. The first position corresponding to a first image block in the first image is determined by the coordinates of the four vertices of a first image block, or the first position corresponding to the first image block in the first image is determined by the coordinates of the vertex in the upper left corner of a first image block and the size of the first image block.

[0078] The following takes the i-th first image block (hereinafter referred to as image block 1#i for the convenience of explanation) and the j-th first image block (hereinafter referred to as image block 1#j for the convenience of explanation) among the N first image blocks as examples. Figure 4A and Figure 4B , describing the first positions corresponding to the N image blocks in the first image.

[0079] Figure 4A FIG. 1 shows a schematic diagram of first positions of image block 1#i and image block 1#j in the first image. Figure 4A As shown, in the first image, the i-th first position (i.e. Figure 4A The four vertices of the first position 1#i in the image are represented by solid black dots, and the jth first position corresponding to the jth first image block (i.e. Figure 4A The four vertices of the first position 1#j in the image are represented by hollow boxes respectively. The first position 1#i overlaps with the first position 1#j, and the overlapping line of the first position 1#i and the first position 1#j is represented by a dotted line. The area composed of the two horizontal edges of the first position 1#i and the first position 1#j and the two dotted lines is the first overlapping area #ij of the first position 1#i and the first position 1#j. The first overlapping area includes the stitching line #ij of the i-th first image block and the j-th first image block, and the first overlapping area #ij is divided into two sub-overlapping areas by the stitching line, including a first sub-overlapping area #ij close to the i-th first image block and a second sub-overlapping area #ij close to the j-th first image block, 1≤i≤N, 1≤j≤N, i≠j, and i and j are both integers. Specifically, how to determine the position of the stitching line #ij will be introduced below.

[0080] Figure 4B A schematic diagram showing first positions of image block 1#i, image block 1#j, image block 1#k, and image block 1#s respectively corresponding to the first image. Figure 4A On the basis of Figure 4B Also shown in FIG. 1 is a first position 1#k and a first position 1#s corresponding to the image block 1#k and the image block 1#s in the first image, respectively. Figure 4B As shown, Figure 4A Similarly, there is a first overlapping area #ik between the first position 1#i and the first position 1#k, the first overlapping area #ik includes the stitching line #ik, and the first overlapping area #ik is divided into two sub-overlapping areas by the stitching line, including a first sub-overlapping area #ik close to the i-th first image block and a second sub-overlapping area #ik close to the k-th first image block; there is a first overlapping area #is between the first position 1#i and the first position 1#s, the first overlapping area #is includes the stitching line #is, and the first overlapping area #is is divided into two sub-overlapping areas by the stitching line, including a first sub-overlapping area #is close to the i-th first image block and a second sub-overlapping area #is close to the s-th first image block, 1≤k≤N, 1≤s≤N, i≠j≠k≠s, and k and s are both integers.

[0081] It can be understood that, taking the first position 1#i as an example, in the four directions of up, down, left, and right of the first position 1#i, there may be other first positions that have overlapping areas with the first position 1#i. Figure 4A and Figure 4B This is only an example and does not limit the scope of protection of this application.

[0082] In a possible implementation, each first image block includes a first valid portion and a first padding portion, and the stitching rule further includes: the first valid portion included in each first image block corresponds to a first sub-position in the first image, and the first padding portion included in each first image block corresponds to a second sub-position in the first image. FIG. 5A to FIG. 5C , describing the corresponding positions of a first valid portion and a first filling portion in a first image block in the first image block.

[0083] The i-th first image block includes the i-th first valid part (hereinafter referred to as the valid part 1#i for the convenience of explanation) and the i-th first filling part (hereinafter referred to as the filling part 1#i for the convenience of explanation). The i-th first valid part corresponds to the i-th first sub-position (hereinafter referred to as the first sub-position 1#i for the convenience of explanation), and the i-th first filling part corresponds to the i-th second sub-position (hereinafter referred to as the second sub-position 1#i for the convenience of explanation). Figure 5A Shown with Figure 4A A schematic diagram of an example of the corresponding positions of the i-th first valid part and the i-th first filling part in the first image. Figure 5A As shown, the area filled with horizontal lines is the first sub-position 1#i, and the area filled with cross lines is the second sub-position 1#i. Figure 5B Shown with Figure 4B A schematic diagram of another example of the corresponding positions of the i-th first valid part and the i-th first filling part in the first image. Figure 5B As shown, the area filled with horizontal lines is the first sub-position 1#i, and the area filled with cross lines is the second sub-position 1#i. Figure 5C Shown with Figure 4A A schematic diagram of an example of the corresponding positions of the j-th first valid part and the j-th first filling part in the first image. Figure 5A As shown, the area filled with horizontal lines is the first sub-position 1#j, and the area filled with cross lines is the second sub-position 1#j.

[0084] It can be understood that when the i-th second sub-position overlaps the j-th first sub-sub-position, the pixel values ​​of the i-th first filling part and the j-th first valid part corresponding to the overlapping areas of the two positions are relatively close.

[0085] Based on the above stitching rules, possible implementation methods for overlapping adjacent first image blocks are described in detail below.

[0086] On the one hand, in the N first image blocks, the i-th second sub-position overlaps with the first sub-position corresponding to the first valid part included in at least one first image block in the other first image blocks, and at least one first image block includes the j-th first image block. On the other hand, in the N first image blocks, the i-th first sub-position and the first sub-position corresponding to the first valid part included in the other first image blocks do not overlap, and the i-th first sub-position and the first sub-position corresponding to the first valid part included in each first image block in at least one first image block are spliced ​​through adjacent edges. Among them, the adjacent edge of the i-th first sub-position and the j-th first sub-position corresponding to the j-th valid part included in the j-th image is a splicing line. In other words, the adjacent edge of the valid part 1#i and the valid part 1#j can be determined as the splicing line #ij.

[0087] Example 1-1, combined Figure 4A , Figure 5A and Figure 5C It can be understood that: the second subposition 1#i overlaps with the first subposition 1#j, while the first subposition 1#i does not overlap with the first subposition 1#j; accordingly, the second subposition 1#j overlaps with the first subposition 1#i, while the first subposition 1#j does not overlap with the first subposition 1#i. And, the adjacent edge between the first subposition 1#i and the first subposition 1#j is the splicing line #ij. In addition, the first sub-overlapping area #ij is the overlapping area between the first subposition 1#i and the second subposition 1#j, and the second sub-overlapping area #ij is the overlapping area between the second subposition 1#j and the second subposition 1#i.

[0088] Example 1-2, combined with Figure 4B , Figure 5B , and by analogy with Example 1-1, it can be understood that: image block 1#j, image block 1#k and image block 1#s include valid part 1#j and padding part 1#j, valid part 1#k and padding part 1#k, and valid part 1#s and padding part 1#s, respectively. The valid part 1#j and padding part 1#j correspond to the first subposition 1#j and the second subposition 1#j, respectively, and the first subposition 1#k corresponds to the first subposition 1#k and the second subposition 1#k, respectively; the valid part 1#s and padding part 1#s correspond to the first subposition 1#s and the second subposition 1#s, respectively. In the N first image blocks, the second subposition 1#i overlaps with the first subposition 1#j, the first subposition 1#k and the first subposition 1#s, respectively. The first subposition 1#i does not overlap with the first subposition 1#j, the first subposition 1#k and the first subposition 1#s. And, the adjacent edge between the first subposition 1#i and the first subposition 1#j is the stitching line #ij; the adjacent edge between the first subposition 1#i and the first subposition 1#k is the stitching line #ik; the adjacent edge between the first subposition 1#i and the first subposition 1#s is the stitching line #is. In addition, the first sub-overlapping area #ij is the overlapping area between the first subposition 1#i and the second subposition 1#j, and the second sub-overlapping area #ij is the overlapping area between the second subposition 1#j and the second subposition 1#i; the first sub-overlapping area #ik is the overlapping area between the first subposition 1#i and the second subposition 1#k, and the second sub-overlapping area #ik is the overlapping area between the second subposition 1#k and the second subposition 1#i; the first sub-overlapping area #is is the overlapping area between the first subposition 1#i and the second subposition 1#s, and the second sub-overlapping area #is is the overlapping area between the second subposition 1#s and the second subposition 1#i.

[0089] It can be understood that, taking the first position 1#i as an example, in the four directions of the first position 1#i, there may be other first positions with overlapping areas with the first position 1#i, so that the filling part 1#i of the image block 1#i can be located around the effective part 1#i. Figure 5A and Figure 5B This is only an example and does not limit the scope of protection of this application.

[0090] A possible implementation of S102 is described below, including the following steps:

[0091] Step 1-1, create a second image and initialize the pixel values ​​of the second image.

[0092] The size of the second image is the same as that of the first image. The pixel value of the second image may be initialized to 0, or initialized to 1, which is not limited in the present application.

[0093] Step 1-2, respectively remove N first filling parts in the N first image blocks to obtain N first valid parts.

[0094] In other words, the pixel values ​​of the N first filling parts in the N first image blocks are removed respectively to obtain the N first valid parts.

[0095] Step 1-3, according to the first sub-position in the first image corresponding to the first valid part included in each first image block, the pixel values ​​in the second image are covered with the pixel values ​​of N first valid parts to obtain the first image.

[0096] Specifically, the pixel value of the first sub-position 1#i is covered with the effective part 1#i, and i increases from 1 to N. Finally, the first image is formed by splicing N first effective parts without overlapping each other.

[0097] In the above solution, the pixel values ​​of the first effective part obtained by cutting off the first filling part are directly overlaid on the second image to obtain the first image, so as to facilitate the subsequent overlay of the second image block obtained by image fusion on the first image.

[0098] S103, calculating the mean square error of the pixel values ​​on both sides of the stitching line in the first image.

[0099] Among them, among the pixel values ​​on both sides, the pixel value on one side (for the convenience of explanation, referred to as pixel value #i below) is included in the first sub-overlapping area and belongs to the i-th first image block, and the pixel value on the other side (for the convenience of explanation, referred to as pixel value #j below) is included in the second sub-overlapping area and belongs to the j-th first image block.

[0100] Fig. 6A FIG. 4 is a schematic diagram showing the adjacent splicing of the effective part 1#i and the effective part 1#j in the first image. Fig. 6A As shown, pixel value #i is the value of pixel #i in the nth column adjacent to the stitching line in effective part 1#i, and pixel value #i is the value of pixel #j in the nth column adjacent to the stitching line in effective part 1#j, where n≥1 and n is an integer.

[0101] The mean square error (MSE) of the pixel values ​​on both sides of the stitching line involved in the present application is used to measure the difference in pixel values ​​on both sides of the stitching line. In a possible implementation, the i-th first effective part and the j-th first effective part are spliced ​​by adjacent edges, and the adjacent edges of the i-th first effective part and the j-th first effective part are the stitching line, a first pixel column adjacent to the stitching line in the i-th first effective part includes M first pixels, a second pixel column adjacent to the stitching line in the j-th first effective part includes M second pixels, the m-th first pixel in the first pixel column and the m-th second pixel in the second pixel column form a pixel pair, M≥2 and M is an integer, 1≤m≤M and m is an integer, and the mean square error of the pixel values ​​on both sides of the stitching line in the first image is calculated, including: calculating the square value of the difference between the pixel value of the first pixel and the pixel value of the second pixel in each of the M pixel pairs composed of the first pixel column and the second pixel column to obtain M square values; calculating the average value of the M square values ​​to obtain the mean square error. Fig. 6A Take the example that the stitching line #ij is parallel to the y-axis in the coordinate system of the first image, and n=1, and one column of pixels #i has M pixels, and one pixel #j also has M pixels, then for m rows of pixels, calculate the square value of the difference between the pixel values ​​with the same ordinate in pixel #i and pixel #j, obtain M square values, and average the M square values ​​to obtain the mean square error of the pixel values ​​on both sides of the stitching line.

[0102] The above solution uses the difference in the values ​​of adjacent pixels on both sides of the stitching line to facilitate judging whether stitching marks will appear on both sides after stitching.

[0103] S104: When the mean square error is greater than or equal to a preset value, image fusion processing is performed on pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area to obtain a second image block.

[0104] The preset value is determined according to the image processing model. When determining the preset value, one image processing model corresponds to one or more test scenes. Exemplarily, the image processing model is a model for improving the clarity of an image, and the multiple groups of test scenes corresponding to the image processing model include: a test scene for night scene shooting, a test scene for indoor shooting, and a test scene for shooting on a cloudy day.

[0105] Optionally, the preset value is also determined according to the size of each first image block.

[0106] Optionally, the preset value is also determined according to a proportion of the size of the first valid part and / or the first filling part in each first image block.

[0107] The determined preset value can be configured in the electronic device. Accordingly, the electronic device can determine which preset value to call based on the image processing model, the size of the first image block output by the model, and the proportion of the size of the first effective part and / or the first filling part in each first image block.

[0108] The following describes possible implementation methods for determining the preset value.

[0109] In a possible implementation, taking the splicing process of at least two first test image blocks output by the image processing model as an example, assuming that the image processing model is model #1 and the size of each first test image block is z, in each test scene, by adjusting the proportion of the size of the first test effective part and the first test filling part in each first test image block, and performing the splicing process in the manner described in S102, respectively calculating the MSE values ​​of the adjacent pixel columns of the splicing line and judging whether there is a splicing mark by human eyes, the critical MSE value of the splicing mark can be summarized. For example, the proportion of the first test filling part is adjusted from 25% to 5% from large to small, and adjusted every 5%. Assuming that the splicing mark cannot be seen by the naked eye when the proportion of the first test filling part is 20%, and the splicing mark can be seen by the naked eye when the proportion of the first test filling part is 15%, then the MSE value when the proportion of the first test filling part is 20% is the critical MSE value. Figure 6B and Figure 6C Schematic diagrams showing the process of processing the first test image block when the proportion of the first test filling part is 25% and 5% respectively. Figure 6B and Figure 6C Only the first test image block #i and the first test image block #j are used as examples, and only the proportions of 25% and 5% are used as examples, which does not limit the scope of protection of the present application. Subsequently, the maximum critical MSE value in multiple groups of test scenes is used as the preset value #1; preferably, a value slightly smaller than the maximum critical MSE value is used as the preset value #1, so that as long as the mean square error calculated in S103 is smaller than the preset value #1, there will be no splicing marks. The preset value #1 thus obtained is the preset value to be called by the electronic device when model #1 is used and the size of the image block output by model #1 is z. The preset values ​​corresponding to first test image blocks of different sizes can also be obtained by adjusting the size of the first test image block.

[0110] It can be understood that by adjusting the ratio of the size of the first test valid part and the first test filling part in each first test image block, when splicing at least two first test image blocks, the reference splicing rule will also be adjusted accordingly, so that the first test valid part of each first test image block in at least two first test image blocks can be adjacently spliced ​​without overlapping.

[0111] Exemplarily, in a test scene of night scene shooting, the image or image block input to the image processing model is an image obtained by shooting in the test scene of night scene shooting, and the size ratio of the first test effective part and the first test filling part in at least two first test image blocks of the output is adjusted, and the first test effective parts in at least two first test image blocks are adjacently spliced ​​to calculate the MSE values ​​corresponding to different ratios. Similarly, the MSE values ​​corresponding to different ratios are calculated for the test scenes of indoor shooting and the test scenes of cloudy shooting. Assume that the maximum value of the MSE values ​​calculated in the three scenes is 2e -5 , determine the default value is 1.8e -5 , then the mean square error calculated in S103 is ≥ 1.8e -5 In the case where the stitching traces can be seen by naked eyes, S104 is executed; then the mean square error calculated in S103 is less than 1.8e -5 In the case where no splicing traces can be seen by naked eyes, S104 is not executed.

[0112] The above scheme can improve the accuracy of judging whether stitching marks will appear by setting corresponding preset values ​​for different proportions of the size of the first effective part and the first filling part in each first image block, different sizes of the first image blocks and different image processing models.

[0113] The following describes a possible implementation method for determining the pixel value corresponding to the first overlapping area. It can be understood that, as can be seen from the above, the first overlapping area includes the first sub-overlapping area and the second sub-overlapping area, so the pixel value corresponding to the first overlapping area includes the pixel value corresponding to the first sub-overlapping area and the pixel value corresponding to the second sub-overlapping area.

[0114] Figure 7 Schematic diagrams of S104 and S105 are shown. Figure 7 As shown, Figure 4A Take the case where the first position 1#i and the second position 1#j overlap to form the first overlapping area #ij as an example. The pixel value corresponding to the first sub-overlapping area #ij is the pixel value corresponding to the effective part 1#i in the first sub-overlapping area #ij, and the pixel value corresponding to the padding part 1#j in the first sub-overlapping area #ij. The pixel value corresponding to the second sub-overlapping area #ij is the pixel value corresponding to the effective part 1#j in the second sub-overlapping area #ij, and the pixel value corresponding to the padding part 1#i in the second sub-overlapping area #ij.

[0115] The following describes the implementation method of image fusion involved in this application. Image fusion can be understood as weighted calculation of the pixel values ​​of two images. In order to reduce the computational complexity as much as possible, this application preferably uses the Alpha fusion method for image fusion. Take the example that the first sub-overlapping area is the same size as the second sub-overlapping area, that is, the size of the filling part 1#i is the same as the filling part 1#j. In other words, the stitching line divides the first overlapping area equally. Then Figure 7 In the example, the effective part #i of the part included in the image block #i to be fused is the same size as the filling part #i, and the effective part #j of the part included in the image block #j to be fused is the same size as the filling part #j.

[0116] Figure 8 FIG. 4 shows a schematic diagram of setting a coordinate system for the image blocks to be fused. Figure 8 As shown, the bottom widths of the image blocks to be fused #i and #j are both o, and the straight line where the stitching line #ij is located is the y-axis, and the straight line where the bottom is located is the x-axis. The intersection of the stitching line and the bottom is the origin (0, 0), and two coordinate systems are established. The range of x in the two coordinate systems is then Alpha fusion is performed according to the following formula.

[0117]

[0118] It can be understood that the above formula is for image fusion of a row of pixel values ​​with the same vertical coordinate. Assuming that there are m rows of pixel values ​​in the image block #i to be fused and the image block #j to be fused, then all alpha fusion needs to be performed on each row of the m rows of pixel values ​​according to the above formula.

[0119] Among them, x is the horizontal coordinate in the coordinate system, weight x is the weight at the horizontal coordinate x, o is the width of the bottom edge of the first overlapping area, and is also the width of the bottom edge of the second image block after fusion, i x is the pixel value corresponding to the horizontal coordinate x in the coordinate system of the image block #i to be fused, j x is the pixel value corresponding to the horizontal coordinate x in the coordinate system of the image block #j to be fused, x is the fused pixel value corresponding to the horizontal coordinate x, and x∈Z means that x is an integer.

[0120] It can also be understood that by calculating mix x From the formula, we can know that when calculating the fused pixel value corresponding to the horizontal coordinate x closer to the image block #i, i x The weight of mix x The closer to i x , otherwise mix x The closer to j x .

[0121] It should be noted that the image fusion method involved in the present application may also be an image fusion method other than the Alpha fusion method, and the present application does not limit this.

[0122] Optionally, when the mean square error is smaller than a preset value, it is considered that no splicing marks will appear at the connection point, and image processing will not be performed on the pixel values ​​corresponding to the first overlapping area.

[0123] Optionally, before S104, method 100 may further include: step 2, saving pixel values ​​corresponding to the first overlapping area of ​​the i-th first image block and the j-th first image block. It is understandable that when performing the stitching process, all overlapping areas obtained by overlapping the first positions corresponding to the N first image blocks may be saved so that they can be flexibly called when image fusion is required in subsequent processes.

[0124] The above scheme is to directly use the pixel values ​​corresponding to the saved first overlapping area for image fusion when the mean square error is determined to be greater than or equal to a preset value based on the N first valid parts obtained after cropping the first filling part and obtaining the first image based on the N first valid parts, thereby improving the efficiency of image fusion.

[0125] S105 , overwriting the pixel values ​​of the first overlapping area in the first image with the pixel values ​​of the second image block to obtain an updated first image.

[0126] The second image block has the same size as the first overlapping area.

[0127] It should be noted that the stitching line involved in this application is only a logical stitching line, and it cannot be understood that if there is a stitching line between two image blocks, then there must be a stitching gap visible to the naked eye in the final image. If the difference between the adjacent pixels on both sides of the stitching line is small, the stitching gap between the two image blocks cannot be seen by the naked eye. Figure 2 As shown; if the difference between adjacent pixels on both sides of the stitching line is particularly large, the following will appear Figure 1 The visible seams shown.

[0128] The image processing method 100 provided by the present application can determine whether a splicing mark will appear at the splicing line by judging whether the mean square error is greater than or equal to a preset value. If the mean square error is greater than or equal to the preset value, it is determined that a splicing mark will appear, and image processing is performed on the pixel values ​​corresponding to the first overlapping area. Thus, while optimizing the splicing mark of the entire image output by the electronic device, additional calculations are introduced as little as possible, thereby minimizing the possibility of causing algorithm performance deterioration.

[0129] In addition, some explanations are given below for method 100.

[0130] As a possible implementation, in S101, the image or image block input to the image processing model is determined based on the image captured by the electronic device. The following will introduce how to determine the implementation of the image or image block input to the image processing model based on the image captured by the electronic device through image processing method 200 and image processing method 300 respectively. In addition, a further solution provided by the present application based on the combination of method 200 and method 100 is introduced; and a further solution provided by the present application based on the combination of method 300 and method 100 is introduced.

[0131] Fig. 9 FIG. 2 is a schematic diagram of an image processing method 200 provided in the present application. It is understandable that the method 200 can be understood as a possible implementation of S102. The method 200 includes:

[0132] S201, acquiring a third image taken by the electronic device.

[0133] The third image has the same size as the first image. It can be understood that the third image here is a whole image, and the first image in method 100 is also a whole image.

[0134] S202, dicing the third image according to a dicing rule to obtain N third image blocks.

[0135] The block cutting rule includes: a second position corresponding to each third image block in the N third image blocks in the third image.

[0136] Fig.10 FIG. 2 shows a schematic diagram of the block processing of the third image provided by the present application. After the block processing, each third image block (in Fig.10 Taking image block 3#i as an example), each corresponds to a second position in the third image.

[0137] In a possible implementation, the second position may be represented by coordinates. For a specific implementation of representing the second position by coordinates, reference may be made to the description of representing the first position by coordinates in S102.

[0138] S203: Input the N third image blocks into an image processing model to obtain N first image blocks.

[0139] The N first image blocks correspond to the N third image blocks one by one, and each first image block has the same size as each third image block in the N third image blocks. For the description of the image processing model, reference may be made to the relevant description in method 100 .

[0140] In the above scheme, the electronic device first performs block processing on the captured image or image block to obtain N third image blocks, then performs image processing on the N third image blocks to obtain N first image blocks, and then performs splicing processing on the N first image blocks, which can realize parallel processing of image blocks and improve the efficiency of image processing.

[0141] In a possible implementation, each third image block includes a second valid portion and a second padding portion. In each third image block, the block cutting rule further includes: the second valid portion included in each third image block corresponds to a third sub-position in the third image, and the second padding portion included in each third image block corresponds to a fourth sub-position in the third image.

[0142] Take the i-th third image block ( Fig.10 Take the image block 3#i in the example, including the i-th second valid part ( Fig.10 The effective part 3#i) and the i-th second filling part ( Fig.10 The i-th second valid part corresponds to the i-th third sub-position in the third image, and the i-th second filling part corresponds to the i-th fourth sub-position in the third image. On the one hand, in the N third image blocks, the filling part 3#i overlaps with the second valid part included in at least one third image block in the other third image blocks. In other words, the i-th fourth sub-position overlaps with the third sub-position corresponding to the second valid part included in at least one third image block in the other third image blocks. Among them, at least one third image block includes the j-th third image block. On the other hand, in the N third image blocks, the filling part 3#i does not overlap with the second valid part included in at least one third image block in the other third image blocks. In other words, the i-th third sub-position does not overlap with the third sub-positions corresponding to the second valid parts included in the other third image blocks.

[0143] In this possible implementation, optionally, the size of the i-th first effective part is the same as the size of the i-th second effective part, and the size of the i-th first filling part is the same as the size of the i-th second filling part.

[0144] Optionally, when the ith third image block is completely contained in the third image, the pixel value of the ith filling portion is the pixel value of the position where the ith filling portion is located. When the ith third image block partially exceeds the third image, the portion exceeding the third image can be filled with a pixel value of 0 or filled with the pixel value of the ith third image block contained in the third image. For example Fig.10 In the figure, some pixel values ​​of the filled part of the third image block in the upper left corner can be filled with pixel values ​​of value 0.

[0145] The splicing rule in method 100 may be determined according to the block cutting rule in method 200. It is understandable that, as described above, the third image is the same size as the first image, each first image block is the same size as each third image block in the N third image blocks, and the N first image blocks correspond to the N third image blocks one by one. Specifically, the first position corresponding to the i-th first image block in the first image is determined according to the second position corresponding to the i-th third image block in the third image. For example, assuming that the third image also establishes a coordinate system with the vertex of the upper left corner of the third image as the origin by referring to the coordinate system established by the first image in S102, then the coordinates of the i-th third image block in the third image are the same as the coordinates of the i-th first image block in the first image. The above scheme determines the first position according to the second position obtained by segmenting the third image, which can restore the positions of each image block before segmentation as much as possible in the splicing process, thereby reducing the influence of segmentation and splicing on the image restoration degree.

[0146] Further, since the size of the i-th first effective part is the same as the size of the i-th second effective part, and the size of the i-th first filling part is the same as the size of the i-th second filling part, the i-th first sub-position corresponding to the i-th first effective part in the first image is determined according to the i-th third sub-position corresponding to the i-th second effective part in the third image, and the i-th second sub-position corresponding to the i-th second filling part in the first image is determined according to the i-th fourth sub-position corresponding to the i-th second filling part in the third image. For example, assuming that the third image also establishes a coordinate system with the vertex of the upper left corner of the third image as the origin by referring to the coordinate system established by the first image in S102, the coordinates of the i-th second filling part in the third image are the same as the coordinates of the i-th first filling part in the first image. In the above scheme, the first sub-position and the second sub-position are determined according to the third sub-position and the fourth sub-position, so that the positions of each image block before segmentation can be restored as much as possible in the splicing process, thereby reducing the influence of the segmentation process and the splicing process on the image restoration degree.

[0147] In addition, based on the possible implementation of the preset value in S104, the preset value in method 200 can also be determined according to the size of the N third image blocks, and the proportion of the size of the i-th second filling part and / or the size of the i-th second effective part in the size of the i-th third image. It can be understood that, referring to method 200, at least two first test image blocks are obtained through the third test image, so that the size of the first test image is determined according to the size of the third test image block obtained by segmenting the third test image, then the proportion of the size of the first test effective part and the first test filling part in the first test image block is also determined according to the proportion of the size of the second test effective part and the second test filling part in the third test image block. Exemplarily, Fig.11A and Fig. 11B Respectively Figure 6B and Figure 6C Correspondingly, a schematic diagram is shown for determining the proportion of the first test filling part in the first test image block according to the proportion of the second test filling part in the third test image block. Fig.11A and Fig. 11B The proportions of 25% and 5% are only used as examples, and do not limit the scope of protection of the present application. In the above scheme, the proportion of the size of the i-th first filling part and the i-th first effective part in the size of the i-th first image is determined according to the proportion of the size of the i-th second filling part and / or the i-th second effective part in the size of the i-th third image, so that the preset value to be used can be determined when the third image is segmented.

[0148] Fig.12 A schematic diagram of an image processing method 300 provided in the present application is shown.

[0149] S301, obtaining N third image blocks taken by an electronic device.

[0150] Each first image block has the same size as each third image block in the N third image blocks.

[0151] S302, inputting N third image blocks into an image processing model to obtain N first image blocks.

[0152] The N first image blocks correspond one to one to the N third image blocks.

[0153] For example, when taking panoramic photos, the electronic device takes N third image blocks, and the image processing model processes the N third image blocks in parallel. Then, method 100 is used to stitch the output N first image blocks into a first image, which can improve the efficiency of image processing.

[0154] It can be understood that the difference between method 300 and method 200 is that in method 300, the N image blocks obtained by the electronic device are not subjected to slicing processing. Therefore, method 300 can refer to other relevant descriptions except for the description related to slicing processing in method 200. In addition, the difference between method 300 and method 200 is that in method 200, the second position, the third sub-position and the fourth sub-position are determined according to the slicing rule; in method 300, the second position, the third sub-position and the fourth sub-position can be pre-configured. For example, assume that the target size of the panoramic image (i.e., the first image) is H×W, where H is the number of pixels in the vertical direction of the first image, and W is the number of pixels in the horizontal direction of the first image. During the shooting process, the number of pixels in the horizontal direction of the overlapping area of ​​the i-th third image block and the i+1-th third image block shot by the electronic device is O, 1≤i≤N. Then, the number of pixels w in the horizontal direction of each third image block can be calculated according to the following formula:

[0155]

[0156] Thus, the size of each third image block is H×w. The second position corresponding to the i-th third image block is from the w×(i-1)th pixel to the w×i-1th pixel in the horizontal direction. The third sub-position is from the w×(i-1)th pixel to the w×i-1-0th pixel in the horizontal direction. The fourth sub-position is from the w×i-1-0th pixel to the w×i-1th pixel in the horizontal direction.

[0157] Please refer to Fig.13 , Fig.13 FIG. 1 is a schematic diagram showing a hardware structure of an electronic device 1000 provided in an embodiment of the present application. Fig.13The electronic device 1000 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 button 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.

[0158] It is understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 1000. In other embodiments of the present application, the electronic device 1000 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.

[0159] 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 memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc.

[0160] The controller may be the nerve center and command center of the electronic device 1000. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

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

[0162] In some embodiments, the processor 110 may include one or more interfaces, such as 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.

[0163] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to realize the shooting function of the electronic device 1000. The processor 110 and the display screen 194 communicate via the DSI interface to realize the display function of the electronic device 1000.

[0164] 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 1000. In other embodiments of the present application, the electronic device 1000 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0165] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. 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 external memory, the display screen 194, the camera 193 and the wireless communication module 160.

[0166] The wireless communication function of the electronic device 1000 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.

[0167] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 1000 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.

[0168] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 1000. 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, etc. 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.

[0169] 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 1000. The wireless communication module 160 can be one or more devices integrating at least one communication processing module.

[0170] The electronic device 1000 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.

[0171] 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 1000 may include 1 or N display screens 194, where N is an integer greater than 1.

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

[0173] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0174] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 1000 may include 1 or N cameras 193, where N is an integer greater than 1.

[0175] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 1000 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0176] Video codecs are used to compress or decompress digital videos. The electronic device 1000 may support one or more video codecs. Thus, the electronic device 1000 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0177] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. NPU can realize applications such as intelligent cognition of electronic device 1000, such as: image recognition, face recognition, speech recognition, text understanding, etc. The NPU in this application is also used to perform image processing through an image processing model. Specifically, the image processing model is used to obtain N third image blocks, and output N first image blocks based on the N third image blocks.

[0178] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 1000. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0179] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 1000 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 1000 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0180] The electronic device 1000 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor. The button 190 includes a power button, a volume button, etc. The button 190 can be a mechanical button or a touch button. The electronic device 1000 can receive key input and generate key signal input related to the user settings and function control of the electronic device 1000. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light, which can be used to indicate the charging status, the change of power, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect a SIM card.

[0181] The sensor module 180 may include one or more sensors, which may be of the same type or of different types. Fig.13 The sensor module 180 shown is only an exemplary division method. There may be other division methods, which are not limited in this application.

[0182] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. When a touch operation is applied to the display screen 194, the electronic device detects the touch operation intensity according to the pressure sensor 180A. The electronic device can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.

[0183] The gyro sensor 180B can be used to determine the motion posture of the electronic device. In some embodiments, the angular velocity of the electronic device around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting.

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

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

[0186] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch 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, which is different from the position of the display screen 194.

[0187] The air pressure sensor 180C is used to measure air pressure. The magnetic sensor 180D includes a Hall sensor. The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The electronic device uses a photodiode to detect infrared reflected light from nearby objects. The ambient light sensor 180L is used to sense the brightness of ambient light. The fingerprint sensor 180H is used to obtain fingerprints. The temperature sensor 180J is used to detect temperature. The bone conduction sensor 180M can obtain vibration signals.

[0188] Next, the software system of the electronic device 1000 will be described.

[0189] Exemplarily, the electronic device 1000 may be a mobile phone. The software system of the electronic device 1000 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device 1000.

[0190] Fig.14 1 shows a block diagram of a software system of an electronic device 1000 provided in an embodiment of the present application. Fig.14 The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system layer, kernel layer and hardware abstraction layer (HAL).

[0191] The application layer can include a series of application packages. Fig.14 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.

[0192] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Fig.14 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc. The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make these data accessible to applications. These data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build the display interface of the application, and the display interface can be composed of one or more views, such as a view for displaying a text message notification icon, a view for displaying text, and a view for displaying pictures. The phone manager is used to provide communication functions of the electronic device 1000, such as management of call status (including connecting, hanging up, etc.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of an icon or scroll bar text, such as a notification of an application running in the background. The notification manager can also be a notification that appears on the screen in the form of a dialog window, such as a text message in the status bar, a reminder sound, an electronic device vibrating, an indicator light flashing, etc.

[0193] Android runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0194] The system library can include multiple functional modules, such as: surface manager, media library, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0195] The kernel layer is the layer between hardware and software. The kernel layer contains at least device drivers such as camera driver, processor driver, display driver, audio driver, etc. The device driver is the interface between the I / O system and related hardware, used to drive the corresponding hardware devices.

[0196] The hardware abstraction layer (HAL) is an interface layer between the operating system kernel and the upper software, and its purpose is to abstract the hardware. The hardware abstraction layer is an abstract interface driven by the device kernel, which is used to implement the application programming interface that provides access to the underlying device to the higher-level Java API framework. HAL contains multiple library modules, such as cameras, displays, Bluetooth, audio, etc. Each of the library modules implements an interface for a specific type of hardware component. When the system framework layer API requires access to the hardware of a portable device, the Android operating system will load the library module for the hardware component. In this application, the HAL layer includes: an image slicing module, an image stitching module, an image calculation module, an image cropping module, an image creation module, an image preservation module, an image fusion module, and an image overlay module, etc., and the image processing method provided in this application is executed by these modules.

[0197] Specifically, in the present application, an image stitching module is used to obtain N first image blocks output by an image processing model from a processor, and stitch the N first image blocks according to a stitching rule to obtain a first image. An image creation module is used to create a second image and initialize the pixel values ​​of the second image. An image cropping module is used to remove the N first filling parts in the N first image blocks respectively to obtain N first valid parts. An image covering module is used to cover the pixel values ​​in the second image with the pixel values ​​of the N first valid parts according to the first sub-position in the first image corresponding to the first valid part included in each first image block, to obtain the first image; and is also used to cover the pixel values ​​of the first overlapping area in the first image with the pixel values ​​of the second image block to obtain an updated first image. An image calculation module is used to calculate the mean square error of the pixel values ​​on both sides of the stitching line in the first image. An image fusion module is used to perform image fusion processing on the pixel values ​​corresponding to the first overlapping area of ​​the i-th first image block and the j-th first image block when the mean square error is greater than or equal to a preset value to obtain a second image block. The image slicing module is used to obtain a third image captured by the electronic device and slice the third image according to the slicing rule to obtain N third image blocks. The image saving module is used to save the pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area.

[0198] The hardware layer includes camera groups, separate processors, integrated processors, displays, and audio devices. Fig.14 The software structure diagram of the electronic device shown is only an example and does not limit the specific module division in different layers of the Android operating system. For details, please refer to the introduction of the Android operating system software structure in conventional technology.

[0199] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0200] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.

Claims

1. An image processing method, applied to an electronic device, characterized in that: The method comprises: Obtain N first image blocks output by the image processing model, where N ≥ 2 and N is an integer; The N first image blocks are stitched together according to a stitching rule to obtain a first image, wherein the stitching rule includes a first position corresponding to each first image block in the N first image blocks in the first image, wherein, among the N first image blocks, the i-th first position corresponding to the i-th first image block and the j-th first position corresponding to the j-th first image block overlap with each other and have a first overlapping area, the first overlapping area in the first image includes a stitching line between the i-th first image block and the j-th first image block, and the first overlapping area is divided into two sub-overlapping areas by the stitching line, including a first sub-overlapping area close to the i-th first image block and a second sub-overlapping area close to the j-th first image block, 1≤i≤N, 1≤j≤N, i≠j, and i and j are both integers; Calculating a mean square error of pixel values ​​on both sides of the stitching line in the first image, wherein the pixel values ​​on one side are contained in the first sub-overlapping area and belong to the i-th first image block, and the pixel values ​​on the other side are contained in the second sub-overlapping area and belong to the j-th first image block; When the mean square error is greater than or equal to a preset value, performing image fusion processing on pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area to obtain a second image block, wherein the preset value is determined according to the image processing model; The pixel values ​​of the first overlapping area in the first image are overwritten with the pixel values ​​of the second image block to obtain an updated first image.

2. The method according to claim 1, characterized in that Each of the first image blocks includes a first valid part and a first filling part, and the splicing rule further includes: the first valid part included in each of the first image blocks corresponds to a first sub-position in the first image, and the first filling part included in each of the first image blocks corresponds to a second sub-position in the first image; wherein the i-th first image block includes the i-th first valid part and the i-th first filling part, the i-th first valid part corresponds to the i-th first sub-position, and the i-th first filling part corresponds to the i-th second sub-position; Among the N first image blocks, the i-th second sub-position overlaps with the first sub-position corresponding to the first valid portion included in at least one first image block in other first image blocks, and the at least one first image block includes the j-th first image block, Among the N first image blocks, the i-th first sub-position and the first sub-position corresponding to the first valid part included in the other first image blocks do not overlap, and the i-th first sub-position and the first sub-position corresponding to the first valid part included in each first image block in the at least one first image block are spliced ​​through adjacent edges, wherein the adjacent edge between the i-th first sub-position and the j-th first sub-position corresponding to the j-th first valid part included in the j-th first image block is the splicing line.

3. The method according to claim 2, characterized in that The j-th first image block includes the j-th first valid part and the j-th first filling part, the j-th first valid part corresponds to the j-th first sub-position, and the j-th first filling part corresponds to the j-th second sub-position; The first sub-overlapping region is an overlapping region between the i-th first sub-position and the j-th second sub-position, and the second sub-overlapping region is an overlapping region between the j-th first sub-position and the i-th second sub-position; The performing image fusion processing on pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area includes: The image fusion processing is performed on the pixel values ​​corresponding to the i-th first valid part and the j-th first filling part in the first sub-overlapping area, and the pixel values ​​corresponding to the j-th first valid part and the i-th first filling part in the second sub-overlapping area.

4. The method according to claim 2, characterized in that The step of performing splicing processing on the N first image blocks according to a splicing rule to obtain a first image includes: Creating a second image and initializing pixel values ​​of the second image, wherein the size of the second image is the same as that of the first image; Removing N first filling parts from the N first image blocks respectively to obtain N first valid parts; According to the first sub-position in the first image corresponding to the first valid part included in each first image block, the pixel values ​​in the second image are covered with the pixel values ​​of N first valid parts to obtain the first image.

5. The method according to claim 1, characterized in that Each of the first image blocks includes a first valid part and a first padding part, the i-th first image block includes the i-th first valid part and the i-th first padding part, and the method further includes: The pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area are saved.

6. The method according to claim 2, characterized in that The ith first effective part and the jth first effective part are spliced ​​by adjacent edges, and the adjacent edges of the ith first effective part and the jth first effective part are the splicing line, a first pixel column adjacent to the splicing line in the ith first effective part includes M first pixels, a second pixel column adjacent to the splicing line in the jth first effective part includes M second pixels, the mth first pixel in the first pixel column and the mth second pixel in the second pixel column form a pixel pair, M≥2 and M is an integer, 1≤m≤M and m is an integer, The calculating the mean square error of pixel values ​​on both sides of the stitching line in the first image includes: Calculate the square value of the difference between the pixel value of the first pixel and the pixel value of the second pixel in each of the M pixel pairs consisting of the first pixel column and the second pixel column to obtain M square values; The average value of the M square values ​​is calculated to obtain the mean square error.

7. The method according to any one of claims 2 to 6, characterized in that The preset value is also determined according to a ratio of the sizes of the first valid part and the first filling part in each first image block.

8. The method according to any one of claims 1 to 6, characterized in that The obtaining of N first image blocks output by the image processing model comprises: Acquire a third image captured by the electronic device, where the third image has the same size as the first image; The third image is sliced ​​according to a slicing rule to obtain N third image blocks, wherein the slicing rule includes a second position corresponding to each of the N third image blocks in the third image, and each of the first image blocks is the same size as each of the N third image blocks, wherein the slicing rule is used to determine the splicing rule; The N third image blocks are input into the image processing model to obtain the N first image blocks, and the N first image blocks correspond one-to-one to the N third image blocks.

9. The method according to claim 8, characterized in that Each of the third image blocks includes a second valid part and a second filling part, and in each of the third image blocks, the block cutting rule further includes: the second valid part included in each of the third image blocks corresponds to a third sub-position in the third image, and the second filling part included in each of the third image blocks corresponds to a fourth sub-position in the third image; wherein the i-th third image block includes the i-th second valid part and the i-th second filling part, the i-th second valid part corresponds to the i-th third sub-position, and the i-th second filling part corresponds to the i-th fourth sub-position; Among the N third image blocks, the i-th fourth sub-position overlaps with the third sub-position corresponding to the second valid portion included in at least one third image block in other third image blocks, and the at least one third image block includes the j-th third image block, Among the N third image blocks, the i-th third sub-position does not overlap with the third sub-positions corresponding to the second valid parts included in other third image blocks.

10. The method according to claim 9, characterized in that The third image block has the same size as the first image block, and the method further includes: The first position corresponding to the i-th first image block in the first image is determined according to the second position corresponding to the i-th third image block in the third image.

11. The method according to claim 10, characterized in that Each of the first image blocks includes a first valid part and a first filling part, and the splicing rule further includes: the first valid part included in each of the first image blocks corresponds to a first sub-position in the first image, and the first filling part included in each of the first image blocks corresponds to a second sub-position in the first image; wherein the i-th first image block includes the i-th first valid part and the i-th first filling part, the i-th first valid part corresponds to the i-th first sub-position, the i-th first filling part corresponds to the i-th second sub-position, the i-th first valid part is the same size as the i-th second valid part, and the i-th first filling part is the same size as the i-th second filling part; The determining, according to the second position corresponding to the i-th third image block in the third image, the first position corresponding to the i-th first image block in the first image includes: Determine the i-th first sub-position corresponding to the i-th first valid part in the first image based on the i-th third sub-position corresponding to the i-th second valid part in the third image, and determine the i-th second sub-position corresponding to the i-th first filling part in the first image based on the i-th fourth sub-position corresponding to the i-th second filling part in the third image.

12. The method according to claim 11, characterized in that The preset value is also determined according to the proportion of the size of the i-th second filling part and / or the i-th second effective part in the size of the i-th third image.

13. The method according to any one of claims 1 to 6, characterized in that The obtaining of N first image blocks output by the image processing model comprises: Acquire N third image blocks taken by the electronic device, wherein each of the first image blocks has the same size as each of the N third image blocks; The N third image blocks are input into the image processing model to obtain the N first image blocks, and the N first image blocks correspond one-to-one to the N third image blocks.

14. The method according to claim 1, wherein: The performing image fusion processing on pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area includes: Based on the Alpha fusion method, image fusion processing is performed on the pixel values ​​corresponding to the i-th first image block and the j-th first image block in the first overlapping area.

15. An electronic device comprising a memory and one or more processors, characterized in that: The memory is used to store a computer program; the processor is used to call the computer program so that the electronic device executes the method according to any one of claims 1 to 14.

16. A computer storage medium, characterized in that: include: Computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 14.