function dst = BEMD(src,a,b,c,d,e)
% BEMD This program calculates the Bidimensional EMD of a 2-d signal using
% the process of sifting. It is dependent on the function SIFT.
% Assigning the initial values of 'h' (data for sifting) and 'k' (imf index)
h_func = src;
k=1;
% The process of Sifting
dst=zeros(size(h_func));
% figure,imshow(orig);
while(k<5)
[imf_temp, residue_temp] = sift(h_func);
imf_matrix(:,:,k) = imf_temp; %#ok<AGROW>
k = k+1;
h_func = residue_temp;%余量图像
end
% Assigning the final residue to the last IMF index
imf_matrix(:,:,k) = residue_temp;%4个IMF图像和一个余量图像
% orig =orig-residue_temp;
% orig =imf_matrix(:,:,1)+imf_matrix(:,:,2)+imf_matrix(:,:,3);
dst =a*imf_matrix(:,:,1)+b*imf_matrix(:,:,2)+c*imf_matrix(:,:,3)+d*imf_matrix(:,:,4)+e*imf_matrix(:,:,5);
% orig =orig+h_f;
%imf_matrix(:,:,k+1)=orig;
% End of BEMD Computation
% subplot(3,2,1),imshow(cast(imf_matrix(:,:,1) ,'uint8'));
% subplot(3,2,2),imshow(cast(imf_matrix(:,:,2) ,'uint8'));
% subplot(3,2,3),imshow(cast(imf_matrix(:,:,3) ,'uint8'));
% subplot(3,2,4),imshow(cast(imf_matrix(:,:,4) ,'uint8'));
% subplot(3,2,5),imshow(cast(imf_matrix(:,:,5) ,'uint8'));
% figure(2),imshow(cast(dst ,'uint8'));
% figure,imshow(cast(imf_matrix(:,:,1) ,'int8'));
% figure,imshow(cast(imf_matrix(:,:,2) ,'int8'));
% figure,imshow(cast(imf_matrix(:,:,3) ,'int8'));
% figure,imshow(cast(imf_matrix(:,:,4) ,'int8'));
% figure,imshow(cast(imf_matrix(:,:,5) ,'int8'));
% %subplot(3,2,4),imshow(imf_matrix(:,:,4));
% % subplot(3,2,5),imshow(imf_matrix(:,:,5));
% orig=cast(orig ,'int8');
%figure,imshow(im );
% figure,imshow(orig);
end
%%
function [ h_imf residue ] = sift( input_image )
% This function sifts for a single IMF of the given 2D signal input
% Pre-processing
[len bre] = size(input_image);
x = 1:len;
y = 1:bre;
input_image_temp = input_image;
while(1)
% Finding the extrema in the 2D signal
[zmax imax zmin imin] = extrema2(input_image_temp);
[xmax ymax] = ind2sub(size(input_image_temp),imax);
[xmin ymin] = ind2sub(size(input_image_temp),imin);
% Interpolating the extrema to get the extrema suraces
[zmaxgrid , ~, ~] = gridfit(ymax,xmax,zmax,y,x);
[zmingrid, ~, ~] = gridfit(ymin,xmin,zmin,y,x);
% Averaging the extrema to get the Zavg surface
zavggrid = (zmaxgrid + zmingrid)/2;
% Computation of the h_imf (IMF for the 'h' input)
h_imf = input_image_temp - zavggrid;
% Computing IMF cost
eps = 0.00000001;
num = sum(sum((h_imf-input_image_temp).^2));
den = sum(sum((input_image_temp).^2)) + eps;
cost = num/den;
% Checking the IMF accuracy
if cost<0.2
break;
else
input_image_temp = h_imf;
end
end
% Computation of the Residue after IMF computation
residue = input_image - h_imf;
end
%%
function [xmax,imax,xmin,imin] = extrema(x)
%EXTREMA Gets the global extrema points from a time series.
% [XMAX,IMAX,XMIN,IMIN] = EXTREMA(X) returns the global minima and maxima
% points of the vector X ignoring NaN's, where
% XMAX - maxima points in descending order
% IMAX - indexes of the XMAX
% XMIN - minima points in descending order
% IMIN - indexes of the XMIN
%
% DEFINITION (from http://en.wikipedia.org/wiki/Maxima_and_minima):
% In mathematics, maxima and minima, also known as extrema, are points in
% the domain of a function at which the function takes a largest value
% (maximum) or smallest value (minimum), either within a given
% neighbourhood (local extrema) or on the function domain in its entirety
% (global extrema).
%
% Example:
% x = 2*pi*linspace(-1,1);
% y = cos(x) - 0.5 + 0.5*rand(size(x)); y(40:45) = 1.85; y(50:53)=NaN;
% [ymax,imax,ymin,imin] = extrema(y);
% plot(x,y,x(imax),ymax,'g.',x(imin),ymin,'r.')
%
% See also EXTREMA2, MAX, MIN
% Written by
% Lic. on Physics Carlos Adri醤 Vargas Aguilera
% Physical Oceanography MS candidate
% UNIVERSIDAD DE GUADALAJARA
% Mexico, 2004
%
% nubeobscura@hotmail.com
% From : http://www.mathworks.com/matlabcentral/fileexchange
% File ID : 12275
% Submited at: 2006-09-14
% 2006-11-11 : English translation from spanish.
% 2006-11-17 : Accept NaN's.
% 2007-04-09 : Change name to MAXIMA, and definition added.
xmax = [];
imax = [];
xmin = [];
imin = [];
% Vector input?
Nt = numel(x);
if Nt ~= length(x)
error('Entry must be a vector.')
end
% NaN's:
inan = find(isnan(x));
indx = 1:Nt;
if ~isempty(inan)
indx(inan) = [];
x(inan) = [];
Nt = length(x);
end
% Difference between subsequent elements:
dx = diff(x);
% Is an horizontal line?
if ~any(dx)
return
end
% Flat peaks? Put the middle element:
a = find(dx~=0); % Indexes where x changes
lm = find(diff(a)~=1) + 1; % Indexes where a do not changes
d = a(lm) - a(lm-1); % Number of elements in the flat peak
a(lm) = a(lm) - floor(d/2); % Save middle elements
a(end+1) = Nt;
% Peaks?
xa = x(a); % Serie without flat peaks
b = (diff(xa) > 0); % 1 => positive slopes (minima begin)
% 0 => negative slopes (maxima begin)
xb = diff(b); % -1 => maxima indexes (but one)
% +1 => minima indexes (but one)
imax = find(xb == -1) + 1; % maxima indexes
imin = find(xb == +1) + 1; % minima indexes
imax = a(imax);
imin = a(imin);
nmaxi = length(imax);
nmini = length(imin);
% Maximum or minumim on a flat peak at the ends?
if (nmaxi==0) && (nmini==0)
if x(1) > x(Nt)
xmax = x(1);
imax = indx(1);
xmin = x(Nt);
imin = indx(Nt);
elseif x(1) < x(Nt)
xmax = x(Nt);
imax = indx(Nt);
xmin = x(1);
imin = indx(1);
end
return
end
% Maximum or minumim at the ends?
if (nmaxi==0)
imax(1:2) = [1 Nt];
elseif (nmini==0)
imin(1:2) = [1 Nt];
else
if imax(1) < imin(1)
imin(2:nmini+1) = imin;
imin(1) = 1;
else
imax(2:nmaxi+1) = imax;
imax(1) = 1;
end
if imax(end) > imin(end)
imin(end+1) = Nt;
else
imax(end+1) = Nt;
end
end
xmax = x(imax);
xmin = x(imin);
% NaN's:
if ~isempty(inan)
imax = indx(imax);
imin = indx(imin);
end
% Same size as x:
imax = reshape(imax,size(xmax));
imin = reshape(imin,size(xmin));
% Descending order:
[~,inmax] = sort(-xmax); clear temp
xmax = xmax(inmax);
imax = imax(inmax);
[xmin,inmin] = sort(xmin);
imin = imin(inmin);
end
%%
function [xymax,smax,xymin,smin] = extrema2(xy,varargin)
%EXTREMA2 Gets the extrema points from a surface.
% [XMAX,IMAX,XMIN,IMIN] = EXTREMA2(X) returns the maxima and minima
% elements of the matriz X ignoring NaN's, where
% XMAX - maxima points in descending order (the bigger first and so on)
% IMAX - linear indexes of the XMAX
% XMIN - minima points in descending order
% IMIN - linear indexes of the XMIN.
% The program uses EXTREMA.
%
% The extrema points are searched only through the column, the row and
% the diagonals crossing each matrix element, so it is not a perfect
% mathematical program and for this reason it has an optional argument.
% The user should be aware of these limitations.
%
% [XMAX,IMAX,XMIN,IMIN] = EXTREMA2(X,1) does the same but without
% searching through the diagonals (less strict and perhaps the user gets
% more output points).
%
% DEFINITION (from http://en.wikipedia.org/wiki/Maxima_and_minima):
% In mathematics, maxima and minima, also known as extrema, are points in
% the domain of a function at which the function takes a largest value
% (maximum) or smallest value (minimum), either within a given
% neighbourhood (local extrema) or on the function domain in its entirety
% (global extrema).
%
% Note: To change the linear index to (i,j) use IND2S
没有合适的资源?快使用搜索试试~ 我知道了~
【图像分割】 FCM侧扫声呐图像分割【含Matlab源码 1478期】.zip
共37个文件
bmp:20个
m:12个
jpg:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 197 浏览量
2024-06-20
16:35:59
上传
评论
收藏 1.42MB ZIP 举报
温馨提示
Matlab领域上传的代码均可运行,亲测可用,直接替换数据即可,适合小白; 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主或扫描博客文章底部QQ名片; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作 能量泛函分割:DBSCAN、GAC水平集、snake、分水岭、 阙值分割: 特征增强分割:超像素SFFCM图像分割、关键像素点FLICM图像分割 智能算法图像分割:遗传算法、灰狼算法、人工鱼群、贝叶斯、北方苍鹰、萤火虫、和声搜索、粒子群、蚁群算法
资源推荐
资源详情
资源评论
收起资源包目录
【图像分割】 FCM侧扫声呐图像分割【含Matlab源码 1478期】.zip (37个子文件)
【图像分割】基于matlab FCM侧扫声呐图像分割【含Matlab源码 1478期】
GmrfPara_1Order_Estimat.m 858B
BEMDFCM.m 5KB
运行结果1.jpg 108KB
运行结果5.jpg 35KB
picture
6.bmp 264KB
7.bmp 21KB
16.bmp 30KB
13.bmp 38KB
8.bmp 84KB
3.bmp 107KB
4.bmp 61KB
9.bmp 14KB
15.bmp 52KB
20.bmp 100KB
10.bmp 57KB
5.bmp 193KB
1.bmp 52KB
14.bmp 71KB
12.bmp 33KB
19.bmp 54KB
17.bmp 29KB
18.bmp 27KB
2.bmp 144KB
11.bmp 68KB
GFCM.m 5KB
GmrfPara_5Order_Estimat.m 1KB
X_Gmrf_ParaG.m 2KB
FCM_.m 3KB
GmrfPara_4Order_Estimat.m 1KB
C_MEANS.m 2KB
GmrfPara_2Order_Estimat.m 959B
main.m 586B
BEMD.m 47KB
运行结果2.jpg 79KB
运行结果4.jpg 39KB
GmrfPara_3Order_Estimat.m 1KB
运行结果3.jpg 78KB
共 37 条
- 1
资源评论
Matlab领域
- 粉丝: 3w+
- 资源: 3222
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功