Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions include/rawtoaces/image_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ class ImageConverter
bool parse_parameters( const OIIO::ArgParse &arg_parser );

/// Collects all illuminants supported by this version.
std::vector<std::string> supported_illuminants();
std::vector<std::string> get_supported_illuminants() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it. method should be verbs


/// Collects all camera models for which spectral sensitivity data is
/// available in the database.
std::vector<std::string> supported_cameras();
std::vector<std::string> get_supported_cameras() const;

/// Configures the converter using the requested white balance and colour
/// matrix method, and the metadata of the file provided in `input_file`.
Expand All @@ -160,14 +160,14 @@ class ImageConverter
/// decode the pixels.
/// @param input_filename
/// A file name of the raw image file to read the metadata from.
/// @param options
/// @param hints
/// Conversion hints to be passed to OIIO when reading an image file.
/// The list can be pre- or post- updated with other hints, unrelated to
/// the rawtoaces conversion.
/// @result
/// `true` if configured successfully.
bool configure(
const std::string &input_filename, OIIO::ParamValueList &options );
const std::string &input_filename, const OIIO::ParamValueList &hints );

/// Configures the converter using the requested white balance and colour
/// matrix method, and the metadata of the given OIIO::ImageSpec object.
Expand All @@ -181,8 +181,8 @@ class ImageConverter
/// the rawtoaces conversion.
/// @result
/// `true` if configured successfully.
bool
configure( const OIIO::ImageSpec &imageSpec, OIIO::ParamValueList &hints );
bool configure(
const OIIO::ImageSpec &imageSpec, const OIIO::ParamValueList &hints );

/// Load an image from a given `path` into a `buffer` using the `hints`
/// calculated by the `configure` method. The hints can be manually
Expand Down Expand Up @@ -261,19 +261,19 @@ class ImageConverter
/// image. The multipliers become available after calling either of the
/// two `configure` methods.
/// @result a reference to the multipliers vector.
const std::vector<double> &get_WB_multipliers();
const std::vector<double> &get_WB_multipliers() const;

/// Get the solved input transform matrix of the currently processed image.
/// The multipliers become available after calling either of the two
/// `configure` methods.
/// @result a reference to the matrix.
const std::vector<std::vector<double>> &get_IDT_matrix();
const std::vector<std::vector<double>> &get_IDT_matrix() const;

/// Get the solved chromatic adaptation transform matrix of the currently
/// processed image. The multipliers become available after calling either
/// of the two `configure` methods.
/// @result a reference to the matrix.
const std::vector<std::vector<double>> &get_CAT_matrix();
const std::vector<std::vector<double>> &get_CAT_matrix() const;

private:
// Solved transform of the current image.
Expand Down
2 changes: 1 addition & 1 deletion include/rawtoaces/spectral_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct Spectrum

/// Integrate the spectral curve.
/// @result the sum of all elements in `values`.
double integrate();
double integrate() const;

/// Find the maximum element in `values`
/// @result the maximum element in `values`.
Expand Down
2 changes: 1 addition & 1 deletion include/rawtoaces/usage_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class UsageTimer
/// passed since the last invocation of `reset()`.
/// @param path The file math to print.
/// @param message The message to print.
void print( const std::string &path, const std::string &message );
void print( const std::string &path, const std::string &message ) const;

private:
double _start_time = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion src/rawtoaces_core/spectral_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void Spectrum::reshape()
shape = ReferenceShape;
}

