% we wrote a script, rather than a function, called
%
%  changebluetogreen.m
%
% it assumes that A is a 3d matrix containing the pixel values
%

counter = 0;

[rows,cols,colors] = size(A);    % get size of the image

for row = 1:1:rows,              % loop through the whole image
  for col = 1:1:cols,

    r = A(row,col,1);            % get RGB components
    g = A(row,col,2);
    b = A(row,col,3);

    if ( r == 3 | g == 3 | b == 3 | ...
         r == 13 | g == 13 | b == 13 |  ...
         r == 23 | g == 23 | b == 23 |  ...
         (r >= 30 & r < 40) | ...
         r == 43 | g == 43 | b == 43 |  ...
         r == 53 | g == 53 | b == 53 |  ...
         r == 63 | g == 63 | b == 63 |  ...
         r == 73 | g == 73 | b == 73 |  ...
         r == 83 | g == 83 | b == 83 |  ...
         r == 93 | g == 93 | b == 93 |  ...
         r == 103 | g == 103 | b == 103 |  ...
         r == 113 | g == 113 | b == 113 |  ...
         r == 123 | g == 123 | b == 123 |  ...
         (r >= 130 & r < 140) | ...
         r == 143 | g == 143 | b == 143 |  ...
         r == 153 | g == 153 | b == 153 |  ...
         r == 163 | g == 163 | b == 163 |  ...
         r == 173 | g == 173 | b == 173 |  ...
         r == 183 | g == 183 | b == 183 |  ...
         r == 193 | g == 193 | b == 193 |  ...
         r == 203 | g == 203 | b == 203 |  ...
         r == 213 | g == 213 | b == 213 |  ...
         r == 223 | g == 223 | b == 223 |  ...
         r == 233 | g == 233 | b == 233 |  ...
         r == 243 | g == 243 | b == 243 |  ...
         r == 253 | g == 253 | b == 253  ...
        )
      counter = counter+1;       % counting the number of blue pixels
      A(row,col,:) = [0 255 0];  % changing to green

    end                          % end the if block
    
    % col                        % line for debugging -- check col number

  end                            % end of inner for (columns)

  row                            % line for debugging -- check row number

end                              % end of outer for (rows)
