资源简介
图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测

代码片段和文件信息
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 camera128.bmp
文件 12039 2008-08-09 11:13 func_ant_colony_image_edge_detection.m
相关资源
- 基于OpenCV的数字识别468815
- 小波模极大值边缘检测
- 带式输送机托辊红外图像分割与定位
- 基于libsvm的图像分割代码
- 综合Canny法与小波变换的边缘检测方法
- 基于朴素贝叶斯分类法的图像分割
- 复杂背景与天气条件下的棉花叶片图
- 舌图像分割
- 图像分割方法在遥感图像分析中的应
- 基于彩色图像的Canny边缘检测算法
-
Accurate subpixel edge location ba
sed on pa - 图像分割算法研究区域分割,数学形
- 基于图切算法的交互式图像分割技术
- 纹理图像分割论文+代码
- Dence CRF 条件随机场图像分割
- FPGA边缘检测
- 图像分割-章毓晋
- 改进的自适应阈值Canny边缘检测
- Matalb图像分割边缘检测算子比较
- 交互式图像分割——算法与系统
- ITK入门教程_医学图像分割与配准_高清
- FPGA实现sobel图像边缘检测,VGA显示
- 机器视觉教材包括边缘检测二值图像
- 边缘和轮廓提取代码
- Canny算子分割遥感影像
- 分水岭图像分割算法C++程序源代码
- 基于形态学的图像分割 图片版
- CrackForest数据集
- 使用Visual Studio+OpenCV进行的Susan算子边
- 基于粒子群优算法的最大熵多阈值图
评论
共有 条评论