# linear algebra

## Open source Structure-from-Motion and Multi-View Stereo tools with C++

Structure-from-Motion (SFM) is genuinely an interesting topic in computer vision, Basically making 3D structure from something 2D is absolutely mesmerizing 🙂 There two open source yet very robust tools for SFM, which sometimes compiling them might be complicated, here I will share my experience with you. 1)VisualSFM Prerequisite: 1)Glew Download the glew from SF at http://glew.sourceforge.net/. Do NOT get it from Github as

## Finding Homography Matrix using Singular-value Decomposition and RANSAC in OpenCV and Matlab

Solving a Homography problem leads to solving a set of homogeneous linear equations such below: \left( \begin{array}{ccccccccc} -x1 & -y1 & -1 & 0 & 0 & 0 & x1*xp1 & y1*xp1 & xp1\\ 0 & 0 & 0 & -x1 & -y1 & -1 & x1*yp1 & y1*yp1 &  yp1\\ -x2 & -y2 &

## Finding Affine Transform with Linear Least Squares

linear least squares is a method of fitting a model to data in which the relation between data and unknown paramere can be expressed in a linear form. $$Ax=b$$ $$X^{*}= \underset{x}{\mathrm{argmin}}= \|Ax-b\|^{2} =(A^{T}A)^{-1}A^{T}b$$

And testing the code:

## Roll, pitch, yaw using Eigen and KDL Frame

From Eigen documentation: If you are working with OpenGL 4×4 matrices then Affine3f and Affine3d are what you want. Since Eigen defaults to column-major storage, you can directly use the Transform::data()  method to pass your transformation matrix to OpenGL. construct a Transform:

or like this:

But note that unfortunately, because of