@@ -28,95 +28,104 @@ static const std::vector<std::vector<double> > CAT_D65_to_ACES = {
2828// clang-format on
2929
3030// / Calculate spectral power distribution of a daylight illuminant of given CCT
31- // / - parameter cct: correlated colour temperature of the requested illuminant.
32- // / - parameter spectrum: a reference to a `Spectrum` object to full with the
31+ // / @param cct correlated colour temperature of the requested illuminant.
32+ // / @param spectrum a reference to a `Spectrum` object to full with the
3333// / calculated values.
3434void calculate_daylight_SPD ( const int &cct, Spectrum &spectrum );
3535
3636// / Calculate spectral power distribution of a blackbody illuminant of given CCT
37- // / - parameter cct: correlated colour temperature of the requested illuminant.
38- // / - parameter spectrum: a reference to a `Spectrum` object to full with the
37+ // / @param cct correlated colour temperature of the requested illuminant.
38+ // / @param spectrum a reference to a `Spectrum` object to full with the
3939// / calculated values.
4040void calculate_blackbody_SPD ( const int &cct, Spectrum &spectrum );
4141
4242// / Solve an input transform using spectral sensitivity curves of a camera.
4343class SpectralSolver
4444{
4545public:
46- SpectralSolver ();
46+ // / The camera spectral data. Can be either assigned directly, loaded
47+ // / in-place place via `solver.camera.load()`, or found via
48+ // / `solver.find_camera()`.
49+ SpectralData camera;
50+
51+ // / The illuminant spectral data. Can be either assigned directly, loaded
52+ // / in-place place via `solver.illuminant.load()`, or found via
53+ // / `solver.find_illuminant()`.
54+ SpectralData illuminant;
55+
56+ // / The observer spectral data. Can be either assigned directly, or loaded
57+ // / in-place place via `solver.observer.load()`.
58+ SpectralData observer;
59+
60+ // / The training set spectral data. Can be either assigned directly, or loaded
61+ // / in-place place via `solver.training_data.load()`.
62+ SpectralData training_data;
63+
64+ // / The constructor. Takes the database search path as an optional
65+ // / parameter.
66+ // / @param search_directories optional database search path.
67+ SpectralSolver ( const std::vector<std::string> &search_directories = {} );
68+
69+ // / A helper method collecting of spectral data files of a given type from
70+ // / the database.
71+ // / @param type data type of the files to search for.
72+ // / @result a collection of files found in the database.
73+ std::vector<std::string>
74+ collect_data_files ( const std::string &type ) const ;
75+
76+ // / A helper method loading the spectral data for a file at the given path.
77+ // / @param file_path the path to the file to load. If the path is relative,
78+ // / all locations in the search path will be searched in.
79+ // / @param out_data the `SpectralData` object to be filled with the loaded
80+ // / data.
81+ // / @result `true` is loaded successfully.
82+ bool
83+ load_spectral_data ( const std::string &file_path, SpectralData &out_data );
4784
4885 // / Load spectral sensitivity data for a camera.
49- // / - parameter path: a path to the data file
50- // / - parameter make: the camera make to verify the loaded data against.
51- // / - parameter model: the camera model to verify the loaded data against.
52- // / - returns `true` if loaded successfully.
53- bool load_camera (
54- const std::string &path,
55- const std::string &make,
56- const std::string &model );
57-
58- // / Load spectral power distribution data for an illuminant.
59- // / If an illuminant type specified, try to find the matching data,
60- // / otherwise load all known illuminants.
61- // / - parameter paths: a set of data file paths to the data file
62- // / - parameter type: illuminant type to load.
63- // / - returns `true` if loaded successfully.
64- bool load_illuminant (
65- const std::vector<std::string> &paths, const std::string &type = " " );
66-
67- // / Load spectral reflectivity data for a training set (a colour chart).
68- // / - parameter path: a path to the data file
69- // / - returns `true` if loaded successfully.
70- bool load_training_data ( const std::string &path );
71-
72- // / Load spectral sensitivity data for an observer
73- // / (colour matching functions).
74- // / - parameter path: a path to the data file
75- // / - returns `true` if loaded successfully.
76- bool load_observer ( const std::string &path );
86+ // / @param make the camera make to search for.
87+ // / @param model the camera model to search for.
88+ // / @result `true` if loaded successfully.
89+ bool find_camera ( const std::string &make, const std::string &model );
90+
91+ // / Find spectral power distribution data of an illuminant of the given
92+ // / type.
93+ // / @param type illuminant type. Can be one of the built-in types,
94+ // / e.g. `d55`, `3200k`, or a custom illuminant stored in the database.
95+ // / @result `true` if loaded successfully.
96+ bool find_illuminant ( const std::string &type );
7797
7898 // / Find the illuminant best matching the given white-balancing multipliers.
79- // / See `get_best_illuminant()` to access the result.
80- // / - parameter wb_multipliers: white-balancing multipliers to match.
81- // / - parameter highlight: the highlight recovery mode, used for
82- // / normalisation.
83- void find_best_illuminant (
84- const std::vector<double > &wb_multipliers, int highlight );
85-
86- // / Select an illuminant of a given type.
87- // / See `get_best_illuminant()` to access the result.
88- // / - parameter type: illuminant type to select.
89- // / - parameter highlight: the highlight recovery mode, used for
90- // / normalisation.
91- void select_illuminant ( const std::string &type, int highlight );
92-
93- // / Calculate an input transform matrix.
94- // / See `get_IDT_matrix()` to access the result.
95- // / - returns `true` if calculated successfully.
99+ // / @param wb_multipliers white-balancing multipliers to match.
100+ // / @result `true` if loaded successfully.
101+ bool find_illuminant ( const std::vector<double > &wb_multipliers );
102+
103+ // / Calculate the white-balance multipliers for the given configuration.
104+ // / The `camera`, and `illuminant` data have to be configured prior to this
105+ // / call. See `get_WB_multipliers()` to access the result.
106+ // / @result `true` if calculated successfully.
107+ bool calculate_WB ();
108+
109+ // / Calculate an input transform matrix. The `camera`, `illuminant`,
110+ // / `observer` and `training_data` have to be configured prior to this
111+ // / call. See `get_IDT_matrix()` to access the result.
112+ // / @result `true` if calculated successfully.
96113 bool calculate_IDT_matrix ();
97114
98- // / Get the illuminant configured using `find_best_illuminant()` or
99- // / `select_illuminant()`.
100- // / - returns a reference to the illuminant.
101- const SpectralData &get_best_illuminant () const ;
102-
103115 // / Get the matrix calculated using `calculate_IDT_matrix()`.
104- // / - returns a reference to the matrix.
116+ // / @result a reference to the matrix.
105117 const std::vector<std::vector<double >> &get_IDT_matrix () const ;
106118
107119 // / Get the white-balance multipliers calculated using
108120 // / `find_best_illuminant()` or `select_illuminant()`.
109- // / - returns a reference to the multipliers.
121+ // / @result a reference to the multipliers.
110122 const std::vector<double > &get_WB_multipliers () const ;
111123
112124 int verbosity = 0 ;
113125
114126private:
115- SpectralData _camera;
116- SpectralData _best_illuminant;
117- SpectralData _observer;
118- SpectralData _training_data;
119- std::vector<SpectralData> _illuminants;
127+ std::vector<std::string> _search_directories;
128+ std::vector<SpectralData> _all_illuminants;
120129
121130 std::vector<double > _WB_multipliers;
122131 std::vector<std::vector<double >> _IDT_matrix;
@@ -142,17 +151,17 @@ class MetadataSolver
142151{
143152public:
144153 // / Initialise the solver using DNG metadata.
145- // / - parameter metadata: DNG metadata
154+ // / @param metadata DNG metadata
146155 MetadataSolver ( const core::Metadata &metadata );
147156
148157 // / Calculate an input transform matrix.
149- // / - returns: calculated matrix
158+ // / @result calculated matrix
150159 std::vector<std::vector<double >> calculate_IDT_matrix ();
151160
152161 // / Calculate a chromatic adaptation transform matrix. Strictly speaking,
153162 // / this matrix is not required for image processing, as it is embedded in
154163 // / the IDT, see `calculate_IDT_matrix`.
155- // / - returns: calculated matrix
164+ // / @result calculated matrix
156165 std::vector<std::vector<double >> calculate_CAT_matrix ();
157166
158167private:
0 commit comments