Skip to content

Instantly share code, notes, and snippets.

@JorgeGT
Last active April 4, 2017 05:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JorgeGT/1da63221e99265d26dfda4ec23bf312b to your computer and use it in GitHub Desktop.
Save JorgeGT/1da63221e99265d26dfda4ec23bf312b to your computer and use it in GitHub Desktop.
%% Init
clear all
close all
%!cp -v ~/place/spacescience.tech/place/img/1*.png ~/place
%% Import data and sum
files = dir('1*.png');
image = imread(files(1).name);
chnum = zeros(1e3,1e3);
for i = 2:length(files)
if mod(i,5) == 0
disp([num2str(round(i/length(files)*100,2)) '% completed'])
end
imori = int16(image);
image = int16(imread(files(i).name));
difference = abs(double(logical(image-imori)));
if sum(sum(difference)) < 1000 % delete frames with colormap changes
chnum = chnum + difference;
end
end
%% Plot
figure('Position',[0 0 1000,1000],'Visible','off')
imagesc(chnum)
axis equal
axis off
colormap(inferno(700)) % needs https://es.mathworks.com/matlabcentral/fileexchange/51986-perceptually-uniform-colormaps
caxis([0 20]) % rounded up from prctile(chnum(:),[2 98])
c = colorbar('southoutside');
c.FontSize = 6;
c.Label.String = '\bfActivity (recorded color changes)';
c.Position = c.Position .* [0.9 0.9 0.3 0.3];
export_fig ~/Dropbox/out_3 -png -r300 % needs https://github.com/altmany/export_fig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment