eigen

Eigen indexing, update all column of a specific row

大城市里の小女人 提交于 2021-02-10 17:48:17
问题 Let say I have an ArrayXXf (or MatrixXf ) m . In each iteration of a for loop, I want to fill m row-wise with a VectorXf . Eigen::ArrayXXf m(5, 5); for (int i = 0; i < 5; i++) { Eigen::VectorXf vec(5); vec << i, i + 1, i + 2, i+3, i+4; //fill m row wise // in matlab I will do something like m(i,:) = vec; // in numpy this will looks like m[i:] = vec; // that means when i is 0 m looks like // [ 0 1 2 3 4 5 // - - - - - - // - - - - - - // - - - - - - // - - - - - -] } How can I achieve that in

Eigen indexing, update all column of a specific row

爱⌒轻易说出口 提交于 2021-02-10 17:47:59
问题 Let say I have an ArrayXXf (or MatrixXf ) m . In each iteration of a for loop, I want to fill m row-wise with a VectorXf . Eigen::ArrayXXf m(5, 5); for (int i = 0; i < 5; i++) { Eigen::VectorXf vec(5); vec << i, i + 1, i + 2, i+3, i+4; //fill m row wise // in matlab I will do something like m(i,:) = vec; // in numpy this will looks like m[i:] = vec; // that means when i is 0 m looks like // [ 0 1 2 3 4 5 // - - - - - - // - - - - - - // - - - - - - // - - - - - -] } How can I achieve that in

Error while creating object from templated class

社会主义新天地 提交于 2021-02-10 06:12:04
问题 I've been trying to find a way to sample random vectors from a multivariate normal distribution in C++, having both the mean vector and the covariance matrix, much like Matlab's mvnrnd function works. I've found relevant code for a class that implements this on this page, but I've been having some problems compiling it. I've created a header file that is being included on my main.cpp, and I'm trying to create an object of the EigenMultivariateNormal class: MatrixXd MN(10,1); MatrixXd CVM(10

《视觉SLAM十四讲》笔记(ch7)

廉价感情. 提交于 2021-02-09 10:10:34
ch7 视觉里程计1 本章目标: 1.理解图像特征点的意义,并掌握在单副图像中提取出特征点及多副图像中匹配特征点的方法 2.理解对极几何的原理,利用对极几何的约束,恢复出图像之间的摄像机的三维运动 3.理解PNP问题,以及利用已知三维结构与图像的对应关系求解摄像机的三维运动 4.理解ICP问题,以及利用点云的匹配关系求解摄像机的三维运动 5.理解如何通过三角化获得二维图像上对应点的三维结构 本章目的:基于特征点法的vo,将介绍什么是特征点,如何提取和匹配特征点,以及如何根据配对的特征点估计相机运动和场景结构,从而实现一个基本的两帧间视觉里程计。 特征点:角点、SIFT(尺度不变特征变换,Scale-Invariant Feature Transform)、SURF、、ORB(后三个是人工设计的特征点,具有更多的优点) 特征点的组成: 1. 关键点 :指特征点在图像里的位置 2. 描述子 :通常是一个向量,按照某种人为设计的方式,描述了该关键点周围像素的信息。相似的特征应该有相似的描述子(即当两个特征点的描述子在向量空间上的距离相近,认为这两个特征点是一样的) 以ORB特征为代表介绍提取特征的整个过程: ORB特征:OrientedFAST关键点+BRIEF关键子 提取ORB特征的步骤: 1.提取FAST角点:找出图像中的“角点”,计算特征点的主方向

Eigen: Perform an 3D rotation around an axis W and anchored at a point P

南楼画角 提交于 2021-02-08 06:30:33
问题 I want to create a function that receives an angle, two vectors, one of them being an unit vector that defines the direction of the axis of rotation and the other is the vector to be rotated and a point P that defines the anchoring position of the rotation. To implement this in Eigen I guess I would have to use the geometry module, unfortunately, I think the documentation of this module is not great and I am failing to understand it. My idea is to combine the rotation transformation AngleAxis

Eigen: matrix to quaternion and back have different result

三世轮回 提交于 2021-02-08 04:10:52
问题 I use Eigen library to covert matrix to quaternion, but when I turn one of the matrix to quaternion and burn it back, it turn out to be another matrix which is identity matrix. The rotation matrix I use was decomposed from a transform matrix. Eigen::Matrix3f R3d = R.topLeftCorner<3,3>(); *Rquat = R3d; R3d = (*Rquat).normalized().toRotationMatrix(); What may cause this problem? This is the matrix before change to quaternion and This is the matrix when I turn it back form the quaternion 回答1:

Eigen: matrix to quaternion and back have different result

旧巷老猫 提交于 2021-02-08 04:10:34
问题 I use Eigen library to covert matrix to quaternion, but when I turn one of the matrix to quaternion and burn it back, it turn out to be another matrix which is identity matrix. The rotation matrix I use was decomposed from a transform matrix. Eigen::Matrix3f R3d = R.topLeftCorner<3,3>(); *Rquat = R3d; R3d = (*Rquat).normalized().toRotationMatrix(); What may cause this problem? This is the matrix before change to quaternion and This is the matrix when I turn it back form the quaternion 回答1:

How do I pass an Eigen matrix row reference, to be treated as a vector?

匆匆过客 提交于 2021-02-07 18:38:17
问题 I have a function that operates on a Vector reference, e.g. void auto_bias(const Eigen::VectorXf& v, Eigen:Ref<Eigen::VectorXf>> out) { out = ... } and at some point I need to have this function operate on a Matrix row. Now, because the default memory layout is column-major, I can't just Map<> the data the row points to into a vector. So, how do I go about passing the row into the above function so that I can operate on it? The not-so-pretty solution is to have a temp vector, e.g. VectorXf

Problem with including Eigen library in Clion CMake

不羁的心 提交于 2021-02-07 10:03:51
问题 I have a problem with the Eigen library. I use Clion on Linux and my project can't find the Eigen library (I have it in a folder on my desktop). I have CMake in two configurations: First: cmake_minimum_required(VERSION 3.15) project(TestFEM) set(CMAKE_CXX_STANDARD 17) set(EIGEN_DIR "~/Desktop/eigen-3.3.7") include_directories(${EIGEN_DIR}) add_executable(TestFEM main.cpp FEM/FEM.cpp FEM/FEM.h) And second: cmake_minimum_required(VERSION 3.15) project(TestFEM) set(CMAKE_CXX_STANDARD 17) list

Avoiding dynamic memory allocation on factorizing sparse matrix with Eigen

南楼画角 提交于 2021-01-29 05:11:17
问题 In my application I need to avoid dynamic memory allocation (malloc like) except in the class constructors. I have a sparse semidefinite matrix M whose elements change during the program execution but it mantains a fixed sparsity pattern. In order to solve many linear systems M * x = b as fast as possible, the idea is to use inplace decomposition in my class constructor as described in Inplace matrix decompositions, then call factorize method whenever M changes: struct MyClass { private: