20 #ifndef KJB_CHAMFER_CPP
21 #define KJB_CHAMFER_CPP
23 #include <boost/shared_ptr.hpp>
24 #include <g/g_chamfer.h>
33 #ifdef KJB_HAVE_BST_SERIAL
34 #include <boost/serialization/access.hpp>
47 #ifdef KJB_HAVE_BST_SERIAL
48 friend class boost::serialization::access;
65 m_num_rows(edges->num_rows()),
66 m_num_cols(edges->num_cols()),
70 kjb_c::Matrix* c_distances = 0;
71 const kjb_c::Edge_point*** c_edge_map = NULL;
81 m_distances =
Matrix(c_distances);
86 m_edge_map = std::vector<std::vector<const kjb_c::Edge_point*> >(m_num_rows);
87 for(
int row = 0; row < m_num_rows; row++)
90 m_edge_map[row] = std::vector<const kjb_c::Edge_point*>(m_num_cols);
92 for(
int col = 0; col < m_num_cols; col++)
94 m_edge_map[row][col] = c_edge_map[row][col];
99 kjb_c::free_2D_ptr_array((
void***) c_edge_map);
131 swap(m_size, other.m_size);
132 swap(m_edges, other.m_edges);
133 swap(m_num_rows, other.m_num_rows);
134 swap(m_num_cols, other.m_num_cols);
135 m_distances.
swap(other.m_distances);
136 m_edge_map.swap(other.m_edge_map);
142 assert(row < m_num_rows);
144 assert(col < m_num_cols);
146 return *m_edge_map[row][col];
152 assert(row < m_num_rows);
154 assert(col < m_num_cols);
156 return m_distances(row, col);
162 const std::vector<std::vector<const kjb_c::Edge_point*> >&
edge_map()
const {
return m_edge_map; }
172 std::vector<Int_matrix> result(2);
184 row_positions = col_positions =
Int_matrix(m_num_rows, m_num_cols);
186 for(
int row = 0; row < m_num_rows; row++)
187 for(
int col = 0; col < m_num_cols; col++)
189 row_positions(row, col) = (*m_edge_map[row][col]).row;
190 col_positions(row, col) = (*m_edge_map[row][col]).col;
196 return m_edges->get_total_edge_points();
210 std::vector<std::vector<const kjb_c::Edge_point*> > m_edge_map;
212 #ifdef KJB_HAVE_BST_SERIAL
213 template <
class Archive>
214 void serialize(Archive& ,
const unsigned int )
Definition for the Int_matrix class, a thin wrapper on the KJB Int_matrix struct and its related func...
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements...
Definition: l_int_matrix.h:71
void swap(Perspective_camera &cam1, Perspective_camera &cam2)
Swap two cameras.
Definition: perspective_camera.h:599
#define KJB_THROW(ex)
Definition: l_exception.h:46
boost::shared_ptr< Edge_set > Edge_set_ptr
Definition: edge.h:613
void load(Edge_set &edges, const std::string &fname)
Definition: edge.h:603
void swap(kjb::Gsl_Multimin_fdf &m1, kjb::Gsl_Multimin_fdf &m2)
Swap two wrapped multimin objects.
Definition: gsl_multimin.h:693
Object thrown when attempting to use unimplemented functionality.
Definition: l_exception.h:281
edges
Definition: APPgetLargeConnectedEdges.m:85
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
void swap(Matrix &other)
Swap the representations of two matrices.
Definition: m_matrix.h:532
boost::shared_ptr< Chamfer_transform > Chamfer_transform_ptr
Definition: edge_chamfer.h:228