Historical relic image virtual restoration method based on texture reconstruction and color correction

By combining edge detection and texture orientation adaptive affine transformation with color correction, the problem of inconsistent texture and color in cultural relic image restoration is solved, generating restored images with coordinated structure and color.

CN121280286APending Publication Date: 2026-01-06CHONGQING UNIV

Patent Information

Application Number
CN202511461015.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-09-30
Filing Date
2025-10-14
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

Existing methods for restoring cultural relics images cannot simultaneously ensure the continuity of texture direction and the consistency of color distribution, resulting in problems such as texture misalignment or abrupt color changes in the restored area. Furthermore, deep learning methods are highly dependent on training samples and are difficult to adapt to the complex damage characteristics of diverse cultural relics.

Method used

By identifying damaged areas through edge detection, the optimal sample block that best matches the structure of the area to be filled is selected, and an adaptive affine transformation of the texture direction is performed. Color correction is then applied to generate a repair texture block that is consistent with the surrounding area, and finally, it is seamlessly embedded into the damaged area.

Benefits of technology

It achieves consistency in direction and coordination in color distribution between the repaired texture and the surrounding area, avoiding problems such as texture misalignment and abrupt color changes in the repaired area, and generating a final repaired image with coordinated structure and color.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121280286A_ABST
    Figure CN121280286A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing and cultural relic protection, in particular to a cultural relic image virtual restoration method based on texture reconstruction and color correction, and the method comprises the following steps: S1, obtaining a digital image of the surface of a to-be-restored cultural relic, and carrying out the denoising and brightness equalization processing of the digital image; s2, identifying and segmenting a damaged area in the image; s3, selecting an optimal sample block which is most matched with the structure of the region to be filled; s4, performing adaptive affine transformation on the optimal sample block to generate a reconstructed texture block; s5, carrying out linear transformation to obtain a repaired texture block after color correction; and S6, seamlessly embedding the repaired texture block after color correction into the damaged area. According to the method, the texture direction alignment and the color distribution correction are combined, so that the consistency of the damaged area and the surrounding image in structure and color is realized, and the naturalness and integrity of cultural relic image restoration are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing and cultural relic preservation technology, and in particular to a virtual restoration method for cultural relic images based on texture reconstruction and color correction. Background Technology

[0002] With the acceleration of the digitalization process of cultural relic protection, more and more images of cultural relics are being collected and stored in digital form for research, display and restoration. However, in the process of long-term preservation and historical evolution, the surface of cultural relics often suffers damage such as peeling, scratches and fading, resulting in a large number of damaged areas in digital images. These damages not only affect the overall integrity and visual effect of the images of cultural relics, but also limit their application value in academic research and cultural dissemination.

[0003] Existing methods for restoring cultural relics images mostly rely on simple interpolation or texture diffusion-based algorithms, which often fail to balance the continuity of texture direction and the consistency of color distribution, leading to problems such as texture misalignment or abrupt color changes in the restored area. Meanwhile, while some deep learning methods can achieve automatic restoration, they are heavily dependent on training samples and struggle to adapt to the complex damage characteristics of diverse cultural relics. Therefore, there is an urgent need to propose a virtual restoration method for cultural relics images based on texture reconstruction and color correction to address the inconsistencies in the damaged area at both the structural and color levels. Summary of the Invention

[0004] To achieve the above objectives, this invention provides a virtual restoration method for cultural relic images based on texture reconstruction and color correction.

[0005] A virtual restoration method for cultural relic images based on texture reconstruction and color correction includes the following steps:

[0006] S1: Acquire a digital image of the surface of the cultural relic to be restored, and perform noise reduction and brightness equalization on it to obtain a preprocessed image;

[0007] S2: Perform edge detection on the preprocessed image, identify and segment the damaged areas in the image, and generate a binary mask image that only identifies the damaged areas;

[0008] S3: Taking the edge pixels of the damaged area as the center, select the optimal sample block that best matches the structure of the area to be filled in the surrounding intact area; and calculate the main direction of the pixel gradient within the optimal sample block as the main texture direction;

[0009] S4: Based on the main texture direction, perform an adaptive affine transformation on the optimal sample block to adjust its texture direction and generate a reconstructed texture block that is consistent with the surrounding intact texture direction.

