Skip to content

Instantly share code, notes, and snippets.

@martinmev
Created December 26, 2013 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinmev/8135398 to your computer and use it in GitHub Desktop.
Save martinmev/8135398 to your computer and use it in GitHub Desktop.
Convert image to an abstract picture
%% run in Octave:
%% source 'imgfft.m'
filename = 'image.jpg';
img = imread(filename);
img2=double(img);
img3= (img2(:,:,1)+img2(:,:,2)+img2(:,:,3))/3;
img3f = fftshift(fft2(img3));
img4f=log(abs(img3f));
minimal = min(min(img4f));
maximal = max(max(img4f));
img5f = (img4f - minimal) * (255/maximal);
img5u=uint8(img5f);
img5i=gray2ind(img5u);
imwrite(ind2rgb(img5i,prism()),strcat(filename,'.png'));
%% prism() opens a Figure window
delete(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment