Image inpainting method, device and medium fusing diffusion equation and cartoon map information

By generating cartoon images and constructing a restoration priority model, combined with the FMM fast restoration algorithm and improved sample block matching criteria, the problems of texture extension and abrupt information in image restoration are solved, achieving high-quality image restoration results.

CN117974500BActive Publication Date: 2026-11-27CHINA UNIV OF GEOSCIENCES (WUHAN)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311369898.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-20
Publication Date
2026-11-27
Estimated Expiration
2043-10-20

AI Technical Summary

Technical Problem

Existing image restoration methods are prone to texture extension and abrupt information when processing images with complex content. They cannot effectively suppress texture extension and avoid the appearance of abrupt information in the restored image.

Method used

An image of the image to be repaired is generated using an RTV diffusion model. The transfer equations of the structure operator E(p) and the BSCB model are constructed. A repair priority model is designed. The repair order is determined and the image is repaired by combining the FMM fast repair algorithm and the sample block matching criterion of the improved Criminisi algorithm.

Benefits of technology

It effectively suppresses texture extension, avoids the appearance of abrupt information in the restored image, improves the visual effect of image restoration, and maintains the integrity and continuity of the image structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117974500B_ABST
    Figure CN117974500B_ABST
Patent Text Reader

Abstract

The application provides an image repairing method fusing diffusion equation and cartoon information, comprising: acquiring an image to be repaired, generating a cartoon of the image to be repaired through an RTV diffusion model; constructing a structure operator E(p) according to texture characteristics of the image to be repaired and the cartoon; designing a repairing priority model according to the structure operator E(p) and a transport equation of a BSCB model; preliminarily repairing the image to be repaired through a FMM fast repairing algorithm; using the preliminarily repaired image to be repaired as a matching image of a sample block; improving a sample block matching criterion based on a Criminisi algorithm through the matching image; and repairing the image to be repaired through the repairing priority model and the sample block matching criterion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and in particular to an image restoration method, apparatus and medium that fuses diffusion equations and cartoon image information. Background Technology

[0002] With the rapid development of digital technology, people can more easily obtain various images. Techniques such as art restoration, sensitive object removal, and film special effects are receiving increasing attention. Image inpainting is a key technology widely used in these fields. Generally speaking, image inpainting techniques can be broadly classified into three categories based on their restoration methods: diffusion-based inpainting, sparse representation-based inpainting, and sample-based inpainting. Among these, diffusion-based image inpainting methods and sparse representation-based image inpainting algorithms often cause significant blurring when restoring damaged images containing a large amount of texture information.

[0003] Sample-based inpainting methods can effectively solve the above problems. These algorithms are block-filling methods, where the information filled into the damaged areas is a copy-and-paste of image information "from scratch". The Criminisi algorithm is a representative example of this type of algorithm, using a similarity matching principle to find the best sample block within the intact area and then copying and pasting it.

[0004] However, it is not very targeted at structural information in images, and in some cases, it cannot achieve reasonable repair results. Later, Casaca used the diffusion equation in the third paper to construct an iso-illuminance line model to determine the priority of the pixels to be repaired and obtain the repair order of priority repair at the edges. Qiang Zhenping determined the priority by extracting the structural component image of the image to be repaired and calculating data terms together with the original image to ensure the rationality of the priority.

[0005] However, these existing sample-based image inpainting algorithms typically determine priority solely based on the gradient information of the image to be inpainted or its cartoon image. In complex images, prioritizing based on the image to be inpainted may result in unclear definition of image edges and textures, while prioritizing based on the cartoon image may result in unclear definition of image textures and noise, leading to undesirable visual effects such as structural breaks and excessive texture extension. Furthermore, during information matching, using only known information from the original image can easily result in inconsistencies in the inpainted image.

[0006] This invention is a solution to the above-mentioned problems, which can suppress texture extension while greatly avoiding the appearance of abrupt information in the repaired image. Summary of the Invention

