9 namespace depth_to_rgb_calibration {
13 std::vector<double>
const & d_vals,
16 std::function<
void(
size_t i,
double d_val,
double weight,
double vertex_cost ) > fn
20 std::vector< double > cost_per_vertex(d_vals.size());
22 for (
size_t i = 0; i < z_data.
weights.size(); i++)
24 double d_val = d_vals[
i];
27 if (d_val != std::numeric_limits<double>::max())
28 cost = d_val * weight;
30 cost_per_vertex[
i] = cost;
31 fn(i, d_val, weight, cost);
34 return cost_per_vertex;
43 [&](
size_t i,
double d_val,
double weight,
double vertex_cost) {});
49 [&](
size_t i,
double d_val,
double weight,
double vertex_cost) {});
53 for (
auto i = 0; i < cost_per_vertex_new.size(); i++)
55 if (cost_per_vertex_old[i] != std::numeric_limits<double>::max() &&
56 cost_per_vertex_new[
i] != std::numeric_limits<double>::max())
58 diff += cost_per_vertex_old[
i] - cost_per_vertex_new[
i];
71 [&](
size_t i,
double d_val,
double weight,
double vertex_cost)
78 const std::vector< double2 > & uv,
79 std::vector< double > * p_interpolated_edges
88 [&](
size_t i,
double d_val,
double weight,
double vertex_cost )
90 if( d_val != std::numeric_limits<double>::max() )
96 if( p_interpolated_edges )
97 *p_interpolated_edges = d_vals;
98 return N ? cost / N : 0.;
std::vector< double2 > uvmap_t
std::vector< double > calc_cost_per_vertex(std::vector< double > const &d_vals, z_frame_data const &z_data, yuy2_frame_data const &yuy_data, std::function< void(size_t i, double d_val, double weight, double vertex_cost) > fn)
GLuint GLuint GLfloat weight
std::vector< double > biliniar_interp(std::vector< double > const &vals, size_t width, size_t height, uvmap_t const &uv)
double calc_cost_per_vertex_diff(z_frame_data const &z_data, yuy2_frame_data const &yuy_data, const uvmap_t &uvmap_old, const uvmap_t &uvmap_new)
double calc_cost(const z_frame_data &z_data, const yuy2_frame_data &yuy_data, const std::vector< double2 > &uv, std::vector< double > *p_interpolated_edges)
std::vector< double > edges_IDT
std::vector< double > weights