Skip to content

Instantly share code, notes, and snippets.

@olzhas
olzhas / pseudoinverse.cpp
Created March 16, 2017 11:43 — forked from javidcf/pseudoinverse.cpp
Compute the pseudoinverse of a dense matrix with Eigen (C++11)
#include <Eigen/Dense>
template <class MatT>
Eigen::Matrix<typename MatT::Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime>
pseudoinverse(const MatT &mat, typename MatT::Scalar tolerance = typename MatT::Scalar{1e-4}) // choose appropriately
{
typedef typename MatT::Scalar Scalar;
auto svd = mat.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV);
const auto &singularValues = svd.singularValues();
Eigen::Matrix<Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime> singularValuesInv(mat.cols(), mat.rows());
ffmpeg -i 1.mov -i 2.mov -i 3.mov -filter_complex "hstack=3" output.mp4
@olzhas
olzhas / make_clang_great_again.sh
Created January 26, 2018 05:35
make clang-5.0 default clang
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 100
@olzhas
olzhas / timer.hpp
Last active May 29, 2018 11:03
simple tic and toc
#ifndef TIMER_H
#define TIMER_H
#include <chrono>
#include <thread>
using timer = std::chrono::high_resolution_clock::time_point;
inline void tic(timer &t){
t = std::chrono::high_resolution_clock::now();

The document provides description on calibration of three Kinect for Microsoft sensors connected to one computer with several usb controllers. Three cameras setup is shown below:

Figure 1

Intrinsic, extrinsic, and Kinect2Kinect calibration is performed to know the position of each sensor in the space. Our setup is ROS Indigo with Ubuntu 14.04. freenect_launch and camera_pose ROS packages are used. Camera_pose package provides the pipeline to calibrate the relative 6D poses between multiple camera's. freenect_launch package contains launch files for using OpenNI-compliant devices in ROS. It creates a nodelet graph to transform raw data from the device driver into point clouds, disparity images, and other products suitable for processing and visualization. It is installed with catkin as follows:

# Prepa
@olzhas
olzhas / README.md
Last active September 9, 2019 14:58
Change swapfile size in Ubuntu 18.04
  1. Turn off all swap processes
sudo swapoff -a
  1. Resize the swap
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
  • if = input file
  • of = output file
@olzhas
olzhas / x11_docker_mac.md
Created April 16, 2021 04:17 — forked from cschiewek/x11_docker_mac.md
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@olzhas
olzhas / How to setup VirtualGL and TurboVNC on Ubuntu.md
Created September 4, 2021 13:10 — forked from cyberang3l/How to setup VirtualGL and TurboVNC on Ubuntu.md
Setup VirtualGL and TurboVNC on Ubuntu for OpenGL forwarding
@olzhas
olzhas / qpsolve.py
Created August 2, 2017 10:39 — forked from jaeandersson/qpsolve.py
Solve QP using qpOASES and CasADi from Python
import numpy as NP
import casadi as C
def qpsolve(H,g,lbx,ubx,A=NP.zeros((0,0)),lba=NP.zeros(0),uba=NP.zeros(0)):
# Convert to CasADi types
H = C.DMatrix(H)
g = C.DMatrix(g)
lbx = C.DMatrix(lbx)
ubx = C.DMatrix(ubx)
A = C.DMatrix(A)
A = A.reshape((A.size1(),H.size1())) # Make sure matching dimensions