cpp中的本征矩阵

问题描述 投票:0回答:1

如何使用特征库创建动态3D矩阵。以及如何在特定的通道中切出某个通道的高度和宽度?

示例

I want to create a matrix of size 3 * 320 * 240 (here channel width and height known at runtime)
and I want a slice of 3 * 3 in each channel
c++ tensorflow eigen eigen3
1个回答
0
投票

也许像这样:

#include <iostream>
#include <vector>
#include <Eigen/Dense>

using namespace Eigen;
int main()
{
    int a = 320;
    int b = 240;

    // Create as many as you want, probably better in a loop.
    MatrixXd m(a, b);
    MatrixXd n(a, b);
    MatrixXd o(a, b);

    std::vector<MatrixXd> v;
    v.push_back(m);
    v.push_back(n);
    v.push_back(o);

    std::cout << v.at(0)(0, 1) << std::endl;
}

© www.soinside.com 2019 - 2024. All rights reserved.