Commit 26915254 authored by T.J. Corona's avatar T.J. Corona

Use VXLs RGTL instead of providing our own.

parent 8fd88449
......@@ -18,7 +18,6 @@ target_include_directories(${vtk-module}
$<BUILD_INTERFACE:${SMTK_SOURCE_DIR}>
$<BUILD_INTERFACE:${SMTK_BINARY_DIR}>
$<INSTALL_INTERFACE:include/smtk/${SMTK_VERSION}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../../thirdparty/rtvl/
${VXL_RPL_INCLUDE_DIR}
${VXL_VCL_INCLUDE_DIR}
......
......@@ -34,8 +34,8 @@
// refine
#include <rgtl/rgtl_serialize_ostream.hxx>
#include <thirdparty/rtvl/rtvl_refine.hxx>
#include <thirdparty/rtvl/rtvl_tokens.hxx>
#include <rtvl/rtvl_refine.hxx>
#include <rtvl/rtvl_tokens.hxx>
#include <vcl_fstream.h>
#include <vcl_memory.h>
......@@ -43,13 +43,13 @@
// extract
#include <rgtl/rgtl_serialize_istream.hxx>
#include <thirdparty/rtvl/rtvl_tensor.hxx>
#include <thirdparty/rtvl/rtvl_tensor_d.hxx>
#include <thirdparty/rtvl/rtvl_vote.hxx>
#include <thirdparty/rtvl/rtvl_votee.hxx>
#include <thirdparty/rtvl/rtvl_votee_d.hxx>
#include <thirdparty/rtvl/rtvl_voter.hxx>
#include <thirdparty/rtvl/rtvl_weight_smooth.hxx>
#include <rtvl/rtvl_tensor.hxx>
#include <rtvl/rtvl_tensor_d.hxx>
#include <rtvl/rtvl_vote.hxx>
#include <rtvl/rtvl_votee.hxx>
#include <rtvl/rtvl_votee_d.hxx>
#include <rtvl/rtvl_voter.hxx>
#include <rtvl/rtvl_weight_smooth.hxx>
#include <rgtl/rgtl_object_array_points.hxx>
#include <rgtl/rgtl_octree_cell_bounds.hxx>
......
......@@ -47,18 +47,3 @@ if (SMTK_IGNORE_DELAUNAY_WARNINGS)
PROPERTY COMPILE_FLAGS ${ignore_rules_for_delaunay})
endforeach()
endif()
if (SMTK_ENABLE_VXL_SUPPORT)
# We need VXL for rgtl, vnl_algo, vnl, and vcl.
find_package(VXL REQUIRED)
if(NOT VXL_RPL_FOUND)
message(FATAL_ERROR "vxl must be built with BUILD_RPL enabled")
endif(NOT VXL_RPL_FOUND)
if(NOT VXL_RPL_RGTL_FOUND)
message(FATAL_ERROR "vxl must be built with BUILD_RPL_RGTL enabled")
endif(NOT VXL_RPL_RGTL_FOUND)
include(${VXL_CMAKE_DIR}/UseVXL.cmake)
# Build the Tensor Voting library.
add_subdirectory(rtvl)
endif()
# Copyright 2007-2009 Brad King, Chuck Stewart
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file rtvl_license_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(rtvl_headers
rtvl_intpow.hxx
rtvl_terms.hxx
rtvl_tokens.hxx
rtvl_vote.hxx rtvl_vote.txx
rtvl_votee.hxx rtvl_votee.txx
rtvl_votee_d.hxx rtvl_votee_d.txx
rtvl_voter.hxx rtvl_voter.txx
rtvl_refine.hxx rtvl_refine.txx
rtvl_tensor.hxx rtvl_tensor.txx
rtvl_tensor_d.hxx rtvl_tensor_d.txx
rtvl_weight.hxx
rtvl_weight_original.hxx rtvl_weight_original.txx
rtvl_weight_smooth.hxx rtvl_weight_smooth.txx
)
add_library(rtvl STATIC
${rtvl_headers}
Templates/rtvl_vote+2-.cxx
Templates/rtvl_votee+2-.cxx
Templates/rtvl_votee_d+2-.cxx
Templates/rtvl_voter+2-.cxx
Templates/rtvl_refine+2-.cxx
Templates/rtvl_tensor+2-.cxx
Templates/rtvl_tensor_d+2-.cxx
Templates/rtvl_weight_original+2-.cxx
Templates/rtvl_weight_smooth+2-.cxx
Templates/rtvl_vote+3-.cxx
Templates/rtvl_votee+3-.cxx
Templates/rtvl_votee_d+3-.cxx
Templates/rtvl_voter+3-.cxx
Templates/rtvl_refine+3-.cxx
Templates/rtvl_tensor+3-.cxx
Templates/rtvl_tensor_d+3-.cxx
Templates/rtvl_weight_original+3-.cxx
Templates/rtvl_weight_smooth+3-.cxx
)
#We need to enable position independence on static libraries so we can
#link them to shared libraries.
set_target_properties( rtvl PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
set(ignore_rules_for_rtvl "")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
CMAKE_CXX_COMPILER_ID MATCHES "Intel")
target_compile_options(rtvl
PRIVATE
# Silence warning about std::auto_ptr being deprecated.
-Wno-deprecated-declarations
# Silence warning about unused parameters.
-Wno-unused-parameter)
endif()
target_include_directories(rtvl
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:include>
${VXL_RPL_INCLUDE_DIR}
${VXL_VCL_INCLUDE_DIR}
${VXL_CORE_INCLUDE_DIR})
target_link_libraries(rtvl
LINK_PUBLIC
${RGTL_LIBRARY} ${VNL_ALGO_LIBRARY} ${VNL_LIBRARY} ${V3P_NETLIB_LIBRARY})
install(TARGETS rtvl
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
install(FILES ${rtvl_headers}
DESTINATION include/rtvl)
This directory requires one to build vxl from its Subversion repository:
http://vxl.sourceforge.net/
Download instructions:
http://sourceforge.net/scm/?type=svn&group_id=24293
svn co https://vxl.svn.sourceforge.net/svnroot/vxl/trunk vxl
One uses CMake to build and install the vxl package. The following
CMake cache options should be set ON when configuring vxl:
BUILD_CONTRIB
BUILD_CORE_GEOMETRY
BUILD_CORE_IMAGING
BUILD_CORE_NUMERICS
BUILD_CORE_SERIALISATION
BUILD_CORE_UTILITIES
BUILD_MUL
BUILD_OXL
BUILD_RPL
BUILD_RPL_RGTL
Other options may be set OFF:
BUILD_BRL
BUILD_CONTRIB_VIDL2
BUILD_CONVERSIONS
BUILD_EXAMPLES
BUILD_FOR_VXL_DASHBOARD
BUILD_GEL
BUILD_MUL_TOOLS
BUILD_OUL
BUILD_PRIP
BUILD_SHARED_LIBS
BUILD_TARGETJR
BUILD_TBL
BUILD_TESTING
BUILD_UNMAINTAINED_LIBRARIES
BUILD_VGUI
After building vxl one may optionally install it, but one may also use
vxl directly from its build tree. When configuring this project,
set VXL_DIR either to point at the vxl build tree or at the
<prefix>/share/vxl/cmake
directory of the vxl install tree.
------------------------------------------------------------------------------
This directory contains Brad King's research code for analysis of
LiDaR points and extraction of a terrain surface hypothesis.
Currently the interface is very primitive. There are two executables
which must be run in succession:
cmbTokenRefine input.vtp outname
cmbTerrainExtract input.vtp name max min
The "cmbTokenRefine" tool reads input points from a Visualization
Toolkit Polygonal data file (.vtp) and generates a set of files whose
name start with <outname>. These files contain a serialized
representation of the Tensor Voting tokens suitable for use at each
voting scale selected by the tool. They are numbered by "scale index"
and serve as input to the second tool.
The "cmbTerrainExtract" tool loads the representation serialized by
the first tool for a range of scale indices given by the <max> and
<min> arguments. The given <name> must match the <outname> given to
the first tool. This tool generates a terrain surface hypothesis in a
coarse-to-fine manner. It generates a series of .vtp files with
increasingly detailed terrain.
Example Usage:
$ mkdir TestTrackGroupA && cd TestTrackGroupA
$ /pathto/cmbTokenRefine /pathto/TestTrackGroupA.vtp TestTrackGroupA
$ /pathto/cmbTerrainExtract /pathto/TestTrackGroupA.vtp TestTrackGroupA 17 8
The code has not been tested with input data sizes more than 1e6 points.
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_refine.txx>
RTVL_REFINE_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_refine.txx>
RTVL_REFINE_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_tensor.txx>
RTVL_TENSOR_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_tensor.txx>
RTVL_TENSOR_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_tensor_d.txx>
RTVL_TENSOR_D_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_tensor_d.txx>
RTVL_TENSOR_D_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_vote.txx>
RTVL_VOTE_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_vote.txx>
RTVL_VOTE_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_votee.txx>
RTVL_VOTEE_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_votee.txx>
RTVL_VOTEE_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_votee_d.txx>
RTVL_VOTEE_D_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_votee_d.txx>
RTVL_VOTEE_D_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_voter.txx>
RTVL_VOTER_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_voter.txx>
RTVL_VOTER_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_weight_original.txx>
RTVL_WEIGHT_ORIGINAL_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_weight_original.txx>
RTVL_WEIGHT_ORIGINAL_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_weight_smooth.txx>
RTVL_WEIGHT_SMOOTH_INSTANTIATE(2);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#include <rtvl/rtvl_weight_smooth.txx>
RTVL_WEIGHT_SMOOTH_INSTANTIATE(3);
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#ifndef rtvl_intpow_hxx
#define rtvl_intpow_hxx
#if defined(_MSC_VER) && _MSC_VER <= 1300
#define RTVL_INTPOW_HELP , rtvl_intpow_impl<T, n>* = 0
#else
#define RTVL_INTPOW_HELP
#endif
template <bool>
struct rtvl_bool
{
};
template <typename T, unsigned int n>
struct rtvl_intpow_impl;
template <unsigned int n, typename T>
inline T rtvl_intpow(T x RTVL_INTPOW_HELP)
{
return rtvl_intpow_impl<T, n>::compute(x);
}
template <typename T, unsigned int n>
struct rtvl_intpow_impl
{
typedef rtvl_bool<true> const& true_;
typedef rtvl_bool<false> const& false_;
typedef rtvl_intpow_impl<T, n> self_type;
static inline T f(T x, true_, true_) { return self_type::compute(x * x) * x; }
static inline T f(T x, true_, false_) { return self_type::compute(x * x); }
static inline T f(T x, false_, true_) { return x; }
static inline T f(T, false_, false_) { return 1; }
static inline T compute(T x)
{
return (rtvl_intpow_impl<T, (n >> 1)>::f(x, rtvl_bool<!!(n >> 1)>(), rtvl_bool<!!(n & 1)>()));
}
};
#endif
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#ifndef rtvl_refine_hxx
#define rtvl_refine_hxx
template <unsigned int N>
class rtvl_refine_internal;
template <unsigned int N>
class rtvl_tokens;
template <unsigned int N>
class rtvl_refine
{
public:
rtvl_refine(unsigned int num_points, double* points, double* bounds);
~rtvl_refine();
/** Set the fraction of the scale to use as the masking sphere size
during downsampling. */
void set_mask_size(double f);
/** Compute the initial scale, which, if called (may instead "set") must done
only "immediately" after construction. */
double compute_scale() const;
/** Set the initial scale to a user specified value. Only do before starting
the refine process. Must be > 0. */
void set_scale(double scale);
/** Build the quad tree. Don't expect this to be the final resting place for
this call, since it is currently required! */
void build_tree();
/** Compute the # of chunks based on the memory limit (in KB) and a minimum
of chunks */
int initialize_refine_level(unsigned int memory_limit, int requested_min_depth) const;
int refine_next_block(const char* base_filename);
/** Get refined tokens for the current scale. */
void get_tokens(int level, double* bounds, rtvl_tokens<N>& tokens) const;
/** Get scale of the specified level */
double get_level_scale(int level);
/** Get number of votes cast during token refinement. */
unsigned int get_vote_count() const;
/** Move to the next-larger scale. */
bool next_scale();
unsigned int estimate_refine_levels();
private:
friend class rtvl_refine_internal<N>;
typedef rtvl_refine_internal<N> internal_type;
internal_type* internal_;
};
#endif
This diff is collapsed.
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#ifndef rtvl_tensor_hxx
#define rtvl_tensor_hxx
template <class T, unsigned int n>
class vnl_vector_fixed;
template <class T, unsigned int nr, unsigned int nc>
class vnl_matrix_fixed;
#include <vnl/vnl_vector_fixed.h>
#include <rgtl/rgtl_serialize_access.hxx>
#include <rgtl/rgtl_serialize_vnl_vector_fixed.hxx>
template <unsigned int N>
class rtvl_tensor
{
public:
/** Construct with a unit ball tensor. */
rtvl_tensor();
/** Construct with a given tensor. */
explicit rtvl_tensor(vnl_matrix_fixed<double, N, N> const& tensor);
/** Store a given tensor. */
void set_tensor(vnl_matrix_fixed<double, N, N> const& tensor);
/** Store a canonical ball tensor. */
void set_ball_tensor();
/** Scale to make the largest eigenvalue equal to 1. */
void normalize();
/** Scale to make the largest eigenvalue at most the given limit. */
void limit_saliency(double limit = 1);
/** Adjust the tensor towards a ball to move to the next scale. */
void next_scale(double scale_multiplier, double max_saliency);
double lambda(unsigned int d) const { return this->lambda_[d]; }
double saliency(unsigned int d) const { return this->lambda_[d] - this->lambda_[d + 1]; }
typedef vnl_vector_fixed<double, N> basis_type[N];
basis_type const& basis() const { return this->basis_; }
vnl_vector_fixed<double, N> const& basis(unsigned int d) const { return this->basis_[d]; }
private:
basis_type basis_;
double lambda_[N + 1];
private:
friend class rgtl_serialize_access;
template <class Serializer>
void serialize(Serializer& sr)
{
sr& basis_;
sr& lambda_;
}
};
#endif
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#ifndef rtvl_tensor_txx
#define rtvl_tensor_txx
#include "rtvl_tensor.hxx"
#include <vnl/algo/vnl_symmetric_eigensystem.h>
#include <vnl/vnl_matrix_fixed.h>
#include <vnl/vnl_vector_fixed.h>
template <unsigned int N>
rtvl_tensor<N>::rtvl_tensor()
{
this->set_ball_tensor();
}
template <unsigned int N>
rtvl_tensor<N>::rtvl_tensor(vnl_matrix_fixed<double, N, N> const& tensor)
{
this->set_tensor(tensor);
}
template <unsigned int N>
void rtvl_tensor<N>::set_tensor(vnl_matrix_fixed<double, N, N> const& tensor)
{
vnl_symmetric_eigensystem<double> eig(tensor);
for (unsigned int i = 0; i < N; ++i)
{
this->lambda_[i] = eig.get_eigenvalue((N - 1) - i);
this->basis_[i] = eig.get_eigenvector((N - 1) - i);
}
this->lambda_[N] = 0;
}
template <unsigned int N>
void rtvl_tensor<N>::set_ball_tensor()
{
for (unsigned int i = 0; i < N; ++i)
{
this->lambda_[i] = 1;
this->basis_[i].fill(0.0);
this->basis_[i][i] = 1;
}
this->lambda_[N] = 0;
}
template <unsigned int N>
void rtvl_tensor<N>::normalize()
{
if (this->lambda_[0] > 0)
{
for (unsigned int i = 1; i < N; ++i)
{
this->lambda_[i] /= this->lambda_[0];
}
this->lambda_[0] = 1;
}
}
template <unsigned int N>
void rtvl_tensor<N>::limit_saliency(double limit)
{
if (this->lambda_[0] > limit)
{
double factor = limit / this->lambda_[0];
for (unsigned int i = 1; i < N; ++i)
{
this->lambda_[i] *= factor;
}
this->lambda_[0] = limit;
}
}
template <unsigned int N>
void rtvl_tensor<N>::next_scale(double scale_multiplier, double max_saliency)
{
double const z = 1.0 / scale_multiplier;
if (z < 3 && this->lambda_[0] > 0.0)
{
// Downweight old information with increasing scale change.
double const w = z * z * (z - 3) * (z - 3) * (z - 3) * (z - 3) / 16;
// Smoothly scale the old information to limit its saliency.
double f = max_saliency / this->lambda_[0];
if (f > 1)
{
double const t = 1.0 / f;
double const t2 = t * t;
double const h = 3 * t2 - 2 * t * t2;
f = f * h;
}
// Combine the scaled old information with a ball tensor.
double const factor = w * f;
for (unsigned int i = 0; i < N; ++i)
{
this->lambda_[i] = 1 + this->lambda_[i] * factor;
}
}
else
{
// Current information is useless for the next scale, so use a
// canonical ball tensor.
this->set_ball_tensor();
}
}
#define RTVL_TENSOR_INSTANTIATE(N) template class rtvl_tensor<N>
#endif
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#ifndef rtvl_tensor_d_hxx
#define rtvl_tensor_d_hxx
#include "rtvl_tensor.hxx"
template <unsigned int N>
class rtvl_tensor_d : public rtvl_tensor<N>
{
public:
typedef rtvl_tensor<N> derived;
/** Construct with a given tensor and its gradient. */
rtvl_tensor_d(vnl_matrix_fixed<double, N, N> const& tensor,
vnl_matrix_fixed<double, N, N> const (&tensor_d)[N]);
void saliency_d(unsigned int d, vnl_vector_fixed<double, N>& dsal) const;
private:
vnl_matrix_fixed<double, N, N> const (&tensor_d_)[N];
};
#endif
/* Copyright 2007-2009 Brad King, Chuck Stewart
Distributed under the Boost Software License, Version 1.0.
(See accompanying file rtvl_license_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) */
#ifndef rtvl_tensor_d_txx
#define rtvl_tensor_d_txx
#include "rtvl_tensor_d.hxx"
#include <vnl/vnl_matrix_fixed.h>
#include <vnl/vnl_vector_fixed.h>
template <unsigned int N>
rtvl_tensor_d<N>::rtvl_tensor_d(
vnl_matrix_fixed<double, N, N> const& tensor, vnl_matrix_fixed<double, N, N> const (&tensor_d)[N])
: derived(tensor)
, tensor_d_(tensor_d)
{
}
template <unsigned int N>
void rtvl_tensor_d<N>::saliency_d(unsigned int d, vnl_vector_fixed<double, N>& dsal) const