function [q] = qualityMeasure(groundTruth,algoOutput)
% Assumes that groundTruth and algoOutput are binary matrices with the patterns
% in their rows.
q = 0;

numGroundTruth = size(groundTruth,1);
numAlgoOut = size(algoOutput,1);

for i = 1:numGroundTruth
	P = groundTruth(i,:);

	best = 0;
	for j = 1:numAlgoOut
		cur = jacc( find(P), find(algoOutput(j,:)) );

		if cur > best
			best = cur;
		end
	end

	q = q + best;
end

q = q / numGroundTruth;

end
