colourlab.tensor module¶
tensor: Compute colour metric tensors. Part of the colourlab package.
Copyright (C) 2013-2021 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.tensor.christoffel(sp, tensor, dat, du=1e-08)[source]¶ Compute the Christoffel symbols numerically.
Compute the Christoffel symbols of the second kind for the given metric tensor function in the given colour space at the given data points.
Parameters: - sp (space.Space) – The colour space.
- tensor (func) – Function returning the metric tensor of the data
- dat (data.Points) – The colour data points (or image)
- du (float) – Delta u for the computation of the numerical derivatives
Returns: The Christoffel symbols of the second kind as M x … x N x 3 x 3 x 3 ndarray (for M x … x N x 3 data points)
Return type: ndata
-
colourlab.tensor.construct_tensor(sp, tensor_ndata, dat)[source]¶ Construct the Tensors object with correct dimensions
The tensors_ndata has shape N x 3 x 3. Construct Tensors object with shape corresponding to the data points in dat.
Parameters: - sp (space.Space) – The colour space of the tensor_ndata
- tensor_ndata (ndarray) – N x 3 x 3 ndarray of tensor data.
- dat (data.Points) – Colour data points
-
colourlab.tensor.dE_00(dat, k_L=1, k_C=1, k_h=1)[source]¶ Compute the Riemannised CIEDE00 metric for the given data points.
Returns Tensors. Be aware that the tensor is singluar at C = 0.
Parameters: - dat (data.Points) – The colour points for which to compute the metric.
- k_L (float) – Parameter of the CIEDE00 metric
- k_C (float) – Parameter of the CIEDE00 metric
- k_h (float) – Parameter of the CIEDE00 metric
Returns: DE00 – The metric tensors.
Return type:
-
colourlab.tensor.dE_DIN99(dat)[source]¶ Compute the DIN99 metric as Tensors for the given data points.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: DIN99 – The metric tensors. Return type: Tensors
-
colourlab.tensor.dE_DIN99b(dat)[source]¶ Compute the DIN99b metric as Tensors for the given data points.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: DIN99b – The metric tensors. Return type: Tensors
-
colourlab.tensor.dE_DIN99c(dat)[source]¶ Compute the DIN99c metric as Tensors for the given data points.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: DIN99c – The metric tensors. Return type: Tensors
-
colourlab.tensor.dE_DIN99d(dat)[source]¶ Compute the DIN99d metric as Tensors for the given data points.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: DIN99d – The metric tensors. Return type: Tensors
-
colourlab.tensor.dE_E(dat)[source]¶ Compute the DEE metric as Tensors for the given data points.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: DEE – The metric tensors. Return type: Tensors
-
colourlab.tensor.dE_ab(dat)[source]¶ Compute the DEab metric as Tensors for the given data points.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: DEab – The metric tensors. Return type: Tensors
-
colourlab.tensor.dE_uv(dat)[source]¶ Compute the DEuv metric as Tensors for the given data points.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: DEuv – The metric tensors. Return type: Tensors
-
colourlab.tensor.euclidean(sp, dat)[source]¶ Compute the general Euclidean metric in the given colour space.
Returns Tensors.
Parameters: - sp (space.Space) – The colour space in which the metric tensor is Euclidean.
- dat (data.Points) – The colour points for which to compute the metric.
Returns: Euclidean – The metric tensors.
Return type:
-
colourlab.tensor.poincare_disk(sp, dat)[source]¶ Compute the general Poincare Disk metric in the given colour space.
Returns Tensors. Assumes that sp is a Poincare Disk of some kind, and thus has a radius of curvature as sp.R.
Parameters: dat (data.Points) – The colour points for which to compute the metric. Returns: Poincare – The metric tensors. Return type: Tensors
-
colourlab.tensor.polar(sp, dat)[source]¶ Compute the general Euclidean metric in cylindrical coordinates.
Assumes z, r, theta (LCh) order. Returns Tensors.
Parameters: - sp (space.Space) – The colour space in which the metric tensor is Euclidean, with cylindrical coordinates
- dat (data.Points) – The colour points for which to compute the metric.
Returns: The metric tensors.
Return type: