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 image patches
  • demo_patching.m: shows how the above functions work

C++ library and MatLab toolbox for Active Appearance Model

this is a note about free C++ libraries and MatLab toolboxes for Active Appearance Model.

1. C++ libraries:

  1. DeMoLib
    implements several AAM fitting methods.
    Difference from other libraries is that DeMoLib provides several AAM fitting methods such as some Inverse Compositional algorithms and 2D+3D fitting method. This feature is fantastic.
    The library requires OpenCV, VxL, and CMake.
  2. CoDe library
    is implementation of a CVPR 2009 paper “On Compositional Image Alignment with an Application to Active Appearance Models.
    With the library, we can align an AAM to a target image from an initial starting position.
    Its documentation tells us that the library requires Blas, Lapack, Cmake, and MatLab. MatLab is probably for PCA based learning part of AAM.
  3. FaceTracker
    is deformable face tracking library based on AAM.
    Looking at the author’s website, the library must work quite nice.
    It requires OpenCV.
  4. AAM-API
    is a C++ implementation of AAM.
    The last update of the library was April 2006 or earlier, it looks working well but is not my first option.
  5. Stasm
    is an ASM library not AAM one but I post the information because Stasm seems to be famous library.
    It requires OpenCV.

2. MatLab toolboxes

  1. AAMtools last updated May 2008
    is a toolbox for both building AAMs and fitting them to images/videos.
    The toolbox additionally requires C++ compiler and OpenGL. C++ compiler is to remove some MatLab bottle neck and OpenGL is for image resampling repeated in the algorithm.
    In addition, the toolbox has an interface to OpenCV’s face detection functions for automatic AAM mask initialization.
  2. ASM and AAM:
    is a set of MatLab functions for basic ASM and AAM for both 2D and 3D objects with multi-resolution.
    The package description is shorter contrast to other libraries but it looks nice.
    It requires Image Processing toolbox.

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 lens distortion to known object such as a chessboard.

A function dibuja_ptos() renders either control points or a chessboard. This switching is done by menu Calibration points->Chessboard (only coplanar), calling a function menu_board_T_Callback(), and Calibration points->Calibration points, calling a function menu_puntos_genera_T_Callback().
Unfortunately, dibuja_ptos() is not what I expected… The function

  1. first apply intrinsic/extrinsic parameters and lens distortion to control points
  2. then render either the points or corresponding rectangle on a plot

Therefore, I cannot apply the transformation to an arbitrary input image.

Hmm, should I go back to PovRay then?


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 =
[100×2 double]    [150×2 double]    [130×2 double]    [50×2 double]
[110×2 double]    [120×2 double]    [310×2 double]    [10×2 double]
[130×2 double]    [115×2 double]    [110×2 double]    [40×2 double]

To access (1,2) of C,
C12 = C(1,2); % [150×2 double]
To access 2nd row/column of C,
Crow2 = C(2,:);
Ccolumn2 = C(:,2);

To concatenate row/column,
Vrow2 = cell2mat(Crow2(:));
Vcolumn2 = cell2mat(Ccolumn2(:));


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 to show images. This can be done by pause() function that halts execution as
for n = 1:10
img = imread( [ ‘image’ num2str(n) ‘.bmp’ ] );
pause(0.5); % execution is halted for 0.5 seconds