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

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function [overlap, normoverlap] = rectintC(A,B)
wolffd@0 2 %
wolffd@0 3 % A(i,:) = [x y w h]
wolffd@0 4 % B(j,:) = [x y w h]
wolffd@0 5 % overlap(i,j) = area of intersection
wolffd@0 6 % normoverlap(i,j) = overlap(i,j) / min(area(i), area(j))
wolffd@0 7 %
wolffd@0 8 % Same as built-in rectint, but faster and uses less memory (since avoids repmat).
wolffd@0 9
wolffd@0 10
wolffd@0 11 leftA = A(:,1);
wolffd@0 12 bottomA = A(:,2);
wolffd@0 13 rightA = leftA + A(:,3);
wolffd@0 14 topA = bottomA + A(:,4);
wolffd@0 15
wolffd@0 16 leftB = B(:,1)';
wolffd@0 17 bottomB = B(:,2)';
wolffd@0 18 rightB = leftB + B(:,3)';
wolffd@0 19 topB = bottomB + B(:,4)';
wolffd@0 20
wolffd@0 21 verbose = 0;
wolffd@0 22 [overlap, normoverlap] = rectintLoopC(leftA, rightA, topA, bottomA, leftB, rightB, topB, bottomB, verbose);