[0007] The purpose of this application is to solve the technical problem that conventional image processing methods can easily produce abrupt information while suppressing the texture extension phenomenon of images with complex content. This application provides an image restoration method, device and medium that integrates diffusion equation and cartoon image information.

[0008] The above-mentioned objective of this application is achieved through the following technical solution:

[0009] S1: Obtain the image to be repaired, and generate a cartoon image of the image to be repaired using the RTV diffusion model;

[0010] S2: Construct the structure operator E(p) based on the texture characteristics of the image to be repaired and the cartoon image;

[0011] S3: Construct a repair priority model based on the structural operator E(p) and the transmission equation of the BSCB model;

[0012] S4: Perform preliminary repair on the image to be repaired using the FMM fast repair algorithm to determine the preliminary repair image;

[0013] The initially repaired image is used as the matching image for the sample block; the sample block matching criterion based on the Criminisi algorithm is improved using the matching image.

[0014] S5: Calculate the confidence level of each pixel in the image to be repaired;

[0015] S6: Determine whether the image to be repaired has pixels to be repaired based on the confidence level of each pixel.

[0016] S7: If there are pixels to be repaired, the repair order of each pixel to be repaired is determined by the repair priority model.

[0017] According to the repair order and the sample block matching criteria, a sample block to be repaired is constructed with the pixel to be repaired as the center. In the intact area of ​​the sample block to be repaired, an intact sample block with the smallest color difference and the same size as the sample block to be repaired is determined. The intact sample block is used to replace the sample block to be repaired, thus completing the repair of the pixel to be repaired.

[0018] S8: Update the confidence of the repaired image to be repaired; determine again whether there are any pixels to be repaired in the image to be repaired. If there are pixels to be repaired, continue to repair the pixels to be repaired until there are no pixels to be repaired in the image to be repaired.

[0019] S9: If there are no pixels to be repaired, the image repair work is completed.

[0020] Optionally, step S2 includes:

[0021] The structural operator E(p) is as follows:

[0022]

[0023] Where I is the image to be repaired, u is the cartoon image of the image to be repaired, and α represents a constant value used for normalization, typically 255. This represents the inner product of the isoluminance line direction of the pixel p to be repaired on the image to be repaired and the isoluminance line direction on the cartoon image. The larger the value, the stronger the structure of the region where the pixel is located.

[0024] Optionally, S31: The transmission equation is incorporated into the calculation of the isoluminance line model of the image to be repaired, as follows:

[0025]

[0026] Among them, u p This refers to the pixel value information at point p in the cartoon image; in the BSCB model, the image follows the isoluminescence lines. Diffusion pixel value information, This represents the isoluminescence line operator, and it represents the vector direction with the minimum color difference. Δ represents the gradient operator, which also represents the edge direction; Δ represents the Laplacian operator; and Δu represents the edge image obtained by discretizing the cartoon image u using the Laplacian operator.

[0027] S32: Use isoluminance line vectors Replace gradient vector as follows:

[0028]

[0029] S33: Calculate the neighborhood structure operator E at each point to be repaired using the structure operator E(p). ε The value of (p) is added to the calculation of the restoration priority of the image to be restored, resulting in the restoration priority model P(p), as follows:

[0030] P(p)=C(p)·(R(p)+E ε (p)) (4)

[0031]

[0032] Among them, E ε (p) is the neighborhood structure operator, ε=3 is the specified neighborhood radius, C(p) represents the confidence term of the pixel to be repaired, which is the proportion of intact pixels in the 9×9 sample block constructed with the pixel to be repaired p, and N qN(p) represents the number of intact pixels within the neighborhood window, N(p) represents the number of pixels in a 9×9 sample block centered at p, q represents the intact pixels in the neighborhood of pixel p, and E(q) represents the size of the neighborhood operator for pixel q.

[0033] Optionally, step S4 includes:

[0034] M = u.*(1-mask) + I_FMM.*mask

[0035] Where M is the matching image of the sample block, I_FMM is the preliminary repair image, I is the image to be repaired, and mask represents the mask image of the image to be repaired, where 1 represents an intact point and 0 represents a damaged point.

