A quantum segmentation algorithm based on local adaptive threshold for NEQR image

Lu Wang, Wenjie LiuarXiv 2023 · DOI

Abstract

Image segmentation is a fundamental task in computer vision, often hindered by uneven lighting when using global thresholding methods. While classical local adaptive thresholding addresses this, its computational cost scales poorly with image resolution. This paper introduces a quantum algorithm for image segmentation based on the Novel Enhanced Quantum Representation (NEQR) model. By leveraging quantum superposition and custom circuit modules for cyclic shifts and comparisons, the algorithm achieves an exponential speedup, reducing complexity from $O(2^{2n})$ to $O(n^2 + q)$. Simulations on IBM’s quantum platform confirm the algorithm's effectiveness and efficiency in handling complex lighting scenarios.

Introduction

Image segmentation partitions an image into meaningful segments, typically foreground and background. Global thresholding is efficient but fails under non-uniform illumination. Classical local adaptive thresholding provides a solution by calculating thresholds for each pixel based on its neighborhood, yet it becomes a bottleneck for high-resolution images due to its $O(2^{2n})$ complexity.

This research proposes a quantum alternative to overcome these real-time processing challenges. By moving the computation to the quantum domain, the algorithm processes multiple pixels simultaneously, offering a path toward real-time segmentation for large-scale imagery.

Methods

The algorithm utilizes the Novel Enhanced Quantum Representation (NEQR) to encode both pixel positions and grayscale values into quantum states. The core of the local adaptive approach involves several key quantum components:

  1. Quantum Image Cyclic Shift (CT): This operation realigns the image to bring neighboring pixels into the same quantum state, enabling parallel neighborhood processing.
  2. Median Calculation and Comparison: The algorithm identifies a local median within a specified neighborhood window.
  3. Quantum Comparator (QC) and Subtractor (QS): These are modular, low-cost circuits designed to perform the arithmetic necessary for thresholding.
  4. Quantum Binarization (QB): The final stage where grayscale values are converted to binary based on the local threshold $T = \text{median} - Z$.
Neighborhood window representation for local adaptive thresholding.

The neighborhood window (shown above) defines which pixels contribute to the local threshold calculation. By applying cyclic shifts, the quantum computer effectively pairs every pixel with its neighbors in superposition, allowing for simultaneous threshold calculation across the entire image.

The modular quantum circuit architecture for the segmentation process.

The circuit architecture (above) demonstrates the modularity required to implement these operations. The design focuses on minimizing quantum cost—the number of basic gates used—making it suitable for the Noisy Intermediate-Scale Quantum (NISQ) era.

Results and Discussion

The algorithm was validated using the ibmq_qasm_simulator. Key findings include:

  • Performance: The local adaptive method significantly outperformed fixed-thresholding in images with uneven illumination. For instance, in one test case ("Image B"), the quantum method achieved a Mean Square Error (MSE) of 11.8750, compared to 14.2500 for the fixed-threshold approach. Lower MSE indicates a more accurate representation of objects in shadowed regions.
  • Complexity: The quantum algorithm demonstrates a complexity of $O(n^2 + q)$, providing an exponential speedup over the classical $O(2^{2n})$. This advantage becomes increasingly pronounced as image size ($2^n \times 2^n$) grows.
  • Efficiency: Gate counts were minimized through the use of optimized QCs and QSs, ensuring the total quantum cost remains manageable for current simulators and near-term hardware.

Conclusion

This work demonstrates a viable quantum approach to local adaptive image segmentation. While current hardware limitations and the I/O bottleneck for quantum state preparation remain challenges, the exponential speedup and improved accuracy under uneven lighting mark a significant step forward. Future research will focus on integrating quantum noise reduction techniques to enhance robustness on physical quantum processors.

Summary updated

BibTeX
@misc{wang2023quantum,
  author = {Lu Wang and Wenjie Liu},
  title = {{A quantum segmentation algorithm based on local adaptive threshold for NEQR image}},
  year = {2023},
  eprint = {2311.11953},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.11953},
}
Figure