[0010] S5: Using the edge of the damaged area as the boundary, extract the color values ​​of pixels in the surrounding intact area, and statistically obtain standard color features; then perform a linear transformation on the color values ​​of the reconstructed texture block according to the standard color features to obtain the color-corrected repaired texture block;

[0011] S6: Seamlessly embed the color-corrected repair texture blocks into the damaged area to generate and output the final image of the restored cultural relic.

[0012] Optionally, S1 specifically includes:

[0013] S11: The surface of the cultural relic to be restored is captured from multiple angles using a high-resolution industrial camera to obtain RGB color image sequences, and the images are stitched and fused to generate a single digital image covering the entire surface.

[0014] S12: Perform median filtering and bilateral filtering on the digital image generated in S11. First, use a 3×3 median filter to remove salt-and-pepper noise, and then use a bilateral filter to suppress high-frequency interference and image texture artifacts to obtain a preliminary denoised image.

[0015] S13: Based on the brightness channel of the preliminary denoised image, the brightness distribution is stretched using the histogram equalization method to expand its dynamic range and improve the visibility of details in low-brightness areas, resulting in a brightness-equalized image. The brightness-equalized image is then used as the preprocessed image and output.

[0016] Optionally, S2 specifically includes:

[0017] S21: Apply the Canny edge detection algorithm to the preprocessed image output from S1 to extract pixel edges with significant changes in edge intensity and generate an initial edge image;

[0018] S22: Based on the initial edge image generated in S21, a contour tracking algorithm is used to extract closed or semi-closed edge regions, and the average gray level and boundary integrity of each candidate region are calculated.

[0019] S23: Analyze all candidate regions. If a region simultaneously meets the following conditions: its average grayscale is below a preset threshold... Boundary integrity is below the threshold If so, it will be identified as a damaged area;

[0020] S24: Map all damaged areas that satisfy condition S23 to pixels with a value of 1, and map other areas to pixels with a value of 0, generating a binary mask image that only identifies the damaged areas.

[0021] Optionally, S22 specifically includes:

[0022] S221: Perform row-by-row pixel scanning on the initial edge image generated in S21. When a non-zero edge pixel is detected, trigger the contour tracking process based on the eight-neighbor connectivity to trace and form a closed or semi-closed edge path. If the starting point and ending point of the path coincide, it is identified as a closed region. If the path is broken at only one end, it is identified as a semi-closed region. Finally, extract all candidate edge regions whose boundary length and area meet the preset minimum value.

[0023] S222: For each candidate region, extract all the pixel gray values ​​contained in it from the corresponding preprocessed image, and calculate the average gray value of the candidate region.

[0024] S223: Construct an equivalent circular boundary based on the actual boundary length and area of ​​the candidate region, and define the boundary integrity of the region.

[0025] Optionally, S3 specifically includes:

[0026] S31: In the binary mask image generated in S2, extract the edge pixels of all damaged areas, and construct a matrix of size [size missing] centered on each edge pixel. The candidate search window;

[0027] S32: For each intact sample block in the search window, perform a structural similarity evaluation with the corresponding block to be filled in the damaged area, and use the structural similarity index as the discrimination criterion to select the corresponding optimal sample block;

[0028] S33: Perform gradient analysis on the optimal sample block determined in S32, calculate the gradient value of each pixel in its grayscale image along the horizontal and vertical directions, and statistically analyze the gradient direction histogram within the entire block. Define the main texture direction as the direction angle with the highest frequency in the gradient direction histogram.

[0029] Optionally, S32 specifically includes:

[0030] S321: Within the candidate search window constructed in S31, sequentially extract all intact sample blocks of the same size as the region to be filled, denoted as... ;

[0031] S322: Record the current pixel block to be matched within the area to be filled as... and each sample block in the search window respectively. The formula for calculating structural similarity is:

[0032] ,in, Indicates the block to be filled With sample block Structural similarity score; Blocks and The average gray value; Blocks and The grayscale variance; For block and covariance; To avoid stability constants with a denominator of zero;

[0033] S323: Sort the structural similarity scores of all sample blocks obtained in S322, and select the sample block with the highest score as the optimal sample block corresponding to the current edge pixel.

[0034] Optionally, S4 specifically includes:

[0035] S41: Obtain the main texture direction angle of each optimal sample block in S3, and combine it with the texture direction of the surrounding area of ​​the target region to be filled. The reference value is used to calculate the texture direction deviation angle. The formula is: ;

[0036] S42: Constructing a two-dimensional affine transformation matrix Using the center of the optimal sample block as the rotation reference point, an angle of is applied to it. The rotation transformation is used to adjust the texture orientation of the optimal sample block so that it is consistent with the surrounding area;

[0037] S43: Apply an affine matrix to the optimal sample block Perform a rotation operation to generate a reconstructed texture block with the orientation adjusted.

[0038] Optionally, S5 specifically includes:

[0039] S51: Based on the mask image of the damaged area generated in S2, extract the edge pixel contour of each damaged area, and set a fixed-width annular neighboring area outside it as the color sampling range of the intact area.

[0040] S52: Within the sampling range determined in S51, extract the red channel value, green channel value, and blue channel value of each pixel from the preprocessed image, calculate the pixel mean and standard deviation of the three channels respectively, and construct a standard color feature set;

[0041] S53: Input the reconstructed texture block obtained in S4, perform linear transformation on the pixel values ​​in the three channels respectively, so that the channel mean and standard deviation are aligned with the standard color features obtained in S52, and obtain the color-corrected repaired texture block.

[0042] Optionally, S53 specifically includes:

[0043] S531: Using the reconstructed texture block obtained in S4 as input, extract the values ​​of the red, green, and blue channels for each pixel, and calculate the pixel mean and standard deviation for each channel, denoted as... and ;

[0044] S532: From the standard color feature set of S52, read the mean and standard deviation of the corresponding target channel, and record them as follows: and , as the target mapping parameter for the linear transformation;

[0045] S533: For each pixel value in the reconstructed texture block The following linear transformation is performed on each of the three channels to normalize the mean and standard deviation. The specific transformation formula is as follows:

[0046] ;

[0047] ;

[0048] ;in, These represent the transformed red, green, and blue channel pixel values, respectively. These are the red, green, and blue channel pixel values ​​in the original reconstructed texture block.

[0049] Optionally, S6 specifically includes:

[0050] S61: Based on the binary mask image generated in S2, locate the set of pixel coordinates for each damaged area and establish a pixel mapping relationship with the color-corrected repair texture block output in S5.

[0051] S62: The repair texture block directly replaces the pixel content of the corresponding damaged area, and a transition band is set in the edge area. The weighted average fusion method is used to smooth the repair block and the surrounding pixels to eliminate the visual difference at the boundary.

[0052] S63: After embedding all damaged areas, output the image of the restored cultural relic as the final image result.

[0053] The beneficial effects of this invention are:

[0054] This invention achieves directional consistency between the repaired texture and the surrounding area by calculating the texture direction and performing affine transformation based on the optimal sample block after identifying the damaged area, thus ensuring the continuity of the local structure and the coordination of the overall image. At the same time, by extracting the color statistical features of the neighboring area and performing a linear transformation on the repaired texture block, its color distribution is made consistent with the surrounding area, thereby avoiding the problem of abrupt color changes in the repaired area.

[0055] This invention, through seamless embedding processing, allows the repaired texture blocks, after orientation adjustment and color correction, to smoothly transition into the damaged area, generating a final repaired image with coordinated structure and color; it solves the problems of texture misalignment and color inconsistency existing in the prior art. Attached Figure Description

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

[0057] Figure 1 This is a schematic diagram of the virtual restoration method for cultural relic images according to an embodiment of the present invention;

[0058] Figure 2 This is a schematic diagram of the process of obtaining color-corrected and repaired texture blocks according to an embodiment of the present invention. Detailed Implementation

[0059] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. It should also be noted that, to make the embodiments more comprehensive, the following embodiments are the best and preferred embodiments, and those skilled in the art can use other alternative methods to implement some well-known technologies; moreover, the accompanying drawings are only for more specific description of the embodiments and are not intended to specifically limit the present invention.

