资源简介
蚁群算法用于图像边缘检测,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图像拼接
- 蚁群算法求函数最值
- 图像处理/图像分割实验/(自动)阈值
- DLM_constant_delta.m
- 图像去噪的matlab代码
- ssim.m结构相似性代码matlab
- 图像滤波Matlab代码
- Artificial bee colony,ABC,人工蜂群算法
- sfla
- Image_Steg
- image2data 曲线坐标提取
- T01S30P04
- RSIHE RSIHE算法(Recursive sub-image histog
- final-report-n-ppt
-
Matlab ba
sed DIC code Version 1 130814 - Color transfer between images 非常经典的彩
- image-forgery-with-siftand-ransac
- 人工蜂群算法优化无刷直流电机PID控
- 仿生图像增强法(image enchance)
- 图像质量评价(image quality)代码
- 基于字典学习的语音增强中字典更新
- 矩阵变换器永磁同步电机矢量控制
- Quantum GABP 自适应量子遗传算法优化
- matlab 用于核pca(KPCA)的库函数
- 图像的灰度直方图计算Matlab代码一
- matlab2017a的imageLabeler标注后的roi区域裁
- 利用Matlab提取图片中的数据pdf+源码
-
imageLabeler标记工具txt或者xm
l与matl - 基于TV模型的image inpainting算法
- BLS-GSM matlab
评论
共有 条评论