基于Matlab的图像区域特征识别
标签:
matlab图像区域特征识别 |
分类: 技术文章 |
lyqmath
http://blog.sina.com.cn/lyqmath
简介
图像特征识别是经常遇到的问题之一,这里介绍一种基于图像区域属性的方法。
实例
原图:
http://s6/middle/72586626ha3b0702dde95&690
% By lyqmath
% DLUT School of Mathematical Sciences 2008
% BLOG:http://blog.sina.com.cn/lyqmath
clc; clear all; close all;
img = imread('c:\\ce.jpg');
if ndims(img) == 3
else
end
img1 = medfilt2(img1, [4, 4]);
bw = im2bw(img1, graythresh(img1));
bw = imclose(bw,strel('disk', 3));
bw = bwareaopen(bw, 500);
bw = imclearborder(bw);
bw = imclose(bw,strel('disk', 5));
L = bwlabel(bw);
stats = regionprops(L,'all');
imshow(bw);
hold on;
corn1 = stats(1).Extrema;
t1 = 2 : 2 : size(corn1, 1)
plot(corn1(t1, 1), corn1(t1, 2), 'r.', 'MarkerSize', 20);
corn2 = stats(2).Extrema;
t2 = 1 : 2 : size(corn2, 1)
plot(corn2(t2, 1), corn2(t2, 2), 'r.', 'MarkerSize', 20);
figure;
imshow(img); hold on;
plot(corn1(t1, 1), corn1(t1, 2), 'r.', 'MarkerSize', 20);
plot(corn2(t2, 1), corn2(t2, 2), 'r.', 'MarkerSize', 20);
plot(corn1(t1, 1), corn1(t1, 2), 'go', 'MarkerSize', 8);
plot(corn2(t2, 1), corn2(t2, 2), 'go', 'MarkerSize', 8);
结果
http://s14/middle/72586626ha3b098aa9f7d&690
总结
图像的阈值分割、区域属性特征信息,可以用来做特定的图像识别。

加载中…