Created
January 29, 2014 15:58
-
-
Save vbalnt/8691010 to your computer and use it in GitHub Desktop.
Prunes boxes function matlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [resbbox,resconf]=prunebboxes(bbox,conf,ovthresh) | |
% Function that prunes multiples detection boxes. | |
% Taken from http://www.di.ens.fr/willow/events/cvml2012/materials/practical-detection/ | |
[vs,is]=sort(-conf); | |
bbox=bbox(is,:); | |
conf=conf(is); | |
resbbox=[]; | |
resconf=[]; | |
rescount=0; | |
freeflags=ones(size(conf)); | |
while sum(freeflags)>0 | |
indfree=find(freeflags); | |
[vm,im]=max(conf(indfree)); | |
indmax=indfree(im); | |
ov=bboxoverlapval(bbox(indmax,:),bbox(indfree,:)); | |
indsel=indfree(find(ov>=ovthresh)); | |
resbbox(rescount+1,:)=mean(bbox(indsel,:),1); | |
resconf(rescount+1,:)=conf(indmax); | |
rescount=rescount+1; | |
freeflags(indsel)=0; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment