本文整理汇总了C++中eigen::MatrixXf::format方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXf::format方法的具体用法?C++ MatrixXf::format怎么用?C++ MatrixXf::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXf
的用法示例。
在下文中一共展示了MatrixXf::format方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: out
int
writeMat2File(const Eigen::MatrixXf &matrix, const std::string &fileName)
{
std::ofstream out( fileName.c_str() );
if (out.is_open())
out << matrix.format(CSVFormat);
else
return 0;
out.close();
return 1;
}
示例2: matlabFormat
ConverterPlaneFromTo3d::ConverterPlaneFromTo3d(float fx, float fy, float cx, float cy, int height, int width)
{
Eigen::VectorXf colIndicies = Eigen::VectorXf::LinSpaced(Eigen::Sequential, width, 1, (float)width);
Eigen::VectorXf rowIndicies = Eigen::VectorXf::LinSpaced(Eigen::Sequential, height, 1, (float)height);
Eigen::VectorXf onesColSize = Eigen::VectorXf::Ones(width, 1);
Eigen::VectorXf onesRowSize = Eigen::VectorXf::Ones(height, 1);
Eigen::MatrixXf indiciesMatrixAxisX = onesRowSize * colIndicies.transpose(); //row = 1, 2, 3, 4, ..
Eigen::MatrixXf indiciesMatrixAxisY = rowIndicies * onesColSize.transpose();
xAdjustment_ = (indiciesMatrixAxisX.array() - cx) / fx;
yAdjustment_ = (indiciesMatrixAxisY.array() - cy) / fy;
Eigen::IOFormat matlabFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", "\n", "", "", "", "");
std::ostringstream saveFileNameString0;
saveFileNameString0 << "indiciesMatrixAxisX.csv";
std::ofstream matrixFile;
matrixFile.open(saveFileNameString0.str());
if (matrixFile.is_open())
{
matrixFile << indiciesMatrixAxisX.format(matlabFormat);
}
std::ostringstream saveFileNameString;
saveFileNameString << "xAdjustment.csv";
std::ofstream matrixFile1;
matrixFile1.open(saveFileNameString.str());
if (matrixFile1.is_open())
{
matrixFile1 << xAdjustment_.format(matlabFormat);
}
}