MTF
|
basic functions for preprocessing the raw input image using filtering, resizing and histogram equalization before using it for tracking More...
Classes | |
struct | AnisotropicDiffusion |
struct | BilateralFiltering |
struct | Corners |
convert region corners between various formats More... | |
struct | GaussianSmoothing |
class | InputBase |
class | InputCV |
class | InputDummy |
dummy input pipeline to always provide a fixed image; needed to ensure API uniformity of the interactive object selector More... | |
class | InputParams |
class | InputVP |
ViSP input pipeline. More... | |
class | InputVPParams |
class | InputXV |
class | InputXV24 |
class | InputXV32 |
class | InputXVSource |
struct | MedianFiltering |
class | MTFNet |
struct | NoFiltering |
struct | NoPreProcessing |
struct | NormalizedBoxFiltering |
struct | ObjStruct |
simple structure to store an object read from ground truth or selected by the user; requires that the object location be representable by a quadrilateral More... | |
class | ObjUtils |
utility functions to obtain initial object location for tracking - either read from a ground truth file or selected interactively by the user More... | |
struct | PreProcBase |
struct | SobelFltering |
Typedefs | |
typedef void(* | BSpl3WithGradPtr) (double &, double &, double) |
typedef std::shared_ptr< ObjStruct > | ObjStructPtr |
Enumerations | |
enum | InterpType { Nearest, Linear, Cubic, Cubic2, CubicBSpl } |
enum | BorderType { Constant, Replicate } |
enum | FrameType { MUTABLE } |
enum | TrackErrT { MCD, CL, Jaccard } |
functions to handle tracking error computation | |
Functions | |
void | getLog (MatrixXd &eig_log, const MatrixXd &eig_mat, int n_rows, int n_cols) |
void | getLog (VectorXd &eig_log, const VectorXd &eig_vec, int vec_size) |
double | cumBSpl3 (double x) |
template<int bspl_id> | |
void | cumBSpl3WithGradFast (double &val, double &diff, double x) |
template<> | |
void | cumBSpl3WithGradFast< 0 > (double &val, double &diff, double x) |
template<> | |
void | cumBSpl3WithGradFast< 1 > (double &val, double &diff, double x) |
template<> | |
void | cumBSpl3WithGradFast< 2 > (double &val, double &diff, double x) |
template<> | |
void | cumBSpl3WithGradFast< 3 > (double &val, double &diff, double x) |
void | cumBSpl3WithGrad (double &val, double &diff, double x) |
template<int bspl_id> | |
double | cumBSpl3HessFast (double x) |
template<> | |
double | cumBSpl3HessFast< 0 > (double x) |
template<> | |
double | cumBSpl3HessFast< 1 > (double x) |
template<> | |
double | cumBSpl3HessFast< 2 > (double x) |
template<> | |
double | cumBSpl3HessFast< 3 > (double x) |
double | cumBSpl3Hess (double x) |
double | bSpl3 (double x) |
template<int bspl_id> | |
void | bSpl3WithGradFast (double &val, double &diff, double x) |
template<> | |
void | bSpl3WithGradFast< 0 > (double &val, double &diff, double x) |
template<> | |
void | bSpl3WithGradFast< 1 > (double &val, double &diff, double x) |
template<> | |
void | bSpl3WithGradFast< 2 > (double &val, double &diff, double x) |
template<> | |
void | bSpl3WithGradFast< 3 > (double &val, double &diff, double x) |
void | bSpl3WithGrad (double &val, double &diff, double x) |
double | bSpl3Grad (double x) |
first order derivative of the BSpline function of order 3 | |
template<int bspl_id> | |
double | bSpl3HessFast (double x) |
template<> | |
double | bSpl3HessFast< 0 > (double x) |
template<> | |
double | bSpl3HessFast< 1 > (double x) |
template<> | |
double | bSpl3HessFast< 2 > (double x) |
template<> | |
double | bSpl3HessFast< 3 > (double x) |
double | bSpl3Hess (double x) |
second order derivative of the BSpline function of order 3 | |
void | bSpl3WithGrad0 (double &val, double &diff, double x) |
void | bSpl3WithGrad1 (double &val, double &diff, double x) |
void | bSpl3WithGrad2 (double &val, double &diff, double x) |
void | bSpl3WithGrad3 (double &val, double &diff, double x) |
void | getDiracHist (VectorXd &hist, VectorXi &pix_vals_int, const VectorXd &pix_vals, double hist_pre_seed, int n_pix) |
computes histogram using the Dirac delta function to determine the bins to which each pixel contributes, i.e. More... | |
void | getDiracHist (VectorXi &hist, const VectorXi &vals, int n_vals) |
simpler version that assumes that both input and output vectors are integral | |
void | getDiracJointHist (MatrixXd &joint_hist, VectorXd &hist1, const VectorXd &pix_vals1, const VectorXi &pix_vals2_int, double hist_pre_seed, double joint_hist_pre_seed, int n_pix, int n_bins) |
assumes that the histogram for the second image has already been computed along with the floors of its pixel values | |
void | getDiracJointHist (MatrixXd &joint_hist, VectorXd &hist1, VectorXd &hist2, const VectorXd &pix_vals1, const VectorXd &pix_vals2, double hist_pre_seed, double joint_hist_pre_seed, int n_pix, int n_bins) |
void | getDiracJointHist (MatrixXd &joint_hist, VectorXd &hist1, VectorXd &hist2, const MatrixXdMr &patch1, const MatrixXdMr &patch2, int start_x, int end_x, int start_y, int end_y, double hist_pre_seed, double joint_hist_pre_seed, int n_pix, int n_bins) |
consider only corresponding sub regions in two image patches | |
void | getBilinearHist (VectorXd &hist, VectorXi &pix_vals_int, const VectorXd &pix_vals, double hist_pre_seed, int n_pix) |
computes histogram using the bilinear interpolation to determine contributions for the bins corresponding to the floor and ceil of each pixel | |
void | getBilinearJointHist (MatrixXd &joint_hist, VectorXd &hist1, VectorXd &hist2, const VectorXd &pix_vals1, const VectorXd &pix_vals2, double hist_pre_seed, double joint_hist_pre_seed, int n_pix, int n_bins) |
computes joint histogram using the bilinear interpolation to determine contributions for the bins corresponding to the floor and ceil of each pixel | |
void | getBSplHist (VectorXd &hist, MatrixXd &hist_mat, MatrixX2i &bspl_ids, const VectorXd &pix_vals, const MatrixX2i &std_bspl_ids, double pre_seed, int n_pix) |
computes the histogram for the given image specified as a vector of pixel values. More... | |
void | getBSplJointHist (MatrixXd &joint_hist, VectorXd &hist1, VectorXd &hist2, const VectorXd &pix_vals1, const VectorXd &pix_vals2, double hist_pre_seed, double joint_hist_pre_seed, int n_pix, int n_bins) |
void | getBSplJointHist (MatrixXd &joint_hist, VectorXd &hist1, VectorXd &hist2, MatrixXd &hist1_mat, MatrixXd &hist2_mat, MatrixX2i &bspl_ids1, MatrixX2i &bspl_ids2, const VectorXd &pix_vals1, const VectorXd &pix_vals2, const MatrixX2i &std_bspl_ids, double hist_pre_seed, double joint_hist_pre_seed, int n_pix) |
void | getBSplJointHist (MatrixXd &joint_hist, VectorXd &hist1, MatrixXd &hist1_mat, MatrixX2i &bspl_ids1, const VectorXd &pix_vals1, const MatrixX2i &bspl_ids2, const MatrixXd &hist2_mat, const MatrixX2i &std_bspl_ids, double hist_pre_seed, double joint_hist_pre_seed, int n_pix) |
this assumes that the histogram of the second image (typically the reference or initial image) has already been computed, also assumes that the 'floor' or integral parts of the pixels values of this image are available (computed with its histogram) to avoid repeated computation; computes the histogram for the first image and uses the two histograms to compute the joint histogram | |
void | getBSplJointHist (MatrixXd &joint_hist, const MatrixXd &hist_mat, const MatrixX2i &bspl_ids, double pre_seed, int n_pix) |
void | getBSplHistGrad (MatrixXd &hist_grad, const VectorXd &pix_vals, const MatrixX2i &bspl_ids, int n_pix) |
computes a matrix with 'n_bins' rows and 'n_pix' columns that contains the gradient of each bin of the B Spline histogram w.r.t. More... | |
void | getBSplHistHess (MatrixXd &hist_hess, const VectorXd &pix_vals, const MatrixX2i &bspline_ids, int n_pix, double hist_norm_mult) |
void | getBSplJointHistGrad (MatrixXd &joint_hist_grad, MatrixXd &hist1_grad, const VectorXd &pix_vals1, const MatrixXd &hist2_mat, const MatrixX2i &bspl_ids1, const MatrixX2i &bspl_ids2, const MatrixXi &linear_idx, int n_pix) |
computes a matrix with (n_bins*n_bins) rows and n_pix columns that contains the gradient of each entry of the B Spline joint histogram w.r.t. More... | |
void | getBSplJointHistGrad (MatrixXd &joint_hist_grad, const MatrixXd &hist1_grad, const MatrixXd &hist2_mat, const MatrixX2i &bspl_ids1, const MatrixX2i &bspl_ids2, const MatrixXi &linear_idx, int n_pix) |
void | getBSplHistWithGrad (VectorXd &hist, MatrixXd &hist_mat, MatrixXd &hist_grad, MatrixX2i &bspl_ids, const VectorXd &pix_vals, const MatrixX2i &std_bspl_ids, double pre_seed, int n_pix, double hist_norm_mult) |
computes both the histogram and its gradient simultaneously to take advantage of the common computations involved | |
void | getBSplJointHistWithGrad (MatrixXd &joint_hist, VectorXd &hist1, MatrixXd &hist1_mat, MatrixXd &hist1_grad, MatrixXd &joint_hist_grad, MatrixX2i &bspl_ids1, const VectorXd &pix_vals1, const MatrixX2i &bspl_ids2, const MatrixXd &hist2_mat, const MatrixX2i &std_bspl_ids, const MatrixXi &linear_idx, double hist_pre_seed, double joint_hist_pre_seed, int n_pix, double hist_norm_mult=1) |
computes both the histogram and gradient of the first image as well as the joint histogram and its gradient w.r.t. More... | |
void | getBSplJointHistWithGradFast (MatrixXd &joint_hist, VectorXd &hist1, MatrixXd &hist1_mat, MatrixXd &hist1_grad, MatrixXd &joint_hist_grad, MatrixX2i &bspl_ids1, const VectorXd &pix_vals1, const MatrixX2i &bspl_ids2, const MatrixXd &hist2_mat, const MatrixX2i &std_bspl_ids, const MatrixXi &linear_idx, double hist_pre_seed, double joint_hist_pre_seed, int n_pix, double hist_norm_mult) |
void | getEntropyVec (VectorXd &entropy_vec, const VectorXd &norm_hist, int n_bins) |
computes a vector of size 'n_bins' whose sum is equal to the entropy of the image whose normalized histogram is provided | |
void | getEntropyVec (VectorXd &entropy_vec, const VectorXd &norm_hist, const VectorXd &norm_hist_log, int n_bins) |
same as above except it uses precomputed log of the histogram to reduce computation | |
void | getMIVec (VectorXd &mi_vec, VectorXd &log_hist_ratio, const MatrixXd &joint_hist, const VectorXd &norm_hist1, const VectorXd &norm_hist2, const MatrixXi &linear_idx, int n_bins) |
computes a vector of size n_bins x n_bins whose sum gives the MI of the two images whose normalized histograms and joint histogram are provided | |
void | getMIVec (VectorXd &mi_vec, VectorXd &log_hist_ratio, const MatrixXd &joint_hist, const MatrixXd &joint_hist_log, const VectorXd &hist1_log, const VectorXd &hist2_log, const MatrixXi &linear_idx, int n_bins) |
uses precomputed log of the histograms to avoid repeated costly log computations | |
void | getMIVecGrad (MatrixXd &mi_vec_grad, const MatrixXd &joint_hist_grad, const VectorXd &log_hist_ratio, const MatrixXd &hist1_grad_ratio, const MatrixXd &joint_hist, const MatrixX2i &bspl_ids, const MatrixXi &linear_idx, int n_bins, int n_pix) |
computes the gradient of each entry of the MI vector w.r.t. More... | |
void | getCumBSplHistWithGrad (VectorXd &cum_hist, MatrixXd &cum_hist_mat, MatrixXd &cum_hist_grad, MatrixX2i &bspline_ids, const VectorXd &pix_vals, const MatrixX2i &std_bspline_ids, double pre_seed, int n_bins, int n_pix, double hist_norm_mult) |
computes the cumulative cubic BSpline histogram and its gradient | |
void | getCumBSplJointHistWithGrad (MatrixXd &cum_joint_hist, MatrixXd &cum_joint_hist_grad, const MatrixXd &cum_hist_mat, const MatrixXd &hist_mat, const MatrixXd &cum_hist_grad, const MatrixX2i &cum_bspl_ids, const MatrixX2i &bspl_ids, const MatrixXi &linear_idx, double pre_seed, int n_bins, int n_pix) |
void | getCumBSplJointHistWithGrad (MatrixXd &cum_joint_hist, MatrixXd &cum_joint_hist_grad, VectorXd &hist, MatrixXd &hist_mat, const VectorXd &pix_vals, const MatrixXd &cum_hist_mat, const MatrixXd &cum_hist_grad, const MatrixX2i &cum_bspl_ids, const MatrixX2i &bspline_ids, const MatrixXi &linear_idx, double pre_seed, double joint_pre_seed, int n_bins, int n_pix) |
void | getCumBSplJointHistWithGrad (MatrixXd &cum_joint_hist, VectorXd &cum_hist, MatrixXd &cum_hist_mat, MatrixXd &cum_hist_grad, MatrixXd &cum_joint_hist_grad, MatrixX2i &bspline_ids1, const VectorXd &pix_vals1, const MatrixX2i &bspline_ids2, const MatrixXd &hist2_mat, const MatrixX2i &std_bspline_ids, const MatrixXi &linear_idx, double hist_pre_seed, double joint_hist_pre_seed, int n_bins, int n_pix, double hist_norm_mult) |
void | getInvCumBSplJointHistGrad (MatrixXd &cum_joint_hist_grad, const MatrixXd &hist_grad, const MatrixXd &cum_hist_mat, const MatrixX2i &cum_bspl_ids, const MatrixX2i &bspl_ids, const MatrixXi &linear_idx, int n_bins, int n_pix) |
void | getCumBSplHistHess (MatrixXd &cum_hist_hess, const VectorXd &pix_vals, const MatrixX2i &bspline_ids, int n_pix, double hist_norm_mult) |
void | validateJointHist (const MatrixXd &joint_hist, const VectorXd &hist1, const VectorXd &hist2) |
void | validateJointHistGrad (const MatrixXd &joint_hist_grad, const MatrixXd &hist1_grad, const MatrixXd &hist2_grad, const MatrixXi &linear_idx, int n_bins, int n_pix) |
const char * | toString (InterpType interp_type) |
const char * | toString (BorderType border_type) |
const char * | typeToString (int img_type) |
const char * | getType (const cv::Mat &mat) |
bool | checkOverflow (double x, double y, unsigned int h, unsigned int w) |
template<InterpType interp_type, BorderType border_type> | |
double | getPixVal (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val=128.0) |
template<> | |
double | getPixVal< InterpType::Nearest, BorderType::Constant > (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val) |
template<> | |
double | getPixVal< InterpType::Nearest, BorderType::Replicate > (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val) |
template<> | |
double | getPixVal< InterpType::Linear, BorderType::Constant > (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val) |
template<> | |
double | getPixVal< InterpType::Linear, BorderType::Replicate > (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val) |
template<> | |
double | getPixVal< InterpType::Cubic, BorderType::Constant > (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val) |
template<> | |
double | getPixVal< InterpType::Cubic2, BorderType::Constant > (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val) |
template<> | |
double | getPixVal< InterpType::CubicBSpl, BorderType::Constant > (const EigImgT &img, double x, double y, unsigned int h, unsigned int w, double overflow_val) |
template<typename PtsT > | |
void | getPixVals (VectorXd &pix_vals, const EigImgT &img, const PtsT &pts, unsigned int n_pix, unsigned int h, unsigned int w, double norm_mult=1, double norm_add=0) |
void | getWeightedPixVals (VectorXd &pix_vals, const EigImgT &img, const PtsT &pts, unsigned int frame_count, double alpha, bool use_running_avg, unsigned int n_pix, unsigned int h, unsigned int w, double norm_mult, double norm_add) |
get weighted pixel values using alpha as weighting factor between existing and new pixel values | |
void | getWarpedImgGrad (PixGradT &warped_img_grad, const EigImgT &img, const Matrix8Xd &warped_offset_pts, double grad_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
template<InterpType mapping_type> | |
void | getWarpedImgGrad (PixGradT &warped_img_grad, const EigImgT &img, const VectorXd &intensity_map, const Matrix8Xd &warped_offset_pts, double grad_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getWarpedImgGrad (PixGradT &warped_img_grad, const EigImgT &img, bool weighted_mapping, const VectorXd &intensity_map, const Matrix8Xd &warped_offset_pts, double grad_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getImgGrad (PixGradT &img_grad, const EigImgT &img, const PtsT &pts, double grad_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
template<InterpType mapping_type> | |
void | getImgGrad (PixGradT &img_grad, const EigImgT &img, const VectorXd &intensity_map, const PtsT &pts, double grad_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getImgGrad (PixGradT &img_grad, const EigImgT &img, bool weighted_mapping, const VectorXd &intensity_map, const PtsT &pts, double grad_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getWarpedImgHess (PixHessT &warped_img_hess, const EigImgT &img, const PtsT &warped_pts, const Matrix16Xd &warped_offset_pts, double hess_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
template<InterpType mapping_type> | |
void | getWarpedImgHess (PixHessT &warped_img_hess, const EigImgT &img, const VectorXd &intensity_map, const PtsT &warped_pts, const Matrix16Xd &warped_offset_pts, double hess_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getWarpedImgHess (PixHessT &warped_img_hess, const EigImgT &img, bool weighted_mapping, const VectorXd &intensity_map, const PtsT &warped_pts, const Matrix16Xd &warped_offset_pts, double hess_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getImgHess (PixHessT &img_hess, const EigImgT &img, const PtsT &pts, double hess_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
template<InterpType mapping_type> | |
void | getImgHess (PixHessT &img_hess, const EigImgT &img, const VectorXd &intensity_map, const PtsT &pts, double hess_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getImgHess (PixHessT &img_hess, const EigImgT &img, bool weighted_mapping, const VectorXd &intensity_map, const PtsT &pts, double hess_eps, unsigned int n_pix, unsigned int h, unsigned int w, double pix_mult_factor=1.0) |
void | getImgHess (PixHessT &img_hess, const EigImgT &img, const PtsT &pts, unsigned int n_pix, unsigned int h, unsigned int w) |
template<InterpType interp_type> | |
double | mapPixVal (double x, const VectorXd &intensity_map) |
map pixel values using the given intensity map | |
template<> | |
double | mapPixVal< InterpType::Nearest > (double x, const VectorXd &intensity_map) |
template<> | |
double | mapPixVal< InterpType::Linear > (double x, const VectorXd &intensity_map) |
template<InterpType interp_type> | |
void | mapPixVals (VectorXd &dst_pix_vals, const VectorXd &src_pix_vals, const VectorXd &intensity_map, unsigned int n_pix) |
template<typename PixVecT > | |
double | cubicBSplInterpolate (const PixVecT &pix_vec, double dx) |
template<typename PixVecT > | |
double | cubicInterpolate (const PixVecT &pix_vec, double x) |
bool | getNeighboringPixGrid (Matrix4d &pix_grid, const EigImgT &img, double x, double y, unsigned int h, unsigned int w) |
void | getBiCubicCoefficients (Matrix4d &bicubic_coeff, const Matrix4d &pix_grid) |
double | biCubic (const Matrix4d &bicubic_coeff, double x, double y) |
double | biCubicGradX (Vector2d &grad, const Matrix4d &bicubic_coeff, double x, double y) |
double | biCubicGradY (Vector2d &grad, const Matrix4d &bicubic_coeff, double x, double y) |
double | biCubicHessXX (const Matrix4d &bicubic_coeff, double x, double y) |
double | biCubicHessYY (const Matrix4d &bicubic_coeff, double x, double y) |
double | biCubicHessYX (const Matrix4d &bicubic_coeff, double x, double y) |
double | biCubicHessXY (const Matrix4d &bicubic_coeff, double x, double y) |
cv::Mat | convertFloatImgToUchar (cv::Mat &img, int nchannels) |
Miscellaneous image related utility functions. | |
void | generateWarpedImg (cv::Mat &warped_img, const cv::Mat &warped_corners, const mtf::PtsT &warped_pts, const mtf::PixValT orig_patch, const cv::Mat &orig_img, unsigned int img_width, unsigned int img_height, unsigned int n_pts, int background_type, bool show_warped_img=false, const char *win_name="warped_img") |
template<typename ScalarType > | |
void | generateInverseWarpedImg (cv::Mat &warped_img, const mtf::PtsT &warped_pts, const cv::Mat &orig_img, const mtf::PtsT &orig_pts, int img_width, int img_height, int n_pts, bool show_warped_img=false, const char *win_name="warped_img") |
void | generateInverseWarpedImg (cv::Mat &warped_img, const PixValT &pix_vals, unsigned int img_width, unsigned int img_height, unsigned int n_pts, bool show_warped_img, const char *win_name="warped_img") |
void | writePixelsToImage (cv::Mat &img, const PixValT &pix_vals, const mtf::PtsT &pts, unsigned int n_channels, cv::Mat &mask) |
write pixel values in the given image at the given locations | |
void | writePixelsToImage (cv::Mat &img, const cv::Mat &pix_vals, const mtf::PtsT &pts, int n_channels, cv::Mat &mask) |
void | writePixelsToImage (cv::Mat &img, const cv::Mat &pix_vals, const mtf::CornersT &corners, int n_channels, cv::Mat &mask) |
void | writePixelsToImage (cv::Mat &img, const cv::Mat &pix_vals, const cv::Mat &corners, int n_channels, cv::Mat &mask) |
bool | addGaussianNoise (const cv::Mat mSrc, cv::Mat &mDst, int n_channels, double Mean=0.0, double StdDev=10.0) |
add Gaussian distributed random noise to the image | |
cv::Mat | reshapePatch (const VectorXd &curr_patch, int img_height, int img_width, int n_channels=1) |
VectorXd | reshapePatch (const cv::Mat &cv_patch, int start_x=0, int start_y=0, int end_x=-1, int end_y=-1) |
void | anisotropicDiffusion (cv::Mat &output, double lambda=1.0/7.0, double k=30, unsigned int n_iters=15) |
int | getNumberOfFrames (const char *file_template) |
int | getNumberOfVideoFrames (const char *file_name) |
template<typename T > | |
void | copyMatrixFromMatlab (const T *from, cv::Mat &to, int n_channels) |
Copy the (image) data from Matlab-algorithm compatible (column-major) representation to cv::Mat. More... | |
template<typename T > | |
void | copyMatrixToMatlab (const cv::Mat &from, T *to, int n_channels) |
unsigned int | getID (const mxArray *mx_id) |
cv::Mat | getImage (const mxArray *mx_img) |
cv::Mat | getCorners (const mxArray *mx_corners) |
const char * | toString (const mxArray *prhs) |
mxArray * | setCorners (const cv::Mat &corners) |
template<typename ValT > | |
cv::Rect_< ValT > | getBestFitRectangle (const cv::Mat &corners, int img_width=0, int img_height=0, int border_size=0) |
compute the rectangle that best fits an arbitrry quadrilateral in terms of maximizing the Jaccard index of overlap between the corresponding regions; an optional resize factor is provided to avaoid further loss in precision in case a resizing is needed and the input corners are floating point numbers; | |
template<typename ValT > | |
cv::Rect_< ValT > | getBoundedRectangle (const cv::Rect_< ValT > &_in_rect, int img_width, int img_height, int border_size=0) |
adjust the rectangle bounds so it lies entirely within the image with the given size | |
template<typename MatT > | |
void | printMatrix (const MatT &eig_mat, const char *mat_name=nullptr, const char *fmt="%15.9f", const char *coeff_sep="\t", const char *row_sep="\n") |
template<typename ScalarT > | |
void | printScalar (ScalarT scalar_val, const char *scalar_name, const char *fmt="%15.9f", const char *name_sep="\t", const char *val_sep="\n") |
template<typename MatT > | |
void | printMatrixToFile (const MatT &eig_mat, const char *mat_name, const char *fname, const char *fmt="%15.9f", const char *mode="a", const char *coeff_sep="\t", const char *row_sep="\n", char **const row_labels=nullptr, const char **mat_header=nullptr, const char *header_fmt="%15s", const char *name_sep="\n") |
template<typename ScalarT > | |
void | printScalarToFile (ScalarT scalar_val, const char *scalar_name, const char *fname, const char *fmt="%15.9f", const char *mode="a", const char *name_sep="\t", const char *val_sep="\n") |
template<typename ScalarT , typename MatT > | |
void | saveMatrixToFile (const MatT &eig_mat, const char *fname, const char *mode="ab") |
template<typename ScalarT > | |
void | saveScalarToFile (ScalarT &scalar_val, const char *fname, const char *mode="ab") |
template<typename ScalarT > | |
void | printMatrix (const cv::Mat &cv_mat, const char *mat_name, const char *fmt="%15.9f", const char *coeff_sep="\t", const char *row_sep="\n", const char *name_sep="\n") |
template<typename ScalarT > | |
void | printMatrixToFile (const cv::Mat &cv_mat, const char *mat_name, const char *fname, const char *fmt="%15.9f", const char *mode="a", const char *coeff_sep="\t", const char *row_sep="\n", const char **row_labels=nullptr, const char **mat_header=nullptr, const char *header_fmt="%15s", const char *name_sep="\n") |
template<typename MatT > | |
bool | hasInf (const MatT &eig_mat) |
template<typename MatT > | |
bool | hasNaN (const MatT &eig_mat) |
template<typename ScalarT > | |
bool | hasInf (const cv::Mat &cv_mat) |
template<typename ScalarT > | |
bool | hasNaN (const cv::Mat &cv_mat) |
template<typename ScalarT > | |
bool | isFinite (const cv::Mat &cv_mat) |
template<typename T > | |
int | icvCompressPoints (T *ptr, const uchar *mask, int mstep, int count) |
remove elements from OpenCV Mat or other compatible structures according to the provided binary mask copied from its namesake defined in fundam.cpp inside calib3d module of OpenCV | |
void | drawCorners (cv::Mat &img, const cv::Point2d(&cv_corners)[4], const cv::Scalar corners_col, const std::string label) |
void | maskVector (VectorXd &masked_vec, const VectorXd &in_vec, const VectorXb &mask, int masked_size, int in_size) |
VectorXd | maskVector (const VectorXd &in_vec, const VectorXb &mask, int masked_size, int in_size) |
template<typename MatT > | |
void | maskMatrixByRow (MatT &masked_mat, const MatT &in_mat, const VectorXb &mask, int n_cols) |
template<typename MatT > | |
MatT | maskMatrixByRow (const MatT &in_mat, const VectorXb &mask, int n_cols) |
template<typename MatT > | |
void | maskMatrixByCol (MatT &masked_mat, const MatT &in_mat, const VectorXb &mask, int n_rows) |
template<typename MatT > | |
MatT | maskMatrixByCol (const MatT &in_mat, const VectorXb &mask, int n_rows) |
template<typename ScalarT , typename EigT > | |
void | copyCVToEigen (EigT &eig_mat, const cv::Mat &cv_mat) |
template<> | |
void | copyCVToEigen< double, Matrix3d > (Matrix3d &eig_mat, const cv::Mat &cv_mat) |
template<typename ScalarT > | |
MatrixXd | copyCVToEigen (const cv::Mat &cv_mat) |
template<typename ScalarT , typename EigT > | |
void | copyEigenToCV (cv::Mat &cv_mat, const EigT &eig_mat) |
template<> | |
void | copyEigenToCV< double, CornersT > (cv::Mat &cv_mat, const CornersT &eig_mat) |
template<typename EigT , typename ScalarT , int CVMatT> | |
cv::Mat | copyEigenToCV (const EigT &eig_mat) |
double | writeTimesToFile (vector< double > &proc_times, vector< char * > &proc_labels, char *time_fname, int iter_id) |
void | drawRegion (cv::Mat &img, const cv::Mat &vertices, cv::Scalar col=cv::Scalar(0, 255, 0), int line_thickness=2, const char *label=nullptr, double font_size=0.50, bool show_corner_ids=false, bool show_label=false, int line_type=0) |
draw the boundary of the image region represented by the polygon formed by the specified vertices | |
void | drawRegion (vpImage< vpRGBa > &img, const cv::Mat &vertices, vpColor col=vpColor::green, int line_thickness=2, const char *label=nullptr, double font_size=0.50, bool show_corner_ids=false, bool show_label=false, int line_type=0) |
void | drawGrid (cv::Mat &img, const PtsT &grid_pts, int res_x, int res_y, cv::Scalar col=cv::Scalar(0, 255, 0), int thickness=1) |
template<typename ImgValT , typename PatchValT > | |
void | drawPatch (cv::Mat &img, const cv::Mat &patch, int n_channels=1, int start_x=0, int start_y=0) |
template<typename ScalarT > | |
void | drawPts (cv::Mat &img, const cv::Mat &pts, cv::Scalar col, int radius=2, int thickness=-1) |
void | writeCorners (FILE *out_fid, const cv::Mat &corners, int frame_id, bool write_header=false) |
const char * | toString (TrackErrT _er_type) |
template<TrackErrT tracking_err_type> | |
double | getTrackingError (const cv::Mat >_corners, const cv::Mat &tracker_corners) |
template<> | |
double | getTrackingError< TrackErrT::MCD > (const cv::Mat >_corners, const cv::Mat &tracker_corners) |
template<> | |
double | getTrackingError< TrackErrT::CL > (const cv::Mat >_corners, const cv::Mat &tracker_corners) |
template<> | |
double | getTrackingError< TrackErrT::Jaccard > (const cv::Mat >_corners, const cv::Mat &tracker_corners) |
double | getJaccardError (const cv::Mat >_corners, const cv::Mat &tracker_corners, int img_width, int img_height) |
double | getTrackingError (TrackErrT tracking_err_type, const cv::Mat >_corners, const cv::Mat &tracker_corners, FILE *out_fid=nullptr, int frame_id=0, int img_width=0, int img_height=0) |
cv::Mat | readTrackerLocation (const std::string &file_path) |
cv::Mat | getFrameCorners (const cv::Mat &img, int borner_size=1) |
mtf::PtsT | getFramePts (const cv::Mat &img, int borner_size=1) |
cv::Point2d | getCentroid (const cv::Mat &corners) |
template<typename ScalarT > | |
void | getCentroid (cv::Point_< ScalarT > ¢roid, const cv::Mat &corners) |
void | getCentroid (Vector2d ¢roid, const cv::Mat &corners) |
template<typename T > | |
std::string | to_string (T val) |
std::vector< int > | rearrangeIntoRegion (const cv::Mat ®ion_corners) |
get the indices that will rearrange the given points so that they become consecutive points along the border of a connected region | |
template<typename ElementT > | |
void | rearrange (std::vector< ElementT > &vec, const std::vector< int > &indices) |
rearrange elements in vector according to the given indices | |
template<typename ElementT > | |
void | rearrangeCols (cv::Mat &mat, const std::vector< int > &indices) |
rearrange columns of the matrix according to the given indices | |
template<typename ElementT > | |
void | rearrangeRows (cv::Mat &mat, const std::vector< int > &indices) |
rearrange rows of the matrix according to the given indices | |
cv::Mat | concatenate (const cv::Mat img_list[], int n_images, int axis) |
cv::Mat | stackImages (const std::vector< cv::Mat > &img_list, int stack_order=0) |
stack_order :: 0: row major 1 : column major | |
std::string | getDateTime () |
MTFNet * | createNetwork (RegNetParams rgparams, char *conv_model=nullptr, char *last_conv_layer=nullptr, int n_layers=2, int *n_neurons=nullptr, char *activ_fn=nullptr) |
Creates Network with first conv layers from conv_model till name of last_conv_layer. More... | |
float * | forwardPass (MTFNet *network, cv::Mat patch) |
Forward Pass the patch into the network after being resized to image_size. | |
void | train (MTFNet *network, std::vector< cv::Mat > training_data, std::vector< cv::Mat > training_labels) |
Train the network with training_data and labels as input. | |
void | testingInputBlobs (boost::shared_ptr< caffe::Net< float > > net_) |
Tests the Input Blobs and shows images and Label. | |
void | getClickedPoint (int mouse_event, int x, int y, int flags, void *param) |
double | getMean (const bool *spi_mask, const VectorXd &vec, int vec_size) |
void | getMean (RowVectorXd &mean_vec, const bool *spi_mask, const MatrixXd &mat, int n_rows) |
columnwise mean | |
void | getMean (VectorXd &mean_vec, const bool *spi_mask, const MatrixXd &mat, int n_cols) |
rowwise mean | |
void | getProd (RowVectorXd &df_dp, const bool *spi_mask, const RowVectorXd &df_dI, const MatrixXd &dI_dp, int n_pix, int n_channels) |
void | getDiffOfProd (RowVectorXd &df_dp, const bool *spi_mask, const RowVectorXd &df_dIt, const MatrixXd &dIt_dp, const RowVectorXd &df_dI0, const MatrixXd &dI0_dp, int n_pix, int n_channels) |
void | expandMask (bool *out_mask, const bool *in_mask, int res_ratio_x, int res_ratio_y, int in_resx, int in_resy, int out_resx, int out_resy) |
template<typename T1 , typename T2 > | |
void | homogenize (const T1 &dehom_mat, T2 &hom_mat) |
template<typename T1 , typename T2 > | |
void | dehomogenize (const T1 &hom_mat, T2 &dehom_mat) |
HomPtsT | homogenize (const PtsT &dehom_mat) |
PtsT | dehomogenize (const HomPtsT &hom_mat) |
ProjWarpT | getTranslationMatrix (double tx, double ty) |
ProjWarpT | getRotationMatrix (double theta) |
ProjWarpT | getScalingMatrix (double s) |
ProjWarpT | getShearingMatrix (double a, double b) |
ProjWarpT | computeHomographyDLT (const PtsT &in_pts, const PtsT &out_pts, int n_pix) |
Variants of Direct Linear Transformation (DLT) algorithm to estimate best fit parameters for different SSMs from pairs of corresponding points and/or corners. | |
ProjWarpT | computeHomographyDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeHomographyNDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeAffineDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeAffineDLT (const PtsT &in_pts, const PtsT &out_pts) |
ProjWarpT | computeAffineDLT (const Matrix23d &in_pts, const Matrix23d &out_pts) |
ProjWarpT | computeAffineNDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeASRTDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeASRTDLT (const PtsT &in_pts, const PtsT &out_pts) |
ProjWarpT | computeSimilitudeDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeSimilitudeNDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeSimilitudeDLT (const PtsT &in_pts, const PtsT &out_pts) |
ProjWarpT | computeSimilitudeNDLT (const PtsT &in_pts, const PtsT &out_pts) |
ProjWarpT | computeASTDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeASTDLT (const PtsT &in_corners, const PtsT &out_corners) |
Vector3d | computeIsometryDLT (const PtsT &in_pts, const PtsT &out_pts) |
Vector3d | computeIsometryDLT (const CornersT &in_pts, const CornersT &out_pts) |
ProjWarpT | computeISTDLT (const CornersT &in_corners, const CornersT &out_corners) |
ProjWarpT | computeISTDLT (const PtsT &in_corners, const PtsT &out_corners) |
void | decomposeHomographyForward (ProjWarpT &affine_mat, ProjWarpT &proj_mat, const ProjWarpT &hom_mat) |
void | decomposeHomographyInverse (ProjWarpT &affine_mat, ProjWarpT &proj_mat, const ProjWarpT &hom_mat) |
void | decomposeAffineForward (Vector6d &affine_params, const ProjWarpT &affine_mat) |
void | decomposeAffineInverse (Vector6d &affine_params, const ProjWarpT &affine_mat) |
void | decomposeAffineInverse (ProjWarpT &trans_mat, ProjWarpT &rot_mat, ProjWarpT &scale_mat, ProjWarpT &shear_mat, const ProjWarpT &affine_mat) |
void | decomposeAffineForward (ProjWarpT &trans_mat, ProjWarpT &rot_mat, ProjWarpT &scale_mat, ProjWarpT &shear_mat, const ProjWarpT &affine_mat) |
void | normalizePts (CornersT &norm_pts, ProjWarpT &inv_norm_mat, const CornersT &pts) |
normalizes the given points so that their mean (centroid) moves to origin and their mean distance from origin becomes unity; also returns the inverse normalization matrix which, when multiplied to the normalized points will give the original points back | |
void | normalizePts (PtsT &norm_pts, ProjWarpT &inv_norm_mat, const PtsT &pts) |
void | getNormUnitSquarePts (PtsT &std_grid, CornersT &basis_corners, int resx, int resy, double min_x=-0.5, double min_y=-0.5, double max_x=0.5, double max_y=0.5) |
computes the 2D coordinates for an equally spaced grid of points that covers a square centered at the origin and lying between +c and -c in both x and y directions | |
void | getPtsFromCorners (PtsT &pts, const CornersT &corners, int resx, int resy) |
PtsT | getPtsFromCorners (const CornersT &corners, int resx, int resy) |
returning variant | |
PtsT | getPtsFromCorners (const cv::Mat &corners_cv, int resx, int resy) |
overload for OpenCV corners | |
void | getPtsFromCorners (PtsT &pts, const CornersT &corners, const PtsT basis_pts, const CornersT &basis_corners) |
void | getBoundingPts (cv::Mat &bounding_pts, const PtsT &grid_pts, int res_x, int res_y) |
extract points along the boundary of the given region represented by a grid of points with the given sampling resolution and arranged in row major order | |
bool | isInsideRegion (const cv::Mat &verices, double testx, double testy) |
tests if the given point is inside the given region - specified by the vertices of the corresponding polygon; undefined for points on the edges | |
void | getBilinearPts (cv::Vec4i &neigh_pts_id, std::vector< cv::Vec2d > &neigh_pts_dist, double x, double y, const mtf::PtsT &grid_pts, int n_pts) |
returns the four nearest grid points around the given point that can be used for bilinear interpolation | |
int | getNearestPt (double x, double y, const mtf::PtsT &grid_pts, int n_pts) |
returns the id of the grid point nearest to the given point | |
MatrixX2d | computeTPS (const CornersT &in_corners, const CornersT &out_corners) |
void | applyTPS (PtsT &out_pts, const PtsT &in_pts, const PtsT &control_pts, const MatrixX2d &tps_params) |
double | tps (double r) |
Variables | |
const vector< int > | supported_output_types = { CV_32FC3, CV_32FC1, CV_8UC3, CV_8UC1 } |
basic functions for preprocessing the raw input image using filtering, resizing and histogram equalization before using it for tracking
|
inline |
Copy the (image) data from Matlab-algorithm compatible (column-major) representation to cv::Mat.
The information about the image are taken from the OpenCV cv::Mat structure. adapted from OpenCV-Matlab package available at: https://se.mathworks.com/matlabcentral/fileexchange/41530-opencv-matlab
MTFNet* utils::createNetwork | ( | RegNetParams | rgparams, |
char * | conv_model = nullptr , |
||
char * | last_conv_layer = nullptr , |
||
int | n_layers = 2 , |
||
int * | n_neurons = nullptr , |
||
char * | activ_fn = nullptr |
||
) |
Creates Network with first conv layers from conv_model till name of last_conv_layer.
void utils::getBSplHist | ( | VectorXd & | hist, |
MatrixXd & | hist_mat, | ||
MatrixX2i & | bspl_ids, | ||
const VectorXd & | pix_vals, | ||
const MatrixX2i & | std_bspl_ids, | ||
double | pre_seed, | ||
int | n_pix | ||
) |
computes the histogram for the given image specified as a vector of pixel values.
Since the pixel values are allowed to be real numbers, each pixel contributes to multiple bins in the histogram according to a B Spline function of order 3 that approximates a Gaussian distribution clipped to be non zero between +2 and -2 see also: bSpl3 also stores the floors (or integral parts) of all pixel values in a separate array since these may be needed again for computing the joint histogram of this image with another.
void utils::getBSplHistGrad | ( | MatrixXd & | hist_grad, |
const VectorXd & | pix_vals, | ||
const MatrixX2i & | bspl_ids, | ||
int | n_pix | ||
) |
computes a matrix with 'n_bins' rows and 'n_pix' columns that contains the gradient of each bin of the B Spline histogram w.r.t.
each pixel value in the image here 'n_bins' is specified implicitly by the contents of pix_vals and pix_vals_int assumes that the integral parts of all pixel values have been precomputed and provided along with the original floating point values in a separate vector --—output params--— //!
hist_grad | preallocated matrix of size [n_bins X n_pix] that will hold the gradient of the histogram |
pix_vals_int | preallocated vector of size 'n_pix' that will hold the integral parts of the entries in 'pix_vals' --—input params--— //! |
pix_vals | vector of size 'n_pix' that contains the image's pixel values |
bspl_ids | n_bins X n_bins matrix of integers such that that its row 'i' contains the indices of all bins that a pixel whose integral part is 'i' contributes to; this matrix along with 'bspl_id_count' is used to reduce the runtime cost by pre-computing and storing these indices since they do not change |
bspl_id_count | vector of size 'n_bins' that contains the number of bins that each integral pixel value contributes to; this is related to 'bspl_ids' since only the first bspl_id_count(i) elements of row i of bspl_ids contains valid indices |
void utils::getBSplJointHistGrad | ( | MatrixXd & | joint_hist_grad, |
MatrixXd & | hist1_grad, | ||
const VectorXd & | pix_vals1, | ||
const MatrixXd & | hist2_mat, | ||
const MatrixX2i & | bspl_ids1, | ||
const MatrixX2i & | bspl_ids2, | ||
const MatrixXi & | linear_idx, | ||
int | n_pix | ||
) |
computes a matrix with (n_bins*n_bins) rows and n_pix columns that contains the gradient of each entry of the B Spline joint histogram w.r.t.
each pixel value in the first image; assuming the second image to be constant; simulataneusly computes the gradient of the histogram of the first image since the latter is required to compute the former. it is formed by flattening the first two dimensions of the n_bins x n_bins x n_pix 3D tensor; --—output params--— //!
joint_hist_grad | preallocated matrix of size [(n_bins*n_bins) X n_pix] that is filled by this function; this represents a 3D tenor of size [n_bins X n_bins X n_pix] whose first two dimensions have been flattened into a vector. |
hist1_grad | preallocated n_bins X n_pix matrix that is filled by this function --—input params--— //! |
pix_vals1 | column vector of size 'n_pix' that contains the first image's pixel values |
pix_vals2_int | column vector of size 'n_pix' that contains the integral parts of the second image's pixel values |
hist2_mat | n_bins X n_pix matrix that contains the contribution of each pixel of image 2 to its histogram such that the sum of each row of this matrix gives the value of the corresponding bin in its histogram |
bspl_ids | n_bins X n_bins matrix of integers such that that its row 'i' contains the indices of all bins that a pixel whose integral part is 'i' contributes to; this matrix along with 'bspl_id_count' is used to reduce the runtime cost by pre-computing and storing these indices since they do not change |
bspl_id_count | vector of size 'n_bins' that contains the number of bins that each integral pixel value contributes to; this is related to 'bspl_ids' since only the first bspl_id_count(i) elements of row i of bspl_ids contains valid indices |
linear_idx | n_bins X n_bins matrix of integers such that linear_idx(i, j) contains the index that the element at row i and column j of a matrix of dimension n_bins X n_bins goes to when this matrix is flattened into a vector; this is used for determining the row indices of joint_hist_grad where each element goes; |
void utils::getBSplJointHistWithGrad | ( | MatrixXd & | joint_hist, |
VectorXd & | hist1, | ||
MatrixXd & | hist1_mat, | ||
MatrixXd & | hist1_grad, | ||
MatrixXd & | joint_hist_grad, | ||
MatrixX2i & | bspl_ids1, | ||
const VectorXd & | pix_vals1, | ||
const MatrixX2i & | bspl_ids2, | ||
const MatrixXd & | hist2_mat, | ||
const MatrixX2i & | std_bspl_ids, | ||
const MatrixXi & | linear_idx, | ||
double | hist_pre_seed, | ||
double | joint_hist_pre_seed, | ||
int | n_pix, | ||
double | hist_norm_mult = 1 |
||
) |
computes both the histogram and gradient of the first image as well as the joint histogram and its gradient w.r.t.
the first image assuming that the histogram of the second image has already been computed
void utils::getDiracHist | ( | VectorXd & | hist, |
VectorXi & | pix_vals_int, | ||
const VectorXd & | pix_vals, | ||
double | hist_pre_seed, | ||
int | n_pix | ||
) |
computes histogram using the Dirac delta function to determine the bins to which each pixel contributes, i.e.
each pixel has a unit contribution to the bin corresponding to the floor (or nearest integer) of its value; this method of computing histograms is fast but not differentiable
void utils::getMIVecGrad | ( | MatrixXd & | mi_vec_grad, |
const MatrixXd & | joint_hist_grad, | ||
const VectorXd & | log_hist_ratio, | ||
const MatrixXd & | hist1_grad_ratio, | ||
const MatrixXd & | joint_hist, | ||
const MatrixX2i & | bspl_ids, | ||
const MatrixXi & | linear_idx, | ||
int | n_bins, | ||
int | n_pix | ||
) |
computes the gradient of each entry of the MI vector w.r.t.
each pixel value in the first image; assuming the second image to be constant; simulataneusly computes the gradient of the histogram of the first image since the latter is required to compute the former. it is formed by flattening the first two dimensions of the n_bins x n_bins x n_pix 3D tensor; --—output params--— //!
mi_vec_grad | preallocated matrix of size [(n_bins*n_bins) X n_pix] that will hold the gradient computed by this function this represents a 3D tenor of size [n_bins X n_bins X n_pix] whose first two dimensions have been flattened into a vector. --—input params--— //! |
joint_hist_grad | column vector of size 'n_pix' that contains the first image's pixel values |
log_hist_ratio | column vector of size 'n_pix' that contains the integral parts of the second image's pixel values |
hist1_grad_ratio | n_bins X n_pix matrix that contains the contribution of each pixel of image 2 to its histogram such that the sum of each row of this matrix gives the value of the corresponding bin in its histogram |
joint_hist | n_bins X n_bins matrix of integers such that that its row 'i' contains the indices of all bins that a pixel whose integral part is 'i' contributes to; this matrix along with 'bspl_id_count' is used to reduce the runtime cost by pre-computing and storing these indices since they do not change |
bspl_id_count | vector of size 'n_bins' that contains the number of bins that each integral pixel value contributes to; this is related to 'bspl_ids' since only the first bspl_id_count(i) elements of row i of bspl_ids contains valid indices |
linear_idx | n_bins X n_bins matrix of integers such that linear_idx(i, j) contains the index that the element at row i and column j of a matrix of dimension n_bins X n_bins goes to when this matrix is flattened into a vector; this is used for determining the row indices of joint_hist_grad where each element goes; |