資源簡介
本程序使用matlab實現了圖像HOG特征的提取,效果不錯

代碼片段和文件信息
function?hog?=?Calculate_Hog(Grad_MagGrad_Angle)
%UNtitleD2?Summary?of?this?function?goes?here
%???Detailed?explanation?goes?here
noOfBins=9;
cell_width=8;
cell_height=8;
[x?y]=size(Grad_Mag(::1));
ele=x*y/(cell_width*cell_height);
hog=double(zeros(elenoOfBins));
xpos=1;
%?for?i=cell_height:cell_height:y
%?????cnt=0;
%?????xpos=xpos+1;
%?????for?j=cell_width:cell_width:x
%????????%?xpos=i/cell_width;
%?????????
%?????????for?cell_x=i-cell_width+1:i
%?????????????for?cell_y=j-cell_height+1:j
%?????????????????if(cell_x<=x?&&?cell_y<=y)
%?????????????????ang=Grad_Angle(cell_xcell_y)*180/pi;
%?????????????????end
%?????????????????ang=uint8(ang);
%?????????????????bin=getBin(ang);
%?????????????????if(i<=x?&&?j<=y)
%?????????????????????hog(xpos+bin+cnt)=hog(xpos+bin+cnt)+Grad_Mag(ij);
%?????????????????end
%?????????????end
%?????????end
%?????????cnt=cnt+cell_width;
%?????????
%?????end
%?end
for?i=cell_width:cell_width:x
????for?j=cell_height:cell_height:y
????????for?l=i-cell_width+1:i
????????????for?m=j-cell_height+1:j
????????????????ang=Grad_Angle(lm)*180/pi;
????????????????bin=getBin(ang);
????????????????bin=bin+1;
????????????????hog(xposbin)=hog(xposbin)+Grad_Mag(lm);
????????????end
????????end
????????xpos=xpos+1;
????end
end
????????????????
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1342??2010-10-23?19:24??(MATLAB)HOGCalculator\Calculate_Hog.m
?????文件????????660??2011-03-27?11:30??(MATLAB)HOGCalculator\Gradient_calculator.m
?????文件???????6992??2011-03-27?11:12??(MATLAB)HOGCalculator\qq.jpg
?????文件?????803074??2011-03-27?11:22??(MATLAB)HOGCalculator\ddda.txt
?????文件??????14200??2004-11-09?06:29??(MATLAB)HOGCalculator\image_0058.jpg
?????目錄??????????0??2011-03-26?10:14??(MATLAB)HOGCalculator
-----------?---------??----------?-----??----
???????????????826268????????????????????6
- 上一篇:colorspace.m matlab程序
- 下一篇:基于粒子群算法的圖像聚類算法
評論
共有 條評論