资源简介
蚁群算法用于图像边缘检测,matlab程序,非常经典,测试通过的。

代码片段和文件信息
function func_ant_colony_image_edge_detection
%
%
% This is a demo program of image edge detection using ant colony based on
% the paper “An Ant Colony Optimization Algorithm For Image Edge
% Detection“ IEEE Congress on Evolutionary Computation (CEC) pp. 751-756 Hongkong
% Jun. 2008.
%
%
%
% Input:
% gray image with a square size
%
% Output:
% four edge map images which are obtained by the method using four functions
% respectively.
%
% image loading
filename = ‘camera128‘;
img = double(imread([filename ‘.bmp‘]))./255;
[nrow ncol] = size(img);
%visiblity function initialization see equation (4)
for nMethod = 1:4;
%Four kernel functions used in the paper see equations (7)-(10)
%E: exponential; F: flat; G: gaussian; S:Sine; T:Turkey; W:Wave
fprintf(‘Welcome to demo program of image edge detection using ant colony.\nPlease wait......\n‘);
v = zeros(size(img));
v_norm = 0;
for rr =1:nrow
for cc=1:ncol
%defination of clique
temp1 = [rr-2 cc-1; rr-2 cc+1; rr-1 cc-2; rr-1 cc-1; rr-1 cc; rr-1 cc+1; rr-1 cc+2; rr cc-1];
temp2 = [rr+2 cc+1; rr+2 cc-1; rr+1 cc+2; rr+1 cc+1; rr+1 cc; rr+1 cc-1; rr+1 cc-2; rr cc+1];
temp0 = find(temp1(:1)>=1 & temp1(:1)<=nrow & temp1(:2)>=1 & temp1(:2)<=ncol & temp2(:1)>=1 & temp2(:1)<=nrow & temp2(:2)>=1 & temp2(:2)<=ncol);
temp11 = temp1(temp0 :);
temp22 = temp2(temp0 :);
temp00 = zeros(size(temp111));
for kk = 1:size(temp111)
temp00(kk) = abs(img(temp11(kk1) temp11(kk2))-img(temp22(kk1) temp22(kk2)));
end
if size(temp111) == 0
v(rr cc) = 0;
v_norm = v_norm + v(rr cc);
else
lambda = 10;
switch nMethod
case 1%‘F‘
temp00 = lambda .* temp00;
case 2%‘Q‘
temp00 = lambda .* temp00.^2;
case 3%‘S‘
temp00 = sin(pi .* temp00./2./lambda);
case 4%‘W‘
temp00 = sin(pi.*temp00./lambda).*pi.*temp00./lambda;
end
v(rr cc) = sum(sum(temp00.^2));
v_norm = v_norm + v(rr cc);
end
end
end
v = v./v_norm; %do normalization
v = v.*100;
% pheromone function initialization
p = 0.0001 .* ones(size(img));
%paramete setting see Section IV in CEC paper
alpha = 1; %equation (4)
beta = 0.1; %equation (4)
rho = 0.1; %equation (11)
phi = 0.05; %equation (12) i.e. (9) in IEEE-CIM-06
ant_total_num = round(sqrt(nrow*ncol));
ant_pos_idx = zeros(ant_total_num 2); % record the location of ant
% initialize the positions of ants
rand(‘s
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 17462 2003-03-28 16:53 ant_colony_image_edge_detection\camera128.bmp
文件 17462 2009-04-03 18:41 ant_colony_image_edge_detection\camera128_edge_aco_1.bmp
文件 17462 2009-04-03 18:42 ant_colony_image_edge_detection\camera128_edge_aco_2.bmp
文件 17462 2009-04-03 18:43 ant_colony_image_edge_detection\camera128_edge_aco_3.bmp
文件 17462 2009-04-03 18:45 ant_colony_image_edge_detection\camera128_edge_aco_4.bmp
文件 12128 2008-09-04 16:51 ant_colony_image_edge_detection\func_ant_colony_image_edge_detection.m
文件 43 2009-05-25 21:24 ant_colony_image_edge_detection\Unti
目录 0 2009-06-13 18:33 ant_colony_image_edge_detection
----------- --------- ---------- ----- ----
99481 8
相关资源
- 图像降噪Matlab代码
- 8916_msimage.mbn
- image normalization图像归一化matlab程序
- BM3D matlab
- HDR_image-master MATLAB仿真程序
- image fusion tools
- IMAGE_MATLAB_GUI
- Deblurring Images Matrices Spectra and Filteri
- _image fusion(精品.zip
- matlab开发-Poissonimageediting
- BM3D滤波算法+BM3D_image,可实现
- digital image correlation
- Antenna Theory Analysis and Design(源码)
- Biosignal and biomedical image processing matl
- HDR_image-master MATLAB 仿真程序 包含多张
- kmeans图像分类
- Image Deformation Using Moving Least Squaresma
- matlab开发-Image2Data
- Image Deformation Using Moving Least Squares 移
- MATLAB实现灰度处理
- Quaternion and Octonion Color Image Processing
- [实用Matlab图像与视频处理][ocr_exampl
- Gonzalez_2009_Digital Image Processing Using M
- 数字图像处理MATLAB版第二版配套资源
- 图像分割的matlab算法
- Rectangling Panoramic Images via Warping论文的
- Digital Image Processing Using Matlab_2ed_Gonz
- SAR图像分类识别
- 基于MATLAB的金属表面缺陷分类与测量
- 检测、估计和调制理论 (卷I+卷Ⅱ+卷
评论
共有 条评论