Cover = [Good Bad] (0 <= sum(Cover) <= 1) pos contains positions
0001 function [Cover] = findCover(im_mat, pos) 0002 % Cover = [Good Bad] (0 <= sum(Cover) <= 1) 0003 % pos contains positions 0004 Cover = [0 0]; 0005 % sz = size(pos); 0006 % rgb_pos = zeros(sz(1),3); 0007 no_of_green = 0; 0008 for i = 1:length(pos(:,1)) 0009 x = pos(i,2); 0010 y = pos(i,1); 0011 if inMatrix(im_mat, x, y) 0012 [maxVal, idx] = max( findColor(im_mat(x, y , :))); 0013 if idx == 2 0014 no_of_green = no_of_green + 1; 0015 end 0016 else 0017 disp('ERROR: not in matrix'); 0018 x,y 0019 end 0020 end 0021 Cover = [(no_of_green/i) (1-(no_of_green/i))];