【发布时间】:2016-05-19 11:26:13
【问题描述】:
我正在编写人脸检测算法,现在我有很多窗口检测到重叠。
如果center(windowA) in windowB or center(windowB) in windowA,我认为窗口是重叠的。
我的算法是:
resultList <- empty list
for each windowA detected
handled <- False
for each windowB in resultList
if windowA and windowB are overlapping
keep the window with bigger value
handled <- True
brick inner loop
if not handled
append windowA to resultList
但仍有一些重叠的窗口。因此,我将其扩展为:
resultList <- empty list
for each windowA detected
handled <- False
for each windowB in resultList
if windowA and windowB are overlapping
keep the window with bigger value
handled <- True
break inner loop
if not handled
append windowA to resultList
for each windowB in resultList, starting from after windowA
if windowA and windowB are overlapping
if windowA has bigger value
remove windowB
else
remove windowA and break
好多了,但仍然有一些重叠的窗口。
有没有一种已知的算法可以快速而好地完成它? (平凡的 O(n^2) 解决方案有点慢)
或者还有其他方法可以改进我的算法以使其完美运行?
【问题讨论】:
标签: algorithm pseudocode overlap face-detection