[0036]

[0037]

[0038] d(Ψ o ,Ψ q )=α·d1(Ψ p ,Ψ q )+β·d2(Ψ p ,Ψ q )

[0039] Ψ q =argmin d(Ψ) p ,Ψ q )

[0040] Among them, d1(Ψ) p ,Ψ q ) is used to calculate the sample block Ψ to be repaired. p The intact region pixels and the intact sample block Ψ q Color difference at corresponding positions;

[0041] d2(Ψ p ,Ψ q ) is used to calculate the sample block Ψ to be repaired p The pixels that have undergone preliminary repair using the FMM fast repair algorithm and the intact sample block Ψ q Color difference at corresponding positions;

[0042] d(Ψ p ,Ψ q ) is the overall difference obtained by weighting the color differences between the two parts mentioned above; Ψ q This represents the intact sample block selected from the known area that has the smallest color difference from the current sample block to be repaired and is the same size;

[0043] Where p and q are the pixels to be repaired and intact pixels in image M; i represents its x-coordinate, j represents its y-coordinate, and Ψ represents its x-coordinate. p Ψ q Let d(Ψ) represent 9×9 sample blocks centered at p and q respectively. p ,Ψ q ) represents the sum of squared color differences between corresponding pixels in two sample blocks; α and β are two custom parameter values, p(i,j) represents the pixel value at point p, and q(i,j) represents the pixel value at point q.

[0044] An electronic device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform an image restoration method that fuses diffusion equations and cartoon image information.

[0045] A computer-readable storage medium storing instructions that, when executed, perform an image inpainting method that fuses a diffusion equation and cartoon image information.

[0046] The beneficial effects of the technical solution provided in this application are:

[0047] The process involves acquiring the image to be repaired and generating a cartoon image of it using an RTV diffusion model. Based on the texture characteristics of the image to be repaired and the cartoon image, a structure operator E(p) is constructed. A repair priority model is designed based on the structure operator E(p) and the transfer equation of the BSCB model. The image to be repaired is initially repaired using the FMM fast repair algorithm. The initially repaired image is used as a matching image for sample blocks. The sample block matching criterion based on the Criminisi algorithm is improved using the matching image. The image to be repaired is then repaired using the repair priority model and the sample block matching criterion. A structure operator is constructed using the gradient information of the image to be repaired and its cartoon image to determine the priority function of the pixels to be repaired, thus achieving a repair order of prioritizing structural areas, second-priority areas for texture, and last-priority areas for flat areas. A data term is constructed using the diffusion equation to enhance the edge recognition ability in the image to be repaired. The FMM fast repair algorithm is used for initial repair of the image to be repaired. The initially repaired reference image is used to improve the sample block matching criterion based on the Criminisi algorithm, increasing the reference role of local image information at the damaged area to avoid the appearance of irrelevant and abrupt information. Attached Figure Description

[0048] The present application will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:

[0049] Figure 1This is a flowchart of the image restoration method that integrates diffusion equations and cartoon image information in the embodiments of this application;

[0050] Figure 2 This is a comparison chart of the results of different image restoration algorithms that integrate diffusion equations and cartoon image information in the embodiments of this application;

[0051] Figure 3 This is a schematic diagram of an electronic device structure for an image restoration method that integrates diffusion equations and cartoon image information, as described in this application embodiment. Detailed Implementation

[0052] To provide a clearer understanding of the technical features, objectives, and effects of this application, the specific embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0053] Embodiments of this application provide an image restoration method, apparatus, and medium that fuse diffusion equations and cartoon image information.

[0054] Please refer to Figure 1 , Figure 1 This is a flowchart of an image inpainting method that integrates diffusion equations and cartoon image information according to an embodiment of this application, specifically including the following steps:

[0055] S1: Obtain the image to be repaired, and generate a cartoon image of the image to be repaired using the RTV diffusion model;

[0056] S2: Construct the structure operator E(p) based on the texture characteristics of the image to be repaired and the cartoon image;

