I am Charmie

メモとログ

MatLab

MatLab installation

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

MatLab code decompose an image to patches

I uploaded my code, which decomposes an image to patches, on my git. The repository contains 2 basic functions and 1 demo code: im2patch.m: decomposes an image into a set of image patches patch2im.m: forms an image by merging a set of imag…

C++ library and MatLab toolbox for Active Appearance Model

this is a note about free C++ libraries and MatLab toolboxes for Active Appearance Model. C++ libraries: DeMoLib implements several AAM fitting methods. Difference from other libraries is that DeMoLib provides several AAM fitting methods s…

Bouguet's MatLab Camera Calibration Toolbox

I wrote the detail of implementation of MatLab Camera Calibration Toolbox, which was published by Bouguet for my students. You can check the notes for single camera calibration and stereo camera calibration

MatLab Toolbox for Camera Calibration and Simulation

I found a cool toolbox!! I tried the basic functions for synthesize images with different parameters. It runs faster than my MatLab code! I'll dive into the code for more detail, especially how to apply intrinsic/extrinsic parameters and l…

access row/column of 2 dimensional cell array

See here. C = { ... rand(100,2) rand(150,2) rand(130,2) rand(50,2); ... rand(110,2) rand(120,2) rand(310,2) rand(10,2); ... rand(130,2) rand(115,2) rand(110,2) rand(40,2); ... }; C = [100x2 double] [150x2 double] [130x2 double] [50x2 doubl…

update MatLab graph/plot in real time

pause function works well to call graph/plot in a loop. Suppose, you want to show a sequence of images in a for loop. If processes in a loop is not heavy, imshow() only shows image after the loop has executed. The code spends enough time t…

K-SVD toolbox installation

This is a memo how to install K-SVD toolbox provided by Ron Rubinstein. For K-SVD toolbox installation, we need OMP toolbox. Thus, installation needs 2 steps, OMP installation and then K-SVD installation. OMP toolbox installation Change di…

CurveLab installation

This post is memo telling how to install CurveLab in MatLab. CurveLab is a toolbox the Fast Discrete Curvelet Transform both in MatLab and C++. You can find the detail from the website. Current version is 2.1.2. Installation is very simple…

WaveLab installation

This post is memo telling how to install WaveLab850 in MatLab. WaveLab is a collection of MatLab functions of wavelet analysis related algorithms such as wavelet transform and matching pursuit. You can find the detail from the website. Cur…

im2col and col2im

Function im2col formats image blocks to columns and col2im does the inverse operation. When you independently apply some operation on each image patches and then merge the patches, these functions are useful. The code is like img = im2doub…

Normalize the columns/rows of a given matrix

A = randn(m, n); % for columns A = A ./ repmat(sqrt(sum(A.^2, 1)),m,1); % for rows A = A ./ repmat(sqrt(sum(A.^2, 2)),1,n);

CurveLabのインストール

現在のバージョンはCurveLab 2.1.2. インストールマニュアル(curvelab.pdf)に従ってインストール. ファイルのダウンロード CurveLab-2.1.2.tar.gz ファイルの解凍 gunzip CurveLab-2.1.2.tar.gz tar xvf CurveLab-2.1.2.tar CurveLabのパスを設定 解凍した…

Wavelabのインストール

現在のバージョンはWavelab850. インストールマニュアルに従ってインストール. zipファイルのダウンロード Wavelab850.zip zipファイルの解凍 ダウンロードしたzipファイルをmatlab toolboxが保存されているフォルダに解凍. MATLAB\toolbox\Wavelab850 Wa…

Integral image

Compute an integral image using MatLab. img = im2double(imread('test.bmp')); IntegralImage = cumsum( cumsum(img,1),2); Inside cumsum works along y direction while outside cumsum does along x direction.

cvx

自分で試したわけじゃないけど,cvxは画像処理みたいに大きな問題には適してないらしい. くそ時間がかかって,イマイチな答えが返ってくると言ってる人がいた. 又聞きだけど.

GPSR

Sparse solutionのsolverとGPSR(Gradient Projection for Sparse Reconstruction)を試す.一部のデモファイルを動かすにはRice wavelet toolboxが必要なので,以下からzipファイル(rwtwinxp.zip)をダウンロード.http://dsp.rice.edu/software/rice-wavelet-…

乱数

MatLabでの乱数整数生成.randi([1 n])とすると,1からnの中の整数がランダムに選ばれる.

引数のハンドル

MatLabで関数の引数を可変にしたい時は,以下のようにvararginを使う.function test(varargin)varargin{1}, varargin{2}, ... , varargin{i},とやればi番目の引数にアクセス出来る.また,narginは引数の数を表す変数.iptchecknargin関数で関数の引数に関…

L2ノルムとL1ノルムの違い

CVXを使って,L1ノルムとL2ノルムの違いをみてみる.もっと正確に言うと,L1ノルムでスパースな解が求まっているのかを確かめる.>> m=16;n=8;>> A=randn(m,n); b=randn(m,1);% L2 norm% Minimize |Ax-b|2% subject to |x|2>> cvx_begin>> variable x_l2(n);…

CVX: quickstart 5 An optimal trade-off curve

CVX: quickstart 5 An optimal trade-off curveMinimize |Ax-b|2+gamma|x|1% gamma is 10^{-2} to 10^{2}gamma = logspace( -2, 2, 20 );l2norm = zeros(size(gamma)); l1norm = zeros(size(gamma));for k = 1:length(gamma), cvx_begin variable x(n); mini…

CVX: quickstart 3 Other norms and functions

CVX: quickstart 3 Other norms and functionsChebyshevノルム(L∞ノルム)やL1ノルムの計算をMatLabのOptimization toolboxで行うにはlinprog関数を使うのだが,関数の引数がややこしい.それに比べると,CVXはnorm関数の引数を変更するだけなので,記述が簡…

CVX: quickstart 2 Bound-constrained Least squares

CVX: quickstart2 Bound-constrained Least squaresLeast squaresに制約条件を追加する.今回は上界と下界をminimize ||Ax-b||2subject to l<=x<=u m = 16; n = 8;A = randn(m,n); b = randn(m,1);bnds = randn(n,2);l = min( bnds, , 2 ); u = max( bnds, ,…

CVX: quickstart 1 Least squares

とゆーわけで,実際にCVXを触ってみる.examplesフォルダのquickstartをユーザガイドを見ながら実行していく.CVX: quickstart1 Least squares単純なLeast squares.これならx=A\b;と解いてもいけちゃう.minimize ||Ax-b||2m = 16; n = 8;A = randn(m,n);b …

matlabのパス設定

スタートアップファイルを使うと便利らしい.MatLabを起動する時の最初のフォルダにstartup.mというスタートアップファイルがあると,起動時に自動で実行されるそうだ.自作関数やら追加インストールしたいツールボックスのフォルダのパスをスタートアップフ…

CVX; Matlab Software for Disciplined Convex Programming

CVXのインストール @ Windows XP 32bitConvex optimizationを習得すべく,CVXのインストール.以下のページに行く.http://cvxr.com/cvx/downloadCVXのパッケージはzip形式で提供されてる(unix用にはtar.gzファイル).zipファイルの中にはプログラムファイル…

文字列内の最初のトークンを出力

strtoktoken = strtok('str',delimiter);s = 'This is a book, which I gave you.';[token1,rem1] = strtok(s,',');token1 = This is a book[token2,rem2] = strtok(s,'.');token2 = This is a book, which I gave you

matlabのplotの幅

x軸とy軸の最大値と最小値(軸の描画範囲)を指定すると,plotの間隔を微調整できる.

配列の拡張

グレースケールの画像をカラー画像にする方法.といっても,Colorizationではなく,単純にRGBそれぞれのチャンネルに同じグレースケール画像の値を入れたいだけ.imgRGB = cat(3, imgGray, imgGray, imgGray);imgRGB = cat(3, imgR, imgG, imgB);これで終わ…

textscan関数

ファイルからブロック単位でデータを取得する関数.例)ファイル'test.txt'の中身が'%s %d %d'というフォーマット. 頭1行がヘッダ情報.ImageName Width Height1.png 320 2402.png 400 3003.png 160 120・・・100.png 10 8% ファイルオープンfid = fopen('test.…