Czenakowski distance
# Czenakowski distance

The Czenakowski distance (sometimes shortened as CZD) is a per-pixel quality metric that estimates quality or similarity by measuring differences between pixels. Because it compares vectors with strictly non-negative elements, it is often used to compare colored images, as color values cannot be negative. This different approach has a better correlation with subjective quality assessment than PSNR.

## Definition

Androutsos et al. give the Czenakowski coefficient as follows:

$d_{z}(i,j)=1-{\frac {2\sum _{k=1}^{p}{\text{min}}(x_{ik},\ x_{jk})}{\sum _{k=1}^{p}(x_{ik}+x_{jk})}}$

Where a pixel $x_{i}$ is being compared to a pixel $x_{j}$ on the k-th band of color – usually one for each of red, green and blue.

For a pixel matrix of size $M\times N$, the Czenakowski coefficient can be used in an arithmetic mean spanning all pixels to calculate the Czenakowski distance as follows:

${\frac {1}{MN}}\sum _{i=0}^{M-1}\sum _{j=0}^{N-1}{\begin{pmatrix}1-{\frac {2\sum _{k=1}^{3}{\text{min}}(A_{k}(i,j),\ B_{k}(i,j))}{\sum _{k=1}^{3}(A_{k}(i,j)+B_{k}(i,j))}}\end{pmatrix}}$

Where $A_{k}(i,j)$ is the (i, j)-th pixel of the k-th band of a color image and, similarly, $B_{k}(i,j)$ is the pixel that it is being compared to.

## Uses

In the context of image forensics – for example, detecting if an image has been manipulated –, Rocha et al. report the Czenakowski distance is a popular choice for Color Filter Array (CFA) identification.