[0057] S3: Construct a repair priority model based on the structural operator E(p) and the transmission equation of the BSCB model;

[0058] S4: Perform preliminary repair on the image to be repaired using the FMM fast repair algorithm to determine the preliminary repair image;

[0059] The initially repaired image is used as the matching image for the sample block; the sample block matching criterion based on the Criminisi algorithm is improved using the matching image.

[0060] S5: Calculate the confidence level of each pixel in the image to be repaired;

[0061] S6: Determine whether the image to be repaired has pixels to be repaired based on the confidence level of each pixel.

[0062] S7: If there are pixels to be repaired, the repair order of each pixel to be repaired is determined by the repair priority model.

[0063] According to the repair order and the sample block matching criteria, a sample block to be repaired is constructed with the pixel to be repaired as the center. In the intact area of ​​the sample block to be repaired, an intact sample block with the smallest color difference and the same size as the sample block to be repaired is determined. The intact sample block is used to replace the sample block to be repaired, thus completing the repair of the pixel to be repaired.

[0064] S8: Update the confidence of the repaired image to be repaired; determine again whether there are any pixels to be repaired in the image to be repaired. If there are pixels to be repaired, continue to repair the pixels to be repaired until there are no pixels to be repaired in the image to be repaired.

[0065] S9: If there are no pixels to be repaired, the image repair work is completed.

[0066] Specifically, the pixels in the image to be repaired are represented in matrix form. After determining the pixels to be repaired, the data terms of the isoluminance line model R(p) for each pixel to be repaired are modified, and the neighborhood structure operator E for each pixel to be repaired is calculated. ε (p) determines the repair order of the pixels to be repaired in the image to be repaired.

[0067] Specifically, the key to determining the quality of image restoration lies in maintaining the integrity of the image structure. Ideally, the restoration direction is strictly in accordance with the direction of the iso-illuminance lines of the image. However, in actual processing, the rich texture information has a large gradient value. Determining the restoration order solely based on the magnitude of the gradient information may lead to a higher restoration priority for texture areas than for structural areas, resulting in restoration errors.

[0068] A diffusion model is used to generate a cartoon image of the image to be repaired. The priority of the pixels to be repaired in the cartoon image is determined by the gradient information of the pixels to be repaired. To a certain extent, this can effectively separate the image edges and textures, making the priority of edge pixels much higher than that of texture pixels. However, in some areas with weak structural information, these areas in the cartoon image are filtered into smooth parts, and the priority order among weak structural information is not clearly defined, which can also lead to poor repair results.

[0069] Step S2 includes:

[0070] The structural operator E(p) is as follows:

[0071]

[0072] Where I is the image to be repaired, u is the cartoon image of the image to be repaired, and α represents a constant value used for normalization, typically 255. This represents the inner product of the isoluminance line direction of the pixel p to be repaired on the image to be repaired and the isoluminance line direction on the cartoon image. The larger the value, the stronger the structure of the region where the pixel is located.

[0073] Specifically, this application compares the results of multiple cartoon image extraction algorithms and ultimately determines the RTV diffusion model as the extraction algorithm for cartoon images in this application. For edge pixels, and Both will have larger values ​​and more consistent directions, resulting in a larger E(p) value; for texture pixels, its The value is too large, therefore the corresponding pixel information in the cartoon image is filtered out. The value is small, therefore the E(p) value is small; and for flat regions, its and The values ​​of E(p) will be relatively small, making E(p) a minimum value. The magnitude of E(p) obviously satisfies the visual characteristic that geometric regions are repaired first, texture regions are repaired second, and flat regions are repaired last.

[0074] Step S3 includes:

[0075] S31: The transmission equation is introduced into the calculation of the isoilline model of the image to be repaired, as follows:

[0076]

[0077] Among them, u p This refers to the pixel value information at point p in the cartoon image; in the BSCB model, the image follows the isoluminescence lines. Diffusion pixel value information, This represents the isoluminescence line operator, and it represents the vector direction with the minimum color difference. Δ represents the gradient operator, which also represents the edge direction; Δ represents the Laplacian operator; and Δu represents the edge image obtained by discretizing the cartoon image u using the Laplacian operator.

