renamed Mesh3d -> Mesh
This commit is contained in:
@@ -257,7 +257,7 @@ template<> cv::viz::WCloudNormals cv::viz::Widget::cast<cv::viz::WCloudNormals>(
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Mesh Widget implementation
|
||||
|
||||
cv::viz::WMesh::WMesh(const Mesh3d &mesh)
|
||||
cv::viz::WMesh::WMesh(const Mesh &mesh)
|
||||
{
|
||||
CV_Assert(mesh.cloud.rows == 1 && mesh.polygons.type() == CV_32SC1);
|
||||
|
||||
@@ -300,8 +300,8 @@ cv::viz::WMesh::WMesh(const Mesh3d &mesh)
|
||||
vtkSmartPointer<vtkCellArray> cell_array = vtkSmartPointer<vtkCellArray>::New();
|
||||
|
||||
int idx = 0;
|
||||
int poly_size = mesh.polygons.total();
|
||||
for (int i = 0; i < poly_size; ++idx)
|
||||
size_t polygons_size = mesh.polygons.total();
|
||||
for (size_t i = 0; i < polygons_size; ++idx)
|
||||
{
|
||||
int n_points = polygons[i++];
|
||||
|
||||
@@ -330,6 +330,16 @@ cv::viz::WMesh::WMesh(const Mesh3d &mesh)
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
cv::viz::WMesh::WMesh(InputArray cloud, InputArray polygons, InputArray colors, InputArray normals)
|
||||
{
|
||||
Mesh mesh;
|
||||
mesh.cloud = cloud.getMat();
|
||||
mesh.colors = colors.getMat();
|
||||
mesh.normals = normals.getMat();
|
||||
mesh.polygons = polygons.getMat();
|
||||
*this = WMesh(mesh);
|
||||
}
|
||||
|
||||
template<> CV_EXPORTS cv::viz::WMesh cv::viz::Widget::cast<cv::viz::WMesh>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
|
@@ -61,9 +61,9 @@ namespace cv { namespace viz { namespace
|
||||
{
|
||||
struct MeshUtils
|
||||
{
|
||||
static Mesh3d loadMesh(const String &file)
|
||||
static Mesh loadMesh(const String &file)
|
||||
{
|
||||
Mesh3d mesh;
|
||||
Mesh mesh;
|
||||
|
||||
vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();
|
||||
reader->SetFileName(file.c_str());
|
||||
@@ -128,7 +128,7 @@ namespace cv { namespace viz { namespace
|
||||
};
|
||||
}}}
|
||||
|
||||
cv::viz::Mesh3d cv::viz::Mesh3d::load(const String& file)
|
||||
cv::viz::Mesh cv::viz::Mesh::load(const String& file)
|
||||
{
|
||||
return MeshUtils::loadMesh(file);
|
||||
}
|
||||
|
@@ -282,7 +282,7 @@ void cv::viz::writeTrajectory(InputArray _traj, const String& files_format, int
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Computing normals for mesh
|
||||
|
||||
void cv::viz::computeNormals(const Mesh3d& mesh, OutputArray _normals)
|
||||
void cv::viz::computeNormals(const Mesh& mesh, OutputArray _normals)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyData> polydata = getPolyData(WMesh(mesh));
|
||||
vtkSmartPointer<vtkPolyData> with_normals = VtkUtils::ComputeNormals(polydata);
|
||||
|
Reference in New Issue
Block a user