1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCIEDE2000.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
The MIT License (MIT)
Copyright (c) 2015 Greg Fiumara
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=========================================================================*/
/**
* Private header used by vtkColorTransferFunction to support
* LAB/CIEDE2000 interpolation.
*
* Reference:
* "Color Interpolation for Non-Euclidean Color Spaces",
* Zeyen, M., Post, T., Hagen, H., Ahrens, J., Rogers, D. and Bujack, R.,
* SciVis ShortPapers IEEE VIS 2018.
* (https://datascience.dsscale.org/wp-content/uploads/sites/3/2019/01/ColorInterpolationforNon-EuclideanColorSpaces.pdf)
*
* The implementation is a modified version based on the following:
* https://github.com/gfiumara/CIEDE2000
*
*/
#ifndef vtkCIEDE2000_h
#define vtkCIEDE2000_h
#include "vtkABINamespace.h"
#include <vector> // needed for std::vector
namespace CIEDE2000
{
VTK_ABI_NAMESPACE_BEGIN
/**
* Node of the color path
*/
struct Node
{
double rgb[3]; // RGB color
double distance; // Distance from the start
};
/**
* Map a RGB color to its corresponding color in the sampled RGB space.
*/
void MapColor(double rgb[3]);
/**
* Returns the distance between two colors as given by the
* CIE Delta E 2000 (CIEDE2000) color distance measure.
*/
double GetCIEDeltaE2000(const double lab1[3], const double lab2[3]);
/**
* Calculates the shortest color path between two colors with respect
* to the CIEDE2000 measure and returns its overall length.
*/
double GetColorPath(const double rgb1[3], const double rgb2[3], std::vector<Node>& path,
bool forceExactSupportColors);
VTK_ABI_NAMESPACE_END
}
#endif
// VTK-HeaderTest-Exclude: vtkCIEDE2000.h
|