[0078] Specifically, in the diffusion process of the diffusion equation, when the direction of the isoluminescence line is orthogonal to the direction of information diffusion, it is considered to have diffused to the boundary and diffusion stops. However, in the Criminisi algorithm, when a pixel is located at the boundary, the repair should prioritize the direction at the boundary. Therefore, the gradient vector is applied at the boundary. Replace with isoilline vectors

[0079] S32: Use isoluminance line vectors Replace gradient vector as follows:

[0080]

[0081] Specifically, another problem with the priority model of the original Criminisi algorithm is that the priority calculation only considers the information at the pixel to be repaired without taking into account the information complexity within the neighborhood of the pixel to be repaired. This also leads to unsatisfactory repair results. To address this issue, this application incorporates the calculation of the neighborhood structure operator size at each pixel to be repaired into the priority calculation, thereby further prioritizing the repair of image patches with higher neighborhood complexity.

[0082] Specifically, the newly added neighborhood structure operator in the priority list further strengthens the priority of edge information repair and takes into account the image information in the local neighborhood, so that the repair priority of the points with more edge information in the local neighborhood is higher.

[0083] S33: Calculate the neighborhood structure operator E at each point to be repaired using the structure operator E(p). ε The value of (p) is added to the calculation of the restoration priority of the image to be restored, resulting in the restoration priority model P(p), as follows:

[0084] P(p)=C(p)·(R(p)+E ε (p)) (4)

[0085]

[0086] Among them, E ε (p) is the neighborhood structure operator, ε=3 is the specified neighborhood radius, C(p) represents the confidence term of the pixel to be repaired, which is the proportion of intact pixels in the 9×9 sample block constructed with the pixel to be repaired p, and N q N(p) represents the number of intact pixels within the neighborhood window, N(p) represents the number of pixels in a 9×9 sample block centered at p, q represents the intact pixels in the neighborhood of pixel p, and E(q) represents the size of the neighborhood operator for pixel q.

[0087] Step S4 includes:

[0088] M = u.*(1-mask) + I_FMM.*mask

[0089] Where M is the matching image of the sample block, I_FMM is the preliminary repair image, I is the image to be repaired, and mask represents the mask image of the image to be repaired, where 1 represents an intact point and 0 represents a damaged point.

[0090]

[0091]

[0092] d(Ψ p ,Ψ q )=α·d1(Ψ p ,Ψ q )+β·d2(Ψ p ,Ψ q )

[0093] Ψ q =argmin d(Ψ) p ,Ψ q )

[0094] Among them, d1(Ψ) p ,Ψ q ) is used to calculate the sample block Ψ to be repaired. p The intact region pixels and the intact sample block Ψ q Color difference at corresponding positions;

[0095] d2(Ψ p ,Ψ q ) is used to calculate the sample block Ψ to be repaired p The pixels that have undergone preliminary repair using the FMM fast repair algorithm and the intact sample block Ψ q Color difference at corresponding positions;

[0096] d(Ψ p ,Ψ q ) is the overall difference obtained by weighting the color differences between the two parts mentioned above; Ψ q This represents the intact sample block selected from the known area that has the smallest color difference from the current sample block to be repaired and is the same size;

[0097] Where p and q are the pixels to be repaired and intact pixels in image M; i represents its x-coordinate, j represents its y-coordinate, and Ψ represents its x-coordinate. p Ψ q Let d(Ψ) represent 9×9 sample blocks centered at p and q respectively. p ,Ψ q ) represents the sum of squared color differences between corresponding pixels in two sample blocks; α and β are two custom parameter values, p(i,j) represents the pixel value at point p, and q(i,j) represents the pixel value at point q.

[0098] In a cartoon image, the main structural edge information of the image is preserved while other information is filtered out. The main edge information in the image often has a relatively consistent gradient direction, while the direction of texture information is mostly divergent.

