A continuous-variable quantum-inspired algorithm for classical image segmentation


The probabilistic nature of quantum particles, state space, and the superposition principle are among the important concepts in quantum mechanics. A framework was previously developed by the authors that allowed to take advantage of these quantum aspects in the field of image processing. This was done by modeling each image’s pixel by a two-state quantum system which allowed efficient single-object segmentation. However, the extension of the framework to multi-object segmentation would be highly complex and computationally expensive. In this paper, we propose a classical image segmentation algorithm inspired by the continuous-variable quantum theory that overcomes the challenges in extending the framework to multi-object segmentation. By associating each pixel with a quantum harmonic oscillator, the space of coherent states becomes continuous. Thus, each pixel can evolve from an initial state to any of the continuous coherent states under the influence of an external resonant force. The Hamiltonian operator is designed to account for this force and is derived from the features extracted at the pixel. Therefore, the system evolves from an initial ground state to a final coherent state depending on the image features. Finally by calculating the fidelity between the final state and a set of reference states representing the objects in the image, the state with the highest fidelity is selected. The collective states of all pixels produce the final segmentation. The proposed method is tested on a database of synthetic and natural images, and compared with other methods. Average sensitivity and specificity of 97.86% and 99.61% were obtained respectively indicating the high segmentation accuracy of the algorithm.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8


  1. Adcock MR, Høyer P, Sanders BC (2016) Quantum computation with coherent spin states and the close hadamard problem. Quantum Inf Process 15(4):1361–1386

    MathSciNet  Article  Google Scholar 

  2. Alpert S, Galun M, Basri R, Brandt A (2007) Image segmentation by probabilistic bottom-up aggregation and cue integration. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition

  3. Borelli L, Aguiar L, Roversi J, Vidiella-Barranco A (2016) Quantum key distribution using continuous-variable non-gaussian states. Quantum Inf Process 15(2):893–904

    MathSciNet  Article  Google Scholar 

  4. Caraiman S, Manta VI (2015) Image segmentation on a quantum computer. Quantum Inf Process 14 (5):1693–1715

    MathSciNet  Article  Google Scholar 

  5. Casper E, Hung CC, Jung E, Yang M (2012) A quantum-modeled k-means clustering algorithm for multi-band image segmentation. In: Proceedings of the 2012 ACM research in applied computation symposium. ACM, pp 158–163

  6. Chan TF, Vese LA (2001) Active contours without edges. Trans Img Proc 10(2):266–277

    Article  Google Scholar 

  7. Chapeau-Blondeau F, Belin E (2016) Quantum image coding with a reference-frame-independent scheme. Quantum Inf Process: 1–16

  8. Ekert AK, Alves CM, Oi DK, Horodecki M, Horodecki P, Kwek LC (2002) Direct estimations of linear and nonlinear functionals of a quantum state. Physical Rev Lett 88(21):217, 901

    Article  Google Scholar 

  9. Gerry C, Knight P (2005) Introductory quantum optics. Cambridge University Press, Cambridge

    Google Scholar 

  10. Griffiths DJ (2005) Introduction to quantum mechanics. Pearson Education India

  11. Jiang N, Dang Y, Wang J (2016) Quantum image matching. Quantum Inf Process: 1–30

  12. Lau HK, Pooser R, Siopsis G, Weedbrook C (2016) Quantum machine learning over infinite dimensions. arXiv:160306222

  13. Li Y, Sun J, Tang CK, Shum HY (2004) Lazy snapping. ACM Trans Graphics (ToG) 23(3):303–308

    Article  Google Scholar 

  14. Li P, Xiao H, Li B (2016) Quantum representation and watermark strategy for color images based on the controlled rotation of qubits. Quantum Inf Process: 1–26

  15. Lloyd S (1982) Least squares quantization in pcm. IEEE Trans Inf Theory 28(2):129–137

    MathSciNet  Article  Google Scholar 

  16. Ma H, Huang P, Bao W, Zeng G (2016) Continuous-variable quantum identity authentication based on quantum teleportation. Quantum Inf Process: 1–16

  17. Mastriani M (2015a) Quantum boolean image denoising. Quantum Inf Process 14(5):1647–1673

  18. Mastriani M (2015b) Quantum image processing? arXiv:151202942

  19. Nielsen MA, Chuang IL (2010) Quantum computation and quantum information. Cambridge University Press, Cambridge

    Book  Google Scholar 

  20. Otsu N (1979) A threshold selection method from gray-level histograms. IEEE Trans Systems, Man, Cybern 9(1):62–66

    Article  Google Scholar 

  21. Sergioli G, Santucci E, Didaci L, Miskczak JA, Giuntini R (2016) Pattern recognition on the quantum bloch sphere. arXiv:160300173

  22. Sommer C, Straehle C, Koethe U, Hamprecht FA (2011) Ilastik: interactive learning and segmentation toolkit. In: 2011 IEEE International symposium on biomedical imaging: from nano to macro. IEEE, pp 230–233

  23. Tanaka K, Tsuda K (2008) A quantum-statistical-mechanical extension of gaussian mixture model. In: Journal of physics: conference series, vol 95. IOP Publishing, p 012023

  24. Yan F, Iliyasu AM, Venegas-Andraca SE (2016) A survey of quantum image representations. Quantum Inf Process 15(1):1–35

    MathSciNet  Article  Google Scholar 

  25. Youssry A, El-Rafei A, Elramly S (2015) A quantum mechanics-based framework for image processing and its application to image segmentation. Quantum Inf Process 14(10):3613–3638

    MathSciNet  Article  Google Scholar 

  26. Youssry A, El-Rafei A, Elramly S (2016) A quantum mechanics-based algorithm for vessel segmentation in retinal images. Quantum Inf Process 15(6):2303–2323. https://doi.org/10.1007/s11128-016-1292-1

    MathSciNet  Article  Google Scholar 

  27. Zhou R, Hu W, Luo G, Liu X, Fan P (2018a) Quantum realization of the nearest neighbor value interpolation method for ineqr. Quantum Inf Process 17(7):166

  28. Zhou RG, Liu X, Zhu C, Wei L, Zhang X, Ian H (2018b) Similarity analysis between quantum images. Quantum Inf Process 17(6):121

