Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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