Method for removing seal and repairing document based on quantum state cooperative regulation

By employing quantum state collaborative control technology, the problem of poor seal removal in government documents has been solved, achieving high-precision and adaptive seal removal and document repair, ensuring document quality and content integrity.

CN120931533BActive Publication Date: 2025-12-23SICHUAN JISU POWER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511455572.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2025-12-23
Estimated Expiration
2045-10-13

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently remove stamp marks from government documents without compromising the integrity and quality of the document content, especially when dealing with stamps with uneven transparency, and they lack adaptability in specific scenarios.

Method used

By employing a quantum state collaborative control method, through quantum entangled state modeling, Gram-Schmidt orthogonalization, and quantum generative adversarial networks, combined with dynamic quantum phase adjustment and multi-scale quantum Fourier transform, we can achieve precise separation and adaptive filling of seal and document features, and handle different transparency levels and special scenarios.

Benefits of technology

It achieves high-precision and high-fidelity stamp removal, ensuring the integrity and quality of document content, adapting to various complex scenarios, and improving OCR recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120931533B_ABST
    Figure CN120931533B_ABST
Patent Text Reader

Abstract

The application discloses a seal removal and document repair method based on quantum state cooperative regulation, relates to the cross technical field of document image processing and quantum computing, and comprises the following steps: obtaining to-be-processed information, and performing quantum-classical feature cooperative preparation; guaranteeing the continuity of character strokes through quantum entanglement state modeling and entanglement degree constraint iteration, realizing texture decoupling by means of quantum wavelet transform and Gram-Schmidt orthogonalization, and combining quantum generative adversarial network adaptive filling; offsetting the superimposed interference of different transparency seals by means of dynamic quantum phase adjustment, and optimizing the image quality by means of quantum neural network noise reduction and multi-scale quantum Fourier sharpening; checking the repair result, and returning to the texture decoupling filling to the edge sharpening link to re-adjust parameters if the result does not reach the standard; for special scenes such as inclination, multi-color superimposition and ultra-thin frame, quantum rotation correction, color channel separation and boundary annihilation operator processing are used, and finally, high-precision, high-naturalness and high-adaptability repair of seal removal is realized, and high-fidelity results are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of document image processing and quantum computing, in particular to a seal removal and document repair method based on quantum state cooperative regulation. BACKGROUND

[0002] In the electronic processing of government documents, accurate removal of seal traces and document repair are core links to guarantee the reuse value of the documents. However, the traditional repair technology and the existing quantum auxiliary scheme cannot simultaneously consider the seal removal effect and the integrity of the document content and the image quality, and cannot meet the needs of the government scenario, with the following specific limitations:

[0003] The traditional quantum alternating projection algorithm has defects. When processing the intersection area of the text strokes, the algorithm only iteratively repairs a single pixel without considering the texture correlation of adjacent pixels, which easily leads to stroke breakage, blurring and distortion, and cannot guarantee the continuity of the text.

[0004] It is difficult to separate the mixed area of the seal and the document content. The seal is often overlapped with the table lines and the annotations, and the two types of texture features are similar. The classical algorithm is prone to misjudgment, and the quantum state encoding also has no targeted mapping, which leads to the overlap of the quantum states of the two, and the seal remains or the document content is mistakenly deleted after decoupling.

[0005] The processing capacity of the seal with different transparencies is insufficient. The transparency span of the seal of the government document is large, and the seal with medium transparency is the most difficult to process. The interference of the quantum state superposition of the seal and the document is significant, and the existing technology cannot dynamically compensate by adjusting the phase of the fixed basis vector. The removal success rate in this interval is low, and the image quality after repair is poor.

[0006] The image quality after repair is poor. The quantum state iteration and state conversion easily introduce noise, and the traditional noise reduction cannot eliminate the structured noise. The transition zone of the text edge is widened due to the loss of phase, and the contrast is reduced, which reduces the OCR recognition accuracy.

[0007] The special scene adaptability is missing. The correction of the inclined seal easily causes the deformation of the document, the color channel interference of the red+blue multi-color superimposed seal is difficult to handle, and the ultra-thin frame seal is easily misjudged with the text edge and is easily eroded when removed. SUMMARY

[0008] The purpose of the present application is to provide a seal removal and document repair method based on quantum state cooperative regulation to solve the problems of the existing seal removal technology, such as the defects of the traditional quantum alternating projection algorithm, the difficulty in separating the mixed area of the seal and the document content, the insufficient processing capacity of the seal with different transparencies, the poor image quality after repair, and the lack of special scene adaptability.

[0009] To this end, the present application provides a seal removal and document repair method based on quantum state cooperative regulation, comprising the following steps:

[0010] S10, obtaining the coordinates of the located seal region and the original image of the document to be repaired;

[0011] The quantum side stores a quantum feature template library pre-storing typical seal quantum state features, and the classical side processes a gray image of the seal positioning region through a lightweight convolutional neural network to output quantum state regulation parameters, thereby completing quantum-classical feature collaborative preparation;

[0012] S20, constructing a quantum entangled state for each pixel in the seal region and its 8-neighborhood pixels, and adding an entanglement degree constraint in a quantum alternating projection iteration process;

[0013] High-frequency features of the seal and low-frequency features of the document are extracted through quantum wavelet transformation and encoded into quantum states respectively, feature decoupling is realized through Gram-Schmidt quantum orthogonalization processing, and filling content is generated by using a quantum generative adversarial network, thereby completing quantum watermark decoupling and adaptive filling;

[0014] S30, calculating a transparency factor of the seal, dynamically adjusting the phase of a repair basis vector according to the transparency factor, and performing dynamic quantum phase adjustment;

[0015] A quantum neural network comprising a combination of a controlled-Z gate and a rotation gate is used to process the repaired quantum state containing noise, and output a denoised quantum state;

[0016] Multi-scale quantum Fourier transform is performed on the repaired image, a scale adaptive gain is applied to high-frequency components, and the image is reconstructed through inverse quantum Fourier transform, thereby completing edge quantum state sharpening optimization;

[0017] S40, triggering special scene adaptive processing on demand, wherein the special scene includes a tilted seal, a multi-color superimposed seal region, and an ultra-thin frame seal;

[0018] S50, detecting the structural similarity index and the peak signal-to-noise ratio of the repaired result, and if the pre-set threshold is met, outputting a target document without seal traces, and if the pre-set threshold is not met, returning to the quantum watermark decoupling and adaptive filling step to re-optimize parameters.

[0019] In an embodiment, in the S20 step, a quantum entangled state is constructed for each pixel in the seal region and its 8-neighborhood pixels, and the specific operation mode is as follows:

[0020] (1) For any pixel in the seal region, 8 neighborhood pixels in the up, down, left, right, and diagonal directions are selected as entangled partners;

[0021] (2) A quantum entangled state of the target pixel and the neighborhood pixels is constructed, the entangled state is formed by associating the quantum states of the target pixel and the neighborhood pixels through tensor product, and the influence weight of the neighborhood pixels on the target pixel is adjusted by an entanglement coefficient;

[0022] (3) dynamically optimize the entanglement coefficient through quantum entanglement swapping protocol.

[0023] In an embodiment, the way that the quantum entanglement swapping protocol dynamically optimizes the entanglement coefficient is: if the neighboring pixel and the target pixel belong to the same character stroke, the corresponding entanglement coefficient is increased; if the neighboring pixel belongs to the background region, the corresponding entanglement coefficient is reduced.