Download references


AY is supported by an Australian Government Research Training Program Scholarship. This work is supported by the National Natural Science Foundation of China under Grant No. 61463016, 61763014, National Key R&D Plan under Grant No. SQ2018YFC120002 and “Science and technology innovation action plan” of Shanghai in 2017 under Grant No. 17510740300.

Author information



Corresponding author

Correspondence to Akram Youssry.

Additional information

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.


Appendix: 1. Proof of Eq. 16

It is required to prove that given the Hamiltonian

$$ H=\hbar\omega\left( \hat{a}^{\dagger}\hat{a}+\frac{1}{2}\right) + \hbar\left( f(t)\hat{a}+f^{*}(t)\hat{a}^{\dagger}\right), $$

such that

$$ f(t)=f_{0} e^{i\omega t}, $$

and the initial state

$$ |\psi(0)\rangle=|0\rangle, $$

then the final state obtained after evolution is a coherent state

$$ |\alpha\rangle=e^{-\frac{1}{2}|\alpha|^{2}} \sum\limits_{n=0}^{\infty} {\frac{\alpha^{n}}{\sqrt{n!}}}|n\rangle. $$

The Hamiltonian in Eq. 28 can be written in the form

$$ H=H_{0}+V, $$


$$ H_{0}=\hbar\omega\left( \hat{a}^{\dagger}\hat{a}+\frac{1}{2}\right) $$

is the free field Hamiltonian which is time independent, while

$$ V=\hbar\left( f(t)\hat{a}+f^{*}(t)\hat{a}^{\dagger}\right) $$

is the interaction potential which is time dependent. As it is known in the theory of quantum mechanics, there are three pictures (representations) of states and operators:

  • The Schrödinger picture in which the states are time dependent, while the operators are time independent.

  • The Heisenberg picture in which the states are time independent, while the operators are time dependent

  • The Dirac (interaction) picture, where both states and operators are time dependent.

The three representations are equivalent to each other and can be converted easily from one picture to another. The state represented in the interaction picture |ψ(t)〉I is related to Schrödinger’s picture |ψ(t)〉S via the transformation

$$ |\psi(t)\rangle_{I}=U_{0}^{\dagger} (t)|\psi(t)\rangle_{S}, $$


$$ U_{0}=e^{-\frac{i}{\hbar}H_{0} t}=e^{-i\omega t \left( \hat{a}^{\dagger}\hat{a}+\frac{1}{2}\right)} $$

