00001
00002 #ifndef imesh_project_h_
00003 #define imesh_project_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <imesh/imesh_mesh.h>
00016 #include <vpgl/vpgl_proj_camera.h>
00017 #include <vpgl/vpgl_perspective_camera.h>
00018 #include <bpgl/bpgl_lens_distortion.h>
00019 #include <vil/vil_image_view.h>
00020 #include <vgl/vgl_box_2d.h>
00021
00022
00023 void imesh_project_verts(const vcl_vector<vgl_point_3d<double> >& verts3d,
00024 const vpgl_proj_camera<double>& camera,
00025 vcl_vector<vgl_point_2d<double> >& verts2d);
00026
00027
00028 void imesh_project_verts(const imesh_vertex_array<3>& verts3d,
00029 const vpgl_proj_camera<double>& camera,
00030 vcl_vector<vgl_point_2d<double> >& verts2d);
00031
00032
00033 void imesh_project_verts(const vcl_vector<vgl_point_3d<double> >& verts3d,
00034 const vpgl_proj_camera<double>& camera,
00035 vcl_vector<vgl_point_2d<double> >& verts2d,
00036 vcl_vector<double>& depths);
00037
00038
00039 void imesh_project_verts(const imesh_vertex_array<3>& verts3d,
00040 const vpgl_proj_camera<double>& camera,
00041 vcl_vector<vgl_point_2d<double> >& verts2d,
00042 vcl_vector<double>& depths);
00043
00044
00045 void imesh_distort_verts(const vcl_vector<vgl_point_2d<double> >& in_verts,
00046 const bpgl_lens_distortion<double>& lens,
00047 vcl_vector<vgl_point_2d<double> >& out_verts);
00048
00049
00050
00051 void imesh_project(const imesh_mesh& mesh,
00052 const vpgl_proj_camera<double>& camera,
00053 const bpgl_lens_distortion<double>& lens,
00054 vil_image_view<bool>& image);
00055
00056
00057
00058
00059
00060 void imesh_project(const imesh_mesh& mesh,
00061 const vcl_vector<vgl_vector_3d<double> >& normals,
00062 const vpgl_proj_camera<double>& camera,
00063 const bpgl_lens_distortion<double>& lens,
00064 vil_image_view<bool>& image,
00065 vgl_box_2d<unsigned int>* bbox = 0);
00066
00067
00068
00069 void imesh_project(const imesh_mesh& mesh,
00070 const vpgl_proj_camera<double>& camera,
00071 vil_image_view<bool>& image);
00072
00073
00074
00075 void imesh_project_depth(const imesh_mesh& mesh,
00076 const vpgl_proj_camera<double>& camera,
00077 vil_image_view<double>& image);
00078
00079
00080 void imesh_render_triangle_interp(const vgl_point_2d<double>& v1,
00081 const vgl_point_2d<double>& v2,
00082 const vgl_point_2d<double>& v3,
00083 const double& i1, const double& i2, const double& i3,
00084 vil_image_view<double>& image);
00085
00086
00087
00088 void imesh_render_triangles_interp(const imesh_regular_face_array<3>& tris,
00089 const vcl_vector<vgl_point_2d<double> >& img_verts,
00090 const vcl_vector<double>& vals,
00091 vil_image_view<double>& image);
00092
00093
00094 void imesh_render_faces_interp(const imesh_mesh& mesh,
00095 const vcl_vector<vgl_point_2d<double> >& img_verts,
00096 const vcl_vector<double>& vals,
00097 vil_image_view<double>& image);
00098
00099
00100
00101
00102 void imesh_projection_bounds(const vcl_vector<vgl_point_2d<double> >& img_pts,
00103 vgl_box_2d<unsigned int>& bbox);
00104
00105
00106
00107 int imesh_project_onto_mesh(const imesh_mesh& mesh,
00108 const vcl_vector<vgl_vector_3d<double> >& normals,
00109 const vcl_vector<vgl_point_2d<double> >& verts2d,
00110 const vpgl_perspective_camera<double>& camera,
00111 const vgl_point_2d<double>& pt_2d,
00112 vgl_point_3d<double>& pt_3d);
00113
00114
00115
00116 int imesh_project_texture_to_barycentric(const imesh_mesh& mesh,
00117 const vgl_point_2d<double>& pt_2d,
00118 vgl_point_2d<double>& pt_uv);
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 bool imesh_project_texture_to_barycentric(const imesh_mesh& mesh,
00133 const vcl_vector<vgl_point_2d<double> >& pts_2d,
00134 vcl_vector<vgl_point_2d<double> >& pts_uv,
00135 vcl_vector<unsigned long>& idxs,
00136 vcl_vector<int>& map_back);
00137
00138
00139
00140 vnl_matrix_fixed<double,3,3>
00141 imesh_project_texture_to_3d_map(const imesh_mesh& mesh, unsigned int tidx);
00142
00143
00144 vnl_matrix_fixed<double,3,3>
00145 imesh_affine_map(const vgl_point_2d<double>& a1,
00146 const vgl_point_2d<double>& b1,
00147 const vgl_point_2d<double>& c1,
00148 const vgl_point_2d<double>& a2,
00149 const vgl_point_2d<double>& b2,
00150 const vgl_point_2d<double>& c2);
00151
00152
00153
00154 vgl_point_2d<double>
00155 imesh_project_barycentric_to_texture(const imesh_mesh& mesh,
00156 const vgl_point_2d<double>& pt_uv,
00157 unsigned int idx);
00158
00159
00160
00161 vgl_point_3d<double>
00162 imesh_project_barycentric_to_mesh(const imesh_mesh& mesh,
00163 const vgl_point_2d<double>& pt_uv,
00164 unsigned int idx);
00165
00166
00167
00168 void imesh_project_onto_mesh(const imesh_mesh& mesh,
00169 const vcl_vector<vgl_vector_3d<double> >& normals,
00170 const vpgl_perspective_camera<double>& camera,
00171 const vcl_vector< vgl_point_2d<double> >& pts_2d,
00172 vcl_vector<unsigned int >& idx_2d,
00173 vcl_vector<vgl_point_3d<double> >& pts_3d);
00174
00175
00176
00177
00178 int imesh_project_onto_mesh_barycentric(const imesh_mesh& mesh,
00179 const vcl_vector<vgl_vector_3d<double> >& normals,
00180 const vcl_vector<vgl_point_2d<double> >& verts2d,
00181 const vpgl_perspective_camera<double>& camera,
00182 const vgl_point_2d<double>& pt_img,
00183 vgl_point_2d<double>& pt_bary);
00184
00185
00186
00187
00188
00189 int imesh_project_onto_mesh_texture(const imesh_mesh& mesh,
00190 const vcl_vector<vgl_point_2d<double> >& verts2d,
00191 const vpgl_perspective_camera<double>& camera,
00192 const vgl_point_2d<double>& pt_img,
00193 vgl_point_2d<double>& pt_uv);
00194
00195 #endif // imesh_project_h_