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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ A help message with a description of all command line options can be obtained by
- "custom" uses the custom white balancing coefficients provided using the -"custom-wb" parameter.

Rawtoaces supports the following methods of color matrix computation:
- "auto" (recommended) first tries the "spectral" method if spectral sensitivity data for the camera is available. If not, it falls back to "metadata". This avoids failures when spectral data is missing while still using the most accurate method when possible.
- "spectral" uses the camera sensor's spectral sensitivity data to compute the optimal matrix. This mode requires spectral sensitivity data for the camera model the image comes from. The list of cameras such data is available for, can be seen using the "--list-cameras" parameter.
- "metadata" uses the matrix (matrices) contained in the raw image file metadata. This mode works best with the images using the DNG format, as the DNG standard mandates the presense of such matrices.
- "Adobe" uses the Adobe coefficients provided by LibRaw.
Expand All @@ -179,7 +180,7 @@ A help message with a description of all command line options can be obtained by
--help Print help message
--version Print version and exit
--wb-method STR White balance method. Supported options: metadata, illuminant, box, custom. (default: metadata)
--mat-method STR IDT matrix calculation method. Supported options: spectral, metadata, Adobe, custom. (default: spectral)
--mat-method STR IDT matrix calculation method. Supported options: auto, spectral, metadata, Adobe, custom. (default: auto)
--illuminant STR Illuminant for white balancing. (default = D55)
--wb-box X Y W H Box to use for white balancing. (default = (0,0,0,0) - full image)
--custom-wb R G B G Custom white balance multipliers.
Expand All @@ -191,6 +192,7 @@ A help message with a description of all command line options can be obtained by
--scale VAL Additional scaling factor to apply to the pixel values. (default: 1)
General options:
--overwrite Allows overwriting existing files. If not set, trying to write to an existing file will generate an error.
--data-dir STR Directory containing rawtoaces spectral sensitivity and illuminant data files. Overrides the default search path and the RAWTOACES_DATA_PATH environment variable.
--output-dir STR The directory to write the output files to. This gets applied to every input directory, so it is better to be used with a single input directory.
--create-dirs Create output directories if they don't exist.
--disable-cache Disable the colour space transform cache.
Expand Down Expand Up @@ -270,7 +272,7 @@ If spectral sensitivity data for your camera is included with `rawtoaces` then t

This command is equivalent to :

$ rawtoaces --wb-method metadata --mat-method spectral input.raw
$ rawtoaces --wb-method metadata --mat-method auto input.raw

To process mutiple raw files, you can try:

Expand Down
7 changes: 6 additions & 1 deletion include/rawtoaces/image_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class ImageConverter

enum class MatrixMethod
{
/// Automatically choose the best available matrix method.
/// - If spectral sensitivity data for the camera is available,
/// use `Spectral`.
/// - Otherwise, fall back to `Metadata`.
Auto,
/// Use the camera spectral sensitivity curves to solve for the colour
/// conversion matrix. In this mode the illuminant is either provided
/// directly in `illuminant` if `WB_method` ==
Expand All @@ -67,7 +72,7 @@ class ImageConverter
/// Specify a custom matrix in `colourMatrix`. This mode is useful if
/// the matrix is calculated by an external tool.
Custom
} matrix_method = MatrixMethod::Spectral;
} matrix_method = MatrixMethod::Auto;

/// Cropping mode.
enum class CropMode
Expand Down
18 changes: 17 additions & 1 deletion src/rawtoaces/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,33 @@ int main( int argc, const char *argv[] )
std::vector<std::vector<std::string>> batches =
rta::util::collect_image_files( files );

// Process raw files ...
// Process raw files
bool empty = true;
bool result = true;

size_t file_index = 0;
size_t total_files = 0;

for ( auto const &batch: batches )
total_files += batch.size();

Copy link
Contributor

Choose a reason for hiding this comment

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

why not use size_t and avoid casting? this use case is exactly what size_t is for

for ( auto const &batch: batches )
{
for ( auto const &input_filename: batch )
{
++file_index;
std::cout << "[" << file_index << "/" << total_files
<< "] Processing file: " << input_filename << std::endl;

empty = false;
result = converter.process_image( input_filename );
if ( !result )
{
std::cerr << "Failed on file [" << file_index << "/"
<< total_files << "]: " << input_filename
<< std::endl;
break;
}
}
if ( !result )
break;
Expand Down
2 changes: 1 addition & 1 deletion src/rawtoaces_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ install( TARGETS ${RAWTOACES_CORE_LIB}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION include/rawtoaces
)
)
2 changes: 1 addition & 1 deletion src/rawtoaces_core/rawtoaces_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,4 +1247,4 @@ bool IDTOptimizationCost::operator()( const T *beta_params, T *residuals ) const
}

} // namespace core
} // namespace rta
} // namespace rta
Loading
Loading