资源简介
各种基于形状特征的检索方法都可以比较有效地利用图像中感兴趣的目标来进行检索,本代码是用matlab写的,亲测有效
代码片段和文件信息
function shape_recognition_demo1
try
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
workspace; % Make sure the workspace panel is showing.
fontSize = 15;
% For reference compute the theoretical circularity of a bunch of regular polygons
% with different number of sides starting with 3 (triangle).
dividingValues = PlotTheoreticalCircularity;
% Make the last dividing value infinity because any circularity from .99999 up to inifinity should be a circle.
% and sometimes you have a circularity more than 1 due to quantization errors.
dividingValues(end) = inf;
% Now create a demo image.
[binaryImage numSidesCircularity] = CreateDemoImage();
% Count the number of shapes
[~ numShapes] = bwlabel(binaryImage);
% Display the polygon demo image.
subplot(1 2 1);
imshow(binaryImage);
caption = sprintf(‘Image with %d Shapes‘ numShapes);
title(caption ‘FontSize‘ fontSize);
hold on; % So that text labels won‘t blow away the image.
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf ‘Units‘ ‘Normalized‘ ‘OuterPosition‘ [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf ‘Toolbar‘ ‘none‘ ‘Menu‘ ‘none‘);
% Give a name to the title bar.
set(gcf ‘Name‘ ‘Demo by ImageAnalyst‘ ‘Numbertitle‘ ‘Off‘)
drawnow; % Make it display immediately.
[labeledImage numberOfobjects] = bwlabel(binaryImage);
blobMeasurements = regionprops(labeledImage ‘Perimeter‘ ‘Area‘ ‘Centroid‘ ‘Image‘);
% Now compute the number of vertices by looking at the number of peaks in a plot of distance from centroid.
numSidesDistance = FindNumberOfVertices(blobMeasurements labeledImage);
% Get all the measurements into single arrays for convenience.
allAreas = [blobMeasurements.Area];
allPerimeters = [blobMeasurements.Perimeter];
circularities = (4 * pi * allAreas) ./ allPerimeters.^2
% Sort in order of increasing circularity
[sortedCircularities sortOrder] = sort(circularities ‘Ascend‘);
% Sort all the measurements in the same way.
blobMeasurements = blobMeasurements(sortOrder);
allAreas = allAreas(sortOrder);
allPerimeters = allPerimeters(sortOrder);
numSidesDistance = numSidesDistance(sortOrder);
% Plot a bar chart of the circularities.
subplot(1 2 2);
bar(sortedCircularities);
ylim([0.55 1.1]);
grid on;
title(‘Actual Measured Circularities‘ ‘FontSize‘ fontSize);
% Let‘s compute areas a different way. The “Area“ returned by regionprops is a count of the number of pixels.
% This sometimes overestimates the area. Let‘s use bwarea which computes the area on a
% pixel-center to pixel center basis.
for k = 1 : numberOfobjects
thisBlob = blobMeasurements(k).Image;
allBwAreas(k) = bwarea(thisBlob);
end
bwCircularities = (4 * pi * allBwAreas) ./ allPerimeters.^2
sortedCircularities = bwCircularities
% Put up red horizontal line
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 21361 2018-03-28 15:25 形状特征提取\shape_recognition_demo1.m
文件 21361 2018-03-28 15:26 形状特征提取\shape_recognition_demo2.m
目录 0 2018-03-28 15:53 形状特征提取
----------- --------- ---------- ----- ----
42722 3
相关资源
- matlab代码_小波矩特征提取
- 心电特征提取程序
- matlab实现图像边缘检测、图像分割、
- 轴承故障分析
- LBP(局部二值模式)特征提取
- 独立分量ICA图像特征提取程序和图片
- SVM的手写数字识别(Handwriting recogni
- 高斯混合模型(GMM)
- LBP特征提取的MATLAB实现
- 时域、频域特征提取
- 振动信号频域特征提取算法
- hog特征提取matlab实现
- 希尔伯特包络谱matlab
- 小波包特征提取
- 表面肌电sEMG特征提取的Matlab程序
- ECG特征提取
- MATLAB图像纹理特征提取代码
- Haar-like特征提取功能
- 图像SURF特征提取(SURF extraction)
- 提取图像纹理特征值
- image-texture-features 图像纹理特征提取
- sift sift 特征提取算法matlab实现
- wenli 分析了纹理特征提取方法
- DoGfilters DOG高斯差分实现物体识别中的
- PCA_SVM 此方法采用经典的PCA对人脸图像
- pca_knn 本方法采用pca进行特征提取
- pca 主成分分析程序
- Harris.rar 特征提取是图像配准的重要步
- hao 调制识别全过程
- tezheng 本人找到的非常好的几何特征提
评论
共有 条评论