Gray code encoding rearranged spatial light modulation method and system
By employing a collaborative approach of Gray code index rearrangement and dual-path differential detection, the problems of hardware compatibility and unstable reconstruction quality in single-pixel imaging systems are solved. This approach achieves efficient and stable image reconstruction and anti-interference capabilities at low sampling rates, and is suitable for single-pixel imaging, structured light 3D imaging, transmission scattering medium imaging, and optical encrypted communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIANFU JIANGXI LAB
- Filing Date
- 2026-02-27
- Publication Date
- 2026-05-01
AI Technical Summary
In existing single-pixel imaging systems, random modulation mode is hardware-incompatible, and deterministic orthogonal basis modulation mode has unstable reconstruction quality and low information acquisition efficiency at low sampling rates, making it difficult to balance imaging quality and hardware compatibility.
A spatial light modulation method using Gray code rearrangement is adopted. The basic modulation matrix is rearranged by generating a Gray code index sequence, and a new measurement matrix is generated by combining dual-path differential detection. This matrix is used for pattern loading of the spatial light modulator. Two single-pixel detectors are used simultaneously to collect optical signals, and differential operations and compressed sensing reconstruction are performed.
It achieves stable and efficient information capture at low sampling rates, improves reconstruction quality and information capture efficiency, has strong anti-interference ability, good adaptability, is suitable for stable imaging in complex lighting environments, has high repeatability, low implementation cost, and is easy to integrate into existing systems.
Smart Images

Figure CN121770631B_ABST
Abstract
Description
Spatial light modulation method and system with Gray code rearrangement Technical Field
[0001] This application relates to the fields of computational imaging and spatial light modulation technology, and in particular to a spatial light modulation method and system with Gray code rearrangement. Background Technology
[0002] In the field of single-pixel imaging technology, spatial light modulators encode the target scene by sequentially projecting a preset structured illumination pattern, while single-pixel detectors synchronously acquire the corresponding total light intensity response. Then, a computational reconstruction algorithm is used to restore the target image. The design of the modulation matrix directly determines the system's imaging quality, imaging speed, and operating efficiency. Currently, the mainstream modulation matrices are mainly divided into two categories: completely random modulation modes and deterministic orthogonal basis modulation modes.
[0003] The fully random modulation mode uses independent and identically distributed random numbers to construct the measurement matrix. From the perspective of compressed sensing theory, this mode has the best constrained isometry, which can guarantee the high probability of reconstructing sparse signals from undersampled measurement data, showing certain advantages at the theoretical level. However, this mode is highly sensitive to the randomness of random numbers, resulting in poor robustness of the fully random modulation matrix. Since about 50% of the modulation unit states change between adjacent random patterns, the spatial light modulator needs to frequently perform large-scale and irregular physical state switching. This not only significantly increases the dynamic power consumption of the system, but also introduces severe electrical noise and timing jitter during high-speed switching. This noise will be directly coupled into the detection signal, ultimately degrading the signal-to-noise ratio of the system.
[0004] Deterministic orthogonal basis modulation modes use orthogonal function bases such as Hadamard and Fourier bases, which have fast algorithms, as the modulation basis. These methods have the advantages of strong determinism and low storage requirements, and are relatively convenient in hardware implementation. However, the inherent limitations of this mode are also quite prominent: the row order of the basis matrix remains unchanged. In low sampling rate scenarios, this fixed sampling order cannot uniformly perceive all information dimensions like random sampling, making the information capture efficiency extremely sensitive to the sampling start point, thus causing unstable image reconstruction quality. In addition, in order to adapt to common spatial light modulators such as digital micromirror devices (DMDs) that can only present binary states, it is often necessary to map the original +1 / -1 Hadamard base linearly to a 1 / 0 binary form. This mapping process destroys the original strict orthogonality of the matrix, so that its theoretically optimal performance cannot be fully realized in practical hardware applications.
[0005] In summary, there is a fundamental contradiction between the two mainstream modulation modes in existing single-pixel imaging systems: the mathematically superior random modulation mode performs poorly in terms of hardware adaptability, and suffers from problems such as high power consumption and high noise; while the hardware-friendly deterministic orthogonal basis modulation mode cannot simultaneously achieve high reconstruction quality and high information capture efficiency at low sampling rates. This technical bottleneck severely restricts the promotion and application of single-pixel imaging technology in more scenarios, and there is an urgent need for a new spatial light modulation method that can systematically solve this contradiction. Summary of the Invention
[0006] In view of this, this application provides a spatial light modulation method and system for Gray code rearrangement, which is used to solve the contradictions in existing single-pixel imaging systems, such as the hardware incompatibility of random modulation mode and the unstable reconstruction quality and low information acquisition efficiency of deterministic orthogonal basis modulation mode at low sampling rate. At the same time, it is necessary to improve the anti-interference capability and repeatability of the system.
[0007] According to one aspect of this application, a spatial light modulation method with Gray code rearrangement is provided, comprising:
[0008] The total number of pixels N is determined based on the resolution of the target image, the number of measurements M is determined based on the preset sampling rate, and an N×N-dimensional basic modulation matrix suitable for compressed sensing reconstruction and with excellent algebraic properties is selected in combination with the physical characteristics of the pre-determined spatial light modulator.
[0009] The natural binary sequence 0 to L-1 is encoded using standard reflective Gray code, where L is a positive integer not less than M, to generate a Gray code index sequence of length L. The binary representations of any adjacent index values in the Gray code index sequence differ by only one bit. The Gray code index sequence is used to control the pattern loading order of the spatial light modulator.
[0010] By using a preset mapping function, the first M indexes of the Gray code index sequence are systematically mapped onto the row index set of the basic modulation matrix to generate a new measurement matrix. The row order of the measurement matrix corresponds one-to-one with the pattern projection order of the spatial light modulator.
[0011] Each row of the measurement matrix is converted into a two-dimensional spatial light modulation pattern that matches the modulation unit array of the spatial light modulator. The pattern is then loaded onto the spatial light modulator in the order of the rows of the measurement matrix. After the light source is transmitted through the target object, it forms a light signal carrying the target object information. The spatial light modulator spatially encodes the light signal. Two single-pixel detectors with matching performance are used simultaneously to collect the total light intensity response of the scene corresponding to the encoded light signal in the transmission state and reflection state of the spatial light modulator, respectively, to obtain two measurement vectors containing the target object information.
[0012] The difference vector is obtained by performing a difference operation on the two measurement vectors. The measurement matrix and the difference vector are then input into a compressed sensing reconstruction algorithm. By solving a constraint optimization problem, an estimate of the original target image reflecting the physical shape of the target object is reconstructed.
[0013] In one implementation, the basic modulation matrix is selected from a Hadamard matrix, a Fourier matrix, or other deterministic measurement matrices with low coherence; wherein, when the basic modulation matrix is a Hadamard matrix, if Where n is a positive integer, the Sylvester construction method is used to construct the system, and the construction process satisfies the following conditions: ;like where k is a positive integer. If the prime number is odd, then the Legendre symbolic construction method is used to construct it, and the construction process involves using odd prime numbers. The quadratic residue property generates matrix elements.
[0014] In one implementation, the Gray code index sequence is generated recursively using bitwise operations, and the expression for the bitwise recursion is: , where i is a natural number index starting from 1. This represents the i-th element in the Gray code index sequence; during the generation process, the natural binary sequence 0 to L-1 is first converted to... A binary sequence of bits, where satisfy Then, based on the bitwise operation recursive formula, the converted binary sequence is encoded bit by bit to obtain the Gray code index sequence.
[0015] In one implementation, the mapping function is implemented using linear modulo operation, hash mapping, or direct mapping based on a preset lookup table; when using linear modulo operation, the expression is: ,in For mapping functions, For the i-th element in the Gray code index sequence, ensure that the mapping result falls within the range of row indices 1 to N of the basic modulation matrix; when using hash mapping, convert the Gray code index into an integer using an improved hash algorithm based on MD5 or SHA, and then constrain it to the range of row indices 1 to N through modulo operation; when using a pre-set lookup table mapping, the lookup table pre-stores a one-to-one correspondence between the Gray code index and the row index of the basic modulation matrix, and the construction of the lookup table satisfies the adjacent single-bit transition characteristics of the Gray code sequence and the ordered mapping of the row index of the basic matrix.
[0016] In one implementation, the measurement matrix satisfies Where A is the measurement matrix, i=1,2,...,M, Based on the modulation matrix, For mapping functions, The i-th element in the Gray code index sequence; the element values of the measurement matrix include -1 and 1, which are the binary working states adapted to the spatial light modulator. The binary working state can only present two physical states. Before being loaded onto the spatial light modulator, the -1 element in the measurement matrix is mapped to 0 to obtain the loading matrix. In the loading matrix, 1 corresponds to the on state of the spatial light modulator and 0 corresponds to the off state.
[0017] In one implementation, the spatial light modulator includes a digital micromirror device (DMD) or a rotating mask; when a digital micromirror device is used, the on state of the micromirror corresponds to the transmission state, and the off state of the micromirror corresponds to the reflection state.
[0018] In one implementation, the compressed sensing reconstruction algorithm is selected from the Total Variation Minimization Algorithm (TVAL3) based on Augmented Lagrange and Alternating Direction Method, the Basis Pursuit Denoising Algorithm (BPDN), or the Approximate Message Passing Algorithm (AMP). During the solution process, the L1 norm constrained optimization problem is solved by the compressed sensing reconstruction algorithm, and the pixel grayscale information of the original target image is restored by utilizing the linear correspondence between the measurement matrix and the difference vector.
[0019] In one implementation, the preset sampling rate ranges from 10% to 50%, and the number of measurements... ,in The sampling rate is a preset sampling rate; wherein the sampling rate is adjusted based on the system modulation rate, imaging time requirements and / or the peak signal-to-noise ratio of imaging quality.
[0020] In one implementation, the single-pixel detector is selected from a superconducting nanowire single-photon detector, a single-photon avalanche diode, or a photomultiplier tube. By setting the values of response speed, detection sensitivity, and noise level, the performance parameters of the two single-pixel detectors are ensured to be consistent. During the acquisition process, the two single-pixel detectors work synchronously through a synchronous trigger signal, and respectively acquire the total light intensity response of the scene in the transmission and reflection states of the spatial light modulator in real time, ensuring the time synchronization of the two detection signals.
[0021] According to one aspect of this application, a spatial light modulation system with Gray code rearrangement is provided, the system comprising a light source, an optical transmission module, a spatial light modulation module, a dual-path detection module, a signal conversion module, and a data processing module;
[0022] The light source is used to provide stable incident light and is selected from LED array light source, infrared laser light source or pseudo-thermal light source, with appropriate wavelength and light intensity selected according to the imaging scene requirements;
[0023] The optical transmission module includes a collimating lens, an imaging lens, and two collecting lenses. The collimating lens is used to convert divergent light emitted from the light source into parallel light and project it onto the target object. The imaging lens is used to accurately transmit the light transmitted through the target object to the modulation unit array of the spatial light modulation module. The two collecting lenses are respectively set to correspond to the transmission state light output direction and the reflection state light output direction of the spatial light modulator, and are used to collect the encoded light signal and converge it to the detection surface of the dual-path detection module.
[0024] The spatial light modulation module is the spatial light modulator in the aforementioned Gray code rearrangement spatial light modulation method. It is used to receive the light transmitted by the optical transmission module, load the two-dimensional spatial light modulation pattern generated by the aforementioned Gray code rearrangement spatial light modulation method, and spatially encode the incident light through the physical state switching of the modulation unit.
[0025] The dual-path detection module includes two single-pixel detectors with matched performance, which are respectively set to correspond to the two collection lenses. They are used to convert the converged light signals into electrical signals, collect the total light intensity response of the scene corresponding to the transmission state and reflection state of the spatial light modulation module, and obtain two measurement vectors containing target object information.
[0026] The signal conversion module is a time-to-digital converter, used to convert the analog electrical signal output by the dual-channel detection module into a digital electrical signal and transmit it synchronously to the data processing module;
[0027] The data processing module pre-stores the measurement matrix generated by the aforementioned spatial light modulation method with Gray code rearrangement. It receives the digital electrical signal transmitted by the signal conversion module and restores it to two measurement vectors. It performs a difference operation on the two measurement vectors to obtain a difference vector. It inputs the pre-stored measurement matrix and the difference vector into the compressed sensing reconstruction algorithm to solve for the estimated value of the original target image. The reconstructed image is then output through the display unit or stored in the storage unit.
[0028] By employing the above technical solutions, the spatial light modulation method and system for Gray code rearrangement provided in this application, through the synergy of Gray code index rearrangement and dual-path differential detection, achieves multi-dimensional technical improvements: In terms of imaging performance, the adjacent single-bit jump characteristics of the Gray code sequence endow the basic modulation matrix with a deterministic and smooth sampling trajectory, avoiding the problem of uneven information acquisition in random sampling, enabling uniform and efficient acquisition of image information even at low sampling rates, and improving the stability of reconstruction quality and information acquisition efficiency; in terms of anti-interference capability, the dual-path differential detection mechanism accurately cancels common-mode noise such as ambient light background and light source intensity fluctuations, while retaining and enhancing effective signals related to the target object, thus improving data acquisition efficiency. The system's signal-to-noise ratio is improved at the source, ensuring stable imaging under complex lighting conditions. Regarding experimental repeatability, the Gray code index sequence and its mapping can be pre-calculated offline, eliminating the uncertainty of traditional pseudo-random sampling and enabling precise reproduction of imaging experimental conditions. This makes it suitable for scenarios with high repeatability requirements, such as scientific research and industrial non-destructive testing. In terms of hardware adaptability, the improvements focus on the algorithm logic level, requiring no modification to core hardware such as spatial light modulators, light sources, and detectors, nor the generation of massive new modulation pattern libraries. It can be integrated into existing single-pixel imaging systems through software upgrades or simple circuit expansion, resulting in low implementation costs and high scalability, while retaining the high-speed modulation advantages of the original system.
[0029] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0030] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0031] Figure 1 shows a schematic diagram of an example of a spatial light modulation method based on Gray code index rearrangement provided in an embodiment of this application;
[0032] Figure 2 shows a schematic diagram of a differential dual-path spatial light modulation system based on DMD provided in an embodiment of this application;
[0033] Figure 3 shows a schematic diagram of the image reconstruction effect of different modulation matrices in the embodiments of this application. Detailed Implementation
[0034] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.
[0035] To address the shortcomings of the aforementioned background technology, this application aims to provide a spatial light modulation method based on Gray code index rearrangement to solve the following technical problems: while preserving the excellent reconstruction performance of the measurement basis mathematics, the projection order of its modulation mode is optimized to achieve more stable and efficient information capture at low sampling rates; through deterministic and non-random sampling order design, the system control complexity is reduced, the experimental repeatability is improved, and the convergence characteristics of the reconstruction algorithm are potentially improved.
[0036] To achieve the above objectives, this application provides a spatial light modulation method based on Gray code index rearrangement. By combining the determinism and hardware-friendliness of Gray code sequences with the mathematical advantages of high-performance fundamental modulation matrices, and introducing a differential detection mechanism, it achieves high-quality and robust image reconstruction within the compressed sensing framework. This application's solution includes at least two core improvements. First, it provides a system method for deterministically rearranging the fundamental measurement matrix based on Gray code sequences. The protected method uses a Gray code sequence—a sequence where adjacent indices change by only one bit—to rearrange the row or column index order of a pre-selected fundamental measurement matrix to generate the final measurement matrix for spatial light modulation. The key is utilizing the sequential characteristics of Gray code sequences to control the systemic sampling order. This method is applicable to all computational imaging systems based on sequentially projected structured patterns, such as single-pixel imaging, structured light 3D imaging, and through-scattering medium imaging. Regardless of the fundamental modulation matrix... This method can be applied to Hadamard matrices, Fourier matrices, random Bernoulli matrices, noisy speckle matrices, or chaotic matrices. It is applicable regardless of whether the spatial light modulator is a DMD, a rotating mask, or another type, as long as the patterns are loaded sequentially. Secondly, there is a dual-path differential detection and information processing mechanism that works in conjunction with the above coding method. This protects the specific system architecture and data processing steps in a single-pixel imaging system combined with the above rearrangement coding method, where at least two detectors are used to collect the light intensity of the spatial light modulator under different states, and their responses are differentially processed to eliminate common-mode noise and obtain the final measurement value used for reconstruction.
[0037] The spatial light modulation method based on Gray code index rearrangement provided in this application specifically includes the following steps 1-5.
[0038] Step 1: Construct the basic modulation matrix.
[0039] Specifically, the total number of pixels N is determined based on the resolution of the target image, the number of measurements M is determined based on the preset sampling rate, and an N×N-dimensional basic modulation matrix suitable for compressed sensing reconstruction and with excellent algebraic characteristics is selected by combining the pre-determined physical characteristics of the spatial light modulator (number of modulation units, working state type and response rate).
[0040] For example, based on the resolution of the target image Determine the size of the modulation matrix This dimension corresponds to the number of complete modulation units in the spatial light modulator. Based on the physical characteristics of the imaging system's core hardware, the spatial light modulator, a fundamental modulation matrix with excellent algebraic properties suitable for compressed sensing reconstruction is selected. This matrix is usually a The square matrix, whose row vectors form a complete set of basis functions with excellent mathematical properties, provides a theoretical guarantee for high-quality reconstruction. In practical applications, in order to overcome the limitations of the traditional Nyquist sampling theorem and achieve fast imaging, this application adopts the compressed sensing principle. Based on the requirements for system modulation rate and imaging time, a sampling rate lower than the conventional requirement is preset, and the actual number of measurements is determined accordingly. This enables efficient subsampling capture of image information.
[0041] In this application, the spatial light modulator includes, but is not limited to, digital micromirror devices (DMDs) and rotating masks. When a digital micromirror device is used, the on state of the micromirror corresponds to the transmission state, and the off state of the micromirror corresponds to the reflection state. In one setting, the deflection angle of the micromirror is +12° when it is on and -12° when it is off, and the accuracy of the deflection angle is controlled within ±0.1°.
[0042] In one implementation, the basic modulation matrix The matrix can be selected from, but is not limited to, the Hadamard matrix, the Fourier matrix, or other deterministic measurement matrices with low coherence. Specifically, when the fundamental modulation matrix is the Hadamard matrix, if N=2 n Where n is a positive integer, the Sylvester construction method is used to construct the system, and the construction process satisfies the following conditions: If N = 4k and N = p + 1, where k is a positive integer and p is an odd prime, then the Legendre symbolic construction method is used to construct the matrix, and the matrix elements are generated through the quadratic residue property of the odd prime p during the construction process.
[0043] Step 2: Generate Gray code index sequence.
[0044] This step is one of the key steps. Specifically, the natural binary sequence 0 to L-1 is encoded using standard reflective Gray code, where L is a positive integer not less than M, to generate a Gray code index sequence of length L. The binary representation of any adjacent index value in the Gray code index sequence differs by only one bit. The Gray code index sequence is used to control the pattern loading order of the spatial light modulator.
[0045] To achieve the basic modulation matrix To optimize access, this application first generates a digital control sequence decoupled from physical modulation. Specifically, it uses a natural binary sequence... to Perform standard reflective Gray code encoding, where For a not less than A sufficiently large number. This process can be achieved using an efficient bitwise recursive formula. Direct implementation, in which For natural number indices starting from 1, Let be the i-th element in the Gray code index sequence. During generation, the natural binary sequence 0 to L-1 is first converted into an n_bit binary sequence, where n_bit is the smallest integer not less than log₂N. Then, based on the bitwise operation recursive formula, the converted binary sequence is encoded bit by bit to obtain the Gray code index sequence. This generates a Gray code index sequence of length L. The core mathematical property of this sequence is that any two adjacent index values... and The binary representations of the modulation sequences differ by exactly one bit. While this characteristic does not directly change the modulation content, it lays the mathematical foundation for constructing modulation sequences with smooth transition characteristics.
[0046] Step 3: Rearrange and map the modulation matrix.
[0047] This step is also one of the key steps. Specifically, through a preset mapping function, the first M indexes of the Gray code index sequence are systematically mapped onto the row index set of the basic modulation matrix, generating a new measurement matrix. The row order of the measurement matrix corresponds one-to-one with the pattern projection order of the spatial light modulator. This step achieves an organic combination of hardware-friendly sequences and mathematically optimal basis.
[0048] For example, the Gray code index sequence generated above The front of the middle A valid index, through a preset, flexibly adjustable mapping function. Systematically mapped to the fundamental modulation matrix On the set of row indices. Mapping function The design is diverse, but its core purpose is to transfer the asymptotic, low-jump ergodic characteristics inherent in Gray code sequences in binary space to the fundamental matrix. The order in which rows are accessed. A simple and efficient implementation is to use modulo operation, that is... Through this mapping, a new, ordered measurement matrix is obtained. Its definition ,in .matrix It not only inherits the basic matrix The excellent mathematical reconstruction properties of each row vector are important, but more importantly, their row order is endowed with a deterministic, approximately smoothly varying access structure by the Gray code sequence. This structure simulates structured random sampling at the system level, which helps to acquire image information more uniformly and efficiently at low sampling rates, thereby improving the information entropy and stability of the measurement.
[0049] Furthermore, for ,make Mapping function This function is used to establish the correspondence between Gray code indices and matrix row indices. Implementation methods include linear modulo operation, hash mapping, or direct mapping based on a pre-defined lookup table. The aim is to transfer the traversal characteristics of the Gray code sequence to the access order of the base matrix rows. Therefore, in one implementation, the mapping function can be implemented using linear modulo operation, hash mapping, or direct mapping based on a pre-defined lookup table; when using linear modulo operation, the expression is... ,in For mapping functions, For the i-th element in the Gray code index sequence, ensure that the mapping result falls within the range of row indices 1 to N of the basic modulation matrix; when using hash mapping, convert the Gray code index into an integer using an improved hash algorithm based on MD5 or SHA, and then constrain it to the range of row indices 1 to N through modulo operation; when using a pre-set lookup table mapping, the lookup table pre-stores a one-to-one correspondence between the Gray code index and the row index of the basic modulation matrix, and the construction of the lookup table satisfies the adjacent single-bit transition characteristics of the Gray code sequence and the ordered mapping of the row index of the basic matrix.
[0050] In one implementation, the measurement matrix satisfies Where A is the measurement matrix, i=1,2,...,M, Based on the modulation matrix, For mapping functions, The i-th element in the Gray code index sequence; the elements of the measurement matrix include -1 and 1, which are the binary working states adapted to the spatial light modulator. The binary working state can only present two physical states. Before being loaded onto the spatial light modulator, the -1 elements in the measurement matrix are mapped to 0 to obtain the loading matrix. In the loading matrix, 1 corresponds to the on state of the spatial light modulator and 0 corresponds to the off state.
[0051] Step 4: Spatial light modulation and differential image acquisition.
[0052] This step is one of the important steps. Specifically, each row of the measurement matrix is converted into a two-dimensional spatial light modulation pattern that matches the modulation unit array of the spatial light modulator. The pattern is then loaded into the spatial light modulator in the order of the rows of the measurement matrix. After the light source is transmitted through the target object, it forms a light signal carrying the target object information. The spatial light modulator spatially encodes the light signal. Simultaneously, two single-pixel detectors with matching performance are used to collect the total light intensity response of the scene corresponding to the encoded light signal in the transmission and reflection states of the spatial light modulator, respectively, to obtain two measurement vectors containing the target object information.
[0053] For example, measurement matrix Each row vector is reconstructed into a corresponding two-dimensional spatial light modulation pattern, strictly following the matrix... The patterns are sequentially loaded onto the spatial light modulator in the order of rows. In the transmissive imaging optical path, the light emitted from the light source is spatially encoded by the spatial light modulator after passing through the target object. To effectively suppress ambient light noise and improve the signal-to-noise ratio, this application innovatively adopts a dual-path differential detection mechanism: two single-pixel detectors with matched performance are used simultaneously to accurately acquire the patterns corresponding to the transmission states of the spatial light modulator. With reflection state The total light intensity response of the scene under two working states. For each measurement, two one-dimensional measurements are obtained simultaneously. and Ultimately, measurement vectors are formed respectively. and This design ensures that each modulation simultaneously incorporates two sets of complementary light intensity information.
[0054] Step 5: Calculate the reconstructed image.
[0055] Specifically, a difference vector is obtained by performing a difference operation on two measurement vectors. The measurement matrix and the difference vector are then input into a compressed sensing reconstruction algorithm. By solving a constraint optimization problem, an estimate of the original target image reflecting the physical shape of the target object is reconstructed.
[0056] To fully utilize the dual-path detection information and maximize the elimination of common-mode noise, this application first converts the acquired two-path measurement vectors into... and Perform a difference operation to obtain the difference vector. This operation is mathematically equivalent to subtracting the responses of the two detection channels, effectively canceling out the common ambient light background components in both signals, thus significantly improving the signal-to-noise ratio of the effective signal and simultaneously expanding the amount of information. Finally, the known measurement matrix is... The difference vector after difference processing The images are input together into a selected compressed sensing reconstruction algorithm for solving. The algorithm solves a constrained optimization problem and ultimately reconstructs an estimate of the original target image with high accuracy. .
[0057] In this application, the reconstruction algorithms include, but are not limited to, the Total Variation Minimization Algorithm (TVAL3) based on the Augmented Lagrange method and the Alternating Direction method, the Basis Pursuit Denoising (BPDN) algorithm, or the Approximate Message Passing (AMP) algorithm. For example, during the solution process, the L1 norm constrained optimization problem is solved by the compressed sensing reconstruction algorithm, and the pixel grayscale information of the original target image is restored by utilizing the linear correspondence between the measurement matrix and the difference vector.
[0058] In summary, the spatial light modulation method based on Gray code index rearrangement provided in this application has the following beneficial effects:
[0059] 1. Regarding imaging quality and information acquisition efficiency, intelligent reconstruction of the access order of the fundamental modulation matrix is achieved through the core step of Gray code index rearrangement. Specifically, Gray code sequences with adjacent single-bit transition characteristics are systematically applied to the fundamental matrix through a mapping function. The row index is used. This operation does not generate new primitives, but rather assigns a deterministic, asymptotically smooth sampling trajectory to the high-performance mathematical basis. Compared to completely random sampling, this rearranged order can guide the measurement system to explore the information space of the image in a more ordered way at low sampling rates, avoiding the problem of uneven early information acquisition that may occur with random sampling;
[0060] 2. To improve the system's anti-interference capability and signal-to-noise ratio, a dual-path differential detection mechanism is adopted. This works synergistically with the aforementioned coding scheme to suppress noise. The dual-path differential detection mechanism can accurately cancel common-mode noise such as ambient light background and light source intensity fluctuations in both signals, because these noise components are... and The high correlation is significantly reduced during the difference process. Meanwhile, the matrix is rearranged using Gray code. The encoded effective signals related to the target object are preserved or even enhanced after differential processing. Therefore, this scheme significantly improves the effective signal-to-noise ratio of the system from the source of data acquisition, enabling the imaging system to maintain stable performance in complex lighting environments. This effect is difficult to achieve independently by a single coding optimization or detection scheme.
[0061] 3. Regarding system determinism and repeatability, the core control sequence of the entire imaging process is the Gray code index sequence. The mappings are completely predetermined and can be computed offline. This completely eliminates the measurement sequence uncertainty caused by different random seeds in traditional compressed sensing imaging based on pseudo-random number generators. The resulting technical effect is that the conditions of any imaging experiment can be accurately reproduced. This is crucial for scientific research requiring rigorous comparison, non-destructive testing of industrial products, and calibration and performance evaluation of imaging systems, enhancing the scientific rigor and engineering practicality of the method.
[0062] 4. In terms of hardware compatibility and implementation efficiency, this solution demonstrates high user-friendliness and flexibility. The core innovation of the entire solution lies in the algorithm and logic level: Gray code index rearrangement only requires modification of memory addressing or pattern calling order in the controller; dual-channel differential detection is a classic and efficient circuit design. These improvements do not require changes to the core hardware of the spatial light modulator, light source, and detector, nor do they require the generation of entirely new, massive modulation pattern libraries. Therefore, this solution can be easily integrated into existing single-pixel imaging systems, achieving a performance leap through software upgrades or simple circuit expansions. It has low implementation costs, is easy to promote, and maintains the high-speed modulation advantages of the original system.
[0063] The specific implementation of the embodiments of this application is described below through examples.
[0064] See Figure 1, which is a schematic diagram of an example of a spatial light modulation method based on Gray code index rearrangement according to this application.
[0065] Step S01: Construction of the basic modulation matrix. Based on the resolution of the target image. Determine the total number of pixels The number of measurements is determined based on the preset sampling rate. Based on the physical characteristics of the spatial light modulator, a fundamental modulation matrix with excellent algebraic properties suitable for compressed sensing reconstruction is selected. Its size is .
[0066] Step S02: Gray code index sequence generation. For the natural binary sequence... to Perform standard reflective Gray code encoding to generate a string of length... Gray code index sequence ,in ,sequence The binary representations of adjacent index values differ by only one bit.
[0067] Step S03: Serialization and rearrangement mapping. The Gray code index sequence... The former Each index is mapped using a predefined mapping function. Systematically mapped to the fundamental modulation matrix On the row index set, a new, ordered measurement matrix is generated. .
[0068] Step S04: Spatial light modulation and image acquisition. The measurement matrix... Each row is converted into a corresponding two-dimensional spatial light modulation pattern. According to the matrix... The patterns are sequentially loaded into the spatial light modulator in row order. After the light source is transmitted through the target object, it is encoded by the spatial light modulator. Two single-pixel detectors are used simultaneously to collect the state of each pattern under projection. and state The total light intensity response of the scene is used to obtain a one-dimensional measurement vector. and .
[0069] Step S05: Calculate the reconstructed image. The acquired measurement vectors... and Differences yield difference vectors Using the measurement matrix and difference vector The compressed sensing reconstruction algorithm is used to solve for the estimated value of the original image. .
[0070] For example, a DMD is selected as the spatial light modulator, and a Hadamard matrix is used as the basic modulation matrix. The image size is set to... Then the number of pixels in the modulation matrix .when satisfy The Hadamard matrix is constructed using the Sylvester construction method and the following formula:
[0071]
[0072] when satisfy ,and When the prime number is odd, the Hadamard matrix is constructed using the Legendre symbolic construction method. Let the initial complete Hadamard matrix be denoted as . , Size is They possess strict orthogonality.
[0073] Set the sampling rate to Then the number of measurements In one implementation, the preset sampling rate ranges from 10% to 50%. The sampling rate can be adjusted based on the system modulation rate, imaging time requirements, and / or the peak signal-to-noise ratio (PSNR) of the imaging quality. For example, when the system modulation rate is ≥1000Hz and the imaging time requirement is ≤50ms, a sampling rate of 10%-20% is selected; when the PSNR requirement for imaging quality is ≥20dB, a sampling rate of 30%-50% is selected. (The length is...) The decimal index sequence is , ,Require .remember ,Will Convert to A binary sequence of bits Denote the Gray code sequence. It is generated by the following formula:
[0074]
[0075] The mapping function is:
[0076]
[0077] To correct Gray code sequences The initial complete Hadamard matrix Rearrange to get Because the number of samples is compressed to Next, the measurement matrix .at this time The initial complete Hadamard matrix is reassembled into a new matrix determined by the Gray code sequence, exhibiting determinism and smooth changes in adjacent row numbers. This facilitates loading the measurement matrix onto the DMD. ,Will middle Element mapping , obtain the loading matrix ,but Corresponding to the opening of the microscope, Corresponding to the microscopic switch.
[0078] This application also provides a differential dual-path spatial light modulation system based on DMD, as shown in Figure 2, including: a high-stability light source 1, a collimating lens 2, a target object 3, an imaging lens 4, a digital micromirror device 5, a first collecting lens 6, a first single-photon detector 7, a second collecting lens 8, a second single-photon detector 9, a time-to-digital converter 10, and a data processing device 11.
[0079] The light source 1 is required to have high stability, and the appropriate light source is selected according to different actual imaging requirements such as high-speed imaging, low-light imaging, photon counting imaging, and non-visible light band imaging.
[0080] The collimating lens 2 converts the divergent light emitted by the light source into parallel light, which then passes through the target object 3. The imaging lens 4 precisely loads the light beam passing through the target object 3 onto the digital micromirror device 5. The host computer of the digital micromirror device 5 controls the matrix... Each row is rearranged in order as follows The two-dimensional binary images are generated and sent to the controller of the digital micromirror device 5. The controller then sequentially loads these patterns onto its micromirror array. Each micromirror of the digital micromirror device switches between two states, guiding the incident light in different directions. The light in the micromirror opening direction (+12°) is denoted as the transmitted light. The light at the micromirror's indirection (-12°) is reflected light. .
[0081] The first collecting lens 6 collects to the maximum extent. The collected light is then focused onto the effective photosensitive area of the first single-photon detector 7; the second collecting lens 8 collects the light to the maximum extent possible. The collected light rays are then focused onto the effective photosensitive area of the second single-photon detector 9. The signals from the first single-photon detector 7 and the second single-photon detector 9 are then converted into a transmission light path measurement vector by the time-to-digital converter 10. and reflected light path measurement vector The data is then input into data processing device 11. The modulation model can be expressed as:
[0082] ;
[0083] in To load the matrix, This refers to the noise of the first single-photon detector 7 in the transmission optical path. The noise of the second single-photon detector 9 in the reflected optical path. For ambient light noise, Represents a matrix of all ones. , , , .Will and By taking the difference, we get: .
[0084] Differential processing effectively eliminates common ambient light background noise and laser power fluctuations in both signals, significantly improving the signal-to-noise ratio. The noise of the single-photon detector is negligible if properly selected; therefore, the image reconstruction model can be expressed as: ;in Represents the reconstructed image vector. express The pseudo-inverse matrix, , .Depend on The structural characteristics of, then , For the measurement matrix, we have: Then, switching back to the basic image reconstruction model, since this system is undersampled, for The pseudo-inverse matrix.
[0085] Optionally, the light source 1 can be any one of an LED array light source, an infrared laser light source, or a pseudo-thermal light source;
[0086] Optionally, the single-photon detector is any one of a superconducting nanowire single-photon detector, a single-photon avalanche diode, and a photomultiplier tube.
[0087] Measurement matrix Sum of difference vectors As input, the TVAL3 reconstruction algorithm is invoked. The image size is set to 64×64, and the sampling rate is 30%. The reconstruction results of different coding modes and modulation optical paths are compared from three indicators: relative error, peak signal-to-noise ratio, and structural similarity.
[0088] See Table 1 below for a comparison of metrics for single-pixel reconstruction of the test_running image at a 30% sampling rate.
[0089] Table 1
[0090]
[0091] Furthermore, using a subset of images from the Set12 dataset as tests, the image reconstruction results of different modulation matrices are shown in Figure 3. Under a 30% sampling rate, the differential Gray-Hadamard matrix modulation reconstruction performance is significantly better than that of the traditional matrix.
[0092] The spatial light modulation method for Gray code rearrangement disclosed in this application can be used in fields such as single-pixel imaging, structured light three-dimensional measurement, through-scattering medium imaging, and optical encrypted communication. It is beneficial to the development of computational optical imaging and advanced light field manipulation technology towards high efficiency, high robustness, and intelligence.
[0093] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A spatial light modulation method with Gray code rearrangement, characterized in that, include: The total number of pixels N is determined based on the resolution of the target image, the number of measurements M is determined based on the preset sampling rate, and an N×N-dimensional basic modulation matrix suitable for compressed sensing reconstruction and with excellent algebraic properties is selected in combination with the physical characteristics of the pre-determined spatial light modulator. The natural binary sequence 0 to L-1 is encoded using standard reflection Gray code, where L is a positive integer not less than M, generating a Gray code index sequence of length L. The binary representations of any adjacent index values in this Gray code index sequence differ by only one bit. This Gray code index sequence is used to control the pattern loading order of the spatial light modulator. Using a preset mapping function, the first M indexes of the Gray code index sequence are systematically mapped onto the row index set of the basic modulation matrix, generating a new measurement matrix. The row order of this measurement matrix corresponds one-to-one with the pattern projection order of the spatial light modulator. Each row of the measurement matrix is then converted into a two-dimensional spatial light modulation array that matches the modulation unit array of the spatial light modulator. A pattern is created and sequentially loaded into a spatial light modulator according to the row order of the measurement matrix. After the light source is transmitted through the target object, a light signal carrying the target object information is formed. The spatial light modulator spatially encodes the light signal. Two single-pixel detectors with matched performance are used simultaneously to collect the total scene light intensity response corresponding to the encoded light signal in the transmission and reflection states of the spatial light modulator, respectively, to obtain two measurement vectors containing the target object information. The two measurement vectors are then differentially processed to obtain a difference vector. The measurement matrix and the difference vector are input into a compressed sensing reconstruction algorithm. By solving a constrained optimization problem, an estimate of the original target image reflecting the physical shape of the target object is reconstructed.
2. The method according to claim 1, characterized in that, The fundamental modulation matrix is selected from the Hadamard matrix, Fourier matrix, or other deterministic measurement matrices with low coherence; wherein, when the fundamental modulation matrix is the Hadamard matrix, if Where n is a positive integer, the Sylvester construction method is used to construct the system, and the construction process satisfies the following conditions: ;like where k is a positive integer. If the prime number is odd, then the Legendre symbolic construction method is used to construct it, and the construction process involves using odd prime numbers. The quadratic residue property generates matrix elements.
3. The method according to claim 1, characterized in that, The Gray code index sequence is generated recursively using bitwise operations, and the expression for the bitwise recursion is: , where i is a natural number index starting from 1. Let i be the i-th element in the Gray code index sequence; During the generation process, the natural binary sequence 0 to L-1 is first converted into... A binary sequence of bits, where satisfy Then, based on the bitwise operation recursive formula, the converted binary sequence is encoded bit by bit to obtain the Gray code index sequence.
4. The method according to claim 1, characterized in that, The mapping function can be implemented using linear modulo operation, hash mapping, or direct mapping based on a preset lookup table; when using linear modulo operation, the expression is: ,in For mapping functions, For the i-th element in the Gray code index sequence, ensure that the mapping result falls within the row index range of 1 to N of the basic modulation matrix; when using hash mapping, convert the Gray code index into an integer using an improved hash algorithm based on MD5 or SHA, and then constrain it to the row index range of 1 to N through modulo operation; When using a pre-defined lookup table for mapping, the lookup table stores a one-to-one correspondence between the Gray code index and the row index of the basic modulation matrix. The construction of the lookup table satisfies the adjacent single-bit transition characteristics of the Gray code sequence and the ordered mapping of the row index of the basic matrix.
5. The method according to claim 1, characterized in that, The measurement matrix satisfies Where A is the measurement matrix, i=1,2,...,M, Based on the modulation matrix, For mapping functions, The i-th element in the Gray code index sequence; the element values of the measurement matrix include -1 and 1, which are the binary working states adapted to the spatial light modulator. The binary working state can only present two physical states. Before being loaded onto the spatial light modulator, the -1 element in the measurement matrix is mapped to 0 to obtain the loading matrix. In the loading matrix, 1 corresponds to the on state of the spatial light modulator and 0 corresponds to the off state.
6. The method according to claim 1, characterized in that, The spatial light modulator includes a digital micromirror device (DMD) or a rotating mask; when a digital micromirror device is used, the on state of the micromirror corresponds to the transmission state, and the off state of the micromirror corresponds to the reflection state.
7. The method according to claim 1, characterized in that, The compressed sensing reconstruction algorithm is selected from the total variation minimization algorithm (TVAL3) based on augmented Lagrange method and alternating direction method, the basis pursuit denoising algorithm (BPDN) or the approximate message passing algorithm (AMP). In the solution process, the L1 norm constrained optimization problem is solved by the compressed sensing reconstruction algorithm, and the pixel gray value information of the original target image is restored by utilizing the linear correspondence between the measurement matrix and the difference vector.
8. The method according to claim 1, characterized in that, The preset sampling rate ranges from 10% to 50%, and the number of measurements... ,in The sampling rate is a preset sampling rate; wherein the sampling rate is adjusted based on the system modulation rate, imaging time requirements and / or the peak signal-to-noise ratio of imaging quality.
9. The method according to claim 1, characterized in that, The single-pixel detector is selected from superconducting nanowire single-photon detectors, single-photon avalanche diodes, or photomultiplier tubes. By setting the values of response speed, detection sensitivity, and noise level, the performance parameters of the two single-pixel detectors are ensured to be consistent. During the acquisition process, the two single-pixel detectors work synchronously through a synchronous trigger signal, and respectively acquire the total light intensity response of the scene in the transmission and reflection states of the spatial light modulator in real time, ensuring the time synchronization of the two detection signals.
10. A spatial optical modulation system with Gray code rearrangement, characterized in that, The system includes a light source, an optical transmission module, a spatial light modulation module, a dual-path detection module, a signal conversion module, and a data processing module. The light source provides stable incident light, selected from LED array light sources, infrared laser light sources, or pseudothermal light sources, with appropriate wavelength and intensity chosen according to the imaging scenario requirements. The optical transmission module includes a collimating lens, an imaging lens, and two collecting lenses. The collimating lens converts the diverging light emitted by the light source into parallel light and projects it onto the target object. The imaging lens accurately transmits the light transmitted through the target object to the modulation unit array of the spatial light modulation module. The two collecting lenses are respectively positioned corresponding to the transmission and reflection light output directions of the spatial light modulator, collecting the encoded light signals and converging them onto the detection surface of the dual-path detection module. The spatial light modulation module receives the light transmitted by the optical transmission module, loads a two-dimensional spatial light modulation pattern, and transmits it through the modulation unit array. The physical state switching spatially encodes the incident light; the dual-path detection module includes two performance-matched single-pixel detectors, respectively set to correspond to the two collecting lenses, for converting the converged light signal into an electrical signal, acquiring the total light intensity response of the scene corresponding to the transmission and reflection states of the spatial light modulation module, and obtaining two measurement vectors containing target object information; the signal conversion module is a time-to-digital converter, for converting the analog electrical signal output by the dual-path detection module into a digital electrical signal, and synchronously transmitting it to the data processing module; the data processing module pre-stores a measurement matrix, for receiving the digital electrical signal transmitted by the signal conversion module and restoring it to the two measurement vectors, performing a difference operation on the two measurement vectors to obtain a difference vector, inputting the pre-stored measurement matrix and the difference vector into a compressed sensing reconstruction algorithm, solving to obtain an estimate of the original target image, and outputting it through the display unit or storing it through the storage unit.
Citation Information
Patent Citations
Fringe projection three-dimensional shape measurement method based on frequency domain and time domain joint coding
CN121026011A
Low-cost three-dimensional live-action measurement and holographic reconstruction method and system for fringe projection
CN121067760A