Last change
on this file since 115 was
43,
checked in by dtax, 12 years ago
|
New, useful functions for the cells.
|
File size:
418 bytes
|
Rev | Line | |
---|
[43] | 1 | % do a majority vote over all cells in an image |
---|
| 2 | function [labout,truelab] = majorityimagevote(a,w) |
---|
| 3 | |
---|
| 4 | imlab = getident(a,'image'); |
---|
| 5 | ll = unique(imlab); |
---|
| 6 | n = length(ll); |
---|
| 7 | lab = zeros(n,1); |
---|
| 8 | truelab = []; |
---|
| 9 | for 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); |
---|
| 15 | end |
---|
| 16 | |
---|
| 17 | classll = getlabels(w); |
---|
| 18 | |
---|
| 19 | labout = classll(lab,:); |
---|
| 20 | truelab = char(truelab); |
---|
| 21 | |
---|
Note: See
TracBrowser
for help on using the repository browser.