Home > src > BN_pol_rec > Hsand > extractRoadsCoverWaterPx.m

extractRoadsCoverWaterPx

PURPOSE ^

040407 RS. Classify px according to colour

SYNOPSIS ^

function [roadPoints, costMap, Green, Water] = extractRoadsCoverWaterPx(A)

DESCRIPTION ^

 040407 RS. Classify px according to colour
 roadPoints =  Road matrix 1 if black; 0 if not black
 Green =  Green matrix 1 if green; 0 if not green
 Water =  Blue matrix 1 if blue; 0 if not blue

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 function [roadPoints, costMap, Green, Water] = extractRoadsCoverWaterPx(A)
0003 
0004 % 040407 RS. Classify px according to colour
0005 % roadPoints =  Road matrix 1 if black; 0 if not black
0006 % Green =  Green matrix 1 if green; 0 if not green
0007 % Water =  Blue matrix 1 if blue; 0 if not blue
0008 
0009 % Cost for different types of terrain
0010 % the '1's below are for test purpose
0011 water = 1;
0012 road = 1;
0013 urabanArea = 1;
0014 grass = 1;
0015 
0016 %initialize
0017 roadPoints = zeros(size(A(:,:,1)));
0018 costMap= ones(size(A(:,:,1)));
0019 Green = zeros(size(A(:,:,1)));
0020 Water = zeros(size(A(:,:,1)));
0021 
0022 for i = 1:length(A(:,1,1))
0023     for j=1:length(A(1,:,1))
0024        costMap(i,j) = urabanArea;
0025        [col] = findColor(A(round(i),round(j),:));
0026         if (col(2) == 1)
0027             costMap(i,j) = grass;
0028             Green(i,j) = 1;
0029         end;
0030         if (col(3) == 1)
0031             costMap(i,j) = water;
0032             Water(i,j) = 1;
0033         end;
0034         if (col(5) == 1)
0035             roadPoints(i,j) = 1;
0036             costMap(i,j) = road;
0037         end;
0038 %REMOVE A.S.A.P.--------------------------------------------------------->
0039  if costMap(i,j) == 0
0040             costMap(i,j) = grass;
0041  end;
0042  %REMOVE A.S.A.P.<---------------------------------------------------------
0043 
0044 
0045         col = zeros(size(col));
0046     end
0047 end
0048 
0049 
0050  
0051

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003