[0024] In an embodiment, the specific operation mode of quantum decoupling and adaptive filling in the S20 step is:

[0025] (1) analyze 16 frequency channels of the image in parallel through quantum wavelet transform, and screen out the seal high-frequency features in the range of 1024-4096 Hz and the document low-frequency features in the range of 256-1024 Hz;

[0026] (2) map the high-frequency features and the low-frequency features into seal quantum states and document quantum states respectively by using amplitude-phase double-parameter coding: the amplitude of the seal quantum state is positively correlated with the seal gray intensity, and the phase corresponds to the seal texture direction; the amplitude decay coefficient of the document quantum state reflects the continuity of the document content, and the phase correlation ensures smooth transition of the character strokes;

[0027] (3) realize feature decoupling through Gram-Schmidt quantum orthogonalization processing: first, calculate the projection component of the seal quantum state on the document quantum state, then eliminate the projection component from the seal quantum state to eliminate the feature overlap between the two, and finally adjust the amplitude of the processed seal quantum state to meet the normalization requirement of the quantum state;

[0028] (4) generate the filling content by using quantum generative adversarial network: the quantum generator receives the quantum states of the 3x3 neighborhood, processes them through a hidden layer containing 2 rotation gates and 1 controlled gate, and then outputs the quantum states of the filling area; the quantum discriminator judges the authenticity of the generated content by calculating the similarity distance between the filling quantum state and the real document quantum state, and if the distance exceeds the preset threshold, it feeds back to adjust the rotation gate angle of the quantum generator until the distance meets the requirement;

[0029] (5) convert the filling quantum state into classical pixels through quantum chromatography technology: take the amplitude statistical average value to determine the pixel gray scale, and read the phase angle to convert it into the pixel gradient direction, so as to ensure the continuity of the filling area and the neighborhood texture.

[0030] In an embodiment, the specific operation mode of performing dynamic quantum phase adjustment in the S30 step is:

[0031] (1) extract the RGB values or gray values of each pixel in the seal area, and calculate the normalized brightness of each pixel;

[0032] (2) Calculate the transparency factor of the seal by parallel processing 1024 pixels of normalized brightness through quantum average operators;

[0033] (3) Determine the phase compensation angle of the repair basis vector according to the transparency factor: take a specific radian as the reference phase, the greater the transparency factor, the greater the adjustment range of the phase compensation angle, and ensure that the compensation angle matches the phase of the seal interference;

[0034] (4) Load the phase compensation angle to the control end of the rotation gate to apply rotation to the quantum state of the repair basis vector, and obtain the adjusted repair basis vector quantum state;

[0035] (5) Make the mixed quantum state containing the seal interference interfere with the adjusted repair basis vector quantum state, eliminate the seal interference through phase cancellation, and restore the original quantum state of the document.

[0036] In an embodiment, the specific operation mode of processing the repaired quantum state with noise in the S30 step is as follows:

[0037] Encode the repaired quantum state with noise into an input layer composed of 8 quantum bits: when encoding, the pixel gray value is proportionally mapped to the amplitude of the quantum bit, and the spatial gradient direction of the pixel corresponds to the phase of the quantum bit;

[0038] The hidden layer includes 4 quantum neurons, each of which is composed of a controlled-Z gate and a rotation gate in series: the controlled-Z gate is used to identify the spatial correlation of noise; the rotation gate realizes noise amplitude attenuation and phase cancellation by adjusting the rotation angle, and decomposes the noisy quantum state into a document feature subspace and a noise feature subspace;

[0039] The output layer applies an inverse parameterized transformation to the quantum state output by the hidden layer, sets the quantum bits corresponding to the noise feature subspace to the vacuum state, eliminates the noise contribution, and obtains a pure document quantum state;

[0040] Perform multiple quantum measurements on the pure document quantum state, and take the average value of the gray scale measurement as the final pixel gray scale.

[0041] In an embodiment, the specific operation mode of edge quantum state sharpening optimization in the S30 step is as follows:

[0042] A quantum Fourier transform circuit is constructed using a system of no less than 8 quantum bits to perform 3-level quantum Fourier transform;

[0043] Each frequency component is encoded by "amplitude-phase-frequency" three parameters;

[0044] Scale adaptive gain is applied to different levels of frequency components;

[0045] The amplitude of the frequency domain quantum state is adjusted by a quantum multiplication circuit, and the phase is kept unchanged.

[0046] An inverse quantum Fourier transform circuit corresponding to the quantum Fourier transform is constructed to convert the enhanced frequency domain quantum state into a spatial domain quantum state, which is used to compress the edge transition band pixels and improve the gray scale difference between the text and the background.

[0047] In an embodiment, in the S40 step, the adaptive processing of the special seal is as follows:

[0048] For a seal with an inclination angle of 0°-45°: a quantum edge detection circuit composed of 8 qubits is used to measure the phase angle of the seal edge pixels, calculate the phase difference between adjacent pixels, and construct a phase gradient matrix; a quantum Fourier transform operator is used to analyze the phase gradient matrix to obtain the inclination angle of the seal; a quantum rotation operator is constructed to correct the seal region quantum state before performing repair, thereby avoiding text truncation caused by angle deviation;

[0049] For a red plus blue multi-color superimposed region: the RGB three channels are respectively mapped into orthogonal quantum states to construct an RGB combined quantum state; the similarity of each color channel quantum state to the corresponding color seal template quantum state is calculated, and if the similarity is greater than a threshold value, it is determined as a seal region; the quantum state amplitude of the corresponding channel seal region is flipped by a quantum NOT gate to remove the seal features; the phases of the quantum states of each channel are adjusted to align with the phase of the green channel, and then they are fused again;

[0050] For a super-thin frame seal with a line width of ≤1 pixel: the amplitude of the seal region quantum state is measured, and candidate frame quantum states with an amplitude in the range of 0.1-0.3 are selected; the change rate of the phase of the candidate quantum state along the path is detected, and if the change rate is less than a threshold value, it is determined as a frame quantum state; a boundary annihilation operator is constructed to compress the amplitude of the frame quantum state to below 0.01.

[0051] In an embodiment, in the S50 step, the structural similarity index and the peak signal-to-noise ratio of the repair result are detected, including:

[0052] The structural similarity index threshold value and the peak signal-to-noise ratio threshold value are preset.

[0053] If the structural similarity index of the repair result is lower than the structural similarity index threshold value or the peak signal-to-noise ratio is lower than the peak signal-to-noise ratio threshold value, the quantum watermark decoupling and adaptive filling step is returned to, and the quantum orthogonalization parameters and the rotation gate angle of the quantum generative adversarial network are re-optimized;

[0054] If the repair result meets the threshold requirement, a target document without seal traces in PDF or Word format is output.

[0055] In an embodiment, in the S10 step,

[0056] The quantum characteristic template library is constructed based on a system of 10 qubits, and pre-stores quantum state characteristics of more than 3000 typical seals, which cover red, blue, black, and official and private seal types.

[0057] The classical side processes the gray scale image of the seal positioning area through a lightweight CNN, and outputs quantum state regulation parameters, including: the lightweight CNN extracts features such as gray scale distribution and edge gradient of the positioning area, and outputs regulation parameters for adjusting the amplitude and phase of the quantum state according to the feature analysis result.

