haar 特征计算
2015-09-15 21:26
288 查看
function haar = AdaBoost_haar(m, n)
% 在m*n检测窗口中遍历符合(s, t)条件矩形特征,包括(1, 2), (2, 1), (1, 3), (3, 1), (2, 2)
% 对20*20检测窗口而言,共有78460个符合上述矩形特征的haar结构
% m: 检测窗口列数
% n: 检测窗口行数
% haar(s, t, x_lu, y_lu, x_rd, y_rd)
% 参考《基于adaboost算法的人脸检测技术》(P.7)
N = 0;
haar = zeros(1,6);
for Num = 1:5
switch Num
case 1
s=1; t=2; % (1, 2)矩形特征
case 2
s=2; t=1; % (2, 1)矩形特征
case 3
s=1; t=3; % (1, 3)矩形特征
case 4
s=3; t=1; % (3, 1)矩形特征
case 5
s=2; t=2; % (2, 2)矩形特征
end
for x_lu = 1:m-s+1
for y_lu = 1:n-t+1
P = floor((m-x_lu+1)/s); % 向下取整
Q = floor((n-y_lu+1)/t); % 向下取整
for i = 1:P
for j = 1:Q
N = N +1;
haar(N,:) = [s, t, x_lu, y_lu, x_lu+i*s-1, y_lu+j*t-1];
end
end
end
end
end
function haar = AdaBoost_haar(m, n)
% 在m*n检测窗口中遍历符合(s, t)条件矩形特征,包括(1, 2), (2, 1), (1, 3), (3, 1), (2, 2)
% 对20*20检测窗口而言,共有78460个符合上述矩形特征的haar结构
% m: 检测窗口列数
% n: 检测窗口行数
% haar(s, t, x_lu, y_lu, x_rd, y_rd)
% 参考《基于adaboost算法的人脸检测技术》(P.7)
N = 0;
haar = zeros(1,6);
for Num = 1:5
switch Num
case 1
s=1; t=2; % (1, 2)矩形特征
case 2
s=2; t=1; % (2, 1)矩形特征
case 3
s=1; t=3; % (1, 3)矩形特征
case 4
s=3; t=1; % (3, 1)矩形特征
case 5
s=2; t=2; % (2, 2)矩形特征
end
for x_lu = 1:m-s+1
for y_lu = 1:n-t+1
P = floor((m-x_lu+1)/s); % 向下取整
Q = floor((n-y_lu+1)/t); % 向下取整
for i = 1:P
for j = 1:Q
N = N +1;
haar(N,:) = [s, t, x_lu, y_lu, x_lu+i*s-1, y_lu+j*t-1];
end
end
end
end
end
相关文章推荐
- 当一个子view需要接收点击事件,而父view也需要接收点击事件, 如何做?
- Part 17 Temporary tables in SQL Server
- 初识 SyntaxHighlighter 代码高亮控件
- 表情列表发送功能
- 时间复杂度和空间复杂度
- gcc与g++
- stringToTime && timeToString
- linux下的网络命令netstat
- 如何创建magento模块z之Hello World例子(转)
- 白驹过隙之大一总结第二话
- Aizu 2538 Stack Maze【记忆化搜索】
- 谈谈最近OLCS项目的开发感受
- 四种解析方法
- ldd获得可执行程序的所有库并输出到指定目录
- PHP基础------引用传值
- 队列-java代码
- Oracle插入数据中包含【&】需要转移
- 各种包管理器
- poj1321棋盘问题
- SoundPool(播放小音频),MediaRecorder(录音),视频播放,开启摄像头