[0099] Specifically, the Criminisi algorithm, when searching for the best-matching sample block, only uses pixel values ​​within the known region for matching, without considering the correlation of local information. This easily leads to mismatches, where the image information filled in the area to be repaired is highly unreasonable and completely unrelated to its surrounding information, resulting in a jarring visual effect. This application improves the sample block matching criterion based on the Criminisi algorithm by combining the FMM fast repair algorithm based on the principle of local repair. A larger α and a smaller β indicate that the pixel values ​​of the original image remain key determining information during the matching process, with additional reference to the pixel values ​​after local repair. The improved sample block matching criterion further considers the correlation of local information to avoid abrupt matching errors.

[0100] To verify the effectiveness of the proposed algorithm, simulation experiments were conducted using Matlab 2014a software on a computer with a 2.50 GHz processor and 8 GB RAM. To more intuitively demonstrate the effectiveness of the proposed algorithm, six images with large-area damage were selected for testing in the experimental section. Three of these images required target removal, and the other three were manually annotated images with damage. The results were compared with those of algorithms in other literature. The quality of the restored image was objectively evaluated using Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity (SSIM). Higher values ​​for both indicate a greater similarity between the restored image and the original image, and thus a better restoration effect.

[0101] The calculation formula is as follows:

[0102]

[0103]

[0104] In the formula, f, These are the grayscale values ​​of the images before and after restoration, where u represents the average brightness of the image. Let c1 = 6.5025, c2 = 58.5225, M represent the height of the image, and N represent the width of the image. Let f(x,y) represent the pixel values ​​of the restored image, and f(x,y) represent the pixel values ​​of the original image to be restored (the intact image). This represents the variance of the image to be repaired. This represents the variance of the restored image. This represents the covariance between the image to be repaired and the image after repair. This represents the mean value of the image to be repaired. This represents the mean value of the restored image. The experimental results compare the results of different restoration algorithms, as shown in the image below. Figure 2 As shown.

[0105] Observe the experimental results of the 6 images in the figure above, where (a) is the original image, (b) is the image with manual annotation of damage, (c) is the experimental result of the algorithm in the first reference, (d) is the experimental result of the algorithm in the second reference, and (e) is the experimental result of the algorithm of this application.

[0106] Regarding object removal, observing the first bungee jumping image reveals that the algorithm in the first reference exhibited structural breaks when repairing the roof area. While the algorithm in the second reference largely preserved the continuous structure of the roof, it inevitably introduced mismatches in the grass and water areas. The algorithm in this application effectively preserved the structure of the roof area without mismatches, resulting in the best visual effect.

[0107] In the second experimental image for pumpkin removal, both the first and second references exhibited mismatches, with window frames appearing where they shouldn't have been in areas that should have been black windows. The algorithm in this application, however, preserved the original structure while avoiding erroneous texture structures. In the third experimental image for person removal, both the algorithms in the first and second references incorrectly filled the ground with black shadows. While the algorithm in this application did not restore the structure in the tree shadows as well as the algorithm in the second reference, it largely avoided the abrupt shadows on the ground seen in the second reference.

[0108] Regarding damage restoration, the fourth image uses a magnified view of the BRA image to add damage for repair. It can be seen that both the algorithms in the first and second documents exhibit significant texture extension when filling the edges of the clothing. The algorithm in this application significantly suppresses the occurrence of extended textures. In the fifth image, the algorithm in the first document shows textures extending from the trousers on the woman's arm, while the algorithm in the second document shows unnatural shadows on the woman's hand. The algorithm in this application has better overall visual appeal and more continuous structural texture.

[0109] The experimental images and their analysis above demonstrate that the algorithm presented in this application best meets the requirements of human visual perception. While the algorithm in the second reference enhances the recognition of image structure and maintains greater continuity in image structure compared to the algorithm in the first reference, it still cannot avoid texture extension due to the lack of explicit division of image structure and texture. Furthermore, both algorithms use the color variance between pixels for matching, which also fails to prevent mismatches of sample blocks.

