Saturday, December 28, 2013

Solving a set of linear equations and finding the echelon form using MATLAB (LU or LR Factorization)

% factorization  of a set of n equations n unknowns...
% u + v + w = 6
% u + 2v + 2w = 11
% 2u + 3v - 4w = 3

A = [1 1 1 6; 1 2 2 11; 2 3 -4 3]
[L U] = lu(A);

% U contains the echelon form, or the upper triangular matrix.

U =

    2.0000    3.0000   -4.0000    3.0000
         0        0.5000    4.0000    9.5000
         0         0            7.0000   14.0000

Tuesday, June 25, 2013

VL_SLIC gives disjointed superpixels!!! Is it a bug?


I used vl_slic to oversegment the following image.
I tried both using the RGB image and LAB image for superpixel segmentation.
Strangely, I find some superpixels which are disconnected regions, instead of whole regions!! I do not know why, if it is a bug in my own way of giving inputs or it is an actual bug.

Here is my command for segmentation:

% Read the RGB image
fileName = [num2str(imgInd) '_rgb'];
load(sprintf(imgFile, imgInd),'imgRgb');
rgbImg = im2double(imgRgb);

% % For LAB colorspace
 regionSize  = 30; %25 ;
 regularizer = 30; %50;
 imglab =  vl_xyz2lab(vl_rgb2xyz(single(img))) ;
 structSuperpix(1).segments = vl_slic(single(imglab), regionSize, regularizer);

% For RGB colorspace
regionSize  = 25;%30;
regularizer = 0.008;%0.01;
structSuperpix(1).segments = vl_slic(single(img), regionSize, regularizer);

The input Image:

 

Broken superpixel  using LAB image:

















Broken superpixel  using RGB image:



Moreover, I need to provide different values of regularizer for equivalent shaped superpixels. Superpixels obtained with LAB colorspace appear more irregular than that using RGB colorspace.

What might be the reason?