colourlab.metric module¶
metric: Colour metric functions. Part of the colourlab package.
Copyright (C) 2013-2017 Ivar Farup
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-
colourlab.metric.dE_00(dat1, dat2, k_L=1, k_C=1, k_h=1)[source]¶ Compute the CIEDE00 metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.dE_DIN99(dat1, dat2)[source]¶ Compute the DIN99 metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.dE_DIN99b(dat1, dat2)[source]¶ Compute the DIN99b metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.dE_DIN99c(dat1, dat2)[source]¶ Compute the DIN99c metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.dE_DIN99d(dat1, dat2)[source]¶ Compute the DIN99d metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.dE_E(dat1, dat2)[source]¶ Compute the DEE metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.dE_ab(dat1, dat2)[source]¶ Compute the DEab metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.dE_uv(dat1, dat2)[source]¶ Compute the DEuv metric.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.euclidean(sp, dat1, dat2)[source]¶ Compute the Euclidean metric between the two data sets in the given space.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.linear(sp, dat1, dat2, metric_tensor_function)[source]¶ Compute the linearised colour difference between the two data sets.
The function metric_tensor_function is used to compute the metric tensor at the midpoint between the two data sets in the given colour space. Then the colour metric is computed as dC^T * g * dC.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.poincare_disk(sp, dat1, dat2)[source]¶ Compute the Poincare Disk metric betwen the two data sets.
Compted in the given space. Assumes that the space is some form of a Poincare Disk space, such that the radius of curvature is given by sp.R. The first coordinate is treated as Euclidean.
Parameters: Returns: distance – Array of the difference or distances between the two data sets.
Return type: ndarray
-
colourlab.metric.reshape_diff(diff, sh)[source]¶ Reshape the computed metric differences to fit with original data.
The purpose is for, e.g., the difference of two MxNx3 images to be a MxN scalar image etc.
Parameters: - diff (ndarray) – The computed differences
- sh (tuple) – The shape of the original data (not the diff)