[0110] The first document is: Criminisi A, Perez P, and Toyama K.Region Filling and ObjectRemoval by Exemplar-Based Image Inpainting[J]. IEEE Transactions on ImageProcessing, 2004, 13(9):1200-1212.

[0111] The second document is: Yuantao Chen, Haopeng Zhang and Linwu Liu, et al. Research onimage inpainting algorithm of improved total variation minimization method [J]. Journal of Ambient Intelligence and Humanized Computing, 2021: 1-10.

[0112] The third document is: Casaca W, Boaventura M, de Almeida MP, et al. Combininganisotropic diffusion, transport equation and texture synthesis for inpaintingtextured images[J]. Pattern recognition letters, 2014(36):36-45.

[0113] Compared with existing technologies, the advantages of this invention are:

[0114] 1. This invention utilizes the gradient information of the image to be repaired and its cartoon image to construct a priority function, which allows the pixels to be repaired to be repaired in the order of edge area, texture area, and flat area, thereby avoiding texture extension caused by prioritizing texture information over edge structure information repair.

[0115] 2. The FMM fast image inpainting algorithm is used for preliminary repair of the image to be repaired. It takes into account the correlation of local information more, thereby reducing the appearance of irrelevant and abrupt information in the repaired image.

[0116] It should be noted that the above embodiments of the apparatus are only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided above belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0117] This application also discloses an electronic device. (See reference...) Figure 3 , Figure 3 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. The electronic device 500 may include: at least one processor 501, at least one network interface 504, a user interface 503, a memory 505, and at least one communication bus 502.

[0118] The communication bus 502 is used to enable communication between these components.

[0119] The user interface 503 may include a display screen and a camera. Optionally, the user interface 503 may also include a standard wired interface and a wireless interface.

[0120] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0121] The processor 501 may include one or more processing cores. The processor 501 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 505, and by calling data stored in memory 505. Optionally, the processor 501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 501 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 501 and may be implemented as a separate chip.

[0122] The memory 505 may include random access memory (RAM) or read-only memory.

[0123] Optionally, the memory 505 includes a non-transitory computer-readable storage medium. The memory 505 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 505 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. The memory 505 may also optionally include, but is not limited to, at least one storage device located remotely from the aforementioned processor 501. (Refer to...) Figure 3 The memory 505, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for an image restoration method that integrates diffusion equations and cartoon image information.

[0124] exist Figure 3In the illustrated electronic device 500, the user interface 503 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 501 can be used to call an application program stored in the memory 505 that stores an image restoration method for fusing diffusion equations and cartoon image information. When executed by one or more processors 501, the electronic device 500 performs one or more methods as described in the above embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simplicity, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0125] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0126] In the various embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed include, but are not limited to, indirect couplings or communication connections between apparatuses or units through some service interfaces, including but not limited to electrical or other forms.

[0127] The units described as separate components include, but are not limited to, physically separate units. The components shown as units include, but are not limited to, physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of these units can be selected to achieve the purpose of this embodiment according to actual needs.

[0128] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or may exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0129] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0130] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will readily conceive of those skilled in the art upon consideration of the specification and the disclosure of practical truths.

