Archive for June, 2017

Read animated gif and convert to rgb frames

Wednesday, June 14th, 2017

Matlab’s built in imread (as of 2017) doesn’t load animated gifs correctly. You can fix this by changing the line:

map = info.ColorTable;

in /Applications/MATLAB_R2017a.app/toolbox/matlab/imagesci/private/readgif.m with

map = reshape([info(:).ColorTable],[],3,n);

For a single frame indexed image you can use ind2rgb to convert to an rgb image. To do this on entire animated gif. You can use an arrayfun for-loop hack:

[X,M] = imread('input.gif');
Y = cell2mat(permute(arrayfun(@(C) ind2rgb(X(:,:,:,C),M(:,:,C)),1:size(X,4),'UniformOutput',false),[1 4 3 2]));

Update:

Use this instead:

map = zeros(0,3,n);
for j = 1:n
  map(1:size(info(j).ColorTable,1),:,j) = info(j).ColorTable;
end

Project page for “Generalized Matryoshka: Computational Design of Nesting Objects”

Wednesday, June 14th, 2017

This April I had fun working on a little project that’s been tickling my mind for a while. Can you make any shape into a Matryoshka doll?

I’ll be presenting my paper on this at SGP 2017. It’s entitled
Generalized Matryoshka: Computational Design of Nesting Objects.

Pause (and then resume) Battery-Guzzling programs

Wednesday, June 7th, 2017

My laptop battery dies quickly these days. Certain apps (cough, cough, Slack), have very high idle CPU-usage. You can pause these programs with

killall -STOP Slack

And later you can resume the application with

killall -CONT Slack