annotate _FullBNT/KPMtools/rectintSparseC.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function [overlap, normoverlap] = rectintSparseC(A,B)
matthiasm@8 2 %
matthiasm@8 3 % function [area, normarea] = rectintSparseC(A,B)
matthiasm@8 4 % A(i,:) = [x y w h]
matthiasm@8 5 % B(j,:) = [x y w h]
matthiasm@8 6 % out(i,j) = area of intersection
matthiasm@8 7 %
matthiasm@8 8 % Same as built-in rectint, but uses less memory.
matthiasm@8 9 % Also, returns area of overlap normalized by area of patch.
matthiasm@8 10 % See rectintSparse
matthiasm@8 11
matthiasm@8 12 if isempty(A) | isempty(B)
matthiasm@8 13 overlap = [];
matthiasm@8 14 normoverlap = [];
matthiasm@8 15 return;
matthiasm@8 16 end
matthiasm@8 17
matthiasm@8 18 leftA = A(:,1);
matthiasm@8 19 bottomA = A(:,2);
matthiasm@8 20 rightA = leftA + A(:,3);
matthiasm@8 21 topA = bottomA + A(:,4);
matthiasm@8 22
matthiasm@8 23 leftB = B(:,1)';
matthiasm@8 24 bottomB = B(:,2)';
matthiasm@8 25 rightB = leftB + B(:,3)';
matthiasm@8 26 topB = bottomB + B(:,4)';
matthiasm@8 27
matthiasm@8 28 numRectA = size(A,1);
matthiasm@8 29 numRectB = size(B,1);
matthiasm@8 30
matthiasm@8 31 verbose = 0;
matthiasm@8 32 [overlap, normoverlap] = rectintSparseLoopC(leftA, rightA, topA, bottomA, leftB, rightB, topB, bottomB, verbose);