Archive for the ‘Uncategorized’ Category

Matlab imresize with bilinear methods computes different result than bilinear interpolation

Thursday, May 12th, 2016

Strangely, it seems that matlab’s builtin function imresize does not reproduce the usual bilinear interpolation.

Let’s consider a toy 4×4 image:

F = matrixnormalize(magic(4));

input image

BF = imresize(F,[256 256],'bilinear');

imresize bilinear

Compare that to explicitly computing the bilinear interpolation:

[X,Y] = meshgrid(1:size(F,2),1:size(F,1));
[BX,BY] = meshgrid(linspace(1,size(F,2),size(BF,2)),linspace(1,size(F,1),size(BF,1)));
BF2 = interp2(X,Y,F,BX,BY,'bilinear');

imresize bilinear

The difference is obvious in the corners and along the edges. The imresize result has some flat (piecewise constant) patches). Why? It actually looks as if the image was padded by repeated values before upsampling.

Purge big files (and their version history) from a git repository

Wednesday, December 23rd, 2015
  1. fork the repo (e.g. using github web interface) and never touch the original again until confident that everything below worked
  2. clone fork
  3. cd fork
  4. git rm all big files
  5. git commit -m “removed big files”
  6. bfg –strip-blobs-bigger-than 20K .
  7. git reflog expire –expire=now –all && git gc –prune=now –aggressive
  8. git push origin –force master

Verify (e.g. on github website) that both repositories look as expected.