[0058] The seal removal and document repair method based on quantum state cooperative regulation has the following advantages:

[0059] The seal removal and document repair method cooperatively extracts features by calling the quantum characteristic template library and the classical lightweight CNN, models the quantum entangled state, iterates the entanglement degree constraint, realizes pattern decoupling through quantum wavelet transform and Gram-Schmidt orthogonalization, combines quantum generative adversarial network for adaptive filling, dynamically adjusts the quantum phase to offset the superimposed interference of different transparency seals, uses quantum neural network for noise reduction and multi-scale quantum Fourier sharpening to optimize image quality, checks the repair result, and finally realizes high-precision, high-naturalness, and high-adaptability repair of seal removal, and guarantees high-fidelity results. BRIEF DESCRIPTION OF DRAWINGS

[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the embodiment or related art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0061] Figure 1 The flowchart of the first embodiment of the present application;

[0062] Figure 2 The quantum entanglement auxiliary repair reconstruction flowchart of the first embodiment of the present application;

[0063] Figure 3 The quantum pattern decoupling and adaptive filling flowchart of the first embodiment of the present application;

[0064] Figure 4 The dynamic quantum phase adjustment flowchart of the first embodiment of the present application;

[0065] Figure 5 The quantum neural network noise reduction enhancement flowchart of the first embodiment of the present application. DETAILED DESCRIPTION

[0066] In order to make the purposes, technical solutions and beneficial technical effects of the present application clearer, the present application will be further described in detail below in combination with the drawings and specific embodiments. It should be understood that the specific embodiments described in the present specification are only for the purpose of explaining the present application, and are not intended to limit the present application.

[0067] Embodiment:

[0068] Reference Figure 1 , Figure 1 The present application is based on the process schematic diagram of the first embodiment of the method for removing seals and repairing documents based on quantum state collaborative control. The method for removing seals and repairing documents based on quantum state collaborative control can include steps S10-S50:

[0069] Step S10, obtaining the information to be processed, and performing quantum-classical feature collaborative preparation.

[0070] In one possible embodiment, step S10 can include steps S101-S104:

[0071] Step S101, accurate receiving and preprocessing of the information to be processed.

[0072] In one specific embodiment, step S101 can include steps S1011-S1012:

[0073] Step S1011, receiving core data, wherein the core data includes a document image to be processed and seal region coordinates.

[0074] It should be noted that the document image to be processed is the original government document to be repaired, and the color mode is compatible with RGB and grayscale. The seal region coordinates are the output of the pre-positioning module, and the format is a rectangular bounding box coordinate , which accurately frames the seal coverage range (error ≤ 1 pixel, avoiding irrelevant background).

[0075] Step S1012, image preprocessing, performing lightweight preprocessing on the received document image to clear interference for subsequent feature extraction.

[0076] Specifically, the RGB image of the positioning region is converted to a grayscale image (if it is a native grayscale image, it is skipped), the standardized grayscale value is normalized to the [0, 1] interval according to the BT.601 standard, the influence of color channel difference on feature extraction is eliminated, and the grayscale normalization mathematical expression is:

[0077]

[0078] In the formula, is the coordinate The grayscale pixel value at that location, and its range. , , , The color image is in coordinates The red, green, and blue channel pixel values ​​at that 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 3-layer lightweight architecture (input layer, hidden layer and output layer), the total number of parameters is less than 100,000, and real-time processing is supported. The input layer receives a positioning area grayscale subgraph (adaptively cut according to the size of the seal to ensure complete texture coverage), the hidden layer is designed with two convolution kernels (3x3) to extract "edge texture features" (such as seal ring texture, text stroke edge, etc.) and "gray distribution features" (such as gray gradient caused by seal transparency), and the output layer outputs a four-dimensional feature vector corresponding to "seal type probability (official seal / private seal), transparency interval (5%-10% / 10%-30% / 30%-60% / 60%-80%), texture complexity (low / medium / high), and document content type (text / table / handwriting)".

[0088] Step S1032, outputting the "quantum state control parameter".

[0089] The 4-dimensional feature vector of the lightweight CNN is converted into 6 quantum state control parameters, which directly guide the feature extraction logic on the quantum side.

[0090] It should be noted that the 6 quantum state control parameters are respectively the template matching weight corresponding to the seal type probability for adjusting the matching priority of the candidate template, the amplitude attenuation coefficient corresponding to the transparency interval for correcting the amplitude of the seal quantum state, the quantum wavelet transform scale corresponding to the texture complexity for determining the accuracy of the QWT analysis frequency, the entanglement coefficient reference corresponding to the document content type (text) for setting the entanglement weight of the text pixel neighborhood, the phase correlation threshold corresponding to the document content type (table) for ensuring the phase continuity of the table line quantum state, the filling learning rate corresponding to the document content type (handwriting) for adjusting the filling iteration speed of the QGAN.

[0091] It should be further noted that the template matching weight has a value range of , the amplitude attenuation coefficient has a value range of , the quantum wavelet transform scale has a value range of , the entanglement coefficient reference has a value range of , the phase correlation threshold has a value range of , and the filling learning rate has a value range of .

[0092] Step S104, quantum-classical collaborative feature extraction, outputting an accurate feature set.

[0093] In one specific embodiment, step S104 can include steps S1041-S1042:

[0094] Step S1041, quantum-classical collaborative extraction.

[0095] Specifically, the quantum side processes the positioning area based on a 10-qubit system (converts the grayscale image into a quantum state ), combines the candidate template quantum state and the regulation parameters , and performs a feature extraction operation.

[0096] In a specific embodiment, the “feature extraction operation” in step S1041 can include steps A1041-A1043.

[0097] Step A1041, quantum inner product calculation is performed to select one template that best matches the positioning area.

[0098] Step A1042, quantum wavelet transform (QWT) is performed according to the regulation parameters to analyze the frequency characteristics of the positioning area quantum state and separate the “seal high-frequency texture quantum state” (1024-4096 Hz, such as star rays) and the “document low-frequency content quantum state” (256-1024 Hz, such as table lines).

[0099] Step A1043, quantum state correction is performed using an amplitude attenuation coefficient to correct the amplitude of the seal quantum state to match the actual transparency and ensure the accuracy of subsequent phase adjustment.

[0100] Step S1042, after collaborative extraction, the seal features and document features in the form of quantum states are output.

[0101] It should be noted that the seal features include , the color, texture, and transparency information of the seal, the amplitude , and the phase corresponding to the texture direction, and the document features include , the grayscale, edge, and phase continuity information of the text / table / handwriting, which satisfy (table) or (text) constraints.

[0102] Step S20, through quantum entangled state modeling and entanglement degree constraint iteration to ensure text stroke continuity, quantum wavelet transform and Gram-Schmidt orthogonalization to realize texture decoupling, and quantum generative adversarial network to adaptively fill.

[0103] In a feasible embodiment, step S20 can include steps S201-S203:

[0104] Step S201, quantum entanglement assisted repair reconstruction, refer to Figure 2 ,Figure 2 A quantum entanglement assisted repair reconstruction flowchart of a first embodiment of a seal removal and document repair method based on quantum state cooperative regulation is provided for the present application. Through quantum entangled state modeling and entanglement degree constraint iteration, adjacent pixels are adjusted "cooperatively" during the repair process, maintaining texture continuity.

[0105] In a specific embodiment, step S201 can include steps S2011-S2013:

