資源簡介
這是圖像處理課程的作業,對圖片進行邊緣檢測和特征提取,這是我自己實現的MATLAB源代碼。
代碼片段和文件信息
clc;?clear?all;?close?all;
I?=?imread(‘Pictures/apple.jpg‘);
I1?=?rgb2hsv(I);
I1?=?I1(:?:?2);
I1?=?im2bw(I1);
I1?=?imfill(I1?‘holes‘);
se?=?strel(‘disk‘3);
I1?=?imopen(I1?se);
L?=?bwlabel(I1);
stats?=?regionprops(L?‘Area‘?‘EquivDiameter‘);
area1?=?[];
for?i?=?1?:?length(stats)
????area1?=?[area1?stats(i).Area];
end
[a1?ind]?=?max(area1);
ti?=?find(L==ind);
I1?=?zeros(size(I1));
I1(ti)?=?1;
I1?=?cat(3?I1?I1?I1);
I1?=?uint8(double(I1(:))?.*?double(I(:)));
I1?=?reshape(I1?size(I));
figure;
imshow(I1);
circle?=?stats(i).EquivDiameter;
str?=?sprintf(‘蘋果周長為%.3f‘?pi*circle);
text(1?50?str?‘FontSize‘?12?‘Color‘?‘w‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????667??2014-12-17?20:21??邊緣檢測特征提取\ApplePerimeter.m
?????文件????????527??2014-12-17?20:28??邊緣檢測特征提取\CharacterExtracting.m
?????文件???????2971??2014-12-16?19:57??邊緣檢測特征提取\EdgeDetection.m
?????文件????????582??2014-12-16?20:21??邊緣檢測特征提取\MatlabEdge.m
?????文件????1231838??2010-10-30?17:10??邊緣檢測特征提取\Pictures\10_m02.tif
?????文件????1231838??2010-10-30?17:10??邊緣檢測特征提取\Pictures\22_m03.tif
?????文件????1231838??2010-10-30?17:11??邊緣檢測特征提取\Pictures\4_m03.tif
?????文件????1231838??2010-10-30?17:11??邊緣檢測特征提取\Pictures\5_m01.tif
?????文件??????14038??2014-12-17?20:19??邊緣檢測特征提取\Pictures\apple.jpg
?????文件?????636928??2014-12-21?11:44??邊緣檢測特征提取\圖像邊緣檢測和特征提取實驗報告.doc
?????文件??????28417??2014-12-17?20:26??邊緣檢測特征提取\實驗效果圖\ApplePerimeter.jpg
?????文件??????93362??2014-12-17?22:19??邊緣檢測特征提取\實驗效果圖\CharacterExtracting.jpg
?????文件??????81782??2014-12-16?19:57??邊緣檢測特征提取\實驗效果圖\EdgeDetection?(1).jpg
?????文件?????103854??2014-12-16?19:53??邊緣檢測特征提取\實驗效果圖\EdgeDetection?(2).JPG
?????文件??????97546??2014-12-16?19:48??邊緣檢測特征提取\實驗效果圖\EdgeDetection?(3).JPG
?????文件??????87680??2014-12-16?19:50??邊緣檢測特征提取\實驗效果圖\EdgeDetection?(4).JPG
?????文件??????76936??2014-12-17?20:30??邊緣檢測特征提取\實驗效果圖\MatlabEdge.jpg
?????目錄??????????0??2015-03-08?09:39??邊緣檢測特征提取\Pictures
?????目錄??????????0??2015-03-08?09:39??邊緣檢測特征提取\實驗效果圖
?????目錄??????????0??2015-03-08?09:39??邊緣檢測特征提取
-----------?---------??----------?-----??----
??????????????6152642????????????????????20
- 上一篇:蟻群聚類算法
- 下一篇:單相逆變器的PI控制
評論
共有 條評論