Scyllarus: C++ Hyperspectral Processing Library
Hyperspectral Image Processing Pipeline
|
Pipeline is an object that holds configuration properties and data items, and facilitates the processing of this data in a pipeline like fashion. More...
#include <pipeline.h>
Public Member Functions | |
pipeline () | |
pipeline (std::shared_ptr< scyl::input > input) | |
pipeline (std::shared_ptr< scyl::output > output) | |
pipeline (std::shared_ptr< scyl::input > input, std::shared_ptr< scyl::output > output) | |
virtual | ~pipeline () |
void | process (bool clear=true) |
process() runs the pipeline. At a minimum, an input image (I) or an input object must be set, before calling this function. More... | |
void | process_recover_illuminant (bool clear=true) |
process_recover_illuminant() calls the function 'recover_global_illuminant'. At a minimum, an input image (I) must be set before calling this function. More... | |
void | process_recover_dichromatic_parameters () |
process_recover_dichromatic_parameters() calls the function 'recover_dichromatic_parameters'. At a minimum, an input image (I) and the illuminant must be set before calling this function. More... | |
void | process_recover_materials () |
process_recover_materials() calls the function 'recover_materials'. At a minimum, a reflectance cube (s) must be set. More... | |
void | process_recover_endmembers () |
process_recover_endmembers() calls the function 'unmix_by_spectra' with the list of material elements and spectra from a Spectral Library as input. More... | |
void | process_classification (scyl::CLASSIFICATION_METHOD method=scyl::CLASSIFICATION_SAM) |
process_classification() performs classification of the pipeline object's reflectance cube with the spectral loaded in pipeline's spectral library. More... | |
void | process_analysis (bool reflectance=true) |
process_analysis() performs analysis of the pipeline object's reflectance cube (or image if the input bool is false) using Principal Component Analysis More... | |
void | clear_results (bool reflectance=false) |
clear_results() resets all the member variables associated with the results from the processing pipeline. It does not reset I, or wavelengths. More... | |
void | clear_illuminant_results () |
clear_illuminant_results() resets all the member variables associated with the results from the illuminant processing. It does not reset I, or wavelengths. More... | |
void | clear_dichromatic_results () |
clear_dichromatic_results() resets all the member variables associated with the results from the illuminant processing. It does not reset I, or wavelengths. More... | |
void | clear_material_results () |
clear_material_results() resets all the member variables associated with the results from the illuminant processing. It does not reset I, or wavelengths. More... | |
void | clean_input (bool reflectance=false) |
clean_input takes the I and wavelengths from the current input and puts them into a 'clean' input. More... | |
void | save (std::string filename) |
save() saves a file according to the output object that is set for the pipeline. More... | |
void | crop (int x0, int y0, int x1, int y1, bool reflectance=false) |
crop() will crop the image associated with the pipeline to the specified dimensions (spatially - for band removal use 'remove_bands() More... | |
void | remove_bands (arma::uvec remove, bool reflectance=false) |
remove_bands will remove bands from the image associated with the pipeline in the given list (by index). More... | |
void | resize (int height, int width, bool reflectance=false) |
resize() uses OpenCV to resize the image associated with the pipeline (spatially). More... | |
void | align_bands () |
align_bands() uses a FFT image registration routine to attempt to align the bands in the image I associated with the Pipeline. More... | |
void | filter (scyl::FILTER_METHOD method=scyl::FILTER_WIENER, int size=5, bool reflectance=false) |
filter() performs filtering on the image I associated with the Pipeline. More... | |
void | set_input (std::shared_ptr< scyl::input > in) |
Sets the input object for the pipeline. Object is initialised before it it passed to this function. More... | |
std::shared_ptr< scyl::input > | input () |
Gets input object. More... | |
void | set_output (std::shared_ptr< scyl::output > in) |
Sets the output object for the pipeline. Object is initialised before it it passed to this function. More... | |
std::shared_ptr< scyl::output > | output () |
Gets output object. More... | |
void | set_spectral_library (const std::shared_ptr< scyl::spectral_library > in) |
Sets the spectral_library object for the pipeline. Object is initialised before it is passed to this function. More... | |
std::shared_ptr < scyl::spectral_library > | spectral_library () |
Sets spectral_library. More... | |
void | set_I (const arma::fcube &in, const arma::fvec &wavelengths, bool clean=true) |
Sets I (Used in the case you don't want to use an input object, or you want to perform some other processing on I before/after running the pipeline). More... | |
arma::fcube | I () const |
Gets I, the image cube. More... | |
const arma::fcube * | I_ptr () const |
Gets I_ptr, a pointer to the image cube. More... | |
void | set_illuminant (const arma::fvec &in) |
Sets illuminant. More... | |
arma::fvec | illuminant () const |
Gets illuminant, the recovered vector of the illuminant for the image cube I. More... | |
void | set_wavelengths (const arma::fvec &in) |
Sets wavelengths. More... | |
arma::fvec | wavelengths () const |
Gets wavelengths (List describing the wavelength of each band in I) More... | |
void | set_k (const arma::fmat &in) |
Sets k (Specular) More... | |
arma::fmat | k () const |
Gets k (Specular) More... | |
void | set_g (const arma::fmat &in) |
Sets g (Shading) More... | |
arma::fmat | g () const |
Gets g (Shading) More... | |
void | set_k_factor (const float &in) |
Sets k_factor (Specular Factor) More... | |
float | k_factor () const |
Gets k_factor (Specular Factor) More... | |
void | set_s (const arma::fcube &in, const arma::fvec &wavelengths, bool clean=true) |
Sets s (reflectance) More... | |
arma::fcube | s () const |
Gets s (Reflectance) More... | |
const arma::fcube * | s_ptr () const |
Gets s_ptr, a pointer to the image cube. More... | |
void | set_patches (const arma::umat &in) |
Sets illuminant_patches (n x 4 mat containing (x, y, h, w) for patches used in illuminant recovery) More... | |
arma::umat | patches () const |
Gets illuminant_patches - array of patch locations and sizes (x, y, height, width)(n x 4) More... | |
void | set_material_elements (const arma::fmat &in) |
Sets material_elements. More... | |
arma::fmat | material_elements () const |
Gets material_elements (Mat containing spectral signatures for each recovered material) More... | |
void | set_material_element_abundances (const arma::fcube &in) |
Sets material_element_abundances. More... | |
arma::fcube | material_element_abundances () const |
Gets material_element_abundances. More... | |
void | set_material_element_abundance_indexes (const arma::ucube &in) |
Sets material_element_abundance_indexes. More... | |
arma::ucube | material_element_abundance_indexes () const |
Gets material_element_abundance_indexes. More... | |
void | set_material_map (const arma::umat &in) |
Sets material_map. More... | |
arma::umat | material_map () const |
Gets material_map (Map image showing what materials have been identified at each pixel) More... | |
void | set_endmember_abundances (const arma::fmat &in) |
arma::fmat | endmember_abundances () const |
void | set_endmember_abundance_indexes (const arma::umat &in) |
arma::umat | endmember_abundance_indexes () const |
void | set_classification_abundances (const arma::fcube &in) |
arma::fcube | classification_abundances () const |
void | set_classification_indexes (const arma::ucube &in) |
arma::ucube | classification_indexes () const |
void | set_analysis_components (const arma::fcube &in) |
arma::fcube | analysis_components () const |
void | set_analysis_values (const arma::fvec &in) |
arma::fvec | analysis_values () const |
int | height () const |
Gets height. More... | |
int | width () const |
Gets width. More... | |
int | bands () const |
Gets bands. More... | |
bool | endmember_indexed () const |
Gets endmember_indexed. More... | |
bool | is_filtered () const |
Gets filtered. More... | |
void | set_illuminant_method (scyl::ILLUMINANT_METHOD in) |
Sets illuminant_method (Method used in Illuminant recovery) More... | |
scyl::ILLUMINANT_METHOD | illuminant_method () const |
Gets illuminant_method. More... | |
void | set_dichromatic_method (scyl::DICHROMATIC_METHOD in) |
Sets dichromatic_method (Method used in dichromatic parameter recovery) More... | |
scyl::DICHROMATIC_METHOD | dichromatic_method () const |
Gets dichromatic_method. More... | |
void | set_debug_level (int in) |
Sets debug_level (Amount of output printed to log) More... | |
int | debug_level () const |
Gets debug_level. More... | |
void | set_illuminant_recovery_alpha (float in) |
Sets illuminant_recovery_alpha, a threshold value used in illuminant recover. (See recover_global_illuminant() for more information) More... | |
float | illuminant_recovery_alpha () const |
Gets illuminant_recovery_alpha. More... | |
void | set_illuminant_patch_size (int in) |
Sets illuminant_patch_size, the size of the patches used when determining the image's illuminant. (See recover_global_illuminant() for more information) More... | |
int | illuminant_patch_size () const |
Gets illuminant_patch_size. More... | |
void | set_illuminant_fast_50 (bool in) |
Sets illuminant_fast_50, a flag to tell the Illuminant recovery method to use a faster version for images with more than 50 bands. More... | |
bool | illuminant_fast_50 () const |
Gets illuminant_fast_50. More... | |
void | set_dichromatic_neighbourhood_size (int in) |
Sets dichromatic_neighbourhood_size, the kernel size used when decomposing the image. (See recover_dichromatic_parameters() for more information) More... | |
int | dichromatic_neighbourhood_size () const |
Gets dichromatic_neighbourhood_size. More... | |
void | set_dichromatic_gray_threshold (int in) |
Sets dichromatic_gray_threshold, a threshold used in the dichromatic parameter recovery. (See recover_dichromatic_parameters() for more information) More... | |
int | dichromatic_gray_threshold () const |
Gets dichromatic_gray_threshold. More... | |
void | set_material_method (scyl::MATERIAL_METHOD in) |
Sets material_method (Method used for material recovery) More... | |
scyl::MATERIAL_METHOD | material_method () const |
Gets material_method. More... | |
void | set_material_max_clusters (int in) |
Sets material_max_clusters, the maximum number of clusters found during material recovery. (See recover_materials() for more information) More... | |
int | material_max_clusters () const |
Gets material_max_clusters. More... | |
void | set_material_temperature_max (float in) |
Sets material_temperature_max, the beginning temperature for DA method. (See recover_materials() for more information) More... | |
float | material_temperature_max () const |
Gets material_temperature_max. More... | |
void | set_material_temperature_min (float in) |
Sets material_temperature_min, the ending temperature for DA method. (See recover_materials() for more information) More... | |
float | material_temperature_min () const |
Gets material_temperature_min. More... | |
void | set_material_cooling_rate (float in) |
Sets material_cooling_rate (Rate of cooling for DA method, (t_max will be 'cooled' by this amount each iteration)) More... | |
float | material_cooling_rate () const |
Gets material_cooling_rate. More... | |
void | set_material_split_threshold (float in) |
Sets material_split_threshold (Determines when a cluster is split in DA method. More... | |
float | material_split_threshold () const |
void | set_material_subsample (float in) |
Sets material_subsample (Amount image is subsampled by when performing Material Recovery) More... | |
float | material_subsample () const |
void | set_abundance_num_materials (int in) |
Sets abundance_num_materials (Number of materials to use per abundance when calculating abundances (Serves as a compression level for HSZ saving)) More... | |
int | abundance_num_materials () const |
Gets abundance_num_materials. More... | |
void | set_analysis_num (int in) |
Sets analysis_num (Number of analysis results to return (number of principal components)) More... | |
int | analysis_num () const |
Gets analysis_num. More... | |
void | set_nurbs_save_as (bool in) |
Sets nurbs_save_as (True if you want to use NURBS encoding when saving) More... | |
bool | nurbs_save_as () const |
Gets nurbs_save_as. More... | |
void | set_nurbs_degree (int in) |
Sets nurbs_degree (Degree of the polynomial used to calculate NURBS) More... | |
int | nurbs_degree () const |
Gets nurbs_degree. More... | |
void | set_nurbs_iterations (int in) |
Sets nurbs_iterations (Max number of iterations to use when calculating NURBS) More... | |
int | nurbs_iterations () const |
Gets nurbs_iterations. More... | |
void | set_nurbs_knot_threshold (int in) |
Sets nurbs_knot_threshold (Target number of knots when calculating NURBS) More... | |
int | nurbs_knot_threshold () const |
Gets nurbs_knot_threshold. More... | |
void | set_nurbs_alpha (float in) |
Sets nurbs_alpha (Alpha value used to determine convergence when removing knots) More... | |
float | nurbs_alpha () const |
Gets nurbs_alpha. More... | |
Pipeline is an object that holds configuration properties and data items, and facilitates the processing of this data in a pipeline like fashion.
At the most basic level, the pipeline can be used as follows:
scyl::pipeline p = scyl::pipeline(); p.set_I(arma::fcube input_image_cube); p.process();
To use the Pipeline with input and output objects:
std::shared_ptr<scyl::input> input = std::make_shared<scyl::hdr_input>("raw_image.hdr"); std::shared_ptr<scyl::output> output = std::make_shared<scyl::hsz_output>(); scyl::pipeline pipeline = scyl::pipeline(input,output); pipeline.process(); pipeline.save("processed_image.hsz");
To customise and configure the processing parameters, use the object's property setters before running process().
Whenever a function is called that changes the Image 'I' (set_I, crop, resize), the previous processing results will be assumed stale and discarded. This is also true of any input 'results' (Such as that given by data_input, HSZ or component_input) - these will be cleared and replaced with a data_input object holding only the new Image and the wavelengths, as the previously stored results will no longer be valid.
Member variables are outlined here, for more detail see the function implementation documentation. (default, min : max) For more details on how to use the pipeline, please look at the example program.
scyl::pipeline::pipeline | ( | ) |
Pipeline Constructor Creates a Pipeline object. This constructor is intended for use if members such as I are to be set manually using the setters.
scyl::pipeline::pipeline | ( | std::shared_ptr< scyl::input > | input | ) |
Pipeline Constructor. Creates a Pipeline object. This constructor is intended for use with an input object.
input | Pointer to an already initialised input object. |
scyl::pipeline::pipeline | ( | std::shared_ptr< scyl::output > | output | ) |
Pipeline Constructor. Creates a Pipeline object. This constructor is intended for use with an output object (and manual input)
output | Pointer to an already initialised output object. |
scyl::pipeline::pipeline | ( | std::shared_ptr< scyl::input > | input, |
std::shared_ptr< scyl::output > | output | ||
) |
Pipeline Constructor. Creates a Pipeline object. This constructor is intended for use with an input and object.
input | Pointer to an already initialised input object. |
output | Pointer to an already initialised output object. |
|
virtual |
Pipeline Destructor
int scyl::pipeline::abundance_num_materials | ( | ) | const |
Gets abundance_num_materials.
void scyl::pipeline::align_bands | ( | ) |
align_bands() uses a FFT image registration routine to attempt to align the bands in the image I associated with the Pipeline.
Aligning bands will reset dependent image members.
arma::fcube scyl::pipeline::analysis_components | ( | ) | const |
Gets analysis_components (After running process_analysis())
int scyl::pipeline::analysis_num | ( | ) | const |
Gets analysis_num.
arma::fvec scyl::pipeline::analysis_values | ( | ) | const |
Gets analysis_values (After running process_analysis())
Note that the indexing (in classification_indexes) is done using 'endmember_mean()' returned endmembers, and such 'spectral_library()->label_mean()' should be used to match indexes to labels.
int scyl::pipeline::bands | ( | ) | const |
arma::fcube scyl::pipeline::classification_abundances | ( | ) | const |
Gets classification_abundances (After running process_classification())
Note that the indexing (in classification_indexes) is done using 'endmember_mean()' returned endmembers, and such 'spectral_library()->label_mean()' should be used to match indexes to labels.
arma::ucube scyl::pipeline::classification_indexes | ( | ) | const |
Gets classification_indexes (After running process_classification())
Note that the indexing (in classification_indexes) is done using 'endmember_mean()' returned endmembers, and such 'spectral_library()->label_mean()' should be used to match indexes to labels.
void scyl::pipeline::clean_input | ( | bool | reflectance = false | ) |
clean_input takes the I and wavelengths from the current input and puts them into a 'clean' input.
The intention of this is to remove any processing results that may be present in inputs (such as HSZ and component_input) and only retain the Image and wavelengths.
reflectance | is set to true if the primary image source is the reflectance cube. |
void scyl::pipeline::clear_dichromatic_results | ( | ) |
clear_dichromatic_results() resets all the member variables associated with the results from the illuminant processing. It does not reset I, or wavelengths.
The following items are reset: m_k m_g m_k_factor m_s
void scyl::pipeline::clear_illuminant_results | ( | ) |
clear_illuminant_results() resets all the member variables associated with the results from the illuminant processing. It does not reset I, or wavelengths.
The following items are reset: m_illuminant m_illuminant_options.patches
void scyl::pipeline::clear_material_results | ( | ) |
clear_material_results() resets all the member variables associated with the results from the illuminant processing. It does not reset I, or wavelengths.
The following items are reset: m_material_elements m_material_element_abundances m_material_element_abundance_indexes m_material_abundancy m_material_map
void scyl::pipeline::clear_results | ( | bool | reflectance = false | ) |
clear_results() resets all the member variables associated with the results from the processing pipeline. It does not reset I, or wavelengths.
The following items are reset: m_illuminant m_k m_g m_k_factor m_s m_illuminant_options.patches m_material_elements m_material_element_abundances m_material_element_abundance_indexes m_material_abundancy m_material_map
reflectance | is set to true if the primary image source is the reflectance cube. |
void scyl::pipeline::crop | ( | int | y0, |
int | x0, | ||
int | y1, | ||
int | x1, | ||
bool | reflectance = false |
||
) |
crop() will crop the image associated with the pipeline to the specified dimensions (spatially - for band removal use 'remove_bands()
Cropping will reset dependent image members.
y0 | - top left corner y (rows) |
x0 | - top left corner x (cols) |
y1 | - bottom right corner y (rows) |
x1 | - bottom right corner x (cols) |
reflectance | is set to true if the primary image source is the reflectance cube (and that's what you want to crop). |
int scyl::pipeline::debug_level | ( | ) | const |
Gets debug_level.
int scyl::pipeline::dichromatic_gray_threshold | ( | ) | const |
Gets dichromatic_gray_threshold.
scyl::DICHROMATIC_METHOD scyl::pipeline::dichromatic_method | ( | ) | const |
Gets dichromatic_method.
int scyl::pipeline::dichromatic_neighbourhood_size | ( | ) | const |
Gets dichromatic_neighbourhood_size.
arma::umat scyl::pipeline::endmember_abundance_indexes | ( | ) | const |
Gets endmember_abundance_indexes
Note that the indexing is done using 'endmember_mean()' returned endmembers, and such 'spectral_library()->label_mean()' should be used to match indexes to labels.
arma::fmat scyl::pipeline::endmember_abundances | ( | ) | const |
Gets endmember_abundances
Note that the indexing (in endmember_abundance_indexes) is done using 'endmember_mean()' returned endmembers, and such 'spectral_library()->label_mean()' should be used to match indexes to labels.
bool scyl::pipeline::endmember_indexed | ( | ) | const |
Gets endmember_indexed.
void scyl::pipeline::filter | ( | scyl::FILTER_METHOD | method = scyl::FILTER_WIENER , |
int | size = 5 , |
||
bool | reflectance = false |
||
) |
filter() performs filtering on the image I associated with the Pipeline.
Filtering will reset dependent image members. There are several filter options, some spatial and some spectral:
FILTER_SAVITZKY, - Savitzky Golay filter (spectral) FILTER_WIENER, - Wiener filter (spatial) FILTER_MVAVG - Moving Average filter (spectral)
method | - The filter method used for the filtering. |
size | - kernel size used for the filtering. |
reflectance | is set to true if the primary image source is the reflectance cube (and that's what you want to resize). |
arma::fmat scyl::pipeline::g | ( | ) | const |
int scyl::pipeline::height | ( | ) | const |
arma::fcube scyl::pipeline::I | ( | ) | const |
const arma::fcube * scyl::pipeline::I_ptr | ( | ) | const |
Gets I_ptr, a pointer to the image cube.
arma::fvec scyl::pipeline::illuminant | ( | ) | const |
Gets illuminant, the recovered vector of the illuminant for the image cube I.
bool scyl::pipeline::illuminant_fast_50 | ( | ) | const |
Gets illuminant_fast_50.
scyl::ILLUMINANT_METHOD scyl::pipeline::illuminant_method | ( | ) | const |
Gets illuminant_method.
int scyl::pipeline::illuminant_patch_size | ( | ) | const |
Gets illuminant_patch_size.
float scyl::pipeline::illuminant_recovery_alpha | ( | ) | const |
Gets illuminant_recovery_alpha.
std::shared_ptr< scyl::input > scyl::pipeline::input | ( | ) |
Gets input object.
If you want to modify the input object make sure to 'take it out' and then use set_input, otherwise the pipeline object won't know that it's changed.
bool scyl::pipeline::is_filtered | ( | ) | const |
Gets filtered.
arma::fmat scyl::pipeline::k | ( | ) | const |
float scyl::pipeline::k_factor | ( | ) | const |
float scyl::pipeline::material_cooling_rate | ( | ) | const |
Gets material_cooling_rate.
arma::ucube scyl::pipeline::material_element_abundance_indexes | ( | ) | const |
Gets material_element_abundance_indexes.
arma::fcube scyl::pipeline::material_element_abundances | ( | ) | const |
arma::fmat scyl::pipeline::material_elements | ( | ) | const |
Gets material_elements (Mat containing spectral signatures for each recovered material)
arma::umat scyl::pipeline::material_map | ( | ) | const |
Gets material_map (Map image showing what materials have been identified at each pixel)
int scyl::pipeline::material_max_clusters | ( | ) | const |
Gets material_max_clusters.
scyl::MATERIAL_METHOD scyl::pipeline::material_method | ( | ) | const |
Gets material_method.
float scyl::pipeline::material_split_threshold | ( | ) | const |
Gets material_split_threshold
float scyl::pipeline::material_subsample | ( | ) | const |
Gets material_subsample
float scyl::pipeline::material_temperature_max | ( | ) | const |
Gets material_temperature_max.
float scyl::pipeline::material_temperature_min | ( | ) | const |
Gets material_temperature_min.
float scyl::pipeline::nurbs_alpha | ( | ) | const |
Gets nurbs_alpha.
int scyl::pipeline::nurbs_degree | ( | ) | const |
Gets nurbs_degree.
int scyl::pipeline::nurbs_iterations | ( | ) | const |
Gets nurbs_iterations.
int scyl::pipeline::nurbs_knot_threshold | ( | ) | const |
Gets nurbs_knot_threshold.
bool scyl::pipeline::nurbs_save_as | ( | ) | const |
Gets nurbs_save_as.
std::shared_ptr< scyl::output > scyl::pipeline::output | ( | ) |
Gets output object.
arma::umat scyl::pipeline::patches | ( | ) | const |
Gets illuminant_patches - array of patch locations and sizes (x, y, height, width)(n x 4)
void scyl::pipeline::process | ( | bool | clear = true | ) |
process() runs the pipeline. At a minimum, an input image (I) or an input object must be set, before calling this function.
The process() function will call upon each of the pipeline processing functions in series. It can be considered a wrapper function for the following functions:
If desired, the above functions can be called separately.
To run with all the default options, just set the image cube (I) of the Pipeline object using set_I() and then call process(). The following members will be populated with results:
See the descriptions of the process sub functions for more details on the above members.
clear | if set to false, previous results and the results in the input will not be cleared before processing, otherwise they will be cleared (default) |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::process_analysis | ( | bool | reflectance = true | ) |
process_analysis() performs analysis of the pipeline object's reflectance cube (or image if the input bool is false) using Principal Component Analysis
If the pipeline's process() or process sub functions (up to dichromatic recovery) have been run and there is a reflectance cube in the pipeline's s object, then analysis will proceed according to the given method. If the preconditions are not met, this function will attempt to process the image I to recover the reflectance before proceeding. (There are several exceptions that could be thrown if this should fail)
The results of the analysis will be stored in a cube that can be retrieved with analysis_components().
reflectance | true = PCA on reflectance, false = PCA on image. |
Exception | Required data not present |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::process_classification | ( | scyl::CLASSIFICATION_METHOD | method = scyl::CLASSIFICATION_SAM | ) |
process_classification() performs classification of the pipeline object's reflectance cube with the spectral loaded in pipeline's spectral library.
If the pipeline's process() or process sub functions (up to dichromatic recovery) have been run and there is a reflectance cube in the pipeline's s object, then classification will proceed according to the given method. If the preconditions are not met, this function will attempt to process the image I to recover the reflectance before proceeding. (There are several exceptions that could be thrown if this should fail)
The results of the classification will be stored in cubes that can be retrieved with classification_abundances() and classification_indexes(). For each pixel, there will be abundance_num_materials() indicies and their corresponding abundances as determined by the classification algorithm. The indices in classification_indexes() correspond to the indicies of the materials as they appear in the spectral library (under the endmembers_mean()/labels_mean() functions). Note: SVM will only result in single class results, i.e all abundances will be 1.
method | the classification method to be used (default SAM) |
Exception | Required data not present |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::process_recover_dichromatic_parameters | ( | ) |
process_recover_dichromatic_parameters() calls the function 'recover_dichromatic_parameters'. At a minimum, an input image (I) and the illuminant must be set before calling this function.
process_recover_dichromatic_parameters() will invoke the process of dichromatic parameter recovery on the input image. There are several options that can be set (which are members of the Pipeline class):
After executing, the following members of the Pipeline Object will be populated:
Exception | Required data not present |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::process_recover_endmembers | ( | ) |
process_recover_endmembers() calls the function 'unmix_by_spectra' with the list of material elements and spectra from a Spectral Library as input.
. At a minimum, a valid spectral library must be loaded, and material elements must have been recovered from the image or otherwise provided.
process_recover_endmembers() will invoke the process of endmember unmixing. There are options that can be set (which are members of the Pipeline class):
After executing, the following members of the Pipeline Object will be populated:
Note that the indexing is done using 'endmember_mean()' returned endmembers, and such 'spectral_library()->label_mean()' should be used to match indexes to labels.
Exception | Required data not present |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::process_recover_illuminant | ( | bool | clear = true | ) |
process_recover_illuminant() calls the function 'recover_global_illuminant'. At a minimum, an input image (I) must be set before calling this function.
Calling this function will clear previously calculated results (unless clear is set to false) and clear results stored in the input object as well, as it is assumed if you are running the pipeline again you are invalidating previous results.
process_recover_illuminant() will invoke the process of illuminant recovery on the input image. There are several options that can be set (which are members of the Pipeline class):
After executing, the following members of the Pipeline Object will be populated:
Note: Running the pipeline again (for example, after changing some settings) will result in the same illuminant patches being used unless you clear the illuminant patch mat (i.e set_illuminant_patches(arma::fmat());), as they are stored to the pipeline object.
clear | if set to false, previous results and the results in the input will not be cleared before processing, otherwise they will be cleared (default) |
Exception | Required data not present |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::process_recover_materials | ( | ) |
process_recover_materials() calls the function 'recover_materials'. At a minimum, a reflectance cube (s) must be set.
process_recover_materials() will invoke the process of material recovery on the input image. There are several options that can be set (which are members of the Pipeline class):
After executing, the following members of the Pipeline Object will be populated:
Exception | Required data not present |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::remove_bands | ( | arma::uvec | remove, |
bool | reflectance = false |
||
) |
remove_bands will remove bands from the image associated with the pipeline in the given list (by index).
Removing bands will reset dependent image members.
remove | - arma::uvec if band indices to remove from I (sorted in ascending order) |
reflectance | is set to true if the primary image source is the reflectance cube (and that's what you want to remove from). |
void scyl::pipeline::resize | ( | int | height, |
int | width, | ||
bool | reflectance = false |
||
) |
resize() uses OpenCV to resize the image associated with the pipeline (spatially).
Resizing will reset dependent image members.
height | - new height of image I |
width | - new width of image I |
reflectance | is set to true if the primary image source is the reflectance cube (and that's what you want to resize). |
arma::fcube scyl::pipeline::s | ( | ) | const |
Gets s (Reflectance)
const arma::fcube * scyl::pipeline::s_ptr | ( | ) | const |
Gets s_ptr, a pointer to the image cube.
void scyl::pipeline::save | ( | std::string | filename | ) |
save() saves a file according to the output object that is set for the pipeline.
Depending on the type of output file object set for this pipeline, the save function will produce different results. For a hsz_output object, a HSZ file encoding all the image components recovered from the pipeline's processing will be created. HSZ will use NURBS encoding if nurbs_save_as() is set to true. If the hdr_output object is used, then only the image cube (I) and wavelengths will be saved, or optionally the reflectance cube (if the hdr_output object was constructed: hdr_output(true)).
filename |
Exception | No output object set |
Exception | Re-throws exceptions from sub functions |
void scyl::pipeline::set_abundance_num_materials | ( | int | in | ) |
Sets abundance_num_materials (Number of materials to use per abundance when calculating abundances (Serves as a compression level for HSZ saving))
in | abundance_num_materials |
void scyl::pipeline::set_analysis_components | ( | const arma::fcube & | in | ) |
Sets analysis_components
in | analysis_components |
void scyl::pipeline::set_analysis_num | ( | int | in | ) |
Sets analysis_num (Number of analysis results to return (number of principal components))
in | analysis_num |
void scyl::pipeline::set_analysis_values | ( | const arma::fvec & | in | ) |
Sets analysis_values
in | analysis_values |
void scyl::pipeline::set_classification_abundances | ( | const arma::fcube & | in | ) |
Sets classification_abundances
in | classification_abundances |
void scyl::pipeline::set_classification_indexes | ( | const arma::ucube & | in | ) |
Sets classification_indexes
in | classification_indexes |
void scyl::pipeline::set_debug_level | ( | int | in | ) |
Sets debug_level (Amount of output printed to log)
in | debug_level |
void scyl::pipeline::set_dichromatic_gray_threshold | ( | int | in | ) |
Sets dichromatic_gray_threshold, a threshold used in the dichromatic parameter recovery. (See recover_dichromatic_parameters() for more information)
in | dichromatic_gray_threshold |
void scyl::pipeline::set_dichromatic_method | ( | scyl::DICHROMATIC_METHOD | in | ) |
Sets dichromatic_method (Method used in dichromatic parameter recovery)
in | dichromatic_method |
void scyl::pipeline::set_dichromatic_neighbourhood_size | ( | int | in | ) |
Sets dichromatic_neighbourhood_size, the kernel size used when decomposing the image. (See recover_dichromatic_parameters() for more information)
in | dichromatic_neighbourhood_size |
void scyl::pipeline::set_endmember_abundance_indexes | ( | const arma::umat & | in | ) |
Sets endmember_abundance_indexes
in | endmember_abundance_indexes |
void scyl::pipeline::set_endmember_abundances | ( | const arma::fmat & | in | ) |
Sets endmember_abundances
in | endmember_abundances |
void scyl::pipeline::set_g | ( | const arma::fmat & | in | ) |
Sets g (Shading)
in | g |
void scyl::pipeline::set_I | ( | const arma::fcube & | in, |
const arma::fvec & | wavelengths, | ||
bool | clean = true |
||
) |
Sets I (Used in the case you don't want to use an input object, or you want to perform some other processing on I before/after running the pipeline).
The function assumes that changing I will invalidate the following pipeline member variables (and resets them unless clean is set to false):
m_illuminant m_k m_g m_k_factor m_s m_illuminant_patches m_material_elements m_material_element_abundances m_material_element_abundance_indexes m_material_abundancy m_material_map m_wavelengths
in | I |
wavelengths | Corresponding wavelengths |
clean | if set to true (default) will remove all processing results from the pipeline and input object before setting I (As it is assumed that the results are invalid when a new image is set). Set to false other members will remain untouched. |
void scyl::pipeline::set_illuminant | ( | const arma::fvec & | in | ) |
Sets illuminant.
in | illuminant |
Exception | Incorrect number of elements |
void scyl::pipeline::set_illuminant_fast_50 | ( | bool | in | ) |
Sets illuminant_fast_50, a flag to tell the Illuminant recovery method to use a faster version for images with more than 50 bands.
in | illuminant_fast_50 |
void scyl::pipeline::set_illuminant_method | ( | scyl::ILLUMINANT_METHOD | in | ) |
Sets illuminant_method (Method used in Illuminant recovery)
in | illuminant_method |
void scyl::pipeline::set_illuminant_patch_size | ( | int | in | ) |
Sets illuminant_patch_size, the size of the patches used when determining the image's illuminant. (See recover_global_illuminant() for more information)
in | illuminant_patch_size |
void scyl::pipeline::set_illuminant_recovery_alpha | ( | float | in | ) |
Sets illuminant_recovery_alpha, a threshold value used in illuminant recover. (See recover_global_illuminant() for more information)
in | illuminant_recovery_alpha |
void scyl::pipeline::set_input | ( | std::shared_ptr< scyl::input > | in | ) |
Sets the input object for the pipeline. Object is initialised before it it passed to this function.
Assumes that changing the input will invalidate the following pipeline member variables (and resets them):
m_I m_illuminant m_k m_g m_k_factor m_s m_illuminant_patches m_material_elements m_material_element_abundances m_material_element_abundance_indexes m_material_abundancy m_material_map m_wavelengths
in | input |
void scyl::pipeline::set_k | ( | const arma::fmat & | in | ) |
Sets k (Specular)
in | k |
void scyl::pipeline::set_k_factor | ( | const float & | in | ) |
Sets k_factor (Specular Factor)
in | k_factor |
void scyl::pipeline::set_material_cooling_rate | ( | float | in | ) |
Sets material_cooling_rate (Rate of cooling for DA method, (t_max will be 'cooled' by this amount each iteration))
in | material_cooling_rate |
void scyl::pipeline::set_material_element_abundance_indexes | ( | const arma::ucube & | in | ) |
Sets material_element_abundance_indexes.
in | material_element_abundance_indexes |
void scyl::pipeline::set_material_element_abundances | ( | const arma::fcube & | in | ) |
Sets material_element_abundances.
in | material_element_abundances |
void scyl::pipeline::set_material_elements | ( | const arma::fmat & | in | ) |
Sets material_elements.
in | material_elements |
void scyl::pipeline::set_material_map | ( | const arma::umat & | in | ) |
Sets material_map.
in | material_map |
void scyl::pipeline::set_material_max_clusters | ( | int | in | ) |
Sets material_max_clusters, the maximum number of clusters found during material recovery. (See recover_materials() for more information)
in | material_max_clusters |
void scyl::pipeline::set_material_method | ( | scyl::MATERIAL_METHOD | in | ) |
Sets material_method (Method used for material recovery)
in | material_method |
void scyl::pipeline::set_material_split_threshold | ( | float | in | ) |
Sets material_split_threshold (Determines when a cluster is split in DA method.
If you need to tune this because your materials are not being clustered correctly by the default value, turn debug_level up to 5 and look at the output from the material recovery. The split values printed there can help you decide on a good value for this parameter)
in | material_split_threshold |
void scyl::pipeline::set_material_subsample | ( | float | in | ) |
Sets material_subsample (Amount image is subsampled by when performing Material Recovery)
Image will be subsampled according to image_size/material_subsample at the beginning of process_recover_materials()
in | material_subsample |
void scyl::pipeline::set_material_temperature_max | ( | float | in | ) |
Sets material_temperature_max, the beginning temperature for DA method. (See recover_materials() for more information)
in | material_temperature_max |
void scyl::pipeline::set_material_temperature_min | ( | float | in | ) |
Sets material_temperature_min, the ending temperature for DA method. (See recover_materials() for more information)
in | material_temperature_min |
void scyl::pipeline::set_nurbs_alpha | ( | float | in | ) |
Sets nurbs_alpha (Alpha value used to determine convergence when removing knots)
in | nurbs_alpha |
void scyl::pipeline::set_nurbs_degree | ( | int | in | ) |
Sets nurbs_degree (Degree of the polynomial used to calculate NURBS)
in | nurbs_degree |
void scyl::pipeline::set_nurbs_iterations | ( | int | in | ) |
Sets nurbs_iterations (Max number of iterations to use when calculating NURBS)
in | nurbs_iterations |
void scyl::pipeline::set_nurbs_knot_threshold | ( | int | in | ) |
Sets nurbs_knot_threshold (Target number of knots when calculating NURBS)
in | nurbs_knot_threshold |
void scyl::pipeline::set_nurbs_save_as | ( | bool | in | ) |
Sets nurbs_save_as (True if you want to use NURBS encoding when saving)
in | nurbs_save_as |
void scyl::pipeline::set_output | ( | std::shared_ptr< scyl::output > | in | ) |
Sets the output object for the pipeline. Object is initialised before it it passed to this function.
in | output |
void scyl::pipeline::set_patches | ( | const arma::umat & | in | ) |
Sets illuminant_patches (n x 4 mat containing (x, y, h, w) for patches used in illuminant recovery)
in | illuminant_patches |
void scyl::pipeline::set_s | ( | const arma::fcube & | in, |
const arma::fvec & | wavelengths, | ||
bool | clean = true |
||
) |
Sets s (reflectance)
The function assumes that changing s will invalidate the following pipeline member variables (and resets them unless clean is set to false):
m_illuminant m_k m_g m_k_factor m_I m_illuminant_patches m_material_elements m_material_element_abundances m_material_element_abundance_indexes m_material_abundancy m_material_map m_wavelengths
in | s |
wavelengths | Corresponding wavelengths |
clean | if set to true (default) will remove all processing results from the pipeline and input object before setting s (As it is assumed that the results are invalid when a new image is set). Set to false other members will remain untouched. |
void scyl::pipeline::set_spectral_library | ( | const std::shared_ptr< scyl::spectral_library > | in | ) |
Sets the spectral_library object for the pipeline. Object is initialised before it is passed to this function.
in | spectral_library |
void scyl::pipeline::set_wavelengths | ( | const arma::fvec & | in | ) |
Sets wavelengths.
in | wavelengths |
Exception | Incorrect number of elements |
std::shared_ptr< scyl::spectral_library > scyl::pipeline::spectral_library | ( | ) |
Sets spectral_library.
arma::fvec scyl::pipeline::wavelengths | ( | ) | const |
Gets wavelengths (List describing the wavelength of each band in I)
int scyl::pipeline::width | ( | ) | const |
|
private |
Abundance Num Materials (Compression rate of saved HSZ, higher = better quality) (5, 1 : material_max_clusters) Set using set_abundance_num_materials() and get using abundance_num_materials()
|
private |
Analysis Components (results from process_analysis()) Set using set_analysis_components() and get using analysis_components()
|
private |
Analysis Num Results (Number of bands given from process_analysis()) (10, 1 : num_bands) Set using set_analysis_num() and get using analysis_num()
|
private |
Analysis Values (values for each band of results from process_analysis()) Set using set_analysis_values() and get using analysis_values()
|
private |
Image bands, get using bands() (Cannot be set)
|
private |
Classification Abundances (Per pixel abundances of corresponding classification_indexes to the loaded spectral_library) Set using set_classification_abundances() and get using classification_abundances()
|
private |
Classification Indexes (Per pixel indexes of classification to loaded spectral_library) Set using set_classification_indexes() and get using classification_indexes()
|
private |
Debug Level (Controls the amount of text output/logging the Pipeline does) (0, 0 : 5) Set using set_debug_level() and get using debug_level()
|
private |
Dichromatic Grey Threshold (Threshold when comparing values) (2, 1 : 128) Set using set_dichromatic_gray_threshold() and get using dichromatic_gray_threshold()
|
private |
Dichromatic Method (Method to use when performing the Dichromatic Recovery Step) Set using set_dichromatic_method() and get using dichromatic_method()
|
private |
Dichromatic Neighbourhood Size (Area considered when performing Reflectance calculation) (-1 (auto), 1 : 128) Set using set_dichromatic_neighbourhood_size() and get using dichromatic_neighbourhood_size()
|
private |
Material Element Abundance Indexes. (Index of material in material_elements for each above ratio)
|
private |
Material Element Abundances. (Ratios of elements per pixel) Set using set_material_element_abundances() and get using material_element_abundances()
|
private |
Specifies if the image has been filtered (false)
|
private |
Image height, get using height() (Cannot be set)
|
private |
Illuminant. Set using set_illuminant() and get using illuminant()
|
private |
Illuminant Method (Method to use when performing the Illuminant Recovery Step) Set using set_illuminant_method() and get using illuminant_method()
|
private |
Illuminant Options object Set using various illuminant setters and getters.
|
private |
Input object for the Pipeline, assign during constructor or using set_input(). Input object provides an interface between a data file and the Pipeline.
|
private |
K factor. Set using set_k_factor() and get using k_factor()
|
private |
Material Element Abundance Indexes. (Index of material in material_elements for each above ratio) Set using set_material_element_abundance_indexes() and get using material_element_abundance_indexes()
|
private |
Material Element Abundances. (Ratios of elements per pixel) Set using set_material_element_abundances() and get using material_element_abundances()
|
private |
Material Elements. (List of spectral signatures for the materials in the scene) Set using set_material_elements() and get using material_elements()
|
private |
Material Map. (Index of the dominant material at each pixel in the image) Set using set_material_map() and get using material_map()
|
private |
Material Method (Method to use when performing the Material Recovery Step) Set using set_material_method() and get using material_method()
|
private |
Material Options object Set using various material setters and getters.
|
private |
NURBS Alpha (Value used to test convergence of the NURBS encoding) (0.1, >0 : <1) Set using set_nurbs_alpha() and get using nurbs_alpha()
|
private |
NURBS Degree (Polynomial degree of curves when encoding NURBS) (2, 2 : 6) Set using set_nurbs_degree() and get using nurbs_degree()
|
private |
NURBS Iterations (Number of iterations to use when encoding NURBS) (10, 1 : 10) Set using set_nurbs_iterations() and get using nurbs_iterations()
|
private |
NURBS Knot Threshold (Target number of knots (compression level)) (-1 (auto), degree + 2, image_bands) Set using set_nurbs_knot_threshold() and get using nurbs_knot_threshold()
|
private |
NURBS Save As (Use NURBS encoding when saving as HSZ) (true) Set using set_nurbs_save_as() and get using nurbs_save_as()
|
private |
Output object for the Pipeline, assign during constructor or using set_output(). Output object provides allows for the saving of pipeline data in specific formats.
|
private |
Spectral Library (Object allows for loading/saving of SLZ files) Set using set_spectral_library() and get using spectral_library()
|
private |
Flag for input (Used internally only)
|
private |
Flag for output (Used internally only)
|
private |
Wavelength index of each band in I. Set using set_wavelengths() and get using wavelengths()
|
private |
Image width, get using width() (Cannot be set)