is the free field evolution operator. The interaction potential in the interaction picture VI(t) is related to the Schrödinger’s picture V0 via the transformation

$$ V_{I}(t)=U_{0}^{\dagger} (t) V_{0} U_{0}(t). $$

By substituting Eqs. 36 in Eq. 37, we get

$$ V_{I}(t)=e^{i\omega t \left( \hat{a}^{\dagger}\hat{a}+\frac{1}{2}\right)} \hbar\left( f(t)\hat{a}+f^{*}(t)\hat{a}^{\dagger}\right) e^{-i\omega t \left( \hat{a}^{\dagger}\hat{a}+\frac{1}{2}\right)}. $$

This equation is expanded as

$$ V_{I}(t)=\hbar f(t) e^{i\omega t \hat{a}^{\dagger}\hat{a}}\hat{a}e^{-i\omega t \hat{a}^{\dagger}\hat{a}} +\hbar f^{*}(t) e^{i\omega t \hat{a}^{\dagger}\hat{a}}\hat{a}^{\dagger} e^{-i\omega t \hat{a}^{\dagger}\hat{a}}. $$

The operator part in each of the two terms is in the form esABesA, where s = iωt, \(A=\hat {a}^{\dagger }\hat {a}\), and \(B=\hat {a}\) for the first term and \(\hat {a}^{\dagger }\) for the second term. This allows us to use the Baker-Campbell-Hausdorff (BCH) formula

$$ \begin{array}{@{}rcl@{}} e^{sA} B e^{-sA}&=&B+[A,B]s+[A,[A,B]]\frac{s^{2}}{2!}\\ &&+[A,[A,[A,B]]]\frac{s^{3}}{3!}+\cdots. \end{array} $$

So, we need to calculate these nested commutators. Rewriting the commutator relation in Eq. 5, in the form \(\hat {a}\hat {a}^{\dagger }-\hat {a}^{\dagger }\hat {a}=1\), we obtain

$$ [\hat{a}^{\dagger} \hat{a},\hat{a}]=\hat{a}^{\dagger} \hat{a} \hat{a}- \hat{a} \hat{a}^{\dagger} \hat{a}=\hat{a}^{\dagger} \hat{a} \hat{a}-(1+\hat{a}^{\dagger} \hat{a})\hat{a}=-\hat{a}. $$
$$ [\hat{a}^{\dagger} \hat{a},[\hat{a}^{\dagger} \hat{a},\hat{a}]]=[\hat{a}^{\dagger} \hat{a},-\hat{a}]=-[\hat{a}^{\dagger} \hat{a},\hat{a}]=\hat{a}. $$

and so on. The nested commutators form an alternating series between \(\hat {a}\) and \(-\hat {a}\). By substituting the result of Eq. 41 in the BCH formula of Eq. 40, we get

$$ \begin{array}{@{}rcl@{}} e^{i\omega t \hat{a}^{\dagger}\hat{a}}\hat{a}e^{-i\omega t \hat{a}^{\dagger}\hat{a}}\!&=&\hat{a}-(i\omega t)\hat{a}+\frac{(i\omega t)^{2}}{2!}\hat{a}-\frac{(i\omega t)^{3}}{3!}\hat{a}+\cdots \end{array} $$
$$ \begin{array}{@{}rcl@{}} &=&\hat{a}\!\left( \!1 + (-i\omega t) + \frac{(-i\omega t)^{2}}{2!} + \frac{(-i\omega t)^{3}}{3!} + {\cdots} \!\right) \end{array} $$
$$ \begin{array}{@{}rcl@{}} &=&\hat{a}e^{-i\omega t}, \end{array} $$

where the last equation comes from the Taylor expansion of the exponential function. By taking the adjoint we obtain

$$ e^{i\omega t \hat{a}^{\dagger}\hat{a}}\hat{a}^{\dagger} e^{-i\omega t \hat{a}^{\dagger}\hat{a}}=\hat{a}^{\dagger} e^{i\omega t}. $$

Now we can insert the results into Eq. 39 to get

$$ V_{I}(t)=\hbar\left( f(t)\hat{a}e^{-i\omega t}+f^{*}(t)\hat{a}^{\dagger} e^{i\omega t}\right). $$