[0131] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. An image inpainting method that integrates diffusion equations and cartoon image information, characterized in that, The method includes the following steps: S1: Obtain the image to be repaired, and generate a cartoon image of the image to be repaired using the RTV diffusion model; S2: Construct a structure operator based on the texture characteristics of the image to be repaired and the cartoon image. ; S3: Based on the structural operator And the transport equations of the BSCB model, to construct a repair priority model; Step S3 includes: S31: The transmission equation is introduced into the calculation of the isoilline model of the image to be repaired, as follows: (2) in, Cartoon image Pixel value information at a point; in the BSCB model, the image follows the isoluminescence line. Diffusion pixel value information This represents the isoluminescence line operator, and it represents the vector direction with the minimum color difference. This represents the gradient operator, which in turn represents the edge direction. Represents the Laplace operator. Indicates cartoon image The edge image obtained after discretization by the Laplacian operator; S32: Use isoluminance line vectors Replace gradient vector ,as follows: (3) S33: Through the structural operator Calculate the neighborhood structure operator at each point to be repaired. The size of the image to be repaired is added to the calculation of the repair priority, thus obtaining the repair priority model. ,as follows: (4) (5) in, For neighborhood structure operators, For the specified neighborhood radius, This represents the confidence level of the pixel to be repaired, which is based on the pixel to be repaired. Constructed The proportion of intact pixels in a sample block of a certain size. This represents the number of pixels in the intact region within the neighborhood window. Indicated by Built around The pixels in a sample block of size p, where pixel q represents a intact pixel in the neighborhood of pixel p. The structure operator representing pixel q; S4: Perform preliminary repair on the image to be repaired using the FMM fast repair algorithm to determine the preliminary repair image; The initially repaired image is used as the matching image for the sample block; the sample block matching criterion based on the Criminisi algorithm is improved using the matching image. Step S4 includes: in, For the matching image of the sample block, This is a preliminary image restoration. The image to be repaired. The mask image represents the image to be repaired, where 1 represents an intact point and 0 represents a damaged point; This represents element-wise multiplication; in, Used to calculate the sample block to be repaired intact region pixels and intact sample blocks Color difference at corresponding positions; Used to calculate the sample block to be repaired The pixels that have undergone preliminary repair using the FMM fast repair algorithm and the intact sample block Color difference at corresponding positions; It is the overall difference obtained by weighting the color differences of the two parts mentioned above; This represents the intact sample block selected from the known area that has the smallest color difference and the same size as the current sample block to be repaired; in, and It is located in the image The pixels to be repaired and the intact pixels; Indicate its x-coordinate, Indicate its ordinate, They represent structures built around p and q, respectively. Sample blocks of a certain size This represents the sum of squared color differences between corresponding pixels in two sample blocks; and These are two custom parameter values. This represents the pixel value at point p. This represents the pixel value of point q; S5: Calculate the confidence level of each pixel in the image to be repaired; S6: Determine whether the image to be repaired has pixels to be repaired based on the confidence level of each pixel. S7: If there are pixels to be repaired, the repair order of each pixel to be repaired is determined by the repair priority model. According to the repair order and the sample block matching criteria, a sample block to be repaired is constructed with the pixel to be repaired as the center. In the intact area of ​​the sample block to be repaired, an intact sample block with the smallest color difference and the same size as the sample block to be repaired is determined. The intact sample block is used to replace the sample block to be repaired, thus completing the repair of the pixel to be repaired. S8: Update the confidence of the repaired image to be repaired; determine again whether there are any pixels to be repaired in the image to be repaired. If there are pixels to be repaired, continue to repair the pixels to be repaired until there are no pixels to be repaired in the image to be repaired. S9: If there are no pixels to be repaired, the image repair work is completed.

2. The image inpainting method according to claim 1, which integrates diffusion equations and cartoon image information, is characterized in that... Step S2 includes: The structural operator ,as follows: (1) in, The image to be repaired, The cartoon image is the image to be repaired. This represents the constant value used for normalization, which is 255. This represents the inner product of the isoluminance line direction of the pixel p to be repaired on the image to be repaired and the isoluminance line direction on the cartoon image. The larger the value, the stronger the structure of the region where the pixel is located.

3. An electronic device, characterized in that, The device includes a processor (501), a memory (505), a user interface (503), and a network interface (504). The memory (505) is used to store instructions. The user interface (503) and the network interface (504) are used to communicate with other devices. The processor (501) is used to execute the instructions stored in the memory (505) to cause the electronic device (500) to perform an image restoration method that fuses diffusion equations and cartoon image information as described in any one of claims 1-2.

4. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform an image restoration method according to any one of claims 1-2, which integrates diffusion equations and cartoon image information.

Citation Information

Patent Citations

  • An image restoration method based on a Criminisi algorithm

    CN109785250A

  • Method for example-based image inpainting using structure matrix

    KR101361075B1