Scyllarus: C++ Hyperspectral Processing Library
Hyperspectral Image Processing Pipeline
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
utility.h
Go to the documentation of this file.
1 /****************************************************************************************
2  * SCYLLARUS : C++ HYPERSPECTRAL PROCESSING LIBRARY
3  * utility.h - Helper functions and utility functions.
4  *
5  * This computer code is subject to copyright:
6  * (c) National ICT Australia Limited (NICTA) 2013-2014 All Rights Reserved.
7  *
8  * Jeremy Oorloff, National ICT Australia (NICTA)
9  *
10  ***************************************************************************************/
11 
12 #ifndef UTILITY_H_
13 #define UTILITY_H_
14 
15 #include <armadillo>
16 #include <opencv2/opencv.hpp>
17 #include <iso646.h>
18 
19 #include "utility_imp.h"
20 #include "ocv_tools.h"
21 #include "logger.h"
22 #include "nurbs.h"
23 
24 
25 namespace scyl
26 {
27 
28  template <class T> void nan_to_zero(T & in);
29 
30  template <class T> void zero_to_one(T & in);
31 
32  template <class T> bool arma_cmp(const T & a,
33  const T & b,
34  const bool verbose,
35  float eps);
36 
37  template <class T> int arma_cmp_num(const T & a,
38  const T & b,
39  float eps);
40 
41  template <class T> float arma_cmp_sig_figs(const T & a,
42  const T & b,
43  int num_sig_figs);
44 
45  arma::fvec non_negative_least_squares_2(arma::fmat a,
46  arma::fvec b);
47 
48  void remove_bands(arma::fcube & in,
49  arma::fvec & waves,
50  arma::uvec remove);
51 
52  void scale_cube(arma::fcube & in,
53  int height,
54  int width,
55  int cv_interpolate_flag=cv::INTER_LINEAR);
56 
57  float angle(const arma::fvec & a,
58  const arma::fvec & b);
59 
60  void image_gradient(const arma::fmat & in,
61  arma::fmat & gx,
62  arma::fmat & gy);
63 
64  arma::fmat arma_slice_mean(const arma::fcube & in);
65 
66  void register_image_bands(const arma::fcube & in,
67  arma::fvec & coloff,
68  arma::fvec & rowoff,
69  int debug=0);
70 
71  void align_image_bands(arma::fcube & in,
72  arma::fvec & coloff,
73  arma::fvec & rowoff,
74  int debug=0);
75  void sort_bands(arma::fcube & I,
76  arma::fvec & wavelengths);
77 
78  arma::fmat resample_endmembers(const arma::fmat & in_endmembers,
79  const arma::fvec & in_waves,
80  const arma::fvec & in_waves_new);
81 
82 
83 }
84 #endif /* UTILITY_H_ */
void scale_cube(arma::fcube &in, int height, int width, int cv_interpolate_flag=cv::INTER_LINEAR)
scale_cube() resamples a cube spatially using OpenCV resize methods.
Definition: utility.cpp:226
void nan_to_zero(T &in)
nan_to_zero removes NaN values from a Armadillo data structure, replacing them with 0...
Definition: utility_imp.h:24
void zero_to_one(T &in)
zero_to_one replaces 0's in an Armadillo data structure with 1's.
Definition: utility_imp.h:41
arma::fmat resample_endmembers(const arma::fmat &in_endmembers, const arma::fvec &in_waves, const arma::fvec &in_waves_new)
resample_endmembers() is used to change the number of bands an endmember matrix has using NURBS...
Definition: utility.cpp:585
bool arma_cmp(const T &a, const T &b, const bool verbose, float eps)
arma_cmp compares two Armadillo objects for equality +- epsilon.
Definition: utility_imp.h:110
I.
Definition: scyllarus_types.h:114
void remove_bands(arma::fcube &in, arma::fvec &waves, arma::uvec remove)
remove_bands() removes image bands from the given image cube.
Definition: utility.cpp:184
void align_image_bands(arma::fcube &in, arma::fvec &coloff, arma::fvec &rowoff, int debug=0)
align_image_bands() aligns bands in an image according to the input row and column offsets...
Definition: utility.cpp:479
int arma_cmp_num(const T &a, const T &b, float eps)
void register_image_bands(const arma::fcube &in, arma::fvec &coloff, arma::fvec &rowoff, int debug=0)
register_image_bands() takes a image cube and attempts to automatically find the alignment of the ban...
Definition: utility.cpp:354
void sort_bands(arma::fcube &I, arma::fvec &wavelengths)
sort_bands() manipulates a Image cube and wavelengths vector.
Definition: utility.cpp:542
void image_gradient(const arma::fmat &in, arma::fmat &gx, arma::fmat &gy)
Calculates the gradients in the x and y directions for a given image.
Definition: utility.cpp:289
float angle(const arma::fvec &a, const arma::fvec &b)
angle returns the angle between two vectors in degrees.
Definition: utility.cpp:272
arma::fvec non_negative_least_squares_2(arma::fmat a, arma::fvec b)
non_negative_least_squares_2() gives a non negative solution for x to the problem of Ax = b...
Definition: utility.cpp:25
float arma_cmp_sig_figs(const T &a, const T &b, int num_sig_figs)
arma_cmp compares two Armadillo objects for equality. Instead of using a tolerance, test number of significant figures.
Definition: utility_imp.h:143
arma::fmat arma_slice_mean(const arma::fcube &in)
arma_slice_mean() takes an image cube and returns a mat which is the mean image of all the slices...
Definition: utility.cpp:329