improve the doc for the viz module.

This commit is contained in:
Fangjun Kuang
2018-02-11 14:15:50 +08:00
parent e801e336ed
commit 2f3d4df2f2
12 changed files with 201 additions and 81 deletions
-2
View File
@@ -89,10 +89,8 @@ cv::viz::WCloud::WCloud(cv::InputArray cloud, cv::InputArray colors, cv::InputAr
actor->SetMapper(mapper);
WidgetAccessor::setProp(*this, actor);
}
template<> cv::viz::WCloud cv::viz::Widget::cast<cv::viz::WCloud>()
{
Widget3D widget = this->cast<Widget3D>();
+11 -11
View File
@@ -169,26 +169,26 @@ cv::viz::Viz3d cv::viz::imshow(const String& window_name, InputArray image, cons
void cv::viz::writeCloud(const String& file, InputArray cloud, InputArray colors, InputArray normals, bool binary)
{
CV_Assert(file.size() > 4 && "Extention is required");
String extention = file.substr(file.size()-4);
CV_Assert(file.size() > 4 && "Extension is required");
String extension = file.substr(file.size()-4);
vtkSmartPointer<vtkCloudMatSource> source = vtkSmartPointer<vtkCloudMatSource>::New();
source->SetColorCloudNormals(cloud, colors, normals);
vtkSmartPointer<vtkWriter> writer;
if (extention == ".xyz")
if (extension == ".xyz")
{
writer = vtkSmartPointer<vtkXYZWriter>::New();
vtkXYZWriter::SafeDownCast(writer)->SetFileName(file.c_str());
}
else if (extention == ".ply")
else if (extension == ".ply")
{
writer = vtkSmartPointer<vtkPLYWriter>::New();
vtkPLYWriter::SafeDownCast(writer)->SetFileName(file.c_str());
vtkPLYWriter::SafeDownCast(writer)->SetFileType(binary ? VTK_BINARY : VTK_ASCII);
vtkPLYWriter::SafeDownCast(writer)->SetArrayName("Colors");
}
else if (extention == ".obj")
else if (extension == ".obj")
{
writer = vtkSmartPointer<vtkOBJWriter>::New();
vtkOBJWriter::SafeDownCast(writer)->SetFileName(file.c_str());
@@ -202,27 +202,27 @@ void cv::viz::writeCloud(const String& file, InputArray cloud, InputArray colors
cv::Mat cv::viz::readCloud(const String& file, OutputArray colors, OutputArray normals)
{
CV_Assert(file.size() > 4 && "Extention is required");
String extention = file.substr(file.size()-4);
CV_Assert(file.size() > 4 && "Extension is required");
String extension = file.substr(file.size()-4);
vtkSmartPointer<vtkPolyDataAlgorithm> reader;
if (extention == ".xyz")
if (extension == ".xyz")
{
reader = vtkSmartPointer<vtkXYZReader>::New();
vtkXYZReader::SafeDownCast(reader)->SetFileName(file.c_str());
}
else if (extention == ".ply")
else if (extension == ".ply")
{
reader = vtkSmartPointer<vtkPLYReader>::New();
CV_Assert(vtkPLYReader::CanReadFile(file.c_str()));
vtkPLYReader::SafeDownCast(reader)->SetFileName(file.c_str());
}
else if (extention == ".obj")
else if (extension == ".obj")
{
reader = vtkSmartPointer<vtkOBJReader>::New();
vtkOBJReader::SafeDownCast(reader)->SetFileName(file.c_str());
}
else if (extention == ".stl")
else if (extension == ".stl")
{
reader = vtkSmartPointer<vtkSTLReader>::New();
vtkSTLReader::SafeDownCast(reader)->SetFileName(file.c_str());
+6 -3
View File
@@ -73,13 +73,16 @@ namespace cv
void WriteData();
int FillInputPortInformation(int port, vtkInformation *info);
_OutputArray cloud, colors, normals, tcoords;
_OutputArray cloud; //!< point coordinates of type CV_32FC3 or CV_64FC3 with only 1 row
_OutputArray colors; //!< point color of type CV_8UC3 or CV_8UC4 with only 1 row
_OutputArray normals; //!< point normal of type CV_32FC3, CV_32FC4, CV_64FC3 or CV_64FC4 with only 1 row
_OutputArray tcoords; //!< texture coordinates of type CV_32FC2 or CV_64FC2 with only 1 row
private:
vtkCloudMatSink(const vtkCloudMatSink&); // Not implemented.
void operator=(const vtkCloudMatSink&); // Not implemented.
};
}
}
} // end namespace viz
} // end namespace cv
#endif
@@ -109,7 +109,7 @@ namespace cv
vtkSetMacro(MotionAccelerationFactor,double)
vtkGetMacro(MotionAccelerationFactor,double)
// Set the basic angular unit for turning : efault 1 degree
// Set the basic angular unit for turning : default 1 degree
vtkSetMacro(AngleStepSize,double)
vtkGetMacro(AngleStepSize,double)
@@ -163,7 +163,7 @@ namespace cv
double DeltaYaw;
double DeltaPitch;
};
}
}
} // end namespace viz
} // end namespace cv
#endif
+2 -2
View File
@@ -181,7 +181,7 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
break;
}
default:
CV_Assert("setPointCloudRenderingProperties: Unknown property");
CV_Assert("setRenderingProperty: Unknown property");
}
actor->Modified();
}
@@ -230,7 +230,7 @@ double cv::viz::Widget::getRenderingProperty(int property) const
break;
}
default:
CV_Assert("getPointCloudRenderingProperties: Unknown property");
CV_Assert("getRenderingProperty: Unknown property");
}
return value;
}