At the end of the last century a new paradigm of computation was proposed i.e. quantum computation. Although it is not yet obvious whether useful quantum computers can be constructed, the field of quantum algorithms development in recent years progresses very rapidly , 
. For example many new algorithms for quantum machine learning and quantum image processing were recently created, .
In this work we introduce an algorithm for image classification of grayscale images based on classical principal component analysis (PCA) and quantum measurement. The general idea behind the algorithm is following. Given a set of training images, using PCA we train a classifier to detect images similar to those in the training set. Effectively we divide the image signal space into two orthogonal subspaces. The first one — spanned by the leading principal components — catches the most of the variability of the signal in the training set, the second one consists mostly of noise.
After the classifier is constructed the leading principal components are used to create a projector onto a subspace of quantum states. The image which is being classified is also encoded on a quantum state, and then measured using the projector defined above.
The paper is organised as follows in Section 2 we recall basic notions of quantum computation, in Section 3 we shortly discuss state of the art in quantum image processing, in Section 4 we introduce image classification algorithm. And finally in Section 5 we draw conclusions.
2 Essentials of quantum computation
Lets consider the most basic model of a quantum system – a qubit – elementary quantum system with two basic physical states. In order to provide mathematical description of a state of a qubit we choose an orthonormal basis in the corresponding Hilbert Space. In this case we consider two dimensional Hilbert Space. Our basis will consist two vectors that in the braket notation take the form
The vector is called ‘ket’ and its Hermitian conjugation is called ‘bra’. We can represent any valid state of a qubit as normalized linear combination of the basis vectors:
where and .
The operation which allows us to join
independent qunit systems is the tensor product. Lets takequnit states
We can write their joint state in as
The other way of joining quantum systems into a bigger one is use of the direct sum. The joint state of two states is
We can also consider more general quantum systems called quits. Let (ket) be a normed column vector from Hilbert space with orthonormal basis . Dual vector to ket is (bra). In such case the state of the system is represented as .
We denote inner product of and by It has three properties:
where equality holds iff ,
Furthermore will be their outer product.
One of the most important concepts in quantum information is the measurement. The mathematical model of a measurement is as follows. At first we define a set of outcomes . Then we assign corresponding measurement operators . We request that the measurement operators satisfy the condition and .
The probability that we obtain outcomewhen measuring a state is equal to
If we instantly measure the system for the second time, the outcome willstill be equal to with certainty because after the first measurement the state of the system changes into a state
3 Quantum image processing — state of the art
There are various ways in which classical data can be encoded on quantum states. The specific encoding depends on the type of the data and quantum algorithms that one wishes to execute.
3.1 Quantum representations of digital images
Below we recall various representations of quantum images proposed in recent years.
In the Qubit Lattice representation of grayscale images proposed in  the intensity of pixel at position is encoded on qubit .
The Real Ket representation introduced in  stores grayscale images in unnormalised quantum states of the form
where and subsequent quits serve as the position of pixel encoded in a quad-tree.
Flexible representation of quantum images (FRQI) captures information about pixel colours and their corresponding position. It is inspired by the pixel representation for images in the classical computers. The information is gather into a quantum state defined as follows
where and constitutes the vector encoding colours, is a fixed basis of a two dimensional complex Hilbert space, and is a basis of dimensional space responsible for encoding position in the image. The colour is encoded in a vector by which is connected by a Kronecker product with a vector responsible for a position in the image.
A novel enhanced quantum representation (NEQR) of digital images proposed in  encodes a grayscale image in a quantum state of the form
where is a discrete value of image intensity, quantised with levels of quantisations of pixel at position .
3.2 Quantum image processing algorithms
The sub-field of quantum computation that deals with algorithms development for quantum image processing is developing very rapidly. At least a hundred papers discussing this subject were published in recent fifteen years.
It should be noted that, some of classical image transformations already have their quantum analogues. For example we can list here quantum Fourier transform, quantum discrete cosine transform [5, 12], and quantum wavelet transform .
There exists several clever techniques to process images encoded in quantum states for example in  authors propose a way to perform template matching algorithm using quantum Fourier transform and amplitude amplification. In paper  the authors extended the use of quantum circuit models for quantum image representation and processing. They developed three strategies to extend the number of geometric transformations  on quantum images using the FRQI representation of quantum images. In  authors propose quantum algorithms for edge detection and image filtering based on projective measurement. In  the authors propose a model for storing and operating on infra-red images.
The aim of our algorithm is classification of quantum images. The input of the algorithm is a quantum representation of an image which we want to test. Algorithm requires a set of principal components. The output is “” or “” and answers the question whether the image exhibits features represented by principal components.
4.1 Principal Component Analysis
In order to create our quantum classifier we use Principal Component Analysis (PCA). This technique has been successfully applied in the domain of signal processing to various datasets. In celebrated classical paper  it was applied to classification of human faces.
Suppose we have matrix of data with rank . The matrix is composed of vertically stacked horizontal sample vectors. We assume that our samples are normalised i.e. have norm equal to one.
Then by SVD we have where and are orthogonal matrices. The matrix is such that with .
4.2 Quantum image representation
Suppose we have a features vector of values , where . The quantum system encoding the data from the feature space will be a direct sum . Quantum representation of a picture will be a mapping from to defined by
where pixels are represented by
We will use quantum representation of vectors from PCA in the same way. Let be a set of principal components with values and be a set of quantum representations of them. Representation of each quantum vector chosen from PCA is encoded on different 2-dimensional subspace of such that each of the pixels is transformed into
where and is a pixel index. The whole principal component representation is composed of the pixel representations the same way as in eq. (8). Lets take two vectors and their quantum representation . Inner product of and is
and for corresponding quantum representations one reads
where the first equality is from eq. (8) and the last one is implied by orthonormality of the basis vectors. From eq. (11) and eq. (12) we derive that inner product of two vectors is equal to inner product of quantum representations of these vectors with respect to a constant factor . This is an important feature of the introduced representation, which is significant for the algorithm.
4.3 Construction of measurement
The quantum algorithm for principal component analysis is based on classical methods for determining the characteristic subspace of the data set in the features space. Thus we take principal components that describe the data set crucial properties. The quantum algorithm for principal components analysis will utilise the system defined in the previous section. In order to use the classically computed components in the quantum algorithm we need to convert our principal components into quantum representation .
The developed algorithm is based on the quantum measurement schema. We consider two elements output set . The first of the resulting labels will correspond to the principal components subspace and the other to the rest of the feature space. Thus we create two measurement operators and . The principal components projection operator is of the form
4.4 Measurement probabilities
Let be a input feature vector and set of the principal components. In the classical model we measure the likelihood of the input data being in the control set in the following way
Now let be a quantum representation of the input and be quantum representation of principal components with projector constructed as in eq. (13). Then the probability of the result of the measurement being for a given input is
where the last equation results from eq. (11) and eq. (12). Thus the probability is linearly dependent on the classical likelihood measure with respect to a factor . where last equation is from eq. (11) and eq. (12). Thus the probability linearly dependent on the classical likelihood measure with factor .
Because of the factor we perform tests. We assume that we have copies of the quantum representation of the vector . We perform the measurement on each of the copies. If any of the measurements returns “yes” then the algorithm returns positive answer. If not, the answer is negative. The probability that our algorithm will return the output “no”for a given input vector is equal to
Probability of positively classifying the input image in most of the cases is close to the classical likelihood measure. In general the probability is slightly lower. Thus the algorithm trifle favors the negative answer.
5 Concluding remarks
In this paper we provided a new quantum representation of digital images and an algorithm for classification of said images. The principal component analysis is used during the learning phase of the algorithm which is performed classically and its goal is to construct a quantum measuring device. Classification is performed by applying the measurement apparatus on the quantum states that represent input images. The measurement is performed on multiple copies of the image. Therefore the paper provides complete system for classification of digital images.
Work by M.O. and P.S. was supported by Polish National Science Centre grant number DEC-2011/03/D/ST6/00413. Work by P.G. was supported by Polish National Science Centre grant number DEC-2011/03/D/ST6/03753.
-  Ambainis, A.: Recent Developments in Quantum Algorithms and Complexity. In: Descriptional Complexity of Formal Systems, p. 1–4. Springer (2014)
-  Bacon, D., Van Dam, W.: Recent progress in quantum algorithms. Communications of the ACM 53(2), 84–93 (2010)
-  Curtis, D., Meyer, D.A.: Towards quantum template matching. In: Optical Science and Technology, SPIE’s 48th Annual Meeting. p. 134–141. International Society for Optics and Photonics, http://proceedings.spiedigitallibrary.org/proceeding.aspx?articleid=768557
-  Fijany, A., Williams, C.P.: Quantum Wavelet Transforms: Fast Algorithms and Complete Circuits. arXiv preprint quant-ph/9809004 (1998)
-  Klappenecker, A., Rotteler, M.: Discrete cosine transforms on quantum computers. In: Image and Signal Processing and Analysis, 2001. ISPA 2001. Proceedings of the 2nd International Symposium on. p. 464–468. IEEE (2001)
-  Latorre, J.I.: Image compression and entanglement. arXiv preprint quant-ph/0510031 (2005)
-  Le, P.Q., Iliyasu, A.M., Dong, F., Hirota, K.: Fast geometric transformations on quantum images. IAENG International Journal of Applied Mathematics 40(3), 113–123 (2010)
-  Le, P.Q., Iliyasu, A.M., Dong, F., Hirota, K.: Strategies for designing geometric transformations on quantum images. Theoretical Computer Science 412(15), 1406–1418 (2011)
-  Lloyd, S., Mohseni, M., Rebentrost, P.: Quantum algorithms for supervised and unsupervised machine learning. arXiv preprint arXiv:1307.0411 (2013)
-  Nielsen, M.A., Chuang, I.L.: Quantum computation and quantum information. Cambridge university press (2010)
-  Schuld, M., Sinayskiy, I., Petruccione, F.: An introduction to quantum machine learning. Contemporary Physics (ahead-of-print), 1–14 (2014)
-  Tseng, C.C., Hwang, T.M.: Quantum circuit design of 8 8 discrete cosine transform using its fast computation flow graph. In: Circuits and Systems, 2005. ISCAS 2005. IEEE International Symposium on. p. 828–831. IEEE (2005)
-  Venegas-Andraca, S.E., Bose, S.: Storing, processing, and retrieving an image using quantum mechanics. In: AeroSense 2003. p. 137–147. International Society for Optics and Photonics (2003)
-  Wang, J., Jiang, N., Wang, L.: Quantum image translation. Quantum Information Processing p. 1–16 (2014), http://dx.doi.org/10.1007/s11128-014-0843-6
-  Yuan, S., Mao, X., Chen, L., Xue, Y.: Quantum digital image processing algorithms based on quantum measurement. Optik-International Journal for Light and Electron Optics 124(23), 6386–6390 (2013)
-  Yuan, S., Mao, X., Xue, Y., Chen, L., Xiong, Q., Compare, A.: SQR: a simple quantum representation of infrared images 13(6), 1353–1379, http://link.springer.com/article/10.1007/s11128-014-0733-y
-  Zhang, Y., Lu, K., Gao, Y., Wang, M.: NEQR: a novel enhanced quantum representation of digital images. Quantum Information Processing 12(8), 2833–2860 (Mar 2013)
-  Zhou, R.G., Sun, Y.J.: Quantum multidimensional color images similarity comparison. Quantum Information Processing p. 1–20 (2014), http://dx.doi.org/10.1007/s11128-014-0849-0