HFE grayscale HOWTO: m-file s-by-s decomposition m-file: imsharpen.m Basics see clhowto1_1.html clear all
% input HFE parameters
n = 2; Do = 5; %load image, convert into float: double precision, already converted into grayscale, you can use rgb2gray()
imrgb = imread('Pevnost_na_skaleg.jpg'); %size of image, picture must be same in height and width (square fot fft); not resolved at this time [im_height,im_width] = size(im); %euclidean distance matrix, butterworth high-pass, see clhowto1_1.html
[U,V] = rc2uv(im_height,im_width); %high pass = 1-high pass, wonderful! :-) H = 1-H; % one can need im_height,im_width matrix A of ones! A = ones(im_height,im_width); % an here "ones" A is used for HFE: gain_a*A + gain_highpass*H HPE = a.*A + b.*H; %spectrum of image, details see clhowto1_1.html IM = fftshift(fft2(im)); %filter image with HFE (matrix dot product) IMF=IM.*HPE; %image reconstruction from spectra IMF (inverse fft) imf = ifft2(fftshift(IMF)); %comment % if 0 if you want to see details.
if 0 %print butter filter and original... hope you know that how to do. mesh() is pretty plot for g(u,v) functions
figure(2);
colormap jet; colorbar; %writefile (png, 16bit grayscale): imwrite(imf,'out.png','png','BitDepth',16); |