This interaction part does not generally commute in time [VI(t1),VI(t2)]≠ 0, which makes the exact solution difficult to obtain; however, if the external force is resonant with the oscillator so that it takes the form in Eq. 29, and f0 chosen to be real, we obtain the interaction Hamiltonian in the form

$$ V_{I}(t)=\hbar f_{0} \left( \hat{a}+\hat{a}^{\dagger}\right), $$

which clearly commutes in time, so we can obtain a closed-form solution in the interaction picture

$$ \begin{array}{@{}rcl@{}} |\psi(t)\rangle_{I}=U_{I}|\psi(0)\rangle_{I}&=&e^{-\frac{i}{\hbar}V_{I} t}|\psi(0)\rangle_{I} \end{array} $$
$$ \begin{array}{@{}rcl@{}} &=&e^{-i f_{0} t (\hat{a} +\hat{a}^{\dagger})}|\psi(0)\rangle_{I}. \end{array} $$

We can now return back to Schrödinger’s picture for the initial and final states by using Eq. 35

$$ U_{0}^{\dagger}(t)|\psi(t)\rangle_{S}=e^{-i f_{0} t (\hat{a} +\hat{a}^{\dagger})}U_{0}^{\dagger}(0)|\psi(0)\rangle_{S}, $$

which is equivalent to

$$ |\psi(t)\rangle_{S}=U_{0}(t) e^{-i f_{0} t (\hat{a} +\hat{a}^{\dagger})}U_{0}^{\dagger}(0)|\psi(0)\rangle_{S}. $$

Since |ψ(0)〉S = |0〉, and \(U_{0}^{\dagger }(0)=1\), therefore

$$ |\psi(t)\rangle_{S}=e^{-i \omega t \left( \hat{a}^{\dagger} \hat{a} +\frac{1}{2}\right)} e^{-i f_{0} t (\hat{a} +\hat{a}^{\dagger})}|0\rangle. $$

For two operators A and B, if [A,B]≠ 0 and [A, [A,B]] = [B, [A,B]] = 0, then the following identity holds

$$ e^{A+B}=e^{A} e^{B} e^{-\frac{1}{2}[A,B]}=e^{B} e^{A} e^{\frac{1}{2}[A,B]}. $$

The second exponential clearly satisfies these two conditions with \(A=(-i f_{0} t)\hat {a}\) and \(B=(-i f_{0} t)\hat {a}^{\dagger }\); consequently the final state becomes

$$ |\psi(t)\rangle_{S}=e^{-i \omega t \left( \hat{a}^{\dagger} \hat{a} +\frac{1}{2}\right)} e^{-i f_{0} t \hat{a}^{\dagger}} e^{-i f_{0} t \hat{a}} e^{-\frac{(f_{0} t)^{2}}{2}}|0\rangle. $$

Rearranging the non-operator terms,

$$ |\psi(t)\rangle_{S}=e^{-\frac{i \omega t}{2}} e^{-\frac{(f_{0} t)^{2}}{2}} e^{-i \omega t \hat{a}^{\dagger} \hat{a}} e^{-i f_{0} t \hat{a}^{\dagger}} e^{-i f_{0} t \hat{a}} |0\rangle. $$

The first term is an overall phase shift that does not change the state, so it can be neglected to get

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} e^{-i \omega t \hat{a}^{\dagger} \hat{a}} e^{-i f_{0} t \hat{a}^{\dagger}} e^{-i f_{0} t \hat{a}} |0\rangle. $$

The last exponential can be expanded as a Taylor series:

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} e^{-i \omega t \hat{a}^{\dagger} \hat{a}} e^{-i f_{0} t \hat{a}^{\dagger}} \sum\limits_{n=0}^{\infty} {\frac{(-i f_{0} t)^{n}}{n!}\hat{a}^{n}} |0\rangle. $$

All the terms in the series vanish due to definition of annihilation operator except for the first term (n = 0) which is equal to 1 so

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} e^{-i \omega t \hat{a}^{\dagger} \hat{a}} e^{-i f_{0} t \hat{a}^{\dagger}} |0\rangle. $$

Again expanding the last exponential as a Taylor series we get

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} e^{-i \omega t \hat{a}^{\dagger} \hat{a}} \sum\limits_{n=0}^{\infty} {\frac{(-i f_{0} t)^{n}}{n!}(\hat{a}^{\dagger})^{n}} |0\rangle. $$

By the repeated application of the creation operator on the vacuum state and using Eq. 2,

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} e^{-i \omega t \hat{a}^{\dagger} \hat{a}} \sum\limits_{n=0}^{\infty} {\frac{(-i f_{0} t)^{n}}{n!}\sqrt{n!}}|n\rangle. $$

Due to linearity, we can operate on the series term by term to get

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} \sum\limits_{n=0}^{\infty} {\frac{(-i f_{0} t)^{n}}{n!}\sqrt{n!}}e^{-i \omega t \hat{n}}|n\rangle. $$

Given that |n〉 are eigenstates of the number operator \(\hat {n}=\hat {a}^{\dagger } \hat {a}\), with eigenvalues n, the expression becomes

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} \sum\limits_{n=0}^{\infty} {\frac{(-i f_{0} t)^{n}}{n!}\sqrt{n!}}e^{-i \omega t n}|n\rangle. $$

Simplifying this expression, we get

$$ |\psi(t)\rangle_{S}=e^{-\frac{(f_{0} t)^{2}}{2}} \sum\limits_{n=0}^{\infty} {\frac{(-i f_{0} t e^{-i \omega t})^{n}}{\sqrt{n!}}}|n\rangle. $$

Now let

$$ \alpha = -i e^{-i \omega t} f_{0} t\to|\alpha|^{2}=(f_{0} t)^{2}, $$

then the final state becomes

$$ |\psi(t)\rangle_{S}=e^{-\frac{1}{2}|\alpha|^{2}} \sum\limits_{n=0}^{\infty} {\frac{\alpha^{n}}{\sqrt{n!}}}|n\rangle. $$

This is exactly the definition of the coherent state |α〉, which is required to prove.

Appendix: 2. Proof of invariance of scaling factor in the reference states

Given that the fidelity between a final state |α〉 and two reference states |β1〉 and |β2〉 with equal magnitudes and different phases (i.e lying on the same circle in the complex plane) satisfy that

$$ F_{1}>F_{2}. $$

It is required to prove that scaling the reference states do not change that relation. Evaluating the fidelity yields

$$ \langle{\alpha|\beta_{1}}\rangle>\langle{\alpha|\beta_{2}}\rangle, $$


$$ e^{-\frac{1}{2}|\alpha-\beta_{1}|^{2}}>e^{-\frac{1}{2}|\alpha-\beta_{2}|^{2}}. $$

This is equivalent to

$$ \begin{array}{@{}rcl@{}} |\alpha-\beta_{1}|^{2} &<& |\alpha-\beta_{2}|^{2} \end{array} $$
$$ \begin{array}{@{}rcl@{}} (\alpha-\beta_{1})(\alpha-\beta_{1})^{*} &<& (\alpha-\beta_{2})(\alpha-\beta_{2})^{*} \end{array} $$
$$ \begin{array}{@{}rcl@{}} -\alpha\beta_{1}^{*}-\beta_{1}\alpha^{*}+|\beta_{1}|^{2} &<&-\alpha\beta_{2}^{*}-\beta_{2}\alpha^{*}+|\beta_{2}|^{2}. \end{array} $$

Since |β1|2 = |β2|2, then

$$ \begin{array}{@{}rcl@{}} -\alpha\beta_{1}^{*}-\beta_{1}\alpha^{*}&<&-\alpha\beta_{2}^{*}-\beta_{2}\alpha^{*} \end{array} $$
$$ \begin{array}{@{}rcl@{}} \frac{\alpha}{\alpha^{*}}&<&-\frac{\beta_{1}-\beta_{2}}{\beta_{1}^{*}-\beta_{2}^{*}}. \end{array} $$

If scaling is done, such that β1γβ1 and β2γβ2 for positive γ, then the above equation does not change. Consequently, decisions based on fidelity do not change. This can be generalized to any number of reference states.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Youssry, A., El-Rafei, A. & Zhou, RG. A continuous-variable quantum-inspired algorithm for classical image segmentation. Quantum Mach. Intell. 1, 97–111 (2019). https://doi.org/10.1007/s42484-019-00009-2

Download citation


  • Quantum-inspired algorithms
  • Coherent states
  • Quantum harmonic oscillator
  • Signal processing