HFE truecolor HOWTO: m-file s-by-s decomposition m-file: imsharpenrgb.m Basics see clhowto1_1.html clear all % input parametrs:
n = 5; Do = 50; %load image
imrgb = imread('Pevnost_na_skalergb.jpg'); %size of image [im_height,im_width,rgbext] = size(im); %euclidean distance matrix
[U,V] = rc2uv(im_height,im_width); %generate butterworth filter from euclidean distance matrix H = 1./(1+(D./Do).^(2*n)); %high pass H = 1-H; A = ones(im_height,im_width); HPE = a.*A + b.*H; %spectrum of the rgb image, can by done with single matrix(:,:,1..3) but who cares? this is clear, straight
IMr = fftshift(fft2(im(:,:,1))); %filter image with lowpass butterw (matrix dot product)
IMFr= IMr.*HPE;
%image reconstruction from spectra IMF (inverse fft)
imfr = real(ifft2(fftshift(IMFr)));
%saturation (0,1), Truecolor CData imshow requires (0..1) values
%example: A = imfrs=imfr; imfrs(any(imfr>0.999,3)) = 1; imfrs(any(imfr<0.001,3)) = 0; imfgs=imfg; imfgs(any(imfg>0.999,3)) = 1; imfgs(any(imfg<0.001,3)) = 0; imfbs=imfb; imfbs(any(imfb>0.999,3)) = 1; imfbs(any(imfb<0.001,3)) = 0; %allocate mem and generate RGB matrix
imf = ones(im_height,im_width,3); %details, comment % if 0
if 0 %print butter filter
figure(2); %whole fullscale
figure(3); |