double Spectrum::integrate()
double Spectrum::integrate() const
{
double result = 0;
for ( auto &v: values )
Expand Down
20 changes: 11 additions & 9 deletions src/rawtoaces_util/image_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ bool ImageConverter::parse_parameters( const OIIO::ArgParse &arg_parser )

if ( arg_parser["list-cameras"].get<int>() )
{
auto cameras = supported_cameras();
auto cameras = get_supported_cameras();
std::cout
<< std::endl
<< "Spectral sensitivity data is available for the following cameras:"
Expand All @@ -921,7 +921,7 @@ bool ImageConverter::parse_parameters( const OIIO::ArgParse &arg_parser )

if ( arg_parser["list-illuminants"].get<int>() )
{
auto illuminants = supported_illuminants();
auto illuminants = get_supported_illuminants();
std::cout << std::endl
<< "The following illuminants are supported:" << std::endl
<< OIIO::Strutil::join( illuminants, "\n" ) << std::endl;
Expand Down Expand Up @@ -1169,7 +1169,7 @@ bool ImageConverter::parse_parameters( const OIIO::ArgParse &arg_parser )
return true;
}

std::vector<std::string> ImageConverter::supported_illuminants()
std::vector<std::string> ImageConverter::get_supported_illuminants() const
{
std::vector<std::string> result;

Expand All @@ -1190,7 +1190,7 @@ std::vector<std::string> ImageConverter::supported_illuminants()
return result;
}

std::vector<std::string> ImageConverter::supported_cameras()
std::vector<std::string> ImageConverter::get_supported_cameras() const
{
std::vector<std::string> result;

Expand Down Expand Up @@ -1242,8 +1242,9 @@ void fix_metadata( OIIO::ImageSpec &spec )
}

bool ImageConverter::configure(
const std::string &input_filename, OIIO::ParamValueList &options )
const std::string &input_filename, const OIIO::ParamValueList &hints = {} )
{
OIIO::ParamValueList options = hints;
options["raw:ColorSpace"] = "XYZ";
options["raw:use_camera_wb"] = 0;
options["raw:use_auto_wb"] = 0;
Expand Down Expand Up @@ -1277,8 +1278,9 @@ bool ImageConverter::configure(
// -G - green_matching() filter

bool ImageConverter::configure(
const OIIO::ImageSpec &image_spec, OIIO::ParamValueList &options )
const OIIO::ImageSpec &image_spec, const OIIO::ParamValueList &hints = {} )
{
OIIO::ParamValueList options = hints;
options["raw:use_camera_wb"] = 0;
options["raw:use_auto_wb"] = 0;

Expand Down Expand Up @@ -1977,17 +1979,17 @@ bool ImageConverter::process_image( const std::string &input_filename )
return ( true );
}

const std::vector<double> &ImageConverter::get_WB_multipliers()
const std::vector<double> &ImageConverter::get_WB_multipliers() const
{
return _wb_multipliers;
}

const std::vector<std::vector<double>> &ImageConverter::get_IDT_matrix()
const std::vector<std::vector<double>> &ImageConverter::get_IDT_matrix() const
{
return _idt_matrix;
}

const std::vector<std::vector<double>> &ImageConverter::get_CAT_matrix()
const std::vector<std::vector<double>> &ImageConverter::get_CAT_matrix() const
{
return _cat_matrix;
}
Expand Down
3 changes: 2 additions & 1 deletion src/rawtoaces_util/usage_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void UsageTimer::reset()
}
}

void UsageTimer::print( const std::string &path, const std::string &message )
void UsageTimer::print(
const std::string &path, const std::string &message ) const
{
if ( enabled && _initialized )
{
Expand Down
5 changes: 3 additions & 2 deletions tests/test_image_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ std::string run_rawtoaces_with_data_dir(
}

/// This test verifies that when --list-cameras is provided, the method
/// calls supported_cameras() and outputs the camera list, then exits
/// calls get_supported_cameras() and outputs the camera list, then exits
void test_parse_parameters_list_cameras( bool use_dir_path_arg = false )
{
std::cout << std::endl
Expand Down Expand Up @@ -771,7 +771,8 @@ void test_parse_parameters_list_cameras( bool use_dir_path_arg = false )
}

/// This test verifies that when --list-illuminants is provided, the method
/// calls supported_illuminants() and outputs the illuminant list, then exits
/// calls get_supported_illuminants() and outputs the illuminant list,
/// then exits
void test_parse_parameters_list_illuminants( bool use_dir_path_arg = false )
{
std::cout << std::endl
Expand Down