[0060] It should be noted that the use of terms such as "an embodiment," "an embodiment," "an exemplary embodiment," and "some embodiments" in the specification indicates that the described embodiment may include a specific feature, structure, or characteristic, but not every embodiment necessarily includes that specific feature, structure, or characteristic. Furthermore, when a specific feature, structure, or characteristic is described in connection with an embodiment, implementing such a feature, structure, or characteristic in conjunction with other embodiments (whether explicitly described or not) should be within the knowledge of those skilled in the art.

[0061] Generally, terms can be understood at least partly from their use in context. For example, depending at least partly on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in a singular sense, or a combination of features, structures, or characteristics in a plural sense. Additionally, the term "based on" can be understood not necessarily to convey an exclusive set of factors, but rather, alternatively, depending at least partly on the context, to allow for the presence of other factors that are not necessarily explicitly described.

[0062] like Figures 1-2As shown, the virtual restoration method for cultural relic images based on texture reconstruction and color correction includes the following steps:

[0063] S1: Acquire a digital image of the surface of the cultural relic to be restored, and perform noise reduction and brightness equalization on it to obtain a preprocessed image;

[0064] S1 specifically includes:

[0065] S11: The surface of the cultural relic to be restored is captured from multiple angles using a high-resolution industrial camera to obtain RGB color image sequences, and the images are stitched and fused to generate a single digital image covering the entire surface.

[0066] S12: Perform median filtering and bilateral filtering on the digital image generated in S11. First, use a 3×3 median filter to remove salt-and-pepper noise, and then use a bilateral filter to suppress high-frequency interference and image texture artifacts to obtain a preliminary denoised image.

[0067] S13: Based on the brightness channel of the initially denoised image, a histogram equalization method is used to stretch the brightness distribution to expand its dynamic range and improve the visibility of details in low-brightness areas, resulting in a brightness-equalized image. This brightness-equalized image is then used as a preprocessed image for subsequent damaged area identification and texture restoration operations. Through the above steps, it is ensured that the acquired image has high resolution and high fidelity, while also taking into account noise suppression and brightness uniformity, providing a clear, stable, and information-complete input foundation for subsequent damaged area identification and texture matching.

[0068] S2: Perform edge detection on the preprocessed image, identify and segment the damaged areas in the image, and generate a binary mask image that only identifies the damaged areas;

[0069] S2 specifically includes:

[0070] S21: Apply the Canny edge detection algorithm to the preprocessed image output from S1 to extract pixel edges with significant changes in edge intensity, generating an initial edge image; specifically, first calculate the grayscale gradient magnitude of the image, and set a low threshold. High threshold is Then, during edge extraction, all gradient magnitudes greater than 1 are retained. Strong edge pixels, while including all pixels between and Weak edge pixels are retained only when they are connected to strong edges;

[0071] S22: Based on the initial edge image generated in S21, a contour tracking algorithm is used to extract closed or semi-closed edge regions, and the average gray level and boundary integrity of each candidate region are calculated.

[0072] S23: Analyze all candidate regions. If a region simultaneously meets the following conditions: its average grayscale is below a preset threshold... Boundary integrity is below the threshold If so, it will be identified as a damaged area;

[0073] S24: Map all damaged areas that meet the conditions of S23 to pixels with a value of 1, and other areas to pixels with a value of 0, generating a binary mask image that only identifies the damaged areas, and using it as input for subsequent steps; The above steps, by combining edge intensity detection and shape feature screening, can accurately extract image regions with typical damage features under complex background conditions, and generate binary mask images with clear structure and accurate positioning, providing a stable and high-confidence input basis for the subsequent texture reconstruction process.

[0074] S22 specifically includes:

[0075] S221: Perform row-by-row pixel scanning on the initial edge image generated in S21. When a non-zero edge pixel is detected, trigger the contour tracking process based on the eight-neighbor connectivity to trace and form a closed or semi-closed edge path. If the starting point and ending point of the path coincide, it is identified as a closed region. If the path is broken at only one end, it is identified as a semi-closed region. Finally, extract all candidate edge regions whose boundary length and area meet the preset minimum value.

[0076] S222: For each candidate region, extract the grayscale values ​​of all pixels contained in it from the corresponding preprocessed image, and calculate the average grayscale value of the candidate region to describe the brightness characteristics of the region. The formula is as follows:

[0077] ,in, This represents the average gray value of the candidate region. This represents the total number of pixels within the candidate region. Indicates the first grayscale value of each pixel;

[0078] S223: Measure the closure of the candidate region boundary. Construct an equivalent circular boundary based on the actual boundary length and area of ​​the candidate region, and define the boundary integrity of the region to evaluate the continuity and closure of the boundary. The calculation formula is as follows: ,in, Indicates boundary integrity. This represents the actual boundary length of the candidate region. Represents the pixel area of ​​the candidate region; denominator The area is represented as The theoretical minimum boundary length of a perfectly closed circular region; the actual length when the candidate region boundary is close to a circle. Approaching ,at this time This indicates a closed and complete boundary; when the region has boundary breaks, gaps, or extreme irregularities, the actual length... It will be significantly greater than the theoretical value, at this time This indicates that the boundary is incomplete or has an abnormal shape; therefore, boundary integrity... The closer the value is to 1, the more likely the region is a true closed structure; the larger the value is, the more likely there are gaps or false contours. This formula quantitatively measures whether the region boundary is completely closed by comparing the ratio of the actual boundary length to the ideal circular boundary length, thereby filtering out true structurally closed regions in the image.

[0079] S3: Taking the edge pixels of the damaged area as the center, select the optimal sample block that best matches the structure of the area to be filled in the surrounding intact area; and calculate the main direction of the pixel gradient within the optimal sample block as the main texture direction;

[0080] S3 specifically includes:

[0081] S31: In the binary mask image generated in S2, extract the edge pixels of all damaged areas, and construct a matrix of size [size missing] centered on each edge pixel. The candidate search window is limited to its adjacent intact area, ensuring that the search range only includes image areas that have not been damaged or marked.

[0082] S32: For each intact sample block in the search window, perform structural similarity evaluation with the corresponding block to be filled in the damaged area, and use the structural similarity index (SSIM) as the discrimination criterion to select the corresponding optimal sample block;

[0083] S33: Perform gradient analysis on the optimal sample block determined in S32, calculate the gradient value of each pixel in its grayscale image along the horizontal direction (x-axis) and the vertical direction (y-axis), and statistically analyze the gradient direction histogram within the entire block. Define the main texture direction as the direction angle with the highest frequency in the gradient direction histogram, and its expression is as follows: ,in, This indicates the main texture direction of the optimal sample block. This indicates the preset gradient direction angle of the bucket center. Indicates the direction angle is The gradient direction histogram frequency; the above steps, through the optimal sample matching strategy based on structural similarity, can ensure that the reconstructed texture block is highly consistent with the original region in terms of spatial structure; at the same time, the main texture direction is obtained based on gradient direction statistics, which provides an accurate directional basis for subsequent affine transformation of texture, thereby improving the naturalness of the transition between the repaired area and the surrounding environment and the consistency of texture.

[0084] S32 specifically includes:

[0085] S321: Within the candidate search window constructed in S31, sequentially extract all intact sample blocks of the same size as the region to be filled, denoted as... Each sample block comes from an image region not covered by the broken mask mark, ensuring its texture continuity and information integrity;

[0086] S322: Record the current pixel block to be matched within the area to be filled as... and each sample block in the search window respectively. Structural similarity is calculated using the Structural Similarity Index (SSIM) as the scoring criterion. The calculation formula is as follows:

[0087] ,in, Indicates the block to be filled With sample block Structural similarity score; Blocks and The average gray value; Blocks and The grayscale variance; For block and covariance; To avoid stability constants with a denominator of zero;

[0088] S323: Sort the structural similarity scores of all sample blocks obtained in S322, and select the sample block with the highest score as the optimal sample block corresponding to the current edge pixel for subsequent texture direction calculation and reconstruction. The above steps introduce structural similarity index to uniformly model and quantitatively evaluate the brightness, contrast and structural information of image blocks. Under the premise of the best local structure matching, the optimal texture sample can be automatically selected to ensure that the repaired area maintains a high degree of consistency with the surrounding image at the visual structure level.

[0089] S4: Based on the main texture direction, perform an adaptive affine transformation on the optimal sample block to adjust its texture direction and generate a reconstructed texture block that is consistent with the surrounding intact texture direction.