[0106] Step S2011, for any pixel in the positioning area , select its 8-neighborhood pixels (i.e. up, down, left, right, diagonals, a total of 8 adjacent pixels, denoted as ) as entangled partners.

[0107] It should be noted that these neighborhood pixels and the target pixel together constitute a "local continuous unit" of the character stroke.

[0108] Step S2012, define the entangled state of the target pixel and the neighborhood pixels.

[0109] Specifically, the mathematical expression of step S2012 is:

[0110]

[0111] In the formula, and are the quantum states (including gray scale, phase, etc.) of the target pixel and the neighborhood pixels, is the tensor product, which is an operator symbol in quantum mechanics representing the "multi-particle correlation state", which here is used to represent the "indivisibility" of the quantum states of the target pixel and the neighborhood pixels, when the quantum state of one pixel is changed, the other will respond instantly, is the entanglement coefficient (value range ), used to adjust the influence weight of the neighborhood pixels on the target pixel: the closer the neighborhood pixels (such as directly above or directly to the right), the greater the value, ensuring stronger correlation in the main texture direction (such as horizontal / vertical strokes).

[0112] It should be noted that is adjusted in real time through the "quantum entanglement swapping protocol": when it is detected that the neighborhood pixels belong to the same character stroke (such as consistent gray scale gradient), the protocol will increase to strengthen the correlation; if the neighborhood pixels belong to the background (such as blank areas), then is reduced to avoid interference from irrelevant pixels.

[0113] Step S2013, in the iterative repair process of the QAP algorithm, the "similarity" of adjacent pixel entangled states is constrained to ensure that the texture correlation is not damaged in the repair process.

[0114] Specifically, the quantum entanglement degree is used to measure the "overlap degree" of two entangled states, which is mathematically represented by the inner product is the number of iterations. The closer this value is to 1, the smaller the change in the entangled state in two iterations, and the more stable the correlation of adjacent pixels.

[0115] It should be noted that in each QAP iteration (from the to the ), the following is forced to be satisfied: If the gray level of the target pixel increases (becomes brighter) in the iteration, the gray levels of the neighboring pixels will also "cooperate to increase" under the entanglement constraint, avoiding the "single-pixel abrupt brightening" that causes the stroke to break.

[0116] Step S202, referring to Figure 3 , Figure 3 is a quantum texture decoupling and adaptive filling flowchart of a quantum state cooperative regulation-based seal removal and document repair method first embodiment provided by the present application, which realizes "precise peeling" of two types of textures and "seamless repair" of document content through fine coding, orthogonal separation and intelligent generation mechanism of quantum states.

[0117] In a specific embodiment, step S202 can include steps S2021-S2023:

[0118] Step S2021, the depth of the texture feature is extracted through quantum wavelet transform (QWT), and is converted into a quantum state that can be precisely controlled, providing a "high-dimensional feature space" for separation.

[0119] Specifically, QWT is based on the fast computing ability of quantum Fourier transform (QFT), which can complete the multi-scale decomposition of the image in a single operation (traditional wavelet transform requires multiple iterations), and the extracted features are converted into quantum states through "amplitude-phase dual parameter coding", realizing "holographic storage" of texture features.

[0120] It should be noted that by using quantum superposition state, 16 frequency channels (covering 0-4096Hz) of the image are analyzed at the same time, and the frequency difference between the seal and the document is accurately captured. The frequency of the seal texture is concentrated in the high frequency, and the gray level change rate is >50% / pixel. The frequency of the document content is concentrated in the low frequency, and the gray level change rate is <30% / pixel. The quantum state texture feature is the seal quantum state and the document quantum state ​wherein the amplitude (corresponding to the gray intensity of the seal texture), the phase (corresponding to the directional feature of the texture), and the amplitude attenuation coefficient (reflecting the continuity of the document content), and the phase correlation (the phase difference of adjacent pixels < 5°, ensuring the smooth transition of the text strokes) are contained respectively.

[0121] Step S2022, by Gram-Schmidt quantum orthogonalization process, the "feature space" of two types of quantum states is completely isolated, ensuring that the document content is not damaged when the seal is removed.

[0122] In a specific embodiment, 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, the projection on is calculated by using the quantum inner product circuit: The projection is the "overlapping interference feature" of the two (such as the edge feature shared by the seal star and the table line).

[0125] It should be noted that the inner product calculation follows the quantum mechanical inner product rule:

[0126]

[0127] In the formula, is the conjugate complex of the first component, is the second component. is the second component. Step A2022, interference removal.

[0128] Specifically, by using a quantum subtraction circuit (composed of Hadamard gates and CNOT gates) to perform , the interference component related to the document is completely removed from the seal quantum state.

[0129] It should be noted that the quantum subtraction operation needs to satisfy the superposition principle of quantum states, that is:

[0130] .

[0131] .

[0132] Step A2023, normalization.

[0133] Specifically, a quantum rotation gate (RY gate) is applied to to adjust the amplitude to satisfy the normalization condition ​​​, ensuring the mathematical rigor of orthogonality, the normalization calculation formula is:

[0134]

[0135] The final orthogonalized seal quantum state satisfies .

[0136] It should be noted that after orthogonalization, the feature overlap between the seal and the document is greatly reduced, and the feature overlap calculation formula is:

[0137] .

[0138] Step S2023, after eliminating the seal quantum state, the original coverage area of the document forms an "information blank", and the QGAN generates highly consistent filling content with the surrounding environment by learning the global texture rules of the document.

[0139] In a specific embodiment, step S2023 can include steps B2021-B2023:

[0140] Step B2021, quantum architecture design of QGAN.

[0141] Specifically, the quantum generator contains an input layer, a hidden layer and an output layer, the input layer receives the quantum state of the 3x3 neighborhood (including 8 directional texture trends, such as "horizontal lines on the top edge, vertical lines on the left edge"), the input state can be represented as: , where is the weight coefficient of the texture of the th direction, is the ground state of the directional texture.

[0142] The hidden layer is composed of 4 parameterized quantum circuits, each circuit contains 2 RY rotation gates and 1 CZ controlled gate, and the texture generation rules (such as the gray value distribution range of horizontal lines, the curvature radius of corners) are learned by adjusting the rotation angle, the action formula of RY rotation gate is:

[0143]

[0144]

[0145] The action formula of the CZ controlled gate is:

[0146]

[0147] The output layer generates the quantum state of the filling area The phase distribution of the filling area is continuous with the texture direction of the neighborhood (for example, the phase gradient of the filling area is also along the x-axis when the neighborhood horizontal line is along the x-axis direction), and the phase continuity formula is: , wherein, is the phase gradient of the filling area, is the phase gradient of the neighborhood.

[0148] Quantum discriminator By measuring the generated state The "quantum Jensen-Shannon distance" (an index for measuring the similarity of probability distribution) of the real document quantum state is used to judge the "authenticity" of the generated content, and the quantum Jensen-Shannon distance formula is:

[0149]

[0150] , wherein, is the Kullback-Leibler divergence, is the average state of the two quantum states, is the real document quantum state.

[0151] It should be noted that when the distance is greater than , the output gradient adjustment signal is adjusted to correct the rotation gate angle , until the distance is less than (at this time, the human eye cannot distinguish the true and false), is the distance warning threshold ( ), is the distance convergence threshold ( ), , and the gradient adjustment formula is:

[0152]

