A medical image self-recovery method based on an image inpainting algorithm
By employing an image inpainting algorithm-based approach, this method embeds watermark values using the Hessian matrix and LSB algorithm, and combines differential pulse coding with image inpainting algorithms to solve the problems of watermark destruction and neglect of similar information in medical image tampering detection and self-recovery, achieving efficient and accurate restoration of tampered areas.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2023-03-16
- Publication Date
- 2026-05-12
AI Technical Summary
In existing methods for tamper detection and self-recovery in the field of medical images, embedding watermark information may damage the original image quality, ignore similar information in medical images, and the recovery of tampered areas is not accurate enough.
A method based on image inpainting algorithms is adopted, which uses the Hessian matrix to extract feature information, embeds watermark values through the LSB algorithm, and combines differential pulse coding and image inpainting algorithms to detect tampered areas and restore the tampered areas by using similarity information in the attacked image itself.
It achieves efficient detection and recovery of tampered areas without destroying the original image quality. Especially for cut and copy-paste attacks, the recovered image quality is high, with a PSNR of 35dB, reducing the adverse effects of image tampering.
Smart Images

Figure CN116416112B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the technical fields of digital image processing, computer vision, and signal processing, specifically a medical image self-recovery method based on image inpainting algorithms. Background Technology
[0002] The statements in this section are merely background information relating to this disclosure, and these statements may constitute prior art. In the process of developing this invention, the inventors discovered at least the following problems in the prior art.
[0003] In recent years, image processing technology has developed rapidly, leading to a proliferation of complex image editing software. This software allows people to arbitrarily modify and distribute digital multimedia content according to their own ideas. Therefore, while information technology brings convenience to people's work and lives, it also creates security risks. Attackers use powerful multimedia editing tools to maliciously tamper with and forge digital multimedia information, making it impossible for the naked eye to distinguish between genuine and fake content, resulting in a continuous increase in copyright infringement and malicious tampering incidents. Digital images, as an important carrier of multimedia information, are widely used in information transmission. How to use digital watermarking technology to prevent information leakage and protect the security of multimedia information has become a hot topic.
[0004] Digital watermarking has been widely used in various digital multimedia applications, including text, images, videos, and music. The main idea behind digital watermarking is to embed secret information as a watermark into the multimedia information itself, creating a protective carrier based on the redundancy of the carrier. This embedded secret information is invisible and cannot be perceived by the human eye or auditory system alone. The authenticity and integrity of the digital multimedia are then detected by extracting information from the protected carrier. Digital watermarks are mainly divided into two categories based on their application: the first category, represented by robust watermarks, is primarily used for copyright protection, such as author and publisher information. The second category, represented by fragile watermarks, is mainly used to determine whether content has been tampered with. Initially, fragile watermarking technology only embedded authentication watermarks in the original image to detect the authenticity of the content. Authentication watermarks are usually generated from the hash value of the original image and are used to detect tampered areas, but cannot recover the tampered areas.
[0005] To simultaneously detect and recover tampered regions, most existing fragile watermarking methods employ a dual watermarking mechanism (authentication watermark and reference watermark) to embed watermark information into the original image to generate a protected image. If the protected image is compromised, the reference watermark can be extracted to recover the tampered image. The reference watermark is typically generated using methods such as low-frequency coefficients of each block in the DCT, low-frequency coefficients of the wavelet transform, and a halftone version of the original image. It represents the main content of the original image and is used to recover the tampered region. A common method for recovery is a self-embedding watermarking algorithm, such as embedding a highly compressed version of the image into the image itself or including basic information from the original image in the recovery data. This type of technique, which can both locate and recover tampered regions, has attracted widespread attention from researchers.
[0006] Existing tampering detection and self-recovery methods embed watermark information into the original image, which can not only detect the tampered area, but also recover the tampered area by using information hidden in other areas of the image itself. However, there are still some shortcomings in the field of medical images: (1) Since medical images are sensitive images, embedding a large amount of watermark information may destroy the subjective effect of the original image; (2) When the tampered area is detected, the reference watermark extracted from the attack image is used to fill the tampered area to approximate the recovery of the tampered area, while ignoring the similar information of the attack image itself; (3) Medical images are different from other images. They contain a lot of similar information, but existing methods ignore the similar information of medical images themselves and do not make use of it. Summary of the Invention
[0007] In view of the above problems, the purpose of this invention is to solve some of the problems in the prior art, or at least alleviate these problems.
[0008] A self-recovery method for medical images based on image inpainting algorithms, comprising:
[0009] Use medical images as the original images to generate watermark values;
[0010] Extracting feature information from the original image using the Hessian matrix;
[0011] The generated watermark value is embedded into the original image using the LSB algorithm to generate a watermarked image.
[0012] When a watermarked image with embedded watermark is attacked, a reference watermark is extracted from the attacked image, and the extracted watermark value is used to detect the tampered area.
[0013] After detecting the tampered area, the tampered area is restored using image restoration algorithms that leverage similar information from the attacking image itself.
[0014] Furthermore, the method for quantizing and encoding the coefficients of the LL3 subband is differential pulse coding.
[0015] Furthermore, the generated watermark value is embedded into the original image using the LSB algorithm, including embedding the generated watermark value into the low-bit plane of the pixels of the original image.
[0016] Furthermore, the generated watermark value is embedded into the original image using the LSB algorithm, including the following steps:
[0017] For the first watermark value, assume the pixel value after embedding the watermark is equal to the original pixel value.
[0018] I w (m(i),n(i))=I(m(i),n(i)),i=1
[0019] If the sequence of embedded watermarks is greater than 1 and the currently embedded watermark value is a positive integer, the embedding formula is as follows:
[0020] I w (m(i),n(i))=I(m(i),n(i))-mod(I(m(i),n(i)),2 3 )+w i ,if w i >0
[0021] After embedding the watermark value, the marker bit of the pixel is set to 1, as follows:
[0022] I w (m(i),n(i))=bitset(I w (m(i),n(i)),2,1)
[0023] If the currently embedded watermark value is a negative integer, take its absolute value and embed the watermark value using the LSB algorithm. The embedding formula is as follows:
[0024] I w (m(i),n(i))=I(m(i),n(i))-mod(I(m(i),n(i)),2 3 )+absb(w i ), if w i <0
[0025] I w (m(i),n(i))=bitset(I w (m(i),n(i)),2,0)
[0026] Where i represents the i-th watermark value, m,n represent the m-th row and n-th column of the original image, and I wRepresents the pixel value after embedding the watermark; I refers to the original image, w i This refers to the i-th watermark value;
[0027] Iterate through the watermark values W = [w1, w2, ..., w n This process continues until all pixel values are embedded in the original image to obtain the watermarked image.
[0028] Furthermore, the tampered area is detected using the extracted reference watermark value, including the following steps:
[0029] Extract watermark values from the attacked image;
[0030] An approximate compressed version C' of the original image is obtained using the differential pulse coding watermark value;
[0031] By comparing the difference between the attacked image and the obtained C', the approximate tampered region D1 is obtained;
[0032] D1=TC'
[0033] The obtained tampered region D1 is thresholded and morphologically processed to obtain the final effective tampered range D.
[0034] D2 = threshold(D1)
[0035] D = morphology(D2)
[0036] Where T refers to the attacked image; D2 refers to the tampered area detected after thresholding.
[0037] Furthermore, image restoration algorithms are used to recover the tampered area by utilizing similar information from the attacking image itself. This includes finding similar information about the tampered area in the attacking image itself using image restoration algorithms; copying similar information from the attacking image itself and pasting it into the tampered area to recover the tampered area.
[0038] Furthermore, image inpainting algorithms are used to recover the tampered area by leveraging similarity information within the attacked image itself, including the following steps:
[0039] Traverse the detected tampered areas; if a pixel is detected to have been tampered with, determine a tampered block centered on the currently tampered pixel.
[0040] Ω2=T-Ω1
[0041] Where T is the image that has been attacked after the watermark is embedded; Ω1 is the detected tampered area; and Ω2 is the known part (the part that has not been attacked).
[0042] The best matching block is found in the known region Ω2 of the extracted watermark image. The found matching block S is as follows:
[0043] S = {S1, S2, ..., S} m}
[0044] Where m belongs to the known region Ω2, and its value range is related to the size of the attack region;
[0045] Find the best matching block for the tampered block among all matching blocks. The formula is as follows:
[0046]
[0047] Among them, P x It is a tampering block centered on the tampered pixel x, where p is the currently matched pixel, and S p It is the matching block centered on the matching pixel p in the known region from which the watermark is extracted; the Euclidean distance is used to measure the matching block S. p With tampered block P x The degree of similarity;
[0048] The process of mapping the spatial locations of similar blocks to known regions of the attack image is as follows:
[0049]
[0050] in, To attack the similarity information of known regions in the image;
[0051] Image restoration algorithms are used to obtain similar blocks to the tampered area. The information of the similar blocks is copied and pasted into the tampered area to obtain the restored image.
[0052] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the medical image self-recovery method based on the image restoration algorithm.
[0053] The present invention has the following beneficial effects:
[0054] (1) Testing using the MATLAB platform is inexpensive;
[0055] (2) is a method for restoring tampered areas based on image restoration algorithms. It makes full use of the characteristic that medical images have a lot of similar information. It only relies on the similar information of the attacking image itself to restore the tampered areas, which is simple and effective.
[0056] (3) The present invention embeds a small amount of watermark information into the outline, edge and other areas of the original image, which can protect the content of the original image.
[0057] (4) This invention can achieve tampering and location against attacks such as cut and copy-paste;
[0058] (5) High accuracy, with a PSNR of up to 35dB for the recovered image after being tampered with, against small-scale cut and copy-paste attacks;
[0059] (6) It can assist in related image forensics or image security work, thereby reducing the adverse effects of image tampering on individuals and society. It has practical significance and has achieved good results. Attached Figure Description
[0060] Figure 1 This is a system flowchart of the present invention;
[0061] Figure 2 This is an image showing the effect of embedding a watermark behind the original image.
[0062] Figure 3 This is a flowchart of the location tampering and self-recovery process;
[0063] Figure 4 This is a diagram of the self-recovery process based on an image inpainting model. Detailed Implementation
[0064] The present invention will be further described below with reference to the accompanying drawings. The embodiments of the present invention are only used to illustrate the present invention and not to limit the present invention. Various substitutions and modifications made based on ordinary technical knowledge and conventional means in the art without departing from the technical concept of the present invention should be included within the scope of the present invention.
[0065] like Figure 1 As shown, a medical image self-recovery method based on image inpainting algorithms includes:
[0066] Use medical images as the original images to generate watermark values;
[0067] Extracting feature information from the original image using the Hessian matrix;
[0068] The generated watermark value is embedded into the original image using the LSB algorithm to generate a watermarked image.
[0069] When a watermarked image with embedded watermark is attacked, a reference watermark is extracted from the attacked image, and the extracted watermark value is used to detect the tampered area.
[0070] After detecting the tampered area, the tampered area is restored using image restoration algorithms that leverage similar information from the attacking image itself.
[0071] The Hessian matrix is a real symmetric matrix composed of the second-order partial derivatives of a multivariate function, where the eigenvalues of the Hessian matrix formed by the second-order partial derivatives represent the features of the image itself. The LSB algorithm refers to the Least Significant Bit watermarking embedding algorithm.
[0072] This invention utilizes digital image processing, computer vision, and signal processing technologies to protect the content information of medical images and to recover tampered areas using the similarity information within the attacked image itself. This invention is a method for recovering tampered areas based on image inpainting algorithms. It fully leverages the characteristic of medical images containing a great deal of similarity information; by recovering the tampered area based on this inherent similarity information, the original image information can be approximately restored. Therefore, recovering tampered areas solely by relying on the similarity information within the attacked image itself is simple and effective.
[0073] The process of generating watermark values from medical images as the original images includes: performing DWT on the original image and selecting the low-frequency subband LL3 as an approximate compressed version of the original image; quantizing and encoding the coefficients of the LL3 subband and generating watermark values.
[0074] DWT is a classic transform in advanced mathematics. Compression algorithms can be used to efficiently compress and store the coefficients after DWT transformation. DWT has significant advantages in representing image details and image compression. Its advantages in image compression are mainly manifested in the following aspects: approximately 90% of the energy in the image is concentrated in the low-frequency subband (LL); the energy of small areas such as edges and contours is distributed in the high-frequency subband. The principle of DWT compression is to decompose the original image into subbands of different frequencies, and then apply different encoding algorithms to the different frequency subbands, thus achieving compression of the original image.
[0075] The original image is processed by DWT to generate four non-overlapping subbands. The low-frequency subband LL3 is chosen because the high-frequency subbands concentrate some of the energy at the edges and contours of the image, while the low-frequency subband LL concentrates most of the image's energy. The human eye is not sensitive to high-frequency distortion, especially diagonal high-frequency distortion, but is most sensitive to information from the low-frequency subbands. Therefore, this invention selects the LL3 subband as an approximate compressed version of the original image.
[0076] Since the coefficients of the LL3 subband are discretely distributed, the method for quantizing and encoding the coefficients of the LL3 subband is Differential Pulse Code (DPCM). DPCM utilizes the correlation between adjacent samples, using the value of the previous sample as the predicted estimate of the current sample, and quantizing and encoding the difference between the two. The DPCM encoding / decoding algorithm is simple and easy to implement. The compression ratio of DPCM is related to the predictor performance; the smaller the prediction error of the predictor, the higher the compression ratio. Using the DPCM encoding method can effectively reduce data redundancy and achieve the purpose of data compression.
[0077] The LSB algorithm is used to embed the generated watermark value into the original image. This includes embedding the generated watermark value into the low-order plane of the pixels in the original image. The low-order plane includes the contours and edges of the original image. These regions can be extracted using the Hessian matrix, and then the LSB algorithm is used to embed the generated watermark value into these regions, generating a watermarked image. By combining this with Differential Pulse Codec (DPCM) and Low Frequency Subband (LL3), a small amount of watermark information can be embedded into the contours and edges of the original image. This avoids the large amount of watermark information embedded in sensitive images like medical images from damaging the subjective effect of the image, thus protecting the content of medical images. Figure 2 As shown, the medical image is not affected after the watermark is embedded.
[0078] The generated watermark value is embedded into the original image using the LSB algorithm, including the following steps:
[0079] For the first watermark value, assume the pixel value after embedding the watermark is equal to the original pixel value.
[0080] I w (m(i),n(i))=I(m(i),n(i)),i=1
[0081] If the sequence of embedded watermarks is greater than 1 and the currently embedded watermark value is a positive integer, the embedding formula is as follows:
[0082] I w (m(i),n(i))=I(m(i),n(i))-mod(I(m(i),n(i)),2 3 )+w i ,ifw i >0
[0083] After embedding the watermark value, the marker bit of the pixel is set to 1, as follows:
[0084] I w (m(i),n(i))=bitset(I w (m(i),n(i)),2,1)
[0085] If the currently embedded watermark value is a negative integer, take its absolute value and embed the watermark value using the LSB algorithm. The embedding formula is as follows:
[0086] I w (m(i),n(i))=I(m(i),n(i))-mod(I(m(i),n(i)),2 3 )+absb(w i ), if w i <0
[0087] I w (m(i),n(i))=bitset(I w (m(i),n(i)),2,0)
[0088] Where i represents the index of the i-th watermark value, m,n represents the m-th row and n-th column of the original image, I w Represents the pixel value after embedding the watermark; I refers to the original image, w i This refers to the i-th watermark value;
[0089] Iterate through the watermark values W = [w1, w2, ..., w n This process continues until all pixel values are embedded in the original image to obtain the watermarked image.
[0090] like Figure 3 As shown, the process of detecting tampered areas using the extracted watermark value includes the following steps:
[0091] Extract watermark values from the attacked image;
[0092] An approximate compressed version C' of the original image is obtained using the differential pulse coding watermark value;
[0093] By comparing the difference between the attacked image and the obtained C', the approximate tampered region D1 is obtained;
[0094] D1=TC'
[0095] The obtained tampered region D1 is thresholded and morphologically processed to obtain the final effective tampered range D.
[0096] D2 = threshold(D1)
[0097] D = morphology(D2)
[0098] Where T refers to the attacked image; D2 refers to the tampered area detected after thresholding; such as Figure 4As shown, the image restoration algorithm is used to recover the tampered area by utilizing similar information from the attacking image itself. This includes finding similar information about the tampered area in the attacking image itself using the image restoration algorithm; copying the similar information from the attacking image itself and pasting it into the tampered area to restore the tampered area.
[0099] Image restoration algorithms utilize similarity information within the attacked image itself to recover the tampered area, including the following steps:
[0100] Traverse the detected tampered areas; if a pixel is detected to have been tampered with, determine a tampered block centered on the currently tampered pixel.
[0101] Ω2=T-Ω1
[0102] Where T is the image that has been attacked after the watermark is embedded; Ω1 is the detected tampered area; and Ω2 is the known part (the part that has not been attacked).
[0103] The best matching block is found in the known region Ω2 of the extracted watermark image. The found matching block S is as follows:
[0104] S = {S1, S2, ..., S} m}
[0105] Where m belongs to the known region Ω2, and its value range is related to the size of the attack region;
[0106] Find the best matching block for the tampered block among all matching blocks. The formula is as follows:
[0107]
[0108] Among them, P x It is a tampering block centered on the tampered pixel x, where p is the currently matched pixel, and S p It is the matching block centered on the matching pixel p in the known region from which the watermark is extracted; the Euclidean distance is used to measure the matching block S. p With tampered block P x The degree of similarity;
[0109] The process of mapping the spatial locations of similar blocks to known regions of the attack image is as follows:
[0110]
[0111] in, To attack the similarity information of known regions in the image;
[0112] Image restoration algorithms are used to obtain similar blocks to the tampered area. The information of the similar blocks is copied and pasted into the tampered area to obtain the restored image.
[0113] The specific steps for generating a watermarked image are as follows:
[0114] Step 1: For an 8-bit grayscale medical image I of size M*N, where M and N are multiples of 8, the original image I undergoes three levels of DWT to obtain the LL3 subband, denoted as...
[0115] C = [c1, c2, ..., c n ]
[0116] Step 2: Use DPCM quantization encoding C to obtain the watermark value W = [w1, w2, ..., w n ];
[0117] Step 3: Extract feature information from the original medical image using the Hessian matrix, such as edges and contours. If it is necessary to determine whether a pixel n in image I belongs to a contour region, the image structure within the neighborhood of pixel n in image I can be represented using a Taylor expansion, the expression of which is:
[0118] I(n+Δn)=I(n)+(Δn) T ▽I(n)+(Δn) T H(n)Δ(n)
[0119] Where ▽I(n) represents the gradient vector of pixel n, and H(n) represents the Hessian matrix. For a two-dimensional image I(x,y), the mathematical expression for the Hessian matrix of pixel n is: I(n+Δn) represents the Taylor expansion at pixel n; Δ(n) represents the local minimum vector in the real number domain; (Δn) T The vector representing the transpose of Δ(n).
[0120]
[0121] Among them, I xx I xy I yx I yy These represent the second-order partial derivatives of the image in four different directions.
[0122] Step 4: Use the LSB algorithm to embed the watermark value pixel by pixel into the contour, edge and other areas of the original image to generate a watermark image.
[0123] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the medical image self-recovery method based on the image restoration algorithm.
[0124] This invention can be tested using the MATLAB platform at a low cost. To find a balance between content distortion and image restoration after tampering in medical images, this invention proposes a self-restoration method for medical images based on image inpainting algorithms. The aim is to ensure that the embedded watermark information does not damage the visual effect of the original image and to recover the tampered area using similarity information within the attacked image itself. This method is inspired by an effective method for tamper detection and self-restoration of medical images based on image inpainting algorithms. This method solves previous problems in the field of medical image tamper detection and self-restoration. Because only a small amount of watermark information is embedded in the contours and edges, it effectively protects the original medical image information. When the watermarked image is maliciously attacked, the extracted watermark information can be used to detect the effective range of the tampered area, and the tampered area can be recovered using similarity information within the medical image itself. This invention can effectively detect tampering and maintain high quality of image restoration after tampering, and can locate tampering attacks such as cut and copy-paste. It achieves high accuracy; for small-scale cut and copy-paste attacks, the PSNR of the restored image after tampering reaches 35dB. It can assist in related image forensics or image security work, thereby reducing the adverse effects of image tampering on individuals and society, which is of practical significance and achieves good classification accuracy.
[0125] The above embodiments should be understood as illustrative only and not as limiting the scope of protection of the present invention. After reading the description of the present invention, those skilled in the art can make various alterations or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A self-recovery method for medical images based on image inpainting algorithms, characterized in that, include: Use medical images as the original images to generate watermark values; Extracting feature information from the original image using the Hessian matrix; The generated watermark value is embedded into the original image using the LSB algorithm to generate a watermarked image; the specific steps include the following: For the first watermark value, assume the pixel value after embedding the watermark is equal to the original pixel value. If the sequence of embedded watermarks is greater than 1 and the currently embedded watermark value is a positive integer, the embedding formula is as follows: After embedding the watermark value, the marker bit of the pixel is set to 1, as follows: If the currently embedded watermark value is a negative integer, take its absolute value and embed the watermark value using the LSB algorithm. The embedding formula is as follows: in, Representing the The sequence number of each watermark value. The first one representing the original image Line number List, Represents the pixel value after the watermark is embedded; I refers to the original image. This refers to the i-th watermark value; Iterate through the watermark values one by one This process continues until all pixel values are embedded in the original image to obtain the watermarked image. When a watermarked image with embedded watermark is attacked, a reference watermark is extracted from the attacked image, and the extracted watermark value is used to detect the tampered area. After detecting the tampered area, the tampered area is restored using image restoration algorithms that utilize similar information from the attacking image itself. This restoration process includes: finding similar information about the tampered area in the attacking image itself using image restoration algorithms; and copying and pasting the similar information from the attacking image itself into the tampered area to restore it.
2. The medical image self-recovery method based on image inpainting algorithm according to claim 1, characterized in that, The process of generating watermark values from medical images as the original images includes: performing DWT on the original image and selecting the low-frequency subband LL3 as an approximate compressed version of the original image; quantizing and encoding the coefficients of the LL3 subband and generating watermark values.
3. The medical image self-recovery method based on image inpainting algorithm according to claim 2, characterized in that, The method for quantizing and encoding the coefficients of the LL3 subband is differential pulse coding.
4. The medical image self-recovery method based on image inpainting algorithm according to claim 1, characterized in that, The extracted watermark value is used to detect tampered areas, including the following steps: Extract watermark values from the attacked image; An approximate compressed version of the original image can be obtained using differential pulse coding watermark values. ; Compare the attacked image and the obtained The difference yields an approximately altered region. ; The obtained tampered area Thresholding and morphological processing are performed to obtain the final effective tamper range. Where T refers to the attack image; This refers to the tampered areas detected after thresholding.
5. The medical image self-recovery method based on image inpainting algorithm according to claim 1, characterized in that, Image restoration algorithms utilize similarity information within the attacked image itself to recover the tampered area, including the following steps: Traverse the detected tampered areas; if a pixel is detected to have been tampered with, determine a tampered block centered on the currently tampered pixel. in, The image was attacked after the watermark was embedded; For the detected tampered areas, The known part; In the known area of the extracted watermark image The best matching block is found in the middle. as follows: in, Belongs to the known area Furthermore, its value range is related to the size of the attack area; Find the best matching block for the tampered block among all matching blocks. The formula is as follows: in, It is a tampering block centered on the tampered pixel x. It is the currently matched pixel. It is the matching block centered on the matching pixel p in the known region from which the watermark is extracted; the matching block is measured using Euclidean distance. With tampered blocks The degree of similarity; The process of mapping the spatial locations of similar blocks to known regions of the attack image is as follows: in, To attack the similarity information of known regions in the image; Image restoration algorithms are used to obtain similar blocks to the tampered area. The information of the similar blocks is copied and pasted into the tampered area to obtain the restored image.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the medical image self-recovery method based on the image restoration algorithm as described in any one of claims 1 to 5.