Seal removing and document repairing method based on quantum state cooperative regulation and control
By employing a quantum state collaborative control method, we have solved the problems of text breakage, difficulty in separating mixed regions, insufficient transparency processing, and adaptability to special scenarios in traditional algorithms for seal removal and document restoration, achieving high-precision and high-naturalness document restoration results.
Patent Information
- Application Number
- CN202511455572.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-13
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-10-13
AI Technical Summary
Traditional quantum alternating projection algorithms are prone to causing broken strokes and blurring when processing stamp marks. They are also difficult to separate areas where the stamp and document content are mixed, have insufficient processing capabilities for stamps with different transparency, result in poor image quality after restoration, and lack adaptability to special scenarios.
A quantum state collaborative control method is adopted. By modeling quantum entangled states and constraining entanglement degree, combined with quantum wavelet transform, Gram-Schmidt orthogonalization and quantum generative adversarial network, dynamic quantum phase adjustment is performed to adaptively process special scenarios. Quantum neural network noise reduction and multi-scale quantum Fourier transform are used to optimize image quality.
It achieves high-precision, high-naturalness, and high-adaptability stamp removal and document restoration, ensuring high fidelity and image quality of the restoration results.
Smart Images

Figure CN120931533A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary field of document image processing and quantum computing, specifically a method for stamp removal and document restoration based on quantum state co-control. Background Technology
[0002] In the digitization of government documents, accurate removal of seal marks and document restoration are core aspects of ensuring document reusability. However, traditional restoration techniques and existing quantum-assisted solutions struggle to balance seal removal effectiveness with document content integrity and image quality, failing to meet the needs of government scenarios. Specific limitations are as follows:
[0003] Traditional quantum alternating projection algorithms have flaws. When processing the intersection areas of text strokes, they do not consider the texture correlation between adjacent pixels and only iterate and repair a single pixel, which can easily lead to stroke breakage, blurring and distortion, and cannot guarantee the continuity of text.
[0004] Separating the area where the stamp and document content are mixed is difficult. The stamp often overlaps with table lines and annotations. The two types of texture features are similar, and classical algorithms are prone to misjudgment. Quantum state encoding also lacks targeted mapping, resulting in the overlap of quantum states between the two. Even after decoupling, there may still be stamp residue or accidentally deleted document content.
[0005] The processing capability for seals with varying transparency is insufficient. The transparency range of government document seals is large, and medium transparency seals are the most difficult to process—they significantly interfere with the document's quantum state. Existing technologies use fixed basis phase adjustment, which cannot dynamically compensate for this. The success rate of removal in this range is low, and after repair, color blocks or grayed-out text are easily left behind.
[0006] The restored image quality is poor. Quantum state iteration and state transition easily introduce noise, and traditional noise reduction methods cannot eliminate structured noise. The text edges have a wider transition band and decreased contrast due to phase loss, which reduces the accuracy of OCR recognition.
[0007] The stamp lacks adaptability to special scenarios, tilted stamp correction can easily cause document deformation, red + blue multi-color overprinted stamps are difficult to handle color channel interference, ultra-thin border stamps are prone to misjudging text edges, and text can be easily eroded when removed. Summary of the Invention
[0008] The purpose of this invention is to provide a method for seal removal and document restoration based on quantum state cooperative control, so as to solve the problems of existing seal removal technology, such as the defects of traditional quantum alternating projection algorithm, difficulty in separating the mixed area of seal and document content, insufficient ability to process seals with different transparency, poor image quality after restoration, and lack of adaptability to special scenes.
[0009] Therefore, this invention provides a method for seal removal and document restoration based on quantum state cooperative control, comprising the following steps:
[0010] S10. Obtain the coordinates of the located stamp area and the original image of the document to be repaired;
[0011] The quantum side calls a pre-stored quantum feature template library of typical seal quantum state features, while the classical side processes the grayscale image of the seal positioning area through a lightweight convolutional neural network and outputs quantum state control parameters to complete the quantum-classical feature collaborative preparation.
[0012] S20. Construct quantum entangled states for each pixel and its 8 neighboring pixels within the stamp area, and add entanglement degree constraints during the quantum alternating projection iteration process;
[0013] The high-frequency features of the seal and the low-frequency features of the document are extracted by quantum wavelet transform and encoded into quantum states respectively. The Gram-Schmidt quantum orthogonalization process is used to decouple the features. Then, the quantum generative adversarial network is used to generate the filling content, thus completing the quantum texture decoupling and adaptive filling.
[0014] S30. Calculate the transparency factor of the seal, dynamically adjust the phase of the repair basis vector according to the transparency factor, and perform dynamic quantum phase adjustment;
[0015] A quantum neural network containing a combination of controlled Z-gates and rotation gates is used to process and repair the noisy quantum state, and output the denoised quantum state.
[0016] The image is subjected to multi-scale quantum Fourier transform, scale-adaptive gain is applied to high-frequency components, and then the image is reconstructed by inverse quantum Fourier transform to complete edge quantum state sharpening optimization.
[0017] S40. Trigger adaptive processing for special scenarios as needed. The special scenarios include tilted stamps, multi-color overprinted areas, and ultra-thin border stamps.
[0018] S50. Detect the structural similarity index and peak signal-to-noise ratio of the repair results. If they meet the preset threshold, output the target document without stamp marks. If they do not meet the threshold, return to the quantum texture decoupling and adaptive filling steps to re-optimize the parameters.
[0019] In one embodiment, in step S20, a quantum entangled state is constructed for each pixel within the stamp area and its 8 neighboring pixels. The specific operation method is as follows:
[0020] (1) For any pixel within the stamp area, select its eight neighboring pixels in the top, bottom, left, right and diagonal directions as entanglement partners;
[0021] (2) Construct the quantum entangled state between the target pixel and its neighboring pixels. The entangled state is formed by the quantum states of the target pixel and each neighboring pixel being correlated through tensor product, and the influence weight of the neighboring pixels on the target pixel is adjusted by the entanglement coefficient.
[0022] (3) Dynamically optimize the entanglement coefficient through the quantum entanglement swapping protocol.
[0023] In one embodiment, the quantum entanglement swapping protocol dynamically optimizes the entanglement coefficient as follows: if a neighboring pixel and the target pixel belong to the same character stroke, the corresponding entanglement coefficient is increased; if a neighboring pixel belongs to the background region, the corresponding entanglement coefficient is decreased.
[0024] In one embodiment, the specific operation method of quantum texture decoupling and adaptive filling in step S20 is as follows:
[0025] (1) By using quantum wavelet transform to analyze 16 frequency channels of the image in parallel, high-frequency features of the seal in the range of 1024-4096Hz and low-frequency features of the document in the range of 256-1024Hz were selected.
[0026] (2) The high-frequency features and low-frequency features are mapped to the stamp quantum state and the document quantum state respectively by using amplitude-phase dual-parameter encoding: the amplitude of the stamp quantum state is positively correlated with the gray intensity of the stamp, and the phase corresponds to the direction of the stamp texture; the amplitude attenuation coefficient of the document quantum state reflects the continuity of the document content, and the phase correlation ensures the smooth transition of the text strokes.
[0027] (3) Feature decoupling is achieved through Gram-Schmidt quantum orthogonalization: First, the projection component of the seal quantum state onto the document quantum state is calculated, then the projection component is removed from the seal quantum state to eliminate the feature overlap between the two, and finally the amplitude of the processed seal quantum state is adjusted to meet the normalization requirements of the quantum state.
[0028] (4) Use quantum generative adversarial network to generate filling content: The quantum generator receives the quantum state of the 3×3 neighborhood, and after processing by the hidden layer containing 2 rotating gates and 1 controlled gate, it outputs the quantum state of the filling region; the quantum discriminator judges the authenticity of the generated content by calculating the similarity distance between the filling quantum state and the quantum state of the real document. If the distance exceeds the preset threshold, it will adjust the rotating gate angle of the quantum generator until the distance meets the requirements.
[0029] (5) Transform the filling quantum state into a classical pixel through quantum tomography: Perform multiple measurements on the quantum state, take the average amplitude to determine the pixel gray level, read the phase angle to convert it into the pixel gradient direction, and ensure that the filling area is continuous with the neighborhood texture.
[0030] In one embodiment, the specific operation method for performing dynamic quantum phase adjustment in step S30 is as follows:
[0031] (1) Extract the RGB or grayscale values of each pixel within the stamp area and calculate the normalized brightness of each pixel;
[0032] (2) The normalized brightness of 1024 pixels is processed in parallel by the quantum averaging operator to calculate the transparency factor of the seal.
[0033] (3) Determine the phase compensation angle of the repair basis vector based on the transparency factor: take a specific radian as the reference phase. The larger the transparency factor, the greater the adjustment range of the phase compensation angle, to ensure that the compensation angle matches the stamp interference phase.
[0034] (4) Apply the phase compensation angle to the control end of the rotating gate, apply rotation to the quantum state of the repair basis vector, and obtain the adjusted repair basis vector quantum state;
[0035] (5) Perform quantum interference between the mixed quantum state containing the stamp interference and the adjusted repair basis vector quantum state, eliminate the stamp interference through phase cancellation, and restore the original quantum state of the document.
[0036] In one embodiment, the specific operation method of using a quantum neural network to process the repaired noisy quantum state in step S30 is as follows:
[0037] The repaired noisy quantum state is encoded into an input layer consisting of 8 qubits: during encoding, the pixel grayscale value is mapped proportionally to the amplitude of the qubit, and the spatial gradient direction of the pixel corresponds to the phase of the qubit.
[0038] The hidden layer contains four quantum neurons, each consisting of a controlled Z-gate and a rotation gate connected in series: the controlled Z-gate is used to identify the spatial correlation of noise; the rotation gate achieves noise amplitude attenuation and phase cancellation by adjusting the rotation angle, decomposing the noisy quantum state into a document feature subspace and a noise feature subspace;
[0039] The output layer applies an inverse parameterization transformation to the quantum state output by the hidden layer, sets the qubits corresponding to the noise feature subspace to a vacuum state, eliminates noise contributions, and obtains a pure document quantum state.
[0040] Perform multiple quantum measurements on the quantum state of the clean document, and take the average value of the grayscale measurements as the final pixel grayscale.
[0041] In one embodiment, the specific operation method of edge quantum state sharpening optimization in step S30 is as follows:
[0042] A quantum Fourier transform circuit is constructed using a system with no fewer than 8 qubits to perform a 3-level quantum Fourier transform;
[0043] Each frequency component is encoded using three parameters: amplitude, phase, and frequency.
[0044] Apply scale-adaptive gain to different levels of frequency components;
[0045] The amplitude of the quantum state in the frequency domain is adjusted by using a quantum multiplication circuit while maintaining the phase.
[0046] Construct an inverse quantum Fourier transform circuit corresponding to the quantum Fourier transform to convert the enhanced frequency domain quantum state into a spatial domain quantum state, which is used to compress pixels in the edge transition zone and improve the grayscale difference between text and background.
[0047] In one embodiment, the adaptive processing method for special seals in step S40 is as follows:
[0048] For seals with tilt angles of 0°-45°: A quantum edge detection circuit composed of 8 qubits is used to measure the phase angle of the pixels at the edge of the seal, calculate the phase difference between adjacent pixels and construct a phase gradient matrix; the phase gradient matrix is analyzed by a quantum Fourier transform operator to obtain the seal tilt angle; a quantum rotation operator is constructed to perform positive correction on the quantum state of the seal area before performing the repair, so as to avoid text truncation caused by angle deviation;
[0049] For the red and blue multi-color overprinted region: the RGB three channels are mapped to orthogonal quantum states to construct RGB combined quantum states; the similarity between the quantum states of each color channel and the quantum states of the corresponding color stamp template is calculated, and if the similarity is greater than the threshold, it is determined to be a stamp region; the quantum state amplitude of the stamp region of the corresponding channel is flipped by a quantum NOT gate to remove the stamp features; the phase of the quantum states of each channel is adjusted to align with the phase of the green channel and then re-fused.
[0050] For ultra-thin border stamps with a line width ≤ 1 pixel: measure the amplitude of the quantum state in the stamp region, and screen candidate border quantum states with amplitude in the range of 0.1-0.3; detect the rate of change of the phase of the candidate quantum state along the path, and if the rate of change is less than the threshold, it is determined to be a border quantum state; construct a boundary annihilation operator to compress the amplitude of the border quantum state to below 0.01.
[0051] In one embodiment, step S50, detecting the structural similarity index and peak signal-to-noise ratio of the repair result, includes:
[0052] Preset structural similarity index threshold and peak signal-to-noise ratio threshold;
[0053] If the structural similarity index of the repair result is lower than the structural similarity index threshold or the peak signal-to-noise ratio is lower than the peak signal-to-noise ratio threshold, return to the quantum texture decoupling and adaptive filling step, and re-optimize the quantum orthogonalization parameters and the rotation gate angle of the quantum generative adversarial network;
[0054] If the repair results meet the threshold requirements, output a target document without stamp traces in PDF or Word format.
[0055] In one embodiment, in step S10,
[0056] The quantum feature template library is built on a 10-qubit system and pre-stores the quantum state features of more than 3,000 typical seals, which cover red, blue, black, and official and private seal types.
[0057] The classical side processes the grayscale image of the stamp positioning area using a lightweight CNN and outputs quantum state control parameters, including: the lightweight CNN extracts features such as grayscale distribution and edge gradient of the positioning area, and outputs control parameters for adjusting the quantum state amplitude and phase based on the feature analysis results.
[0058] The stamp removal and document restoration method based on quantum state cooperative control proposed in this invention has the following advantages:
[0059] This stamp removal and document restoration method extracts features by calling a quantum feature template library in collaboration with a classical lightweight CNN, models quantum entangled states, iterates on entanglement constraints, decouples textures through quantum wavelet transform and Gram-Schmidt orthogonalization, adaptively fills with quantum generative adversarial networks, uses dynamic quantum phase adjustment to counteract the superposition interference of stamps with different transparency, optimizes image quality with quantum neural network noise reduction and multi-scale quantum Fourier sharpening, verifies the restoration results, and uses quantum rotation correction, color channel separation and boundary annihilation operators to process special scenarios such as tilting, multi-color overprinting, and ultra-thin borders, ultimately achieving high-precision, high-naturalness, and high-adaptive restoration of stamp removal, ensuring high-fidelity results. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1 This is a flowchart illustrating the first embodiment of this application;
[0062] Figure 2 This is a flowchart of the quantum entanglement-assisted repair and reconstruction process according to the first embodiment of this application;
[0063] Figure 3 This is a flowchart of quantum texture decoupling and adaptive filling in the first embodiment of this application;
[0064] Figure 4 This is a flowchart of the dynamic quantum phase adjustment process according to the first embodiment of this application;
[0065] Figure 5 This is a flowchart of the quantum neural network noise reduction and enhancement process according to the first embodiment of this application. Detailed Implementation
[0066] To make the objectives, technical solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described in this specification are merely for explaining the invention and are not intended to limit the invention.
[0067] Example:
[0068] Reference Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the stamp removal and document restoration method based on quantum state cooperative control according to this application. The stamp removal and document restoration method based on quantum state cooperative control may include steps S10 to S50:
[0069] Step S10: Obtain the information to be processed and perform quantum-classical feature co-preparation.
[0070] In one feasible implementation, step S10 may include steps S101 to S104:
[0071] Step S101: Accurate reception and preprocessing of the information to be processed.
[0072] In one specific implementation, step S101 may include steps S1011 to S1012:
[0073] Step S1011: Receive core data, which includes the image of the document to be processed and the coordinates of the stamp area.
[0074] It should be noted that the document image to be processed is the original image of the government document to be repaired, the color mode is compatible with RGB and grayscale, and the coordinates of the stamp area are the output of the front positioning module, in the format of rectangular bounding box coordinates. Precisely select the area covered by the stamp (error ≤ 1 pixel, avoid including irrelevant background).
[0075] Step S1012, image preprocessing: perform lightweight preprocessing on the received document image to remove interference for subsequent feature extraction.
[0076] Specifically, the RGB image of the location area is converted to a grayscale image (skipping if it is a native grayscale image). According to the BT.601 standard, the grayscale values are standardized to the [0,1] range to eliminate the influence of color channel differences on feature extraction. The grayscale normalization mathematical expression is:
[0077]
[0078] In the formula, coordinates Grayscale pixel values at the location, range of values , , , The color image is in coordinates The red, green, and blue channel pixel values at this location are all The integers 0.299, 0.587, and 0.144 are weighting coefficients defined in the BT.601 standard, which make the grayscale values more closely match the human eye's perception of "brightness".
[0079] Step S102: The quantum side calls the "quantum feature template library" to load the benchmark features.
[0080] The quantum side is based on a 10-qubit system (adapting to the high-dimensional storage requirements of seal features) and calls a pre-built "quantum feature template library" to provide a quantum-level benchmark for subsequent feature matching.
[0081] It should be noted that the quantum feature template library pre-stores the quantum state features of 3,000+ typical seals, covering common seal types in government scenarios to ensure a high matching rate. The coverage dimensions include color dimension, type dimension (round official seal, square private seal, etc.), and texture dimension (star angle, ring width, and font, etc.). The features of each seal are stored as "amplitude-phase dual-parameter quantum states".
[0082] In one specific implementation, the starburst texture quantum state of the red official seal... Its amplitude corresponds to the gray intensity of the starburst (amplitude modulus squared). (Positively correlated with the RGB value of the starburst), the phase corresponds to the direction of the starburst's radiation (30° starburst corresponds to the phase angle). ).
[0083] Based on the "preliminary visual features" (color, approximate shape) of the preprocessed localized region, 10-20 highly similar candidate templates are quickly selected from 3000+ templates (parallel retrieval on the quantum side, taking ≤1ms), avoiding full database traversal.
[0084] Step S103: The classic lightweight CNN extracts the features of the localization region and outputs the quantum control parameters.
[0085] In one specific implementation, step S103 may include steps S1031 to S1032:
[0086] Step S1031, Lightweight CNN network design.
[0087] It should be noted that the network structure adopts a lightweight 3-layer architecture (input layer, hidden layer, and output layer), with a total number of parameters ≤100,000, supporting real-time processing. The input layer receives grayscale sub-images of the localized region (adaptively cut according to the seal size to ensure complete texture coverage). The hidden layer is designed with two convolutional kernels (3×3) to extract "edge texture features" (such as seal ring patterns, text stroke edges, etc.) and "grayscale distribution features" (such as grayscale gradients caused by seal transparency). The output layer outputs a four-dimensional feature vector, corresponding to "seal type probability (official seal / private seal), transparency range (5%-10% / 10%-30% / 30%-60% / 60%-80%), texture complexity (low / medium / high), and document content type (text / table / handwriting)".
[0088] Step S1032: Output "Quantum state control parameters".
[0089] The 4-dimensional feature vector of the lightweight CNN is transformed into 6 quantum state control parameters, which directly guide the feature extraction logic on the quantum side.
[0090] It should be noted that the six quantum state control parameters are template matching weights. The probability of the corresponding seal type is used to adjust the matching priority of the candidate template, and the amplitude attenuation coefficient is used. The corresponding transparency range is used to correct the amplitude of the quantum state of the seal, and the quantum wavelet transform scale. The corresponding texture complexity is used to determine the precision of QWT parsing frequency, with entanglement coefficients as the benchmark. The corresponding document content type (text) is used to set the entanglement weights and phase correlation thresholds of the text pixel neighborhood. The corresponding document content type (table) is used to ensure the phase continuity of the quantum states in the table lines and to fill the learning rate. The corresponding document content type (handwritten) is used to adjust the filling iteration speed of QGAN.
[0091] It should be further noted that the template matching weight range is... The range of amplitude attenuation coefficient The range of values for the quantum wavelet transform scale The baseline range of entanglement coefficients Phase correlation threshold range Fill in the learning rate range .
[0092] Step S104: Quantum-classical collaborative feature extraction, outputting an accurate feature set.
[0093] In one specific implementation, step S104 may include steps S1041 to S1042:
[0094] Step S1041, Quantum-Classical Co-extraction.
[0095] Specifically, the quantum side is based on a 10-qubit system, which quantizes the positioning region (converting the grayscale image into a quantum state). ), combining candidate template quantum states and control parameters Then, feature extraction operations are performed.
[0096] In one specific implementation, the "feature extraction operation" in step S1041 may include steps A1041 to A1043.
[0097] Step A1041: Perform quantum inner product calculation. The template that best matches the location area is selected.
[0098] Step A1042, perform quantum wavelet transform (QWT) according to the control parameters. By analyzing the frequency characteristics of the quantum states in the location region, the "high-frequency texture quantum state of the seal" (1024-4096Hz, such as starburst) and the "low-frequency content quantum state of the document" (256-1024Hz, such as table lines) were separated.
[0099] Step A1043, perform quantum state correction using the amplitude attenuation coefficient. The amplitude of the quantum state of the seal is corrected to match the actual transparency, ensuring the accuracy of subsequent phase adjustments.
[0100] Step S1042: After collaborative extraction, output the seal features and document features in quantum state form.
[0101] It should be noted that the characteristics of a seal are: It includes information about the seal's color, texture, transparency, and amplitude. Phase corresponds to texture direction, document features are It contains grayscale, edge, and phase continuity information of text / tables / handwriting, satisfying... (Table) or (Textual) constraints.
[0102] Step S20: The continuity of character strokes is ensured by quantum entangled state modeling and entanglement degree constraint iteration, texture decoupling is achieved by quantum wavelet transform and Gram-Schmidt orthogonalization, and adaptive filling is combined with quantum generative adversarial network.
[0103] In one feasible implementation, step S20 may include steps S201 to S203:
[0104] Step S201, quantum entanglement-assisted repair and reconstruction, refer to Figure 2 , Figure 2 The flowchart of the first embodiment of the stamp removal and document restoration method based on quantum state cooperative control provided in this application is a quantum entanglement-assisted restoration and reconstruction flowchart. Through quantum entanglement state modeling and entanglement degree constraint iteration, adjacent pixels are "cooperatively adjusted" during the restoration process to maintain texture continuity.
[0105] In one specific implementation, step S201 may include steps S2011 to S2013:
[0106] Step S2011, for any pixel within the positioning area Select its 8 neighboring pixels (i.e., the top, bottom, left, right, and diagonal pixels, a total of 8 adjacent pixels, denoted as 8). (as an entangled partner)
[0107] It should be noted that these neighboring pixels, together with the target pixels, constitute the "local continuous unit" of the character stroke.
[0108] Step S2012, define the target pixel Entangled states with neighboring pixels.
[0109] Specifically, the mathematical expression for step S2012 is:
[0110]
[0111] In the formula, and These are the quantum states (containing information such as grayscale and phase) of the target pixel and its neighboring pixels, respectively. The tensor product is an operator in quantum mechanics representing "multi-particle correlated states." Here, it's used to indicate that the quantum states of the target pixel and its neighboring pixels are "indivisible," meaning that changing the quantum state of one pixel will instantly trigger a response in the others. Entanglement coefficient (range of values) The value is used to adjust the influence weight of neighboring pixels on the target pixel: the closer the neighboring pixels are (such as the top and right), the larger the value, ensuring stronger correlation of the main texture direction (such as horizontal / vertical strokes).
[0112] It should be noted that, The protocol is adjusted in real time through a "quantum entanglement swapping protocol": when neighboring pixels are detected to belong to the same character stroke (e.g., consistent grayscale gradient), the protocol increases. Strengthen the association; if the neighboring pixels belong to the background (such as a blank area), then reduce the correlation. To avoid interference from irrelevant pixels.
[0113] In step S2013, during the iterative repair process of the QAP algorithm, the texture correlation is not destroyed during the repair process by constraining the "similarity" of the entangled states of adjacent pixels.
[0114] Specifically, quantum entanglement degree is used to measure the "degree of overlap" between two entangled states, mathematically expressed as an inner product. express( (This represents the number of iterations). The closer this value is to 1, the smaller the change in the entangled state between two iterations, and the more stable the correlation between adjacent pixels.
[0115] It should be noted that in each QAP iteration (from the 1st... Next to In (times), the following must be satisfied: If the grayscale of the target pixel increases (brightens) during iteration, the grayscale of its neighboring pixels will also "increase collaboratively" under entanglement constraints, thus avoiding stroke breakage caused by "sudden brightening of a single pixel".
[0116] Step S202, refer to Figure 3 , Figure 3 The flowchart of quantum texture decoupling and adaptive filling of the first embodiment of the stamp removal and document repair method based on quantum state collaborative control provided in this application realizes "precise stripping" of two types of textures and "seamless repair" of document content through the fine encoding, orthogonal separation and intelligent generation mechanism of quantum states.
[0117] In one specific implementation, step S202 may include steps S2021 to S2023:
[0118] Step S2021: Deep extraction of texture features is achieved through quantum wavelet transform (QWT), and the features are transformed into precisely controllable quantum states, providing a "high-dimensional feature space" for separation.
[0119] Specifically, QWT is based on the fast computational power of quantum Fourier transform (QFT), which can complete the multi-scale decomposition of images in a single operation (traditional wavelet transform requires multiple iterations). The extracted features are transformed into quantum states through "amplitude-phase dual-parameter encoding", realizing the "holographic storage" of texture features.
[0120] It should be noted that by utilizing quantum superposition states, and simultaneously analyzing 16 frequency channels of the image (covering 0-4096Hz), the frequency differences between the seal and the document are accurately captured. The seal texture's frequency is concentrated in the high frequency range, with a grayscale change rate >50% / pixel, while the document content's frequency is concentrated in the mid-to-low frequency range, with a grayscale change rate <30% / pixel. The quantum state texture characteristics are those of the seal's quantum state. and document quantum state These include amplitude (corresponding to the grayscale intensity of the stamp texture), phase (corresponding to the directional features of the texture), amplitude attenuation coefficient (reflecting the continuity of the document content), and phase correlation (the phase difference between adjacent pixels is <5°, ensuring a smooth transition of text strokes).
[0121] Step S2022 involves completely isolating the "characteristic spaces" of the two types of quantum states through the Gram-Schmidt quantum orthogonalization process, ensuring that the document content is not damaged when the stamp is removed.
[0122] In one specific implementation, taking a 2-qubit system as an example, using 3 quantum gate sequences, the "Gram-Schmidt quantum orthogonalization" in step S2022 can include steps A2021~A2023:
[0123] Step A2021, projection calculation.
[0124] Specifically, calculations are performed using quantum inner product circuits. exist Projection on: This projection is the "overlapping interference feature" of the two (such as the edge feature shared by the stamp star and the table line).
[0125] It should be noted that the inner product calculation follows the inner product rule of quantum mechanics:
[0126]
[0127] In the formula, for No. The conjugate complex number of each component for No. Each component.
[0128] Step A2022, interference removal.
[0129] Specifically, it is performed through a quantum subtraction circuit (composed of Hadamard gates and CNOT gates). This completely eliminates document-related interference components from the quantum state of the seal.
[0130] It should be noted that quantum subtraction operations must satisfy the principle of quantum superposition, that is:
[0131] .
[0132] Step A2023, normalization.
[0133] Specifically, for Apply a quantum rotation gate (RY gate) to adjust the amplitude so that it satisfies the normalization condition. To ensure the mathematical rigor of orthogonality, the normalization calculation formula is as follows:
[0134]
[0135] The final orthogonalized quantum state of the seal satisfy .
[0136] It should be noted that after orthogonalization, the feature overlap between the seal and the document is significantly reduced. The formula for calculating feature overlap is:
[0137] .
[0138] In step S2023, after removing the quantum state of the stamp, the original covered area of the document forms an "information blank". QGAN learns the global texture rules of the document and generates filling content that is highly consistent with the surrounding environment.
[0139] In one specific implementation, step S2023 may include steps B2021 to B2023:
[0140] Step B2021, design of the quantum architecture of QGAN.
[0141] Specifically, quantum generator It consists of an input layer, a hidden layer, and an output layer. The input layer receives quantum states from a 3×3 neighborhood. (Including texture trends in 8 directions, such as "horizontal lines at the top edge and vertical lines at the left edge"), the input state can be represented as: In the formula, For the first Weight coefficients for texture in each direction. This is the ground state of the directional texture.
[0142] The hidden layer consists of four parameterized quantum circuits, each containing two RY rotation gates and one CZ controlled gate. By adjusting the rotation angle, it learns texture generation rules (such as the grayscale distribution range of horizontal lines and the radius of curvature of corners). The formula for the RY rotation gate is as follows:
[0143]
[0144]
[0145] The formula for the action of the CZ controlled gate is:
[0146]
[0147] Quantum states of the output layer generating the filling region Its phase distribution remains continuous with the texture direction of the neighborhood (e.g., if the horizontal lines in the neighborhood are along the x-axis, the phase gradient of the filled region is also along the x-axis). The formula for phase continuity is: In the formula, To fill the phase gradient of the region, The neighborhood phase gradient.
[0148] Quantum discriminator By measuring the generated state The "quantum Jensen-Shannon distance" (a metric for measuring the similarity of probability distributions) between the generated content and the quantum state of the real document is used to determine the "authenticity" of the generated content. The formula for the quantum Jensen-Shannon distance is as follows:
[0149]
[0150] In the formula, For Kullback-Leibler divergence, It is the average state of two quantum states. This represents the quantum state of a real document.
[0151] It should be noted that when the distance > At the same time, the output gradient adjustment signal is sent to correct the revolving door angle. until the distance is less than (At this point, the human eye cannot distinguish between genuine and fake.) Distance warning threshold ( ), Distance convergence threshold ( ), The gradient adjustment formula is:
[0152]
[0153] In the formula, For learning rate, This is the gradient of distance with respect to rotation angle.
[0154] Step B2022, the "lossless transformation" from quantum state to classical image, generates It is transformed into classical pixels through "quantum tomography" technology.
[0155] Specifically, the quantum state is measured multiple times (≥100 times), and the statistical average of the amplitude is obtained (corresponding to pixel grayscale, with an error ≤1). The formula for the statistical average of the amplitude is:
[0156]
[0157] The grayscale mapping formula is:
[0158]
[0159] In the formula, To measure the number of times, For the first The amplitude value measured this time, These are classic pixel grayscale values, ranging from 0 to 255, with an error margin. .
[0160] The phase angle is read by the phase measurement circuit and converted into the gradient direction of the pixel (ensuring a smooth connection with neighboring lines). The gradient direction conversion formula is:
[0161]
[0162] In the formula, The pixel gradient direction vector. The phase angle of the quantum state in the filling region.
[0163] Step B2023, ensuring high value.
[0164] Specifically, It is a key indicator for measuring the structural similarity of images (1 means completely identical). When it is high Value, of which Structural similarity threshold To ensure the consistency of the repaired area with the original document texture, the calculation formula is as follows:
[0165]
[0166] In the formula, For filling the region image, Images of real documents , The mean, , Standard deviation, For covariance, , It is a constant to avoid the denominator being 0.
[0167] It should be noted that this technology ensures high scores through two points. The texture direction, grayscale mean, and neighborhood error of the forced generated state must be less than 5% (e.g., if the grayscale of the neighborhood table line is 180, the grayscale of the filled area must be between 171 and 189). The grayscale error formula is:
[0168]
[0169] The formula for direction error is:
[0170]
[0171] In the formula, The average gray level of the neighborhood. The gradient direction vector of the neighborhood is such that a dot product close to 1 indicates that the directions are consistent.
[0172] During QGAN training, a "document style loss function" is introduced to ensure that the filled content conforms to the global features of the entire document, such as font, line spacing, and line thickness (e.g., if the official document uses Songti font size 5, the filled content will not use Kaiti font). The formula for the style loss function is:
[0173]
[0174] In the formula, For feature layer index, For layer weights, The Gram matrix measures the correlation of features. The quantum state of the real document at the 1st layer.
[0175] Step S30: Dynamic quantum phase adjustment is used to counteract the superposition interference of stamps with different transparency, and quantum neural network noise reduction and multi-scale quantum Fourier sharpening are used to optimize image quality.
[0176] In one feasible implementation, step S30 may include steps S301 to S303:
[0177] Step S301, refer to Figure 4 , Figure 4 The flowchart of the dynamic quantum phase adjustment of the first embodiment of the stamp removal and document restoration method based on quantum state coordinated control provided in this application shows that by quantizing the transparency parameter and dynamically controlling the quantum repair basis phase, the stamp traces can be accurately canceled and the document content can be restored without loss.
[0178] In one specific implementation, step S301 may include steps S3011 to S3013:
[0179] Step S3011: Through pixel-level statistics and quantum state mapping, visual transparency is converted into computable quantum parameters. .
[0180] In one specific implementation, step S3011 may include steps A3011~A3012:
[0181] Step A3011, Classic Domain Pixel Acquisition.
[0182] Specifically, for the located stamp area, the RGB value (or grayscale value) of each pixel is extracted, and the normalized brightness is calculated. (range [0,1]), where represents complete transparency (in line with the background). This indicates that the object is completely opaque.
[0183] Step A3012, Quantized computation .
[0184] Specifically, transparency factor Using a quantum averaging circuit (composed of Hadamard gates and CNOT gates) Perform parallel computing:
[0185]
[0186] In the formula, This is a quantum averaging operator that utilizes quantum superposition to simultaneously process 1024 pixels. value.
[0187] It should be noted that, The value of and The amplitude modulus is positively correlated with the square of the amplitude modulus. ),Right now The larger the size, the stronger the interference of the quantum state of the seal.
[0188] Step S3012, dynamic phase adjustment.
[0189] Specifically, for different The phase compensation angle of the repaired basis vector is calculated using the dynamic phase adjustment formula, and the mathematical expression is:
[0190]
[0191] In the formula, As the reference phase, the value is... (Approximately 45°), at At (medium transparency), this phase allows for the highest matching degree (inner product) between the repair basis vector and the document quantum state. Based on quantum interference theory, the amount of phase interference of a seal on a document and It exhibits a non-linear relationship. ), For phase compensation coefficients, ,make sure That is, the compensation phase is exactly equal to the interference phase.
[0192] It should be noted that, in one specific implementation, the dynamic adjustment logic is used when... (30% opacity) The compensation is weak, only offsetting slight interference. (60% opacity) Enhanced compensation, matching stronger phase interference, when (80% opacity) To maximize compensation and ensure that the document phase is not masked under strong interference.
[0193] In step S3013, dynamic phase adjustment is performed in the quantum circuit through a parameterized quantum rotation gate (RY gate).
[0194] In one specific implementation, step S3013 may include steps B3011~B3012:
[0195] Step B3011, RY gate phase loading.
[0196] Specifically, the calculated values are applied to the control terminal of the RY gate to repair the quantum state of the basis vector. (With an initial phase of 0) Apply rotation, the mathematical expression is:
[0197]
[0198] The matrix representation of the RY gate in the formula is:
[0199]
[0200] It should be noted that after rotation Phase and They are completely identical, forming an "anti-phase interference source".
[0201] Step B3012, quantum interference cancellation.
[0202] Specifically, mixed state With the adjusted basis vectors To perform quantum interference and restore the original quantum state of the document, the mathematical expression is:
[0203]
[0204] It should be noted that, due to The phases exactly cancel each other out. Interference phase ( After interference, the quantum state components of the seal are canceled out, and the final output is... It can completely restore the original quantum state of the document.
[0205] Step S302, refer to Figure 5 , Figure 5 The flowchart of the first embodiment of the stamp removal and document restoration method based on quantum state collaborative control provided in this application is a quantum neural network noise reduction and enhancement flowchart. By constructing a parameterized quantum neural network (QNN), the complex noise in the restored image is accurately suppressed. By utilizing the parallelism of quantum computing and the nonlinear fitting ability of quantum neurons, the noise distribution law is deeply learned and eliminated in a targeted manner.
[0206] It should be noted that the QNN network is built on an 8-qubit basis (adapting to the 256-pixel feature dimension of local document regions), and the input layer takes the repaired noisy quantum state as input. Its mathematical expression is the superposition of the document's true state and its noise state, and the mathematical expression is:
[0207]
[0208] In the formula, For the percentage of effective information, The percentage of noise. (Quantum state normalization condition).
[0209] The classical image pixel values are converted into 8-qubit quantum states through "amplitude-phase dual-parameter encoding". The amplitude mapping formula is as follows:
[0210]
[0211] Phase mapping formula:
[0212]
[0213] In the formula, For pixel grayscale, For the amplitude of a quantum bit, This represents the phase of a qubit, corresponding to the spatial gradient direction of a pixel.
[0214] Each hidden layer contains 4 quantum neurons, and each neuron is composed of a controlled Z-gate (CZ) + a rotation gate (RY) connected in series. The CZ gate is a two-qubit gate, and its action matrix is as follows:
[0215]
[0216] When both the control bit and the target bit are At that time, the target bit phase flips ( ).
[0217] In one specific implementation, in the starburst texture that repairs residual noise, adjacent pixels (distance) The phase angle difference of a pixel is fixed, and the formula is:
[0218]
[0219] CZ gates can mark this "regular correlation" with the random phase difference of document content by phase flipping.
[0220] The RY gate is a single-qubit parameterization gate, and its action matrix is:
[0221]
[0222] In the formula, For learnable parameters, This determines the transformation mode of the quantum state, and is relevant to quantum measurement noise (which follows a Gaussian distribution). ), RY gate by adjustment Achieve "amplitude attenuation" and reduce the proportion of noise. The formula is:
[0223]
[0224] System offset for interactive noise (e.g.) ), RY gate through Perform "phase cancellation", and the phase formula after cancellation is:
[0225]
[0226] It should be noted that the four neurons work together, each responsible for capturing the noise's "high-frequency features" (starburst residue), "spatial correlation features" (synchronous fluctuations of adjacent pixels), "amplitude features" (grayscale fluctuation intensity), and "phase features" (angular shift). Through combination operations, the noisy quantum state is decomposed into a "document feature subspace" (dominant) and a "noise feature subspace" (dominant). The decomposition formula is as follows:
[0227]
[0228] In the formula, For document feature projection operators, For noise feature projection operator, and ( (Unit operator).
[0229] The output layer applies an "inverse parameterization transformation" (i.e., the reverse process of the hidden layer operation) to the quantum state output by the hidden layer, eliminating the contribution of the noise eigenspace. If the hidden layer concentrates the noise onto qubits 5-7 through CZ and RY gates, the output layer sets these three qubits to their normal values through "quantum state projection". (Annihilation noise), retaining 1-4 bits of document features, the projection formula is:
[0230]
[0231] The final output pure quantum state satisfy The value is converted into a classical pixel value through quantum measurement (repeated 100 times and averaged to reduce measurement error). The formula for the average measurement value is:
[0232]
[0233] In the formula, To measure the number of times, For the first The grayscale value of the measurement.
[0234] In one specific implementation, step S302 may include steps S3021 to S3022:
[0235] In step S3021, the QNN optimizes the rotation angle of the RY gate through training, enabling it to identify and suppress specific noise.
[0236] Specifically, a training dataset was precisely constructed, containing 100,000 pairs of "noisy quantum state - pure quantum state" samples, covering different intensity combinations of three types of noise (such as quantum measurement noise standard deviation of 0.01-0.03, interaction noise phase shift of 0.01-0.05 rad, and residual noise from repair accounting for 5%-20%). In the pure quantum states of 1,000 real documents (including text, tables, and handwriting), noise was added according to the proportion of the actual scene: quantum measurement noise was superimposed with random amplitude perturbations of Gaussian distribution; interaction noise was superimposed with fixed phase shifts; and residual noise from repair was superimposed with fragment quantum states of real seal textures.
[0237] Quantum fidelity is used to measure the similarity between the predicted state and the true state. The mathematical expression is:
[0238]
[0239] The loss function is defined as:
[0240]
[0241] In the formula, the fidelity value ranges from [0,1]. The closer the value is to 1, the more similar the two quantum states are (i.e., the better the noise reduction effect). The optimization objective is to minimize... Even if the predicted pure state is as close as possible to the true state.
[0242] The loss function is calculated through quantum circuit simulation. For each RY gate rotation angle partial derivatives Adjust according to gradient direction : (in (for the learning rate), so that Gradually decrease, until the average value of 1000 consecutive iterations is reached. When the fidelity is ≤0.01 (i.e., fidelity ≥0.99), training is stopped. At this point, the QNN has learned the characteristic patterns of various types of noise.
[0243] Step S3022: The trained QNN processes the new noisy quantum state.
[0244] In one specific implementation, the CZ gate detects the spatial correlation of starburst residue (30° phase difference between adjacent pixels), marks it to qubits 6-7, and the RY gate, through an optimized... The Gaussian distribution characteristics of quantum measurement noise are identified and marked on qubit 5. "Amplitude attenuation" is applied to qubits 5-7 (the amplitude is reduced to 10% of the original value by rotating through the RY gate) to reduce the noise contribution. The amplitude and phase of qubits 1-4, where the document features are located, are kept unchanged to preserve effective information such as text strokes and table lines. The processed quantum state is measured 100 times, and the average amplitude is taken as the pixel gray level (error ≤ 1). The phase value is converted into the edge direction (to ensure line continuity). In the final output image, the starburst noise is eliminated, and the gray level fluctuation caused by quantum measurement noise is ≤ 1, achieving "noise stripping + detail preservation".
[0245] Step S303: By analyzing edge frequency features through multi-scale quantum Fourier transform (QFT), enhancing high-frequency quantum states through adaptive gain control, and reconstructing spatial domain images through inverse quantum Fourier transform (IQFT), precise sharpening of text edges is achieved.
[0246] In one specific implementation, step S303 may include steps S3031 to S3033:
[0247] Step S3031: Analyze the edge frequency characteristics using multi-scale quantum Fourier transform.
[0248] Specifically, a QFT circuit is constructed using a quantum bit system, enabling parallel processing of a single operation. Each frequency component ( ),cover Frequency range, determined by the frequency modulus formula. ( (Using frequency coordinates) to distinguish edge types; coarse edges correspond to low-frequency components. Amplitude Relationship Fine edges correspond to high-frequency components Amplitude Relationship .
[0249] Based on edge statistical features, a 3-level QFT is set, with the first level QFT ( ), resolution parameters Analysis Low-frequency components, corresponding to edge width Pixel, Level 2 QFT ( ), resolution parameters Analysis Intermediate frequency components, corresponding edge width Pixel, Level 3 QFT ( ), resolution parameters Analysis High-frequency components, corresponding edge width Pixel.
[0250] For each frequency component It adopts a three-parameter encoding of "amplitude-phase-frequency", and the encoding formulas are as follows:
[0251] Amplitude encoding:
[0252]
[0253] Phase encoding:
[0254]
[0255] Frequency coding:
[0256]
[0257] In the formula, For the probability distribution of qubits, the precision , , For edge energy, For the rotation angle of the qubit, the precision Mark the spatial orientation of the edge. This represents the ground state of a quantum bit, corresponding to discrete frequency points.
[0258] Step S3032: Scale-adaptive gain enhancement of high-frequency components.
[0259] Specifically, regarding the frequency components of the 3rd level QFT output Calculate the enhanced frequency components The mathematical expression is:
[0260]
[0261] In the formula, 0.03 is the gain coefficient, ensuring the ratio of edge gradient magnitude enhancement to noise amplification. , The scaling factor ( This enables differentiated edge enhancement at different scales. For frequency modulus, it is used to compensate for energy loss at blurred edges (the high-frequency modulus of blurred edges is lower than that of normal edges). Modulus attenuation formula ).
[0262] Adjusting the amplitude of the quantum state in the frequency domain using a quantum multiplication circuit (including an RY rotating gate). Adjust the formula to ( (As a gain factor), it keeps the quantum state phase unchanged and avoids edge direction distortion.
[0263] Step S3033: Reconstruct the spatial domain image using inverse quantum Fourier transform (IQFT).
[0264] Specifically, construct the inverse quantum circuit corresponding to QFT, satisfying The enhanced frequency domain quantum state Transformation into a spatial quantum state The conversion formula is:
[0265]
[0266] High-frequency energy and phase information are preserved during the conversion process, and spatial position errors are minimized. Pixels The edge position after sharpening. (Original edge location).
[0267] Through quantum-based fine manipulation, "on-demand enhancement" of edges at different scales is achieved, and edge transition band compression is realized: the distance between transition pixels increases from... Pixel compression to Pixels, compression ratio The difference in grayscale between text and background is from Upgraded to Improve relationships Edge curvature error Pixels (Edge radius).
[0268] Step S40: For special scenarios such as tilting, multi-color overprinting, and ultra-thin bezels, quantum rotation correction, color channel separation, and boundary annihilation operators are used for processing.
[0269] In one feasible implementation, step S40 may include steps S401 to S403:
[0270] Step S401, Tilted stamp (0°-45°) repair, "precise geometric reconstruction" of quantum rotation correction, achieves high-precision measurement of tilt angle through quantum edge phase gradient analysis, and combines quantum rotation operator and quantum entanglement to complete non-destructive correction of stamp and restoration of document content.
[0271] In one specific implementation, step S401 may include steps S4011 to S4013:
[0272] Step S4011, quantum-level measurement of tilt angle θ.
[0273] Specifically, an 8-qubit quantum edge detection circuit is constructed to perform continuous phase measurement on N pixels (N≥1024) in the edge region of the seal, obtaining the phase angle of each pixel. (i=1,2,...,N), and calculate the phase difference between adjacent pixels. Construct the phase gradient matrix (x is the pixel x-coordinate), the phase gradient matrix is analyzed using the Quantum Fourier Transform (QFT) operator, and the tilt angle θ is directly output, satisfying the formula:
[0274]
[0275] In the formula, QFT is the quantum Fourier transform operator, and measurement error is... .
[0276] A quantum neural network noise reduction module is introduced to denoise the original phase value. Perform noise filtering to eliminate phase fluctuations. Outliers, obtained after filtering phase values It satisfies the formula:
[0277]
[0278] Step S4012, global rotation transformation of the quantum rotation operator.
[0279] Specifically, define the quantum spin operator. Its matrix expression is:
[0280]
[0281] In the formula, RY revolving door (rotation angle is) ), For the control NOT gate (control bit i, target bit i+1), N is the number of qubits corresponding to the pixels in the stamp area.
[0282] Applying the aforementioned rotation operator to the original quantum state of the seal region yields an upright quantum state, satisfying the formula:
[0283]
[0284] Phase difference between adjacent pixels after rotation ( (The phase difference before rotation), and the phase difference deviation. This ensures that the rotational transformation is lossless.
[0285] Step S4013, Quantum entanglement cooperative repair after orientation.
[0286] Specifically, for the quantum state after the inversion The system employs quantum entanglement-assisted reconstruction technology; the quantum entanglement repair module identifies the 8-neighbor pixel relationships of character strokes and dynamically adjusts the entanglement coefficient between the i-th and j-th pixels according to the character stroke type. It satisfies the formula:
[0287]
[0288] Step S402, multi-color overprint (red + blue) area processing, through quantum state orthogonal encoding of RGB three channels, channel-specific quantum feature matching and anti-crosstalk fusion, to achieve independent stripping of multi-color stamps and preservation of document content.
[0289] In one specific implementation, step S402 may include S4021~S4023:
[0290] Step S4021, orthogonal encoding of quantum color channels.
[0291] Specifically, an "amplitude-phase dual encoding" method is used to map the three RGB channels into quantum states. (Red Channel) (Green Channel) (Blue channel) The three-channel quantum states are combined into an RGB quantum state through tensor product. It satisfies the formula:
[0292]
[0293] Furthermore, the quantum states of each channel satisfy orthogonality and independence. To avoid interference between channels.
[0294] Step S4022: Quantum feature matching and annihilation of the sub-channels.
[0295] Specifically, regarding the quantum state of the red channel Calculate its quantum state with that of the red stamp in the template library. The quantum fidelity for the blue channel quantum state Calculate its quantum state with that of the blue stamp in the template library. The quantum fidelity is calculated using the following formula:
[0296]
[0297] In the formula, For the quantum state of the channel to be matched ( or ), For the quantum state of the stamp template corresponding to the color; at that time It was determined that the stamp texture area was matched and located.
[0298] Applying a quantum NOT gate (X-gate) to the quantum state of the matched stamp region to perform amplitude flipping achieves color removal, satisfying the formula:
[0299]
[0300] In the formula, It is a quantum NOT gate. To repair the quantum state of the post-channel; to repair the amplitude of the post-channel. ( (This is a grayscale value of the document content), retaining only the document content information.
[0301] Step 4023, anti-crosstalk fusion of quantum states.
[0302] Specifically, the quantum state of the red channel after measurement and repair. Blue channel quantum state With green channel quantum state phase difference ;
[0303] like ( The phase is adjusted to alignment via the RY rotary door to satisfy the formula:
[0304]
[0305] In the formula, For the channel quantum state after phase alignment, Rotation angle The RY scandal.
[0306] The phase-aligned red, green, and blue channel quantum states are re-fused to obtain the final fused state. It satisfies the formula:
[0307]
[0308] Color consistency error after fusion The error calculation formula is:
[0309]
[0310] In the formula, This refers to the quantum state of a standard unbiased color document.
[0311] Step S403: Remove the ultra-thin border stamp (line width ≤ 1 pixel). Identify the border quantum state through amplitude threshold screening and phase continuity detection, and achieve targeted removal of the ultra-thin border by combining the boundary annihilation operator.
[0312] In one specific implementation, step S403 may include S4031~S4032:
[0313] Step S4031, ultra-fine identification of the boundary quantum state.
[0314] Specifically, the amplitude of the quantum states in the seal region is measured, and the quantum states of the border are distinguished based on the amplitude characteristics. quantum state at the edge of text It satisfies the formula:
[0315]
[0316] In the formula, This represents the amplification of the quantum state.
[0317] Phase continuity is detected for the selected candidate bounding box quantum states, and the rate of change of phase along path s is calculated. It satisfies the formula:
[0318]
[0319] Combining amplitude filtering and phase detection improves the accuracy of border recognition. The accuracy calculation formula is as follows:
[0320]
[0321] Step S4032, targeted operation of the boundary annihilation operator.
[0322] Specifically, define the boundary annihilation operator. Phase filtering gate With amplitude annihilation gate A series connection is formed, satisfying the formula:
[0323]
[0324] In the formula, the phase filtering gate ( Pixels Two-stage control NOT gates are used to precisely lock the boundary quantum state; amplitude annihilation gates (RY door rotation angle) ), used to compress the amplitude of the quantum state in the frame.
[0325] Applying the annihilation operator to the identified bounding box quantum state, the amplitude compression satisfies the formula:
[0326]
[0327] In the formula, The amplitude of the original frame quantum state. This is the amplitude after compression; after compression This is equivalent to mapping the boundary quantum state to a vacuum state. This allows for the complete removal of the border.
[0328] It should be noted that quantum state operations are performed in units of 0.1 pixels, with a resolution of... Pixel, the smallest distinguishable size difference Pixels, resolution using traditional methods Pixel, the smallest distinguishable size difference Pixels, the relationship between the two in terms of precision is Based on the aforementioned precision advantages, it can accurately distinguish between ultra-thin borders (0.5 pixels) and text (≥1 pixel), avoiding edge erosion by traditional methods; the integrity retention rate of the repaired text edges reaches 100%, and the retention rate is calculated using the following formula:
[0329]
[0330] Step S50: Verify the repair result. If it does not meet the standard, return to the texture decoupling and filling to edge sharpening stage to readjust the parameters.
[0331] Specifically, the core of the verification is to judge whether the restoration quality meets the standards through quantitative indicators. The Structural Similarity Index (SSIM) measures the structural consistency between the restored area and the original document (the value ranges from 0 to 1, the closer to 1, the more natural the restoration, and the document requires an SSIM ≥ 0.92 after restoration). The Peak Signal-to-Noise Ratio (PSNR) evaluates the noise level of the restored image (the unit is dB, the higher the value, the less noise).
[0332] In one specific implementation, if the SSIM or PSNR is detected to be below the preset threshold (e.g., SSIM < 0.92, PSNR < 30dB), the repair result is deemed unsatisfactory, triggering the "return to readjustment" process.
[0333] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for seal removal and document restoration based on quantum state coordinated control, characterized in that: Includes the following steps: S10. Obtain the coordinates of the located stamp area and the original image of the document to be repaired; The quantum side calls a pre-stored quantum feature template library of typical seal quantum state features, while the classical side processes the grayscale image of the seal positioning area through a lightweight convolutional neural network and outputs quantum state control parameters to complete the quantum-classical feature collaborative preparation. S20. Construct quantum entangled states for each pixel and its 8 neighboring pixels within the stamp area, and add entanglement degree constraints during the quantum alternating projection iteration process; The high-frequency features of the seal and the low-frequency features of the document are extracted by quantum wavelet transform and encoded into quantum states respectively. The Gram-Schmidt quantum orthogonalization process is used to decouple the features. Then, the quantum generative adversarial network is used to generate the filling content, thus completing the quantum texture decoupling and adaptive filling. S30. Calculate the transparency factor of the seal, dynamically adjust the phase of the repair basis vector according to the transparency factor, and perform dynamic quantum phase adjustment; A quantum neural network containing a combination of controlled Z-gates and rotation gates is used to process and repair the noisy quantum state, and output the denoised quantum state. The image is subjected to multi-scale quantum Fourier transform, scale-adaptive gain is applied to high-frequency components, and then the image is reconstructed by inverse quantum Fourier transform to complete edge quantum state sharpening optimization. S40. Trigger adaptive processing for special scenarios as needed. The special scenarios include tilted stamps, multi-color overprinted areas, and ultra-thin border stamps. S50. Detect the structural similarity index and peak signal-to-noise ratio of the repair results. If they meet the preset threshold, output the target document without stamp marks. If they do not meet the threshold, return to the quantum texture decoupling and adaptive filling steps to re-optimize the parameters.
2. The method for seal removal and document restoration based on quantum state coordinated control according to claim 1, characterized in that: In step S20, a quantum entangled state is constructed for each pixel within the stamp area and its 8 neighboring pixels. The specific operation method is as follows: (1) For any pixel within the stamp area, select its eight neighboring pixels in the top, bottom, left, right and diagonal directions as entanglement partners; (2) Construct the quantum entangled state between the target pixel and its neighboring pixels. The entangled state is formed by the quantum states of the target pixel and each neighboring pixel being correlated through tensor product, and the influence weight of the neighboring pixels on the target pixel is adjusted by the entanglement coefficient. (3) Dynamically optimize the entanglement coefficient through the quantum entanglement swapping protocol.
3. The method for seal removal and document restoration based on quantum state coordinated control according to claim 2, characterized in that: The quantum entanglement swapping protocol dynamically optimizes the entanglement coefficient as follows: if a neighboring pixel and the target pixel belong to the same character stroke, the corresponding entanglement coefficient is increased; if a neighboring pixel belongs to the background region, the corresponding entanglement coefficient is decreased.
4. The method for seal removal and document restoration based on quantum state cooperative control according to claim 1, characterized in that: In step S20, the specific operation method of quantum texture decoupling and adaptive filling is as follows: (1) By using quantum wavelet transform to analyze 16 frequency channels of the image in parallel, high-frequency features of the seal in the range of 1024-4096Hz and low-frequency features of the document in the range of 256-1024Hz were selected. (2) The high-frequency features and low-frequency features are mapped to the stamp quantum state and the document quantum state respectively by using amplitude-phase dual-parameter encoding: the amplitude of the stamp quantum state is positively correlated with the gray intensity of the stamp, and the phase corresponds to the direction of the stamp texture; the amplitude attenuation coefficient of the document quantum state reflects the continuity of the document content, and the phase correlation ensures the smooth transition of the text strokes. (3) Feature decoupling is achieved through Gram-Schmidt quantum orthogonalization: First, the projection component of the seal quantum state onto the document quantum state is calculated, then the projection component is removed from the seal quantum state to eliminate the feature overlap between the two, and finally the amplitude of the processed seal quantum state is adjusted to meet the normalization requirements of the quantum state. (4) Using a quantum generative adversarial network to generate filling content: The quantum generator receives the quantum state of the 3×3 neighborhood, processes it through a hidden layer containing 2 rotation gates and 1 controlled gate, and outputs the quantum state of the filling region; The quantum discriminator determines the authenticity of the generated content by calculating the similarity distance between the filled quantum state and the quantum state of the real document. If the distance exceeds a preset threshold, it will adjust the rotation gate angle of the quantum generator until the distance meets the requirements. (5) Transform the filling quantum state into a classical pixel through quantum tomography: Perform multiple measurements on the quantum state, take the average amplitude to determine the pixel gray level, read the phase angle to convert it into the pixel gradient direction, and ensure that the filling area is continuous with the neighborhood texture.
5. The method for seal removal and document restoration based on quantum state cooperative control according to claim 1, characterized in that: In step S30, the specific operation method for performing dynamic quantum phase adjustment is as follows: (1) Extract the RGB or grayscale values of each pixel within the stamp area and calculate the normalized brightness of each pixel; (2) The normalized brightness of 1024 pixels is processed in parallel by the quantum averaging operator to calculate the transparency factor of the seal. (3) Determine the phase compensation angle of the repair basis vector based on the transparency factor: As the reference phase, the larger the transparency factor, the greater the adjustment range of the phase compensation angle, ensuring that the compensation angle matches the stamp interference phase; (4) Apply the phase compensation angle to the control end of the rotating gate, apply rotation to the quantum state of the repair basis vector, and obtain the adjusted repair basis vector quantum state; (5) Perform quantum interference between the mixed quantum state containing the stamp interference and the adjusted repair basis vector quantum state, eliminate the stamp interference through phase cancellation, and restore the original quantum state of the document.
6. The method for seal removal and document restoration based on quantum state cooperative control according to claim 1, characterized in that: In step S30, the specific operation method for processing the repaired noisy quantum state using a quantum neural network is as follows: The repaired noisy quantum state is encoded into an input layer consisting of 8 qubits: during encoding, the pixel grayscale value is mapped proportionally to the amplitude of the qubit, and the spatial gradient direction of the pixel corresponds to the phase of the qubit. The hidden layer contains four quantum neurons, each consisting of a controlled Z-gate and a rotation gate connected in series: the controlled Z-gate is used to identify the spatial correlation of noise; the rotation gate achieves noise amplitude attenuation and phase cancellation by adjusting the rotation angle, decomposing the noisy quantum state into a document feature subspace and a noise feature subspace; The output layer applies an inverse parameterization transformation to the quantum state output by the hidden layer, sets the qubits corresponding to the noise feature subspace to a vacuum state, eliminates noise contributions, and obtains a pure document quantum state. Perform multiple quantum measurements on the quantum state of the clean document, and take the average value of the grayscale measurements as the final pixel grayscale.
7. The method for seal removal and document restoration based on quantum state cooperative control according to claim 6, characterized in that: In step S30, the specific operation method for edge quantum state sharpening optimization is as follows: A quantum Fourier transform circuit is constructed using a system with no fewer than 8 qubits to perform a 3-level quantum Fourier transform; Each frequency component is encoded using three parameters: amplitude, phase, and frequency. Apply scale-adaptive gain to different levels of frequency components; The amplitude of the quantum state in the frequency domain is adjusted by using a quantum multiplication circuit while maintaining the phase. Construct an inverse quantum Fourier transform circuit corresponding to the quantum Fourier transform to convert the enhanced frequency domain quantum state into a spatial domain quantum state, which is used to compress pixels in the edge transition zone and improve the grayscale difference between text and background.
8. The method for seal removal and document restoration based on quantum state cooperative control according to claim 7, characterized in that: In step S40, the adaptive handling method for special scenarios is as follows: For seals with tilt angles of 0°-45°: A quantum edge detection circuit composed of 8 qubits is used to measure the phase angle of the pixels at the edge of the seal, calculate the phase difference between adjacent pixels and construct a phase gradient matrix; the phase gradient matrix is analyzed by a quantum Fourier transform operator to obtain the seal tilt angle; a quantum rotation operator is constructed to perform positive correction on the quantum state of the seal area before performing the repair, so as to avoid text truncation caused by angle deviation; For the red and blue multi-color overprinted region: the RGB three channels are mapped to orthogonal quantum states to construct RGB combined quantum states; the similarity between the quantum state of each color channel and the quantum state of the corresponding color stamp template is calculated. If the similarity is greater than the threshold, it is determined to be a stamp region; the quantum state amplitude of the corresponding channel stamp region is flipped by a quantum NOT gate to remove the stamp features. Adjust the phase of the quantum states in each channel to align with the phase of the green channel and then re-merge them; For ultra-thin border stamps with a line width ≤ 1 pixel: measure the amplitude of the quantum state in the stamp region, and screen candidate border quantum states with amplitude in the range of 0.1-0.3; detect the rate of change of the phase of the candidate quantum state along the path, and if the rate of change is less than the threshold, it is determined to be a border quantum state; construct a boundary annihilation operator to compress the amplitude of the border quantum state to below 0.
01.
9. The method for seal removal and document restoration based on quantum state cooperative control according to claim 1, characterized in that: In step S50, the structural similarity index and peak signal-to-noise ratio of the repair result are detected, including: Preset structural similarity index threshold and peak signal-to-noise ratio threshold; If the structural similarity index of the repair result is lower than the structural similarity index threshold or the peak signal-to-noise ratio is lower than the peak signal-to-noise ratio threshold, return to the quantum texture decoupling and adaptive filling step, and re-optimize the quantum orthogonalization parameters and the rotation gate angle of the quantum generative adversarial network; If the repair results meet the threshold requirements, output a target document without stamp traces in PDF or Word format.
10. The method for seal removal and document restoration based on quantum state cooperative control according to claim 1, characterized in that: In step S10 The quantum feature template library is built on a 10-qubit system and pre-stores the quantum state features of more than 3,000 typical seals, which cover red, blue, black, and official and private seal types. The classical side processes the grayscale image of the stamp positioning area using a lightweight CNN and outputs quantum state control parameters, including: the lightweight CNN extracts the grayscale distribution, edge gradient, stamp type probability, texture complexity and document content type features of the positioning area, and outputs control parameters for adjusting the quantum state amplitude and phase based on the feature analysis results.
Citation Information
Patent Citations
Quantum color image watermarking method based on quantum error correction coding
CN116957896A
Quantum type AR scene generation method based on hybrid model under Babylon.js framework
CN120339556A
Watermark processing method, device, equipment, medium and program product
CN120429848A
Electronic seal verification method based on quantum true random number and anti-quantum multi-dimensional dynamic code
CN120429900A
Seal Anti-counterfeiting verification method, device, and computer readable storage medium
WO2020082577A1
Cited By
Quantum computer probability model optimization processing method and system
CN121189518A
Quantum computer probabilistic model optimization processing method and system
CN121189518B
Quantum fuzzy neural network adaptive to high-dimensional input and classification method
CN121303194A
Quantum fuzzy neural network and classification method suitable for high-dimensional input
CN121303194B