这次读的是大名鼎鼎的Viola-Jones目标检测方法的源头文章「Rapid Object Detection using a Boosted Cascade of Simple Features」,即OpenCV中的Cascade目标检测方法。
该方法的主要内容体现在下图中,对产生的180K的特征使用Boost方法进行快速筛选,可以筛除大部分不相关的特征图形。
其中180K是作者当时计算错误导致的,实际上为162336,可以通过如下代码进行验证,Stack Overflow 上也有类似的问题Viola-Jones’ face detection claims 180k features 。
#include <stdio.h>
int main()
{
int i, x, y, sizeX, sizeY, width, height, count, c;
/* All five shape types */
const int features = 5;
const int feature[][2] = {{2,1}, {1,2}, {3,1}, {1,3}, {2,2}};
const int frameSize = 24;
count = 0;
/* Each shape */
for (i = 0; i < features; i++) {
sizeX = feature[i][0];
sizeY = feature[i][1];
printf("%dx%d shapes:\n", sizeX, sizeY);
/* each size (multiples of basic shapes) */
for (width = sizeX; width <= frameSize; width+=sizeX) {
for (height = sizeY; height <= frameSize; height+=sizeY) {
printf("\tsize: %dx%d => ", width, height);
c=count;
/* each possible position given size */
for (x = 0; x <= frameSize-width; x++) {
for (y = 0; y <= frameSize-height; y++) {
count++;
}
}
printf("count: %d\n", count-c);
}
}
}
printf("%d\n", count);
return 0;
}
只是粗略的介绍了以下,后面详细完善该文章。