[0090] S4 specifically includes:

[0091] S41: Obtain the main texture direction angle of each optimal sample block in S3, and combine it with the texture direction of the surrounding area of ​​the target region to be filled. The reference value is used to calculate the texture direction deviation angle. The formula is: ;

[0092] S42: Constructing a two-dimensional affine transformation matrix Using the center of the optimal sample block as the rotation reference point, an angle of is applied to it. The rotational transformation is used to adjust the texture orientation of the optimal sample block to match the surrounding area. The expression for the two-dimensional affine transformation matrix is: ,in: It is the affine transformation matrix; Adjust the angle to the desired texture direction; For the parameter factors of the rotation transformation;

[0093] S43: Apply an affine matrix to the optimal sample block A rotation operation is performed to generate a reconstructed texture block with adjusted orientation. The above steps, by aligning the main texture direction with the target texture direction and performing an affine rotation transformation, can achieve consistent restoration of the local structure in the texture direction dimension.

[0094] S5: Using the edge of the damaged area as the boundary, extract the color values ​​of pixels in the surrounding intact area, and statistically obtain standard color features; then perform a linear transformation on the color values ​​of the reconstructed texture block according to the standard color features to obtain the color-corrected repaired texture block;

[0095] S5 specifically includes:

[0096] S51: Based on the mask image of the damaged area generated in S2, extract the edge pixel contour of each damaged area, and set a fixed-width annular neighboring area outside it as the color sampling range of the intact area. The sampling range should exclude all pixel areas marked as damaged.

[0097] S52: Within the sampling range determined in S51, extract the red channel value, green channel value, and blue channel value of each pixel from the preprocessed image, calculate the pixel mean and standard deviation of the three channels respectively, and construct a standard color feature set as the target distribution for subsequent color correction.

[0098] S53: Input the reconstructed texture block obtained in S4, and perform linear transformation on the pixel values ​​in the three channels respectively, so that the channel mean and standard deviation are aligned with the standard color features obtained in S52. This achieves the normalization adjustment of the overall color distribution in terms of brightness and contrast, resulting in a color-corrected repaired texture block. The above steps, by using the intact area adjacent to the damaged area as a reference, construct standard color features and perform channel normalization adjustment on the reconstructed texture block. This can achieve the consistency of color distribution between the repaired area and the surrounding environment without introducing human bias, effectively improving the color naturalness and visual integration of the image restoration result.

[0099] S53 specifically includes:

[0100] S531: Using the reconstructed texture block obtained in S4 as input, extract the values ​​of the red, green, and blue channels for each pixel, and calculate the pixel mean and standard deviation for each channel, denoted as... and ;

[0101] S532: From the standard color feature set of S52, read the mean and standard deviation of the corresponding target channel, and record them as follows: and , as the target mapping parameter for the linear transformation;

[0102] S533: For each pixel value in the reconstructed texture block The following linear transformation is performed on each of the three channels to normalize the mean and standard deviation. The specific transformation formula is as follows:

[0103] ;

[0104] ;

[0105] ;in, These represent the transformed red, green, and blue channel pixel values, respectively. The above steps involve performing linear transformation operations on the RGB three channels to align the mean and standard deviation, which can accurately match and adjust the texture color in terms of brightness and contrast. This ensures that the color distribution of the repaired area is consistent with the surrounding image area in terms of statistical characteristics, thereby improving the color fusion and visual coherence of the overall image repair.

[0106] S6: Seamlessly embed the color-corrected repair texture blocks into the damaged area to generate and output the final image of the restored cultural relic;

[0107] S6 specifically includes:

[0108] S61: Based on the binary mask image generated in S2, locate the set of pixel coordinates for each damaged area and establish a pixel mapping relationship with the color-corrected repair texture block output in S5 to ensure spatial alignment;

[0109] S62: The repair texture block directly replaces the pixel content of the corresponding damaged area, and a transition band is set in the edge area. The weighted average fusion method is used to smooth the repair block and the surrounding pixels to eliminate the visual difference at the boundary.

[0110] S63: After embedding all damaged areas, output the restored cultural relic image as the final image result; the above steps, by aligning the position and blending the edges of the restored texture blocks, can achieve seamless connection between the restored area and the original image, significantly improving the structural continuity and overall naturalness of the restored image.

