annotate toolboxes/FullBNT-1.0.7/KPMtools/rectintC.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function [overlap, normoverlap] = rectintC(A,B)
Daniel@0 2 %
Daniel@0 3 % A(i,:) = [x y w h]
Daniel@0 4 % B(j,:) = [x y w h]
Daniel@0 5 % overlap(i,j) = area of intersection
Daniel@0 6 % normoverlap(i,j) = overlap(i,j) / min(area(i), area(j))
Daniel@0 7 %
Daniel@0 8 % Same as built-in rectint, but faster and uses less memory (since avoids repmat).
Daniel@0 9
Daniel@0 10
Daniel@0 11 leftA = A(:,1);
Daniel@0 12 bottomA = A(:,2);
Daniel@0 13 rightA = leftA + A(:,3);
Daniel@0 14 topA = bottomA + A(:,4);
Daniel@0 15
Daniel@0 16 leftB = B(:,1)';
Daniel@0 17 bottomB = B(:,2)';
Daniel@0 18 rightB = leftB + B(:,3)';
Daniel@0 19 topB = bottomB + B(:,4)';
Daniel@0 20
Daniel@0 21 verbose = 0;
Daniel@0 22 [overlap, normoverlap] = rectintLoopC(leftA, rightA, topA, bottomA, leftB, rightB, topB, bottomB, verbose);