I am Charmie

メモとログ

2015-01-01から1年間の記事一覧

LaTeX: xbb not found

.xbb file contains the boundingbox information of its corresponding file. When LaTeX returns an error message "XXX.xbb" not found, we should generate .xbb file by executing the following command: extractbb XXX.pdf

Python: update a script .py file after edit

[code lang="python"] import hoge edit the hoge.py reload(hoge) [/code] You might have an experience that iPython/Anaconda seems to ignore your update on a script file. No matter how many times you edited and saved, iPython/Anaconda returns…

Python: load a list of file names in a directory

There are two functions, os.listdir and glob.glob, for the purpose. os.listdir loads all the filenames in the specified directory. [code lang="python"] import os filelist = os.listdir('dirName/') [/code] glob.glob loads all the filenames i…

Python: mean of a matrix along a specified axis

[code lang="python"] import numpy generate a 10x3 matrix with random values M = numpy.random.random*1 mean along row resulting a 3x1 vector meanRow = M.mean(axis=0) mean along column resulting a 10x1 vector meanCol = M.mean(axis=1) [/code]…

Python module installation using Anaconda for a book Programming Computer Vision using Python

[code lang="bash"] conda install -c https://conda.binstar.org/tlatorre -y pygame conda install pyopengl [/code]

Python: mutable/immutable

Pythonのオブジェクトは変更可能(mutable)なものと変更不可能(immutable)なものがある.変更可能なオブジェクトは関数内での変更が関数外でも有効となる. mutable: 辞書,リスト immutable: 数値,文字列,タプル

Python 2.7 + OpenCV 3.0.0: installation on Windows

English notes is below the Japanese one. OpenCV 3.0.0をPython 2.7から使うためのインストール手順 Pythonのインストール Python-OpenCVを動かすには,Python本体に加えて少なくともNumPy, MatPlotLibのインストールが必要. 1.1. Anacondaのインストール…

Python: startup

Python Scientific Lecture Notes(英語): Python初心者向け.コード付き.iPythonの使用を仮定.NumPy, SciPy, Sympy, Scikit-image, Traits, scikit-learnについても扱ってる. 1の一部和訳されたもの: Matplotlib tutorial(英語): MatPlotLibに関する説明…

Python installation on Ubuntu 14.04

The goal is to use Python with OpenCV under Ubuntu 14.04. The first step is to install Python and its packages. I installed a Python package manager Anaconda. [code lang="bash"] wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b3…

involve, include, consist of

A involve/include B: B is all component or some component of A. A consist of B: B is all component of A.

OpenCV VIZ module compilation with VTK in Ubuntu 14.04

OpenCV ver. 3.0 was released. I tried to compile OpenCV with VTK again and again and finally could compile it. The key was compile VTK with BUILD_SHARED_LIBS on compile OpenCV with VTK That's it!!

Polynomial fitting by linear least squares

I made a repository of C++ code that runs polynomial fitting by linear least squares.

gflags with Visual Studio

Run CMake Run Visual Studio as a superuser Open gflags.sln with Visual Studio Batch build ALL_BUILD, INSTALL, and RUN_TESTS The result is as folllows: ------ Rebuild All started: Project: INSTALL, Configuration: Release x64 ------ -- Insta…

CMake + Visual Studio from command prompt

[code lang="bash"] cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug nmake [/code]

compile latex document written in Japanese on Ubuntu 14.04

[code language="bash"] sudo apt-get install texlive-lang-cjk uplatex -shell-escape %s.tex pbibtex %s.tex uplatex -shell-escape %s.tex uplatex -shell-escape %s.tex dvidfmx %s.dvi [/code]

RedMine setting on Ubuntu

DocumentRoot /var/www/html Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all RailsBaseURI /redmine PassengerResolveSymlinksInDocumentRoot on

DokuWiki on Ubuntu 14.04

Follow the installation guide. Assuming that LAMP and other dependencies have been installed. The following code might need to be executed as a superuser. [code language="bash"] cd /var/www/html wget http://download.dokuwiki.org/src/dokuwi…

Windows: C++ programming environment

Visual Studio 2013 for Windows Desktop Jp|En Boost pre-built binary We can select the install directory, say BOOST_DIR. I chose boost_1_55_0-msvc-12.0-64.exe because msvc-12.0 means VS2013, my PC is 64bit, and my ubuntu PC uses 1.54 (the p…

C++ tensor library

Blitz++ code: http://sourceforge.net/projects/blitz/ rank: up to 11 type: dense operation: - slicing ITensor well-documented code: https://github.com/ITensor/ITensor rank: type: operation: BTAS code: https://github.com/BTAS/BTAS rank: any …

skype installation on Ubuntu 14.04

software & updates > Other Softwares check "Canonical Partners" and Canonical "Partners (Source Code)" sudo apt-get update sudo apt-get -yV install skype

use Meld for git diff

make a script, git-meld.sh #!/bin/bash meld "$2" "$5" > /dev/null 2>&1 put the script in the bin directory sudo mv git-meld.sh /usr/local/bin/ sudo chmod +x /usr/local/bin/git-meld.sh add diff settings in the $HOME/.gitconfig [diff] extern…

C++: count some elements of std::vector

count_if counts the number of elements that satisfies the specified condition. The result is like the following: 79, 55, 57, 44, 0, 14, -5, 52, 86, 95, -7, 100, 5, -5, 95, 19, 63, 59, 40, 51, numNegative = 3 numNonNegative = 17 numZero = 1…

Eigen: make matrix homogeneous and dehomogeneous

[code lang="cpp"] Eigen::MatrixXd M = Eigen::MatrixXd(3,10); // make each column homogeneous Eigen::MatrixXd Mh = M.colwise().homogeneous(); // make each column dehomogeneous Eigen::MatrixXd Md = Mh.colwise().hnormalized().topRows(Mh.rows(…

C++: warning suppression in the code

#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-local-typedefs" #include <Eigen/Geometry> #pragma GCC diagnostic pop</eigen/geometry>

make cv::findHomography stable

A friend of mine told me how to make cv::findHomography more stable. The solution is very easy, comment lines 91-121 of module/calib3d/fundam.cpp and then compile. The unstability is due to the new algorithm to compute the homography. From…

MatLab installation

sudo ./install # to enable the installer mkdir sudo apt-get install matlab-support # add matlab to the launcher

convert std::string to X

C++11 functions std::to_string(X) converts X to std::string. std::stoi(str) converts std::string str to int type data std::stof(str) converts std::string str to float type data std::stod(str) converts std::string str to double type data

English

bronchus - bronchi: 気管支(単複) alveolus - alveoli: 肺胞(単複)

C++: usefull functions

std::iota: assigns successive values to a container include <numeric> std::iota( v.begin, v.end(), val ); // v[0] = val; // v[v.end()-1] = val + v.size()-1; std::random_shuffle: randomizes the order of elements of random access containers. include <algorithm></algorithm></numeric>…

git commit related to an issue

A commit can be linked to an issue by adding issue ID at the beginning of commit message. The following command links the commit to an issue, whose ID is 1. git commit -m "#1 brabrabra"