Quantum Hadamard Edge Detection
This project explores the application of the Quantum Hadamard Edge Detection (QHED) algorithm to perform edge detection on digital images by exploiting quantum image processing paradigms.
The core of the approach relies on the Quantum Probability Image Encoding (QPIE) method, which encodes pixel intensities into the probability amplitudes of quantum states, allowing compact representation of grayscale images in a superposition of qubit states. This quantum encoding enables parallel processing of pixel pairs, overcoming the pixel-by-pixel limitations of classical algorithms.
The fundamental operation involves applying the Hadamard gate on the least significant qubit of the encoded state. This gate produces a quantum transformation that effectively computes the intensity gradients between horizontally adjacent pixels by leveraging quantum interference. To extend the detection to gradients between odd pixel pairs without costly permutations, the algorithm introduces an ancillary qubit, creating redundant information and enabling simultaneous measurement of both even and odd pixel gradients in a single circuit.
The implementation was carried out using IBM’s Qiskit framework, allowing for both ideal simulations via statevector simulators and noisy simulations modeled on actual quantum hardware noise profiles (e.g., the ibm_kyiv backend). These simulations validate the algorithm’s robustness and demonstrate that edge detection quality improves with the number of measurement shots, even under realistic noise conditions.
In terms of computational complexity, the QHED algorithm shows substantial advantages: while classical methods like Sobel or Canny operate with complexity proportional to the number of pixels (O(N)), the quantum approach achieves gradient computation in constant time (O(1)) after the initial state preparation, with a significant reduction in required qubits compared to alternative quantum edge detection methods.
Nevertheless, the high circuit depth—mainly due to the complexity of the shift matrix and the necessity of multiple quantum gates—poses a challenge for execution on current quantum hardware, limiting scalability to larger images. Future work may focus on optimizing circuit depth, exploring error mitigation techniques, and developing hybrid classical-quantum frameworks to enhance practical applicability.
Implementation Details
The input image is first normalized and encoded into a quantum state using QPIE, mapping pixel intensities to normalized amplitude vectors. A quantum circuit with n+1 qubits is constructed, where n corresponds to the logarithm base two of the total pixel count, plus one ancilla qubit for redundancy.
The algorithm applies Hadamard gates on specific qubits and a unitary shift matrix that cyclically permutes amplitudes, enabling the extraction of horizontal edge information via measurement outcomes. The circuit design and state preparation steps were scripted using Qiskit’s API, with visualizations of circuit diagrams generated for small image sizes.
Results Summary
Ideal (noise-free) simulations clearly show precise edge detection, confirming theoretical expectations. Noisy simulations incorporating real hardware noise models reveal that increasing the number of shots leads to progressively better edge resolution, with satisfactory results achieved at moderate shot counts (e.g., 4096 shots).
While transpiled circuits for small images (2×2) have been successfully simulated, scaling beyond this remains computationally expensive due to increased circuit depth. These results underline the promising potential of quantum edge detection while highlighting the need for hardware improvements and algorithmic optimizations.