说明
翻了百度一圈,全是要代币买的代码,用谷歌一搜就搜出来了开源的,实在无语,代码如下,有帮助的话点个赞~
Code
% function to calculate Spatial Frequency. Calculations are from
% Li, S., Kwok, J. T., & Wang, Y. (2001). Combination of images with diverse focuses using the spatial frequency. Information fusion,
% Eskicioglu, A. M., & Fisher, P. S. (1995). Image quality measures and their performance. IEEE
% contact: alp.durmus@sydney.edu.au
function SF = SpatialFrequency(filename_image)
RGB = imread(filename_image);
% convert image to greyscale if its not b&w already
if size(RGB,3) ~= 1
I = rgb2gray(RGB);
else
I=RGB;
end
% convert image to double type. necesarry for sqrt function
I2 = im2double(I);
figure
imshow(I2)
% M=number of rows; N=number of columns in the image
M= size(I2,1);
N= size(I2,2);
% calculate