[0111] This invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of this invention. To provide the public with a thorough understanding of this invention, specific details are described in detail in the following preferred embodiments; however, those skilled in the art will fully understand the invention even without these details. Furthermore, to avoid unnecessary misunderstanding of the essence of this invention, well-known methods, processes, procedures, components, and circuits are not described in detail.

[0112] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A virtual restoration method of cultural relic images based on texture reconstruction and color correction, characterized in that, The method comprises the following steps: S1: obtaining a digital image of a surface of an artifact to be repaired, and performing denoising and brightness equalization processing on the digital image to obtain a preprocessed image; S2: performing edge detection on the preprocessed image, identifying and segmenting a damaged area in the image, and generating a binary mask image that only identifies the damaged area; S3: taking the edge pixels of the damaged area as the center, selecting an optimal sample block that is most matched with the structure of the to-be-filled area in the surrounding intact area, and calculating the main direction of the pixel gradient in the optimal sample block as the main texture direction; S4: performing adaptive affine transformation on the optimal sample block according to the main texture direction, adjusting the texture direction of the optimal sample block, and generating a reconstructed texture block that is consistent with the texture direction of the surrounding intact area; S5: extracting the color values of the pixels in the surrounding intact area of the damaged area, performing statistical processing to obtain standard color features, and performing linear transformation on the color values of the reconstructed texture block according to the standard color features to obtain a repaired texture block with color correction; S6: seamlessly embedding the repaired texture block with color correction into the damaged area, and generating and outputting a final repaired artifact image.

2. The method of claim 1, wherein the method further comprises: The S1 specifically comprises: S11: acquiring a sequence of RGB color images by multi-angle acquisition of the surface of the artifact to be repaired through a high-resolution industrial camera, and generating a single digital image covering the complete surface by image stitching and fusion; S12: performing joint processing of median filtering and bilateral filtering on the digital image generated in S11, first removing salt and pepper noise using a 3*3 median filter, and then suppressing high-frequency interference and image texture artifacts using a bilateral filter to obtain a preliminary denoised image; S13: based on the brightness channel of the preliminary denoised image, performing stretching processing on the brightness distribution by using a histogram equalization method to expand the dynamic range and improve the visibility of the details in the low brightness area, obtaining a brightness equalized image, and outputting the brightness equalized image as the preprocessed image.

3. The method of claim 1, wherein the method further comprises: The S2 specifically comprises: S21: applying a Canny edge detection algorithm to the preprocessed image output in S1 to extract the pixel edges with significant changes in edge intensity in the image, and generating an initial edge image; S22: based on the initial edge image generated in S21, extracting a closed or semi-closed edge region by using a contour tracking algorithm, and calculating the average gray value and boundary integrity of each candidate region; S23: judging all candidate regions, if a region meets the following conditions simultaneously: average gray level is lower than a preset threshold , and boundary integrity is lower than a threshold , it is identified as a damaged region; S24: mapping all damaged areas that meet the conditions of S23 to pixels with a value of 1, and mapping other areas to pixels with a value of 0, to generate a binary mask image that only identifies the damaged areas.

4. The method of claim 3, wherein the method further comprises: The S22 specifically comprises: S221: performing line-by-line pixel scanning on the initial edge image generated in S21, and when a non-zero edge pixel is detected, triggering a contour tracking process based on eight-neighbor connectivity to track a closed or semi-closed edge path; if the starting point and the ending point of the path coincide, it is identified as a closed region, and if only one end of the path is broken, it is identified as a semi-closed region, and finally all candidate edge regions with boundary length and area meeting the preset minimum values are extracted; S222: for each candidate region, extracting all pixel gray values contained in the candidate region from the corresponding preprocessed image, and calculating the average gray value of the candidate region; S223: Constructing an equivalent circular boundary based on the actual boundary length and area of the candidate region, and defining the boundary integrity of the region.

