资源简介
文献fractal analysis and multifractal spectra for the images 及其代码
文献,基于多重分形频谱分析的图像边缘检测_王耀南及其代码
代码片段和文件信息
%Name:multifractal_and_output
%Author:Jia MenghanZhejiang University
%Date: 2013/9/3
%Description:
% 输入灰度图像RGB彩色图像会自动转换为灰度图像
% 输出图像的多重分形谱
%Reference:
% “fractal analysis and multifractal spectra for the images“
%
% Prof. Artde D.K.T. Lam Ph.D
% Department of Information Communication
% Leader University
% 70901 Tainan City Taiwan
% e-mail: artde.lam@gmail.com
%
% Asso. Prof. Q. Li
% Department of Digital Media Arts
% Fuzhou University
% 350108 Fuzhou Fujian
% e-mail: fzuliqi@126.com
%
%% 设定q范围
clc;close all;
clear all;
qmin=-50.5;
qmax=50.5;
qevery=1;
%% 读取图片
[filenamepathnamefilterindex]=uigetfile(‘*.*‘‘选择要打开的图片文件‘);
filename=[pathname filename];
a = imread(filename);
% a=a(1:641:64);
[rows cols] = size(a);
if mod(log2(rows)1)>0
error(‘The size of image must be 2^n‘);
end
if size(a3)==3
a=rgb2gray(a);
end
figure;imshow(a);title(‘原始灰度图片‘);
npix = sum(sum(a));
%% 计算L*L大的盒子的nL 即Zij
%calculates niL which is the number of pixels in the ith box of size L
% ideas from boxcount.m by F. Moisy have been borrowed here
width = rows;
p = log(width)/log(2);
max_boxes = power(rows2)/power(22);
nL = double(zeros(max_boxesp)); %nl每一列为每个分块叠加的值,行为分的块数边长每次*2
for g=(p-1):-1:0
siz = 2^(p-g); %每个盒子像素点数
sizm1 = siz - 1;
index = log2(siz); %为nl的列数
count = 0; %为nl的行数 count=(i-1)*每条边盒子数+j
for i=1:siz:(width-siz+1)
for j=1:siz:(width-siz+1)
count = count + 1;
sums = sum(sum(a(i:i+sizm1j:j+sizm1)));
nL(countindex) = sums;
end
end
end
%% 计算横坐标ln(epsilon)即logl
epsilon = zeros(p-11); %eps的横坐标
for l=1:p-1
epsilon(l)=power(2l)/width;
end
logl=log(epsilon);
%% 规范化质量,像素点数除以总像素点数,即Pij
%normalized masses
pL = double(zeros(max_boxesp)); %pL即pij
for l=1:p %l=1时分成2*2的盒子
nboxes = power(rows2)/power(power(2l)2); %所有的盒子数
norm = sum(nL(1:nboxesl));
for i=1:nboxes
pL(il) = nL(il)/norm;
end
end
%% 计算绘图所用所用参数
%falpha alpha
qval = qmin:qevery:qmax;
fql = zeros(p-1size(qval2));
aql = zeros(p-1size(qval2));
Xq = zeros(p-1size(qval2)); %用来储存Xq,行数为p,列数为分形盒子的次数q
for l=1:p-1
count = 0;
nboxes = power(rows2)/power(power(2l)2); %所有的盒子数
for q = qmin:qevery:qmax
%denominator of muiql
qsum = 0.0;
for i=1:nboxes
if(pL(il) ~= 0)
qsum = qsum + power(pL(il)q);
end
end
fqnum = 0.0;
aqnum = 0.0;
smuiqL = 0.0;
for i=1:nboxes
if(pL(il) ~= 0)
muiqL = power(pL(il)q)/qsum;
fqnum = fqnum + (muiqL * log(muiqL));
aqnum = aqnum + (muiqL * log(pL(il)));
smuiqL = smuiqL + muiqL;
end
end
if(uint8(smuiqL)~=1)
display(‘error‘);
end
count = count + 1;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 126531 2017-12-13 10:36 多重分形文章与代码\Lam\fractal analysis and multifractal spectra for the images.pdf
文件 4313 2017-12-13 10:37 多重分形文章与代码\Lam\multifractal_and_output.m
文件 315429 2017-12-06 22:51 多重分形文章与代码\王耀南\1.基于多重分形频谱分析的图像边缘检测_王耀南.pdf
文件 1412 2017-12-13 10:33 多重分形文章与代码\王耀南\fractal.m
目录 0 2017-12-13 10:37 多重分形文章与代码\Lam
目录 0 2017-12-13 10:34 多重分形文章与代码\王耀南
目录 0 2017-12-13 10:37 多重分形文章与代码
----------- --------- ---------- ----- ----
447685 7
评论
共有 条评论