资源简介
通过鼠标选择所需检测点,然后将离检测点最近的外边缘框出。

代码片段和文件信息
clear all
I = imread(‘1.jpg‘);
im = rgb2gray(I);
figure(1)
imshow(I‘border‘‘tight‘‘initialmagnification‘‘fit‘);
axis normal
% x=800;y=1000;
[yxbutton] = ginput(1);
thresh = graythresh(im);
im2 = im2bw(imthresh);
im = double(im);
u = (im/thresh).^2;
ft = find(im>thresh);
ma = max(im(:));
u(ft) = ((ma-im(ft))/(ma-thresh)).^2;
% imshow(uint8(im));
r = 4;
temp = u;
[hl] = size(im);
uc = 0.99;
if r>=2
for k = 1:r
for i = 1:h
for j = 1:l
if temp(ij) <= uc
temp(ij) = temp(ij).^2/uc;
else
temp(ij) = 1-(1-temp(ij).^2)/(1-uc);
end
end
end
end
end
X1 = thresh*sqrt(temp);
X1(ft) = ma-sqrt(temp(ft))*(ma-thresh);
X2 = X1-min(X1(:));
f = edge(uint8(X2)‘canny‘);
f = imfill(f‘hole‘);
str = strel(‘disk‘5);
ima = imdilate(fstr);
ima = imerode(imastr);
ima = bwareaopen(ima300);
x = fix(x);
y = fix(y);
if(ima(xy)==0)
ima = ~ima;
end
[Lm]= bwlabel(ima8);
ima_temp = zeros(hl);
mm = L(xy);
ft = find(L==mm);
ima_temp(ft) = 1;
ima_temp = imfill(ima_temp‘hole‘);
xx = bwperim(ima_temp);
count = 0;
xi = cell(1);
yi = cell(1);
for i=1:h
for j=1:l
if xx(ij)==1;
count = count+1;
xi{1}(count) = i;
yi{1}(count) = j;
end
end
end
xx = xi{1}(:);
yy = yi{1}(:);
imshow(I);
hold on
% xx = [xx(:);xx(1)];
plot([yy;yy(1)][xx;xx(1)]‘.r‘)
% if m~=0
% for ii=1:m
% rectangle(‘position‘status(ii).BoundingBox‘edgecolor‘‘r‘);
% end
% end
% for i = 1:500
% rectangle(‘Position‘[x-i/2y-i/2ii]‘curvature‘[00]‘edgecolor‘‘r‘);
% end
% px = fix(x);
% py_but = fix(y);
% py_top = fix(y);
% while(1)
% if f(pxpy_top)~=1
% py_top = py_top-1;
% elseif py_top ==0
% break;
% else
% break;
% end
% end
% while(1)
% if f(pxpy_but)~=1
% py_but = py_but-1;
% elseif py_but ==l
% break;
% else
% break;
% end
% end
% figure(1)
% imshow(ima);
% hold on
%
% plot(py_toppy_but‘r‘);
% a=cell(1);
% b =cell(1);
% count = 1;
% ed=[-1 -1;0 -1;1 -1;1 0;1 1;0 1;-1 1;-1 0]; %从左上角像素,逆时针搜索
% imgn=zeros(hl); %边界标记图像
% imgn(pxpy) = 2;
% while(1)
% a{1}(count) = px;
% b{1}(count) = py;
%
% for k = 1:8
% tmpi = a{1}(count)+ed(k1); %八邻域临时坐标
% tmpj = b{1}(count)+ed(k2);
% if f
% end
% count = count+1;
% end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 384520 2016-01-21 10:19 1.jpg
文件 429044 2016-01-21 10:20 10.jpg
文件 239889 2016-01-21 10:19 3.jpg
文件 239889 2016-01-21 10:19 5.jpg
文件 223057 2016-01-21 10:20 6.jpg
文件 384520 2016-01-21 10:20 9.jpg
文件 2468 2016-02-27 09:26 bianyuan.m
相关资源
- 串行级联cpm系统MATLAB仿真
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
评论
共有 条评论