资源简介
图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测图像边缘检测
代码片段和文件信息
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基于分水岭图像分割算法
- meanshift图像分割代码
- 基于神经网络的边缘检测
- Log和Canny边缘检测算子
- Graphcut-源码及实现
- 利用基于直方图的自适应阈值方法实
- 基于改进PSO算法的最大熵阈值图像分
- 基于Mumford-Shah模型的水平集图像分割
- 基于交叉熵阈值法的快速迭代算法
- PSO算法的最大熵阈值图像分割
- 几种图像分割算法在CT 图像分割上的
- 三种方法实现图像的分割含程序源码
- 图像分割+GUI
- 基于FPGA的sobel边缘检测
- 实现图像分割的grabcut代码
- 图像分割的源代码资源
- 三维Otsu图像分割算法
- U-Net:用于生物医学图像分割的卷积网
- 改进的细菌觅食优化算法用于双阈值
- 基于Log算子的边缘检测
- Normalized Cut图像分割
- 图像分割算法研究综述
- 3.25 基于脉冲耦合神经网络的图像分割
- 3.24 基于蚁群算法的图像边缘检测.r
- 基于格林函数边缘检测的焊缝信息获
- sobel边缘检测verilog实现.zip
- 基于边缘和区域信息的水平集SAR图像
- 图像分割ncut代码
- FCN Caffe Net
评论
共有 条评论