[0153] , wherein, is the learning rate, is the gradient of the distance to the rotation angle.

[0154] Step B2022, "lossless conversion" from the quantum state to the classical image, and the generated is converted into a classical pixel by "quantum tomography" technology.

[0155] Specifically, the quantum state is measured multiple times (≥100 times), and the statistical average value of the amplitude (corresponding to the pixel gray scale, error ≤1) is obtained. The amplitude statistical average value formula is:

[0156]

[0157] The gray scale mapping formula is:

[0158]

[0159] wherein, is the measurement number, is the amplitude value of the measurement, is the classical pixel gray value, range 0-255, error .

[0160] The phase angle is read by the phase measurement circuit, which is converted into the gradient direction of the pixel (ensuring smooth connection with the neighborhood line), and the gradient direction conversion formula is:

[0161]

[0162] wherein, is the pixel gradient direction vector, is the filling area quantum state phase angle.

[0163] Step B2023, ensure high value.

[0164] Specifically, is a key indicator for measuring the structural similarity of the image (1 is completely consistent), and when is a high value, wherein is a structural similarity threshold , which ensures the consistency of the repaired area and the original document texture, and the calculation formula is:

[0165]

[0166] wherein, is the filling area image, is the real document image, , is the mean, , is the standard deviation, is the covariance, , is a constant to avoid a denominator of 0.

[0167] It should be noted that this technology ensures a high score by two points, forcing the texture direction, gray mean value and neighborhood error of the generated state to be less than 5% (for example, if the neighborhood table line gray value is 180, the filling area gray value must be between 171-189), and the gray error formula is:

[0168]

[0169] The direction error formula is:

[0170]

[0171] wherein, is the average gray value of the neighborhood, is the gradient direction vector of the neighborhood, and the dot product close to 1 indicates the same direction.

[0172] A "document style loss function" is introduced during QGAN training to ensure that the filled content conforms to the global characteristics of the entire document, such as font, line spacing, line thickness, etc. (e.g. Songti 5 font in official documents, and the filled content will not appear in Kaiti), and the style loss function formula is:

[0173]

[0174] wherein, is the feature layer index, is the layer weight, is the Gram matrix, which measures the correlation of features, is the quantum state of the real document at the layer.

[0175] Step S30, the dynamic quantum phase adjustment is used to offset the superposition interference of different transparency stamps, and quantum neural network denoising and multi-scale quantum Fourier sharpening are used to optimize the image quality.

[0176] In one possible implementation, step S30 can include steps S301-S303:

[0177] Step S301, referring to Figure 4 , Figure 4 is a dynamic quantum phase adjustment flowchart of a first embodiment of a stamp removal and document restoration method based on quantum state cooperative regulation provided by the present application, which realizes accurate stamp trace cancellation and non-destructive document content restoration by quantizing the transparency parameter and dynamically regulating the quantum restoration basis vector phase.

[0178] In one specific implementation, step S301 can include steps S3011-S3013:

[0179] Step S3011, by pixel-level statistics and quantum state mapping, the visual transparency is converted into a calculable quantum parameter .

[0180] In one specific implementation, step S3011 can include steps A3011-A3012:

[0181] Step A3011, classical domain pixel acquisition.

[0182] Specifically, for the located stamp area, the RGB value (or gray value) of each pixel is extracted, and the normalized brightness (range [0, 1]) is calculated, where represents complete transparency (consistent with the background), represents completely opaque.

[0183] Step A3012, quantization calculation .

[0184] Specifically, the transparency factor is calculated by quantum average circuit (composed of Hadamard gate and CNOT gate) on parallel computing:

[0185]

[0186] wherein, is a quantum average operator, which simultaneously processes 1024 pixel values by quantum superposition.

[0187] It should be noted that, the amplitude modulus square of is positively correlated (i.e. ), that is, the larger the stamp quantum state, the stronger the interference.

[0188] Step S3012, dynamic phase adjustment.

[0189] Specifically, for different , the phase compensation angle of the repair basis vector is calculated by a dynamic phase adjustment formula, and the mathematical expression is:

[0190]

[0191] wherein, is a reference phase, and the value is (approximately 45°), when (medium transparency), the phase can make the repair basis vector and the document quantum state have the highest matching degree (inner product ), based on quantum interference theory, the phase interference of the stamp on the document and have a nonlinear relationship (i.e. ), is a phase compensation coefficient, , to ensure , that is, the compensation phase is exactly equal to the interference phase.

[0192] It should be noted that in a specific embodiment, the dynamic adjustment logic is that when (30% opacity), , the compensation is weak, and only offsets slight interference, when (60% opacity), , the compensation is enhanced, and the matching is stronger phase interference, when ​(80% opacity), , compensating maximization, ensuring that the document phase is not covered under strong interference.

[0193] Step S3013, dynamic phase adjustment is completed in the quantum circuit through the parameterized quantum rotation gate (RY gate).

[0194] In a specific embodiment, step S3013 can include steps B3011-B3012:

[0195] Step B3011, RY gate phase loading.

[0196] Specifically, the calculated is loaded to the control end of the RY gate, and the quantum state of the repair basis vector (initial phase is 0) is rotated, and the mathematical expression is:

[0197]

[0198] In the formula, the matrix representation of the RY gate is:

[0199]

[0200] It should be noted that the phase of the rotated is completely consistent with , forming an "anti-coherent interference source".

[0201] Step B3012, quantum interference cancellation.

[0202] Specifically, the mixed state is quantum interfered with the adjusted basis vector , the original quantum state of the document is restored, and the mathematical expression is:

[0203]

[0204] It should be noted that since the phase of exactly cancels the interference phase of ( ), the stamp quantum state component is canceled after interference, and the finally output can completely restore the original quantum state of the document.

[0205] Step S302, refer to Figure 5 , Figure 5 is a quantum neural network denoising enhancement flowchart of a quantum state cooperative regulation-based stamp removal and document repair method first embodiment provided by the present application, which realizes accurate suppression of complex noise in the repaired image by constructing a parameterized quantum neural network (QNN). Using the parallelism of quantum computing and the nonlinear fitting ability of quantum neurons, the noise distribution law is deeply learned and targetedly eliminated.

[0206] It should be noted that the QNN network is constructed based on 8 quantum bits (adapted to the 256 pixel feature dimension of the local area of the document), and the input of the input layer is the repaired noisy quantum state , which is mathematically expressed as the superposition of the real state and the noise state of the document, and the mathematical expression is:

[0207]

[0208] In the formula, is the proportion of effective information, is the proportion of noise, (normalization condition of quantum state).

[0209] The classical image pixel value is converted into a quantum state of 8 quantum bits through "amplitude-phase double parameter encoding", and the amplitude mapping formula is:

[0210]

[0211] The phase mapping formula is:

[0212]

[0213] In the formula, is the pixel gray scale, is the quantum bit amplitude, is the quantum bit phase, corresponding to the pixel space gradient direction.

[0214] Each hidden layer contains 4 quantum neurons, and each neuron is composed of a "controlled-Z gate (CZ) + rotation gate (RY)" in series. The CZ gate is a two-qubit gate, and its action matrix is:

[0215]

[0216] When the control bit and the target bit are both , the phase of the target bit is flipped ( ).

[0217] In a specific embodiment, in the starburst texture repaired residual noise, the phase angle difference of adjacent pixels (distance pixels) is fixed, and the formula is:

[0218]

