资源简介

图像边缘获取,自己实现的基于matlab的8邻域算法,获取图像的边缘。需要手动设置阈值对图像进行二值化。包涵实现程序和测试程序

资源截图

代码片段和文件信息

clc

close all
I = imread(‘small.bmp‘);
% I = imread(‘circle.bmp‘);

 subplot(121)
 title(‘原始图像‘);
 imshow(I)
J =rgb2gray(I);
[rc] = size(J); 
BW = zeros(rc);
 subplot(122)
imshow(J);
title(‘灰度图像‘);
figure
imhist(J)
% g = imhist(J)
% [ai]=sort(J‘descend‘) %给原数组降序排列
size(g)
th = sort(g‘descend‘);
for i = 1:r
    for j = 1:c
        if J(ij) > 70
            BW(ij) = 1;
        end
    end
end

track = eight(BW);
% hold on
% [xxyy] = find(track == 1);
% plot(yyxx‘.r‘)
figure
imshow(track)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        553  2012-08-28 17:17  eightneighborhood\ceshi.m

     文件     195896  2012-08-28 10:37  eightneighborhood\circle.bmp

     文件       2753  2012-08-28 17:15  eightneighborhood\eight.m

     文件    3000054  2012-08-11 09:26  eightneighborhood\small.bmp

    ..A.SH.      6144  2012-08-28 17:20  eightneighborhood\Thumbs.db

     目录          0  2012-08-28 17:20  eightneighborhood

----------- ---------  ---------- -----  ----

              3205400                    6


评论

共有 条评论