资源简介
输入灰度图像,RGB彩色图像会自动转换为灰度图像
输出图像的多重分形谱
参考文献:
"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
相关资源
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
- matlab识别系统
评论
共有 条评论