[0219] The CZ gate can mark this "regular correlation" through phase flipping, which is different from the random phase difference of the document content.

[0220] The RY gate is a single-qubit parameterized gate, and its action matrix is:

[0221]

[0222] In the formula, is a learnable parameter, , determines the transformation mode of the quantum state, and the RY gate adjusts to the quantum measurement noise (consistent with the Gaussian distribution to achieve "amplitude attenuation" and reduce the proportion of noise , and the formula is:

[0223]

[0224] For the system offset of the interaction noise (such as ), the RY gate performs "phase cancellation" through , and the phase formula after cancellation is:

[0225]

[0226] It should be noted that the four neurons work together to capture the "high-frequency features" (starlight residues), "spatial correlation features" (adjacent pixel synchronous fluctuations), "amplitude features" (gray scale fluctuation intensity), and "phase features" (angle offset). Through combination operation, the noisy quantum state is decomposed into "document feature subspace" (dominant) and "noise feature subspace" (dominant), and the decomposition formula is:

[0227]

[0228] In the formula, is the document feature projection operator, is the noise feature projection operator, and ( is the unit operator).

[0229] The output layer applies an "inverse parameterized transformation" (i.e. the inverse process of the hidden layer operation) to the quantum state output by the hidden layer, eliminating the contribution of the noise feature subspace. If the hidden layer aggregates noise to quantum bits 5-7 through CZ gates and RY gates, the output layer will set these three bits to (annihilate noise) through "quantum state projection", and retain the document features of bits 1-4. The projection formula is:

[0230]

[0231] The final output of the pure quantum state satisfies , which is converted into a classical pixel value through quantum measurement (repeated 100 times to take the average value to reduce measurement error). The measurement average value formula is:

[0232]

[0233] wherein, is the number of measurements, is the gray value of the th measurement.

[0234] In a specific embodiment, step S302 can include steps S3021-S3022:

[0235] Step S3021, QNN optimizes the rotation angle of the RY gate through training, so that it has the ability to identify and suppress specific noise.

[0236] Specifically, the training data set is accurately constructed, containing 100,000 pairs of “noisy quantum state-pure quantum state” samples, covering different intensity combinations of 3 types of noise (such as quantum measurement noise standard deviation 0.01-0.03, interaction noise phase shift 0.01-0.05 rad, and repair residual noise ratio 5%-20%). In 1000 pure quantum states of real documents (containing text, tables, and handwritten), noise is added according to the actual scene ratio, quantum measurement noise, superimposed Gaussian distribution of random amplitude disturbance; interaction noise, superimposed fixed phase shift; repair residual noise, superimposed with a fragment of quantum state of real seal texture.

[0237] The quantum fidelity (Fidelity) is used to measure the similarity between the predicted state and the real state, and the mathematical expression is:

[0238]

[0239] The loss function is defined as:

[0240]

[0241] In the formula, the fidelity value range is [0, 1], and the closer the value is to 1, the more similar the two quantum states are (i.e. the better the noise reduction effect), and the optimization goal is to minimize , that is, to make the predicted pure state as close to the real state as possible.

[0242] Through quantum circuit simulation, the loss function is calculated. The partial derivative of each RY gate rotation angle is adjusted in the gradient direction: (where is the learning rate), so that gradually decreases, and when the average of the last 1000 iterations is ≤0.01 (i.e. fidelity ≥0.99), the training is stopped, at which time 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 component, corresponding edge width pixel, 3rd-level QFT resolution parameter resolution high-frequency component, corresponding edge width pixel.

[0250] For each frequency component , the "amplitude-phase-frequency" three-parameter coding is adopted, and the coding formula is as follows:

[0251] Amplitude coding:

[0252]

[0253] Phase coding:

[0254]

[0255] Frequency coding:

[0256]

[0257] In the formula, is the quantum bit probability distribution, and the precision , , is the edge energy, is the quantum bit rotation angle, and the precision , the edge space direction is marked, is the quantum bit ground state, corresponding to the discrete frequency point.

[0258] Step S3032, the scale adaptive gain enhancement of the high-frequency component.

[0259] Specifically, for the frequency component output by the 3rd-level QFT, the enhanced frequency component is calculated, and the mathematical expression is as follows:

[0260]

[0261] In the formula, 0.03 is the gain coefficient, which ensures that the ratio of the edge gradient amplitude increase to the noise amplification , is the scale coefficient , which realizes the differentiated enhancement of different scale edges, is the frequency modulus, which compensates the energy loss of the blurred edge (the high-frequency modulus of the blurred edge is lower than that of the normal edge , and the modulus attenuation formula ).

[0262] The amplitude of the frequency domain quantum state is adjusted through a quantum multiplication circuit (including an RY rotation gate) , the adjustment formula is ( The gain factor is kept unchanged, and the phase of the quantum state is kept unchanged to avoid edge direction distortion.

[0263] In step S3033, the spatial domain image is reconstructed by inverse quantum Fourier transform (IQFT).

[0264] Specifically, the inverse quantum circuit corresponding to the QFT is constructed, and the following formula is satisfied The enhanced frequency domain quantum state is converted into the spatial domain quantum state The conversion formula is as follows:

[0265]

[0266] The high-frequency energy and phase information are preserved during the conversion process, and the spatial position error pixels are the sharpened edge positions, and the original edge positions are the original edge positions.

[0267] By means of the quantumization fine operation, the "on-demand enhancement" of the edges of different scales is realized, and the edge transition band is compressed: the transition pixel distance is compressed from pixels to pixels, the compression rate is , the gray difference between the text and the background is improved from to , the improvement relationship is , and the edge arc error is pixels , and the edge arc radius is

[0268] In step S40, for special scenes such as inclination, multi-color superposition, and ultra-thin frame, quantum rotation correction, color channel separation, and boundary annihilation operator processing are used.

[0269] In one possible implementation, step S40 can include steps S401-S403:

[0270] In step S401, the inclined seal (0°-45°) is repaired, and the "precise geometric reconstruction" of the quantum rotation correction is realized. The high-precision measurement of the inclination angle is realized by means of the quantum edge phase gradient analysis, and the lossless correction of the seal and the restoration of the document content are completed in combination with the quantum rotation operator and the quantum entanglement.

[0271] In one specific implementation, step S401 can include steps S4011-S4013:

[0272] In step S4011, the quantum level measurement of the inclination angle θ is performed.

[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, Cooperative repair of quantum entanglement after orientation.

[0286] Specifically, for the quantum state after the inversion , adopts quantum entanglement auxiliary reconstruction technology; the quantum entanglement repair module identifies the 8-neighbor pixel correlation of the character strokes, and dynamically adjusts the entanglement coefficient of the i-th pixel and the j-th pixel according to the type of the character strokes , meets the formula:

[0287]

[0288] Step S402, multi-color superimposed (red+blue) region processing, through orthogonal encoding of quantum states of RGB three channels, channel-specific quantum feature matching and anti-crosstalk fusion, independent stripping of multi-color seals and fidelity of document content are realized.

[0289] In a specific embodiment, step S402 can include S4021-S4023:

[0290] Step S4021, orthogonal encoding of quantum color channels.

[0291] Specifically, the "amplitude-phase double encoding" method is adopted, and the RGB three channels are respectively mapped into quantum states (red channel), (green channel), (blue channel), and the three-channel quantum states are combined into RGB quantum states by tensor product, which meets the formula:

[0292]

[0293] And each channel quantum state meets the orthogonal independence , avoiding interference between channels.

[0294] Step S4022, channel-specific quantum feature matching and annihilation.

[0295] Specifically, for the red channel quantum state , the quantum fidelity of the red channel quantum state and the red seal quantum state in the template library is calculated, and for the blue channel quantum state , the quantum fidelity of the blue channel quantum state and the blue seal quantum state in the template library is calculated, and the fidelity calculation formula is:

[0296]

[0297] In the formula, is the channel quantum state to be matched or , is the seal template quantum state of the corresponding color; when , it is determined that the seal texture region is matched and located.

[0298] The matched seal region quantum state is subjected to quantum non-gate (X gate) to flip the amplitude and realize color removal, satisfying the formula:

[0299]

[0300] In the formula, is a quantum non-gate, is a repaired channel quantum state; the repaired channel amplitude is a document content gray value, and only the document content information is reserved.

[0301] Step 4023, anti-crosstalk fusion of the quantum state.

[0302] Specifically, the phase difference between the repaired red channel quantum state , the blue channel quantum state and the green channel quantum state is measured.

[0303] If ,the phase is adjusted to be aligned through an RY rotation gate, satisfying the formula:

[0304]

[0305] In the formula, is a phase-aligned channel quantum state, is an RY gate rotation angle .

[0306] The red, green and blue channel quantum states after phase alignment are fused again to obtain a final fusion state , satisfying the formula:

[0307]

[0308] The color consistency error after fusion is , and the error calculation formula is:

[0309]

[0310] In the formula, is a standard unbiased color document quantum state.

[0311] Step S403, ultra-thin frame seal (line width ≤1 pixel) removal, the frame quantum state is identified through amplitude threshold screening and phase continuity detection, and the ultra-thin frame is removed in a targeted manner in combination with a boundary annihilation operator.

[0312] In a specific embodiment, step S403 can include S4031-S4032: ​​

[0313] Step S4031, super-fine identification of the frame quantum state.

[0314] Specifically, amplitude measurement is performed on the quantum state of the seal region, and the frame quantum state is distinguished according to the amplitude characteristics and the text edge quantum state , satisfying the formula:

[0315]

[0316] In the formula, is the amplitude of the quantum state.

[0317] Phase continuity detection is performed on the selected candidate frame quantum state, and the rate of change of the phase along the path s is calculated , satisfying the formula:

[0318]

[0319] Combining amplitude screening and phase detection, the accuracy of frame recognition is improved, and the accuracy calculation formula is:

[0320]

[0321] Step S4032, targeted operation of the boundary annihilation operator.

[0322] Specifically, the boundary annihilation operator is defined by a phase screening gate and an amplitude annihilation gate in series, satisfying the formula:

[0323]

[0324] In the formula, the phase screening gate ( pixel, is a two-level controlled NOT gate), which is used to accurately lock the frame quantum state; the amplitude annihilation gate (RY gate rotation angle ), which is used to compress the amplitude of the frame quantum state.

[0325] The identified frame quantum state is subjected to the annihilation operator, and the amplitude compression satisfies the formula:

[0326]

[0327] In the formula, is the original amplitude of the frame quantum state, is the compressed amplitude; after compression , the frame quantum state is equivalent to being mapped to a vacuum state , achieving complete removal of the frame.

[0328] Note that the quantum state operation is in units of 0.1 pixels, and the resolution pixels, the minimum distinguishable size difference pixels, the resolution of the conventional method pixels, the minimum distinguishable size difference pixels, the accuracy relationship between the two is Based on the above accuracy advantage, the ultra-thin frame (0.5 pixels) and the text (≥1 pixel) can be accurately distinguished, and the edge erosion of the traditional method can be avoided. The retention rate of the integrity of the repaired text edge is 100%, and the retention rate calculation formula is:

[0329]

[0330] Step S50, check the repair result, and return to the edge sharpening step of the texture decoupling filling to re-adjust the parameters if the result does not meet the standard.

[0331] Specifically, the core of the check is to determine whether the repair quality meets the standard through quantitative indicators. The structural similarity index (SSIM) measures the structural consistency of the repaired area and the original document (the value range is 0-1, and the closer to 1 indicates that the repair is more natural. The document requires SSIM≥0.92 after repair), and the peak signal-to-noise ratio (PSNR) evaluates the noise level of the repaired image (in dB, the higher the value, the less the noise).

[0332] In a specific embodiment, if it is detected that SSIM or PSNR does not reach a preset threshold (such as SSIM<0.92, PSNR<30dB), it is determined that the repair result does not meet the standard, and the "return to re-adjust" process is triggered.

[0333] The above is only a preferred specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can make equivalent replacements or changes to the technical solutions and the inventive concept of the present application within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. A method for stamp removal and document restoration based on quantum state collaborative regulation, characterized in that: The method comprises the following steps: S10, obtaining the coordinates of the located seal area and the original image of the document to be repaired; The quantum side calls a quantum feature template library pre-storing typical seal quantum state features, and the classical side processes the gray image of the seal positioning area through a lightweight convolutional neural network to output quantum state regulation parameters, thereby completing quantum-classical feature collaborative preparation; S20, constructing a quantum entangled state for each pixel and its 8-neighborhood pixels in the seal area, and adding entanglement degree constraints in the quantum alternating projection iteration process; Seal high-frequency features and document low-frequency features are extracted through quantum wavelet transform and encoded into quantum states, feature decoupling is realized through Gram-Schmidt quantum orthogonalization processing, filling content is generated using a quantum generative adversarial network, quantum texture decoupling and adaptive filling are completed; S30, calculating the transparency factor of the seal, dynamically adjusting the phase of the repair basis vector according to the transparency factor, and performing dynamic quantum phase adjustment; A quantum neural network comprising a combination of controlled-Z gates and rotation gates is used to process the repaired noisy quantum state, and a denoised quantum state is output; Multi-scale quantum Fourier transform is performed on the repaired image, a scale adaptive gain is applied to the high-frequency components, and the image is reconstructed through inverse quantum Fourier transform, thereby completing edge quantum state sharpening optimization; S40, triggering special scene adaptive processing on demand, the special scene including tilted seal, multi-color superimposed seal area and ultra-thin frame seal; S50, detecting the structural similarity index and the peak signal-to-noise ratio of the repaired result, if the threshold is met, outputting the target document without seal traces, if not, returning to the quantum texture decoupling and adaptive filling step to re-optimize the parameters.

2. The method of claim 1, wherein: In the S20 step, the quantum entangled state of each pixel and its 8-neighborhood pixels in the seal area is constructed in the following manner: (1) For any pixel in the seal area, 8 neighborhood pixels in the up, down, left, right and diagonal directions are selected as entangled partners; (2) A quantum entangled state of the target pixel and the neighborhood pixels is constructed, the entangled state is formed by associating the quantum states of the target pixel and the neighborhood pixels through tensor product, and the influence weight of the neighborhood pixels on the target pixel is adjusted by an entanglement coefficient; (3) The entanglement coefficient is dynamically optimized through a quantum entanglement swapping protocol.

3. The method of claim 2, wherein: The quantum entanglement swapping protocol dynamically optimizes the entanglement coefficient in the following manner: if the neighborhood pixel and the target pixel belong to the same character stroke, the corresponding entanglement coefficient is increased; if the neighborhood pixel belongs to the background area, the corresponding entanglement coefficient is decreased.

4. The method of claim 1, wherein: In the S20 step, the quantum texture decoupling and adaptive filling is performed in the following manner: (1) The 16 frequency channels of the image are analyzed in parallel through quantum wavelet transform, and the seal high-frequency features in the range of 1024-4096 Hz and the document low-frequency features in the range of 256-1024 Hz are screened out; (2) The high-frequency features and low-frequency features are respectively mapped into the seal quantum state and the document quantum state by using amplitude-phase double parameter coding: the amplitude of the seal quantum state is positively correlated with the seal gray intensity, and the phase corresponds to the seal texture direction; 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 character strokes; (3) Feature decoupling is realized by Gram-Schmidt quantum orthogonalization processing: first, the projection component of the seal quantum state on the document quantum state is calculated, and then the projection component is removed from the seal quantum state to eliminate the feature overlap of the two, and finally the amplitude of the processed seal quantum state is adjusted to meet the normalization requirements of the quantum state; (4) The quantum generator receives the quantum state of the 3*3 neighborhood, and after processing by the hidden layer containing 2 rotation gates and 1 controlled gate, the quantum state of the filled area is output; The quantum discriminator judges the authenticity of the generated content by calculating the similarity distance between the filled quantum state and the real document quantum state, and if the distance exceeds the preset threshold, the rotation gate angle of the quantum generator is adjusted until the distance meets the requirements; (5) The filled quantum state is converted into a classical pixel by quantum chromatography technology: multiple measurements are performed on the quantum state, the amplitude statistical average value is taken to determine the pixel gray scale, and the phase angle is converted into a pixel gradient direction to ensure the continuity of the texture in the filled area and the neighborhood.

5. The method of claim 1, wherein: In the S30 step, the specific operation mode of dynamic quantum phase adjustment is as follows: (1) Extract the RGB values or gray values of each pixel in the seal area, and calculate the normalized brightness of each pixel; (2) The normalized brightness of 1024 pixels is processed in parallel by the quantum average operator to calculate the transparency factor of the seal; (3) Determine the phase compensation angle of the repair basis vector according to the transparency factor: take the reference phase as the benchmark, the greater the transparency factor, the greater the adjustment range of the phase compensation angle, ensuring that the compensation angle matches the seal interference phase; (4) Load the phase compensation angle to the control end of the rotation gate, apply rotation to the quantum state of the repair basis vector, and obtain the adjusted repair basis vector quantum state; (5) Make the mixed quantum state containing seal interference interfere with the adjusted repair basis vector quantum state, eliminate the seal interference by phase cancellation, and restore the original quantum state of the document.

6. The method of quantum state-based collaborative regulation for stamp removal and document repair according to claim 1, characterized in that: In the S30 step, the specific operation mode of processing the repaired noisy quantum state by quantum neural network is as follows: The repaired noisy quantum state is encoded into an input layer composed of 8 quantum bits: during encoding, the pixel gray value is proportionally mapped to the amplitude of the quantum bit, and the spatial gradient direction of the pixel corresponds to the phase of the quantum bit; The hidden layer contains 4 quantum neurons, each of which is composed of a controlled-Z gate and a rotation gate in series: the controlled-Z gate is used to identify the spatial correlation of noise; the rotation gate realizes noise amplitude attenuation and phase cancellation by adjusting the rotation angle, and decomposes the noisy quantum state into a document feature subspace and a noise feature subspace; The output layer applies an inverse parameterized transformation to the quantum state output by the hidden layer, sets the quantum bits corresponding to the noise feature subspace to the vacuum state, removes the noise contribution, and obtains a pure document quantum state; Multiple quantum measurements are performed on the pure document quantum state, and the gray scale measurement average value is taken as the final pixel gray scale.

7. The method of claim 6, wherein: In the S30 step, the specific operation mode of edge quantum state sharpening optimization is as follows: The quantum Fourier transform circuit is constructed by using a system of no less than 8 quantum bits to perform 3-level quantum Fourier transform; Each frequency component is encoded by three parameters of "amplitude-phase-frequency"; Scale adaptive gain is applied to different levels of frequency components; The amplitude of the frequency domain quantum state is adjusted by a quantum multiplication circuit, and the phase is kept unchanged; The inverse quantum Fourier transform circuit corresponding to the quantum Fourier transform is constructed to convert the enhanced frequency domain quantum state into a spatial domain quantum state, which is used to compress the edge transition band pixels and improve the gray scale difference between the text and the background.

8. The method of claim 7, wherein: In the S40 step, the special scene adaptive processing mode is: For the stamp with an inclination angle of 0°-45°: a quantum edge detection circuit composed of 8 quantum bits is used to measure the phase angle of the edge pixels of the stamp, calculate the phase difference of adjacent pixels and construct a phase gradient matrix; the phase gradient matrix is analyzed by a quantum Fourier transform operator to obtain the inclination angle of the stamp; a quantum rotation operator is constructed to correct the quantum state of the stamp region and then perform repair to avoid text truncation caused by angle deviation; For the red plus blue multi-color superimposed area: the RGB three channels are respectively mapped into orthogonal quantum states to construct an RGB combined quantum state; the similarity of each color channel quantum state and the corresponding color stamp template quantum state is calculated, and if the similarity is greater than a threshold value, it is determined as a stamp area; the quantum state amplitude of the corresponding channel stamp area is flipped by a quantum NOT gate to remove the stamp features; The phases of the quantum states of each channel are adjusted to align with the phase of the green channel and then fused again; For the ultra-thin frame stamp with a line width of ≤1 pixel: the amplitude of the stamp area quantum state is measured, and candidate frame quantum states with an amplitude in the range of 0.1-0.3 are selected; the change rate of the phase of the candidate quantum state along the path is detected, and if the change rate is less than a threshold value, it is determined as a frame quantum state; a boundary annihilation operator is constructed to compress the amplitude of the frame quantum state to below 0.

01.

9. The method of claim 1, wherein: In the S50 step, the structural similarity index and the peak signal-to-noise ratio of the repair result are detected, including: presetting a structural similarity index threshold value and a peak signal-to-noise ratio threshold value; if the structural similarity index of the repair result is lower than the structural similarity index threshold value or the peak signal-to-noise ratio is lower than the peak signal-to-noise ratio threshold value, returning to the quantum texture decoupling and adaptive filling step to re-optimize the quantum orthogonalization parameters and the rotation gate angle of the quantum generative adversarial network; if the repair result meets the threshold requirement, outputting a stamp-free target document in PDF or Word format.

10. The method of claim 1, wherein: In the S10 step, the quantum feature template library is constructed based on a system of 10 quantum bits, and the quantum states of more than 3000 typical stamps are pre-stored, which include red, blue, black, and official and private stamp types; the classical side processes the gray scale image of the stamp positioning area by a lightweight CNN to output quantum state regulation parameters, including: the lightweight CNN extracts the gray scale distribution, edge gradient, stamp type probability, texture complexity, and document content type features of the positioning area, and outputs regulation parameters for adjusting the amplitude and phase of the quantum state according to the feature analysis result.

Citation Information

Patent Citations

  • Quantum type AR scene generation method based on hybrid model under Babylon.js framework

    CN120339556A

  • Electronic seal verification method based on quantum true random number and anti-quantum multi-dimensional dynamic code

    CN120429900A