5. The method of claim 1, wherein the method further comprises: The S3 specifically comprises: S31: In the binary mask image generated in S2, all edge pixels of the damaged area are extracted, and a candidate search window with a size of is constructed with each edge pixel as the center. S32: Performing structural similarity evaluation on the intact sample block in each search window and the to-be-filled block in the corresponding damaged region, using a structural similarity index as a discrimination criterion to select the optimal sample block; S33: Performing gradient analysis on the optimal sample block determined in S32, calculating the gradient values of each pixel point in the gray image along the horizontal and vertical directions, and counting the gradient direction histogram in the entire block, and defining the main texture direction as the direction angle with the largest frequency in the gradient direction histogram.

6. The method of claim 5, wherein the method further comprises: The S32 specifically comprises: S321: In the candidate search window constructed in S31, all intact sample blocks of the same size as the region to be filled are extracted in turn, denoted as ; S322: record the current pixel block to be matched in the region to be filled as and respectively perform structure similarity calculation with each sample block in the search window, the formula is: and respectively perform structure similarity calculation with each sample block in the search window, the formula is: wherein, denotes the block to be filled the structure similarity score of the sample block ; the average gray value of the block and ; the gray variance of the block and ; the covariance of the block and ; is a stabilizing constant to avoid a zero denominator; S323: Sorting the structural similarity scores of all sample blocks obtained in S322, and selecting the sample block with the highest score as the optimal sample block corresponding to the current edge pixel.

7. The method of claim 1, wherein the method further comprises: The S4 specifically comprises: S41: Obtain the main texture direction angle of each optimal sample block in S3, and combine the texture direction around the target region to be filled of each optimal sample block to calculate the texture direction deviation angle , the formula is: ; S42: Constructing a two-dimensional affine transformation matrix A rotation transformation with an angle of is performed on the optimal sample block center as the rotation reference point to adjust the texture direction of the optimal sample block to be consistent with the surrounding area. S43: apply affine matrix to optimal sample block perform a rotation operation to generate a direction-adjusted reconstructed texture block. 8.The method of claim 1, wherein, The S5 specifically comprises: S51: Based on the damaged region mask image generated in S2, extracting the edge pixel contour of each damaged region, and setting a fixed-width annular adjacent region outside it as the color sampling range of the intact region; S52: In the sampling range determined in S51, extracting the red channel value, green channel value and blue channel value of each pixel from the preprocessed image, calculating the pixel mean and standard deviation of the three channels respectively, and constructing a standard color feature set; S53: Inputting the reconstructed texture block obtained in S4, performing linear transformation on the pixel values in the three channels respectively, aligning the channel mean and standard deviation to the standard color features obtained in S52, and obtaining the repaired texture block after color correction.

9. The method of claim 8, wherein the method further comprises: The S53 specifically comprises: S531: taking the reconstructed texture block obtained in S4 as input, extracting the values of the red, green and blue three channels of its pixels one by one, respectively calculating the pixel mean and standard deviation of each channel, denoted as and ; S532: read the corresponding target channel mean and standard deviation from the standard color feature set of S52, respectively denoted as and , as the target mapping parameters of linear transformation; S533: for each pixel value in the reconstructed texture block The following linear transformation is performed on each of the three channels to achieve the normalization adjustment of the mean and standard deviation, and the specific transformation formula is: ; ; ; wherein, represent the transformed red, green, and blue channel pixel values, respectively; are the red, green, and blue channel pixel values in the original reconstructed texture block.

10. The method of claim 1, wherein the method further comprises: The S6 specifically comprises: S61: According to the binary mask image generated in S2, locating the pixel coordinate set of each damaged region, and establishing a pixel mapping relationship with the color-corrected repaired texture block output in S5; S62: Replacing the pixel content of the corresponding damaged region with the repaired texture block, and setting a transition zone in the edge region, using a weighted average fusion method to smooth the repaired block and the surrounding pixels, and eliminating the boundary visual difference; S63: After embedding all damaged regions, outputting the repaired cultural relic image as the final image result.

Citation Information

Patent Citations

  • Sample based image repairing method

    CN102999887A

  • An image restoration method for cultural archives based on self-color transfer

    CN109102478A

  • Special texture background remote sensing image matching method

    CN112784761A

Cited By

  • Intelligent historical relic image texture enhancement method and system

    CN121921232A

  • Intelligent historical cultural relic image texture enhancement method and system

    CN121921232B