source: hep2cells/majorityimagevote.m @ 100

Last change on this file since 100 was 43, checked in by dtax, 12 years ago

New, useful functions for the cells.

File size: 418 bytes
Line 
1% do a majority vote over all cells in an image
2function [labout,truelab] = majorityimagevote(a,w)
3
4imlab = getident(a,'image');
5ll = unique(imlab);
6n = length(ll);
7lab = zeros(n,1);
8truelab = [];
9for i=1:n
10   I = find(imlab==ll(i));
11   out = a(I,:)*w;
12   truelab(i,:) = getlab(a(I(1),:));
13   [mx,J]=max(+out,[],2);
14   lab(i) = mode(J);
15end
16
17classll = getlabels(w);
18
19labout = classll(lab,:);
20truelab = char(truelab);
21
Note: See TracBrowser for help on using the repository browser.