Daniel@0: function [overlap, normoverlap] = rectintC(A,B) Daniel@0: % Daniel@0: % A(i,:) = [x y w h] Daniel@0: % B(j,:) = [x y w h] Daniel@0: % overlap(i,j) = area of intersection Daniel@0: % normoverlap(i,j) = overlap(i,j) / min(area(i), area(j)) Daniel@0: % Daniel@0: % Same as built-in rectint, but faster and uses less memory (since avoids repmat). Daniel@0: Daniel@0: Daniel@0: leftA = A(:,1); Daniel@0: bottomA = A(:,2); Daniel@0: rightA = leftA + A(:,3); Daniel@0: topA = bottomA + A(:,4); Daniel@0: Daniel@0: leftB = B(:,1)'; Daniel@0: bottomB = B(:,2)'; Daniel@0: rightB = leftB + B(:,3)'; Daniel@0: topB = bottomB + B(:,4)'; Daniel@0: Daniel@0: verbose = 0; Daniel@0: [overlap, normoverlap] = rectintLoopC(leftA, rightA, topA, bottomA, leftB, rightB, topB, bottomB, verbose);