本文整理汇总了C++中eigen::MatrixXi::data方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXi::data方法的具体用法?C++ MatrixXi::data怎么用?C++ MatrixXi::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXi
的用法示例。
在下文中一共展示了MatrixXi::data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resize
void HomogeneousPoint3fIntegralImage::compute(const Eigen::MatrixXi &indices, const HomogeneousPoint3fVector &points) {
if (cols() != indices.cols() || rows() != indices.rows())
resize(indices.rows(), indices.cols());
clear();
HomogeneousPoint3fAccumulator *acc = data();
const int *pointIndex = indices.data();
int s = rows() * cols();
// fill the accumulators with the points
for (int i=0; i<s; i++, acc++, pointIndex++){
if (*pointIndex<0)
continue;
const HomogeneousPoint3f& point = points[*pointIndex];
acc->operator += (point);
}
// fill by column
#pragma omp parallel for
for (int c=0; c<cols(); c++){
for (int r=1; r<rows(); r++){
coeffRef(r,c) += coeffRef(r-1,c);
}
}
// fill by row
#pragma omp parallel for
for (int r=0; r<rows(); r++){
for (int c=1; c<cols(); c++){
coeffRef(r,c) += coeffRef(r,c-1);
}
}
}
示例2: eigenToCV
/*!
* \brief Convert cv::Mat to integer Eigen matrix
* \author Sascha Kaden
* \param[in] image
* \param[out] Eigen matrix
* \date 2016-12-18
*/
cv::Mat eigenToCV(Eigen::MatrixXi eigenMat) {
cv::Mat cvMat(eigenMat.rows(), eigenMat.cols(), CV_32SC1, eigenMat.data());
if (Eigen::RowMajorBit)
cv::transpose(cvMat, cvMat);
cv::Mat dst;
cvMat.convertTo(dst, CV_8UC1);
cv::cvtColor(dst, dst, CV_GRAY2BGR);
return dst;
}
示例3: parse_rhs
void parse_rhs(
const int nrhs,
const mxArray *prhs[],
Eigen::MatrixXd & V,
Eigen::MatrixXi & F,
Eigen::MatrixXd & P,
Eigen::MatrixXd & N,
int & num_samples)
{
using namespace std;
if(nrhs < 5)
{
mexErrMsgTxt("nrhs < 5");
}
const int dim = mxGetN(prhs[0]);
if(dim != 3)
{
mexErrMsgTxt("Mesh vertex list must be #V by 3 list of vertex positions");
}
if(dim != (int)mxGetN(prhs[1]))
{
mexErrMsgTxt("Mesh facet size must be 3");
}
if(mxGetN(prhs[2]) != dim)
{
mexErrMsgTxt("Point list must be #P by 3 list of origin locations");
}
if(mxGetN(prhs[3]) != dim)
{
mexErrMsgTxt("Normal list must be #P by 3 list of origin normals");
}
if(mxGetN(prhs[4]) != 1 || mxGetM(prhs[4]) != 1)
{
mexErrMsgTxt("Number of samples must be scalar.");
}
V.resize(mxGetM(prhs[0]),mxGetN(prhs[0]));
copy(mxGetPr(prhs[0]),mxGetPr(prhs[0])+V.size(),V.data());
F.resize(mxGetM(prhs[1]),mxGetN(prhs[1]));
copy(mxGetPr(prhs[1]),mxGetPr(prhs[1])+F.size(),F.data());
F.array() -= 1;
P.resize(mxGetM(prhs[2]),mxGetN(prhs[2]));
copy(mxGetPr(prhs[2]),mxGetPr(prhs[2])+P.size(),P.data());
N.resize(mxGetM(prhs[3]),mxGetN(prhs[3]));
copy(mxGetPr(prhs[3]),mxGetPr(prhs[3])+N.size(),N.data());
if(*mxGetPr(prhs[4]) != (int)*mxGetPr(prhs[4]))
{
mexErrMsgTxt("Number of samples should be non negative integer.");
}
num_samples = (int) *mxGetPr(prhs[4]);
}
示例4: winding_number
// IF THIS IS EVER TEMPLATED BE SURE THAT V IS COLMAJOR
IGL_INLINE void igl::winding_number(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::MatrixXd & O,
Eigen::VectorXd & W)
{
using namespace Eigen;
// make room for output
W.resize(O.rows(),1);
switch(F.cols())
{
case 2:
return winding_number_2(
V.data(),
V.rows(),
F.data(),
F.rows(),
O.data(),
O.rows(),
W.data());
case 3:
{
WindingNumberAABB<Vector3d> hier(V,F);
hier.grow();
// loop over origins
const int no = O.rows();
# pragma omp parallel for if (no>IGL_WINDING_NUMBER_OMP_MIN_VALUE)
for(int o = 0; o<no; o++)
{
Vector3d p = O.row(o);
W(o) = hier.winding_number(p);
}
break;
}
default:
assert(false && "Bad simplex size");
break;
}
}