0001 function [Pass] = passable(im_mat, pos)
0002
0003 Passable = [0 0];
0004 sz = size(pos);
0005 rgb_pos = zeros(sz(1),3);
0006 no_of_passable = 0;
0007 sx = pos(1) - 1;
0008 sy = pos(2) - 1;
0009 y = sy;
0010 x = sx;
0011 for i = 1:3
0012 for j= 1:3
0013 if inMatrix(im_mat, x, y)
0014 inMatrix(im_mat, x, y)
0015 rgb_pos(i,:) = im_mat(x, y ,1:3);
0016 [maxV, idx] = max( findColor(rgb_pos(i,:)));
0017 if idx == 5
0018 no_of_passable = no_of_passable + 1;
0019 end
0020 else
0021 disp('ERROR: not in matrix');
0022 x,y
0023 end
0024 x = x + 1;
0025 end
0026 x = sx;
0027 y = y + 1;
0028 end
0029 Pass = [(no_of_passable